mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Made the number of file backups configurable
This commit is contained in:
parent
ed3b687284
commit
9acf74041c
6 changed files with 1987 additions and 1923 deletions
|
@ -813,6 +813,7 @@ gzshowvisualvertices = true;
|
|||
gzvertexscale3d = 1f;
|
||||
gzmarkextrafloors = true;
|
||||
maxrecentfiles = 8;
|
||||
maxbackups = 3;
|
||||
autoclearsidetextures = true;
|
||||
storeselectededittab = true;
|
||||
rendercomments = true;
|
||||
|
|
|
@ -114,7 +114,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
private int maxRecentFiles;
|
||||
private bool autoClearSideTextures;
|
||||
private bool storeSelectedEditTab;
|
||||
private bool checkforupdates;
|
||||
private int maxbackups;
|
||||
private bool checkforupdates;
|
||||
private bool rendercomments;
|
||||
private bool rendergrid;
|
||||
private bool dynamicgridsize;
|
||||
|
@ -204,7 +205,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
public int MaxRecentFiles { get { return maxRecentFiles; } internal set { maxRecentFiles = General.Clamp(value, 8, 25); } }
|
||||
public bool AutoClearSidedefTextures { get { return autoClearSideTextures; } internal set { autoClearSideTextures = value; } }
|
||||
public bool StoreSelectedEditTab { get { return storeSelectedEditTab; } internal set { storeSelectedEditTab = value; } }
|
||||
internal bool CheckForUpdates { get { return checkforupdates; } set { checkforupdates = value; } } //mxd
|
||||
internal int MaxBackups { get { return maxbackups; } set { maxbackups = value; } }
|
||||
internal bool CheckForUpdates { get { return checkforupdates; } set { checkforupdates = value; } } //mxd
|
||||
public bool RenderComments { get { return rendercomments; } internal set { rendercomments = value; } } //mxd
|
||||
public bool RenderGrid { get { return rendergrid; } internal set { rendergrid = value; } } //mxd
|
||||
public bool DynamicGridSize { get { return dynamicgridsize; } internal set { dynamicgridsize = value; } } //mxd
|
||||
|
@ -317,7 +319,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
maxRecentFiles = cfg.ReadSetting("maxrecentfiles", 8);
|
||||
autoClearSideTextures = cfg.ReadSetting("autoclearsidetextures", true);
|
||||
storeSelectedEditTab = cfg.ReadSetting("storeselectededittab", true);
|
||||
checkforupdates = cfg.ReadSetting("checkforupdates", false); //mxd
|
||||
maxbackups = cfg.ReadSetting("maxbackups", 3);
|
||||
checkforupdates = cfg.ReadSetting("checkforupdates", false); //mxd
|
||||
rendercomments = cfg.ReadSetting("rendercomments", true); //mxd
|
||||
rendergrid = cfg.ReadSetting("rendergrid", true); //mxd
|
||||
dynamicgridsize = cfg.ReadSetting("dynamicgridsize", true); //mxd
|
||||
|
@ -414,7 +417,8 @@ namespace CodeImp.DoomBuilder.Config
|
|||
cfg.WriteSetting("maxrecentfiles", maxRecentFiles);
|
||||
cfg.WriteSetting("autoclearsidetextures", autoClearSideTextures);
|
||||
cfg.WriteSetting("storeselectededittab", storeSelectedEditTab);
|
||||
cfg.WriteSetting("checkforupdates", checkforupdates); //mxd
|
||||
cfg.WriteSetting("maxbackups", maxbackups);
|
||||
cfg.WriteSetting("checkforupdates", checkforupdates); //mxd
|
||||
cfg.WriteSetting("rendercomments", rendercomments); //mxd
|
||||
cfg.WriteSetting("rendergrid", rendergrid); //mxd
|
||||
cfg.WriteSetting("dynamicgridsize", dynamicgridsize); //mxd
|
||||
|
|
|
@ -828,12 +828,18 @@ namespace CodeImp.DoomBuilder
|
|||
}
|
||||
}
|
||||
|
||||
// Backup existing file, if any
|
||||
if(File.Exists(newfilepathname + ".backup3")) File.Delete(newfilepathname + ".backup3");
|
||||
if(File.Exists(newfilepathname + ".backup2")) File.Move(newfilepathname + ".backup2", newfilepathname + ".backup3");
|
||||
if(File.Exists(newfilepathname + ".backup1")) File.Move(newfilepathname + ".backup1", newfilepathname + ".backup2");
|
||||
File.Copy(newfilepathname, newfilepathname + ".backup1");
|
||||
}
|
||||
int backups = General.Settings.MaxBackups;
|
||||
if (backups > 0)
|
||||
{
|
||||
// Backup existing file, if any
|
||||
if (File.Exists(newfilepathname + ".backup" + backups)) File.Delete(newfilepathname + ".backup" + backups);
|
||||
for (int i = backups - 1; i >= 1; i--)
|
||||
{
|
||||
if (File.Exists(newfilepathname + ".backup" + i)) File.Move(newfilepathname + ".backup" + i, newfilepathname + ".backup" + (i+1));
|
||||
}
|
||||
File.Copy(newfilepathname, newfilepathname + ".backup1");
|
||||
}
|
||||
}
|
||||
|
||||
// Except when saving INTO another file,
|
||||
// kill the target file if it is different from source file
|
||||
|
|
3855
Source/Core/Windows/PreferencesForm.Designer.cs
generated
3855
Source/Core/Windows/PreferencesForm.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -93,7 +93,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
//mxd
|
||||
locatetexturegroup.Checked = General.Settings.LocateTextureGroup;
|
||||
cbStoreEditTab.Checked = General.Settings.StoreSelectedEditTab;
|
||||
checkforupdates.Checked = General.Settings.CheckForUpdates;
|
||||
checkforupdates.Checked = General.Settings.CheckForUpdates;
|
||||
toolbar_gzdoom.Checked = General.Settings.GZToolbarGZDoom;
|
||||
cbSynchCameras.Checked = General.Settings.GZSynchCameras;
|
||||
tbDynLightCount.Value = General.Clamp(General.Settings.GZMaxDynamicLights, tbDynLightCount.Minimum, tbDynLightCount.Maximum);
|
||||
|
@ -107,8 +107,9 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
vertexScale.Value = General.Clamp((int)(General.Settings.GZVertexScale2D), vertexScale.Minimum, vertexScale.Maximum);
|
||||
vertexScaleLabel.Text = vertexScale.Value * 100 + "%" + (vertexScale.Value == 1 ? " (default)" : "");
|
||||
cbMarkExtraFloors.Checked = General.Settings.GZMarkExtraFloors;
|
||||
recentFiles.Value = General.Settings.MaxRecentFiles;
|
||||
screenshotsfolderpath.Text = General.Settings.ScreenshotsPath;
|
||||
recentFiles.Value = General.Settings.MaxRecentFiles;
|
||||
maxBackups.Value = General.Settings.MaxBackups;
|
||||
screenshotsfolderpath.Text = General.Settings.ScreenshotsPath;
|
||||
if(Directory.Exists(General.Settings.ScreenshotsPath))
|
||||
browseScreenshotsFolderDialog.SelectedPath = General.Settings.ScreenshotsPath;
|
||||
|
||||
|
@ -261,10 +262,11 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
General.Settings.GZToolbarGZDoom = toolbar_gzdoom.Checked; //mxd
|
||||
General.Settings.ShowTextureSizes = showtexturesizes.Checked;
|
||||
General.Settings.StoreSelectedEditTab = cbStoreEditTab.Checked; //mxd
|
||||
General.Settings.CheckForUpdates = checkforupdates.Checked; //mxd
|
||||
General.Settings.CheckForUpdates = checkforupdates.Checked; //mxd
|
||||
General.Settings.LocateTextureGroup = locatetexturegroup.Checked; //mxd
|
||||
General.Settings.MaxRecentFiles = recentFiles.Value; //mxd
|
||||
General.Settings.ScreenshotsPath = screenshotsfolderpath.Text.Trim(); //mxd
|
||||
General.Settings.MaxBackups = maxBackups.Value;
|
||||
General.Settings.ScreenshotsPath = screenshotsfolderpath.Text.Trim(); //mxd
|
||||
|
||||
// Script font size
|
||||
int fontsize;
|
||||
|
@ -440,8 +442,13 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
labelRecentFiles.Text = recentFiles.Value.ToString();
|
||||
}
|
||||
|
||||
// This updates the script font preview label
|
||||
private void UpdateScriptFontPreview()
|
||||
private void maxBackups_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
labelBackups.Text = maxBackups.Value.ToString();
|
||||
}
|
||||
|
||||
// This updates the script font preview label
|
||||
private void UpdateScriptFontPreview()
|
||||
{
|
||||
if((scriptfontname.SelectedIndex > -1) &&
|
||||
(scriptfontsize.SelectedIndex > -1))
|
||||
|
|
|
@ -144,6 +144,9 @@
|
|||
<metadata name="label21.GenerateMember" type="System.Boolean, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<data name="snippetsallmanstyle.ToolTip" xml:space="preserve">
|
||||
<value>When enabled, the opening brace
|
||||
will be placed on a new line.
|
||||
|
|
Loading…
Reference in a new issue