Extra backup on my local device
This commit is contained in:
@ -9,6 +9,8 @@ namespace CobXmlSupport
|
||||
{
|
||||
public class codeCompleter
|
||||
{
|
||||
private readonly string LocBackup = "C:\\CCBackup\\";
|
||||
|
||||
private Dictionary<string, string> __wrkDicIn = null;
|
||||
private Dictionary<string, string> __wrkDicOut = null;
|
||||
private string __FieldPrefix;
|
||||
@ -113,10 +115,10 @@ namespace CobXmlSupport
|
||||
__ccFileOutIdNoSuff = __fileId.Substring(0, __fileId.LastIndexOf(".")) + ".Out" + gPrefix;
|
||||
}
|
||||
|
||||
private string backupSuffix()
|
||||
private string backupSuffix(bool rideOver=false)
|
||||
{
|
||||
string tmpSuff = "";
|
||||
if (S.ettingUserCodeBcup)
|
||||
if (S.ettingUserCodeBcup||rideOver)
|
||||
{
|
||||
tmpSuff = "." +
|
||||
(DateTime.Now.Year - 2000).ToString("00") +
|
||||
@ -133,6 +135,17 @@ namespace CobXmlSupport
|
||||
return tmpSuff;
|
||||
}
|
||||
|
||||
private string SafeBackPath()
|
||||
{
|
||||
return LocBackup +
|
||||
"BC"+
|
||||
(DateTime.Now.Year - 2000).ToString("00") +
|
||||
DateTime.Now.Month.ToString("00") +
|
||||
DateTime.Now.Day.ToString("00") +
|
||||
"\\";
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void TryFill_In_Dic()
|
||||
{
|
||||
@ -173,18 +186,31 @@ namespace CobXmlSupport
|
||||
public void Save_In_Dic()
|
||||
{
|
||||
string ccFileInId = __jsonPathId + __ccFileInId;
|
||||
if (Directory.Exists(__jsonPathId + @"\JsonBackup\")) { }
|
||||
if (Directory.Exists(__jsonPathId + @"JsonBackup\")) { }
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(__jsonPathId + @"\JsonBackup\");
|
||||
Directory.CreateDirectory(__jsonPathId + @"JsonBackup\");
|
||||
}
|
||||
string ccFileInBackup = __jsonPathId + @"\JsonBackup\" + __ccFileInIdNoSuff + backupSuffix();
|
||||
|
||||
//Panik-backup
|
||||
if (Directory.Exists(SafeBackPath())) { }
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(SafeBackPath());
|
||||
}
|
||||
|
||||
string ccFileInPanikBackup = SafeBackPath() + __ccFileInIdNoSuff + backupSuffix(true);
|
||||
|
||||
//Panik-backup
|
||||
|
||||
string ccFileInBackup = __jsonPathId + @"JsonBackup\" + __ccFileInIdNoSuff + backupSuffix();
|
||||
|
||||
if (__filePathId.Trim() == "") { }
|
||||
else
|
||||
{
|
||||
if (File.Exists(ccFileInId))
|
||||
{
|
||||
File.Copy(ccFileInId, ccFileInPanikBackup);
|
||||
if (File.Exists(ccFileInBackup))
|
||||
{
|
||||
File.Delete(ccFileInBackup);
|
||||
@ -195,21 +221,36 @@ namespace CobXmlSupport
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Save_Out_Dic()
|
||||
{
|
||||
string ccFileOutId = __jsonPathId + __ccFileOutId;
|
||||
if (Directory.Exists(__jsonPathId + @"\JsonBackup\")) { }
|
||||
if (Directory.Exists(__jsonPathId + @"JsonBackup\")) { }
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(__jsonPathId + @"\JsonBackup\");
|
||||
Directory.CreateDirectory(__jsonPathId + @"JsonBackup\");
|
||||
}
|
||||
string ccFileOutBackup = __jsonPathId + @"\JsonBackup\" + __ccFileOutIdNoSuff + backupSuffix();
|
||||
|
||||
//Panik-backup
|
||||
if (Directory.Exists(SafeBackPath())) { }
|
||||
else
|
||||
{
|
||||
Directory.CreateDirectory(SafeBackPath());
|
||||
}
|
||||
|
||||
string ccFileOutPanikBackup = SafeBackPath() + __ccFileOutIdNoSuff + backupSuffix(true);
|
||||
|
||||
//Panik-backup
|
||||
|
||||
string ccFileOutBackup = __jsonPathId + @"JsonBackup\" + __ccFileOutIdNoSuff + backupSuffix();
|
||||
|
||||
if (__filePathId.Trim() == "") { }
|
||||
else
|
||||
{
|
||||
if (File.Exists(ccFileOutId))
|
||||
{
|
||||
File.Copy(ccFileOutId, ccFileOutPanikBackup);
|
||||
|
||||
if (File.Exists(ccFileOutBackup))
|
||||
{
|
||||
File.Delete(ccFileOutBackup);
|
||||
|
||||
Reference in New Issue
Block a user