Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ReadAllLines, ReadAllText, and ReadAllBytes to CF_File #146

Open
wants to merge 6 commits into
base: development
Choose a base branch
from

Conversation

InclementDab
Copy link
Contributor

No description provided.

@Arkensor Arkensor changed the base branch from production to development April 29, 2023 19:46
Comment on lines +331 to +351
static string ReadAllText(string path)
{
CF_File file = new CF_File(path);
if (!file.IsValid())
{
return string.Empty;
}

string fileContents;
CF_FileStream fileStream = file.CreateStream(FileMode.READ);
CF_Byte byte = fileStream.Next();
while (byte)
{
fileContents += byte.AsciiToString();
byte = fileStream.Next();
}

fileStream.Close();

return fileContents;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for performance reasons something like this should not be read through the whole file io pipeline with every single character going through multiple script calls? Wouln't FGets be an order of magnitude faster?

What was your use case when you came up with the idea to add these 3 methods?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants