WIP CrashReporter, misc refactoring
This commit is contained in:
@@ -38,7 +38,7 @@ namespace Subsurface
|
||||
}
|
||||
else
|
||||
{
|
||||
File.Copy(Game1.GameSession.Submarine.FilePath, tempPath + "\\map.gz");
|
||||
File.Copy(GameMain.GameSession.Submarine.FilePath, tempPath + "\\map.gz");
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@@ -48,7 +48,7 @@ namespace Subsurface
|
||||
|
||||
try
|
||||
{
|
||||
Game1.GameSession.Save(tempPath + "\\gamesession.xml");
|
||||
GameMain.GameSession.Save(tempPath + "\\gamesession.xml");
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
@@ -76,7 +76,7 @@ namespace Subsurface
|
||||
DecompressToDirectory(filePath, tempPath, null);
|
||||
|
||||
Submarine selectedMap = Submarine.Load(tempPath +"\\map.gz");
|
||||
Game1.GameSession = new GameSession(selectedMap, fileName, tempPath + "\\gamesession.xml");
|
||||
GameMain.GameSession = new GameSession(selectedMap, fileName, tempPath + "\\gamesession.xml");
|
||||
|
||||
//Directory.Delete(tempPath, true);
|
||||
}
|
||||
|
||||
@@ -177,5 +177,31 @@ namespace Subsurface
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void CleanOldFiles()
|
||||
{
|
||||
string currentDir = Directory.GetCurrentDirectory();
|
||||
|
||||
string[] files = Directory.GetFiles(currentDir, "*", SearchOption.AllDirectories);
|
||||
|
||||
foreach (string file in files)
|
||||
{
|
||||
if (file.Length<4 || file.Substring(0,4)!="OLD_") continue;
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("deleting file " + file);
|
||||
|
||||
try
|
||||
{
|
||||
File.Delete(currentDir + "\\" + file);
|
||||
}
|
||||
|
||||
catch (Exception e)
|
||||
{
|
||||
System.Diagnostics.Debug.WriteLine("Could not delete file ''" + file + "'' (" + e.Message + ")");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user