-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
78 lines (71 loc) · 2.15 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using GS_PatEditor.Editor;
using GS_PatEditor.Localization;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace GS_PatEditor
{
class Program
{
public static Editor.Editor EditorForBackup;
[STAThread]
private static void Main()
{
try
{
{
var path = Path.GetFileNameWithoutExtension(typeof(Program).Assembly.CodeBase);
if (path.Contains("en"))
{
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("en-US");
}
}
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
var proj = ProjectGenerater.GenerateEmpty(String.Empty);
proj.IsEmptyProject = true;
if (proj != null)
{
EditorForm.ShowEditorForm(proj);
}
}
catch (Exception e)
{
MessageBox.Show(e.ToString());
try
{
var file = CreateBackup();
if (file != null)
{
MessageBox.Show(String.Format(ProgramRes.SaveRecoveryFormat, file));
}
}
catch
{
}
}
}
private static string CreateBackup()
{
if (EditorForBackup != null)
{
if (EditorForBackup.Project != null)
{
var filename = GetBackupFileName();
ProjectSerializer.SaveProject(EditorForBackup.Project, filename);
return filename;
}
}
return null;
}
private static string GetBackupFileName()
{
var filename = "Backup.patproj";
return Path.GetFullPath(filename);
}
}
}