The roofing above the doors sticks out but its shadow on the floor doesn't.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
bool noLF = false;
String lChar;
String fileName = String.Format("$SAVEGAMEDIR$/%s", lst_CustomLevels.Items[lst_CustomLevels.SelectedIndex]);
File *output = File.Open(fileName, eFileRead);
if (output == null) Display ("error opening file.");
else if (output != null)
{
//first check if EOF has a LF:
output.Seek(-1, eSeekEnd);
if (output.ReadRawChar() != 10) //no LF
{
noLF = true;
output.Seek(-1, eSeekEnd);
lChar = String.Format("%c",output.ReadRawChar()); //grab last char
}
// now go back to begin of file, read complete file info using ReadRawLineBack and build up strings
// if the 'title' string (title is the last line in the file) is not empty and (noLF == true) add lChar to last string
output.Close();
}
Quote from: Crimson Wizard on Wed 05/01/2022 20:17:27The data is for that reason written in the savegame folder because (I assumed) that location has no read-only issues.
If the data files are located in read-only location, either technically cannot be written to or player does not have enough permissions on their system to write there.
Quote from: Crimson Wizard on Wed 05/01/2022 20:17:27Yes, it looks like an overkill indeed, but:
Anyway, tbh, overwriting whole file only to let engine read it again properly, sounds like an overkill.
Quote from: Crimson Wizard on Wed 05/01/2022 20:17:27But how do I know if the last character was read if I don't know the content?
What about reading a file first, and then reading last character separately if it was not read?
Quote from: Crimson Wizard on Wed 05/01/2022 20:17:27I see, but how do I check/know the length of the file? By getting File.Position when at the EOF?
You can compare the length of the returned String with the length of the file and if it's shorter - then read the rest yourself.
Quote from: Crimson Wizard on Thu 30/12/2021 17:00:33
The workaround is to always add an extra linebreak at the end of the file.
This seems to be fixed in 3.6.0.
function load_levelinfoCustom()
{
String Line;
String LineTitle;
String LineAuthor;
String checkTitle;
String checkAuthor;
String finalInfo;
String fileName = String.Format("$SAVEGAMEDIR$/%s", lst_CustomLevels.Items[lst_CustomLevels.SelectedIndex]);
File *input = File.Open(fileName, eFileRead);
if (input == null) Display ("the file seems to be empty...");
else if (input != null)
{
while (!input.EOF)
{
Line = input.ReadRawLineBack();
checkAuthor = Line.Substring(0, 7);
checkTitle = Line.Substring(0, 6);
if (checkAuthor == "Author:") LineAuthor = Line;
if (checkTitle == "Title:") LineTitle = Line;
}
if (LineTitle == null) LineTitle = "title unknown";
if (LineAuthor == null) LineAuthor = "author unknown";
finalInfo = LineTitle.Append("[");
finalInfo = finalInfo.Append(LineAuthor);
lbl_LevelInfo.Text = finalInfo;
input.Close();
}
}
Quote from: Cassiebsg on Sun 26/12/2021 12:52:58
I don't think it's possible, but I might be wrong.
Is there a reason you don't want to create an empty/hidden button?
By continuing to use this site you agree to the use of cookies. Please visit this page to see exactly how we use these.
Page created in 0.045 seconds with 15 queries.