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

*Slightly* clean up AutoBackup #1529

Merged
merged 1 commit into from
Nov 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions UndertaleModTool/Scripts/Community Scripts/AutoBackup.csx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ bool debug_override = false;

// Setup root export folder.
string winFolder = GetFolder(FilePath); // The folder data.win is located in.
string BackupFolder = winFolder + "/Backups/";
string BackupFolder = Path.Combine(winFolder, "Backups");

if (!(Directory.Exists(BackupFolder)))
{
Directory.CreateDirectory(BackupFolder);
}
Directory.CreateDirectory(BackupFolder);

System.Timers.Timer aTimer;
// Create a timer with a minute interval defined by 'minutes_per_backup'.
Expand All @@ -39,17 +36,15 @@ while (true)
{
try
{
// SimpleTextInput(string titleText, string labelText, string defaultInputBoxText, bool isMultiline)
// SimpleTextInput(string titleText, string labelText, string defaultInputBoxText, bool isMultiline)
double result = Convert.ToDouble(SimpleTextInput("Automatic backup script.", "Please enter the backup interval in minutes (minimum interval 5 minutes).", "30", false));
if ((result < 5) && (!debug_override))
{
continue;
}
else
{
minutes_per_backup = result;
break;
}

minutes_per_backup = result;
break;
}
catch (FormatException)
{
Expand All @@ -62,17 +57,15 @@ while (true)
{
try
{
// SimpleTextInput(string titleText, string labelText, string defaultInputBoxText, bool isMultiline)
// SimpleTextInput(string titleText, string labelText, string defaultInputBoxText, bool isMultiline)
int result2 = Convert.ToInt32(SimpleTextInput("Automatic backup script.", "Please enter the maximum number of unique backups this session (0 for unlimited).", "200", false));
if (result2 < 0)
{
continue;
}
else
{
maximum_number_of_runs = result2;
break;
}

maximum_number_of_runs = result2;
break;
}
catch (FormatException)
{
Expand Down Expand Up @@ -138,6 +131,7 @@ void OnTimedEvent(Object source, ElapsedEventArgs e)
return;
}
if (times_ran > 1)
// TODO: what's this about?
FileCompare();
else
{
Expand Down
Loading