-
Notifications
You must be signed in to change notification settings - Fork 31
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
base: development
Are you sure you want to change the base?
Conversation
Matches C# standard
Missed compile errors
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; | ||
} |
There was a problem hiding this comment.
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?
No description provided.