- First Update
This commit is contained in:
88
Mitria_Minecraft_Launcher/Program.cs
Normal file
88
Mitria_Minecraft_Launcher/Program.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Mitria_Minecraft_Launcher
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 해당 애플리케이션의 주 진입점입니다.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
private static void Main()
|
||||
{
|
||||
string appGuid = Application.ProductName;
|
||||
using (System.Threading.Mutex mutex = new System.Threading.Mutex(false, "Global\\" + appGuid))
|
||||
{
|
||||
if (!mutex.WaitOne(0, false))
|
||||
{
|
||||
MessageBox.Show(Application.ProductName + " has been duplicated.\r\nThe program is already running.", "Duplicate execution error.", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
else
|
||||
{
|
||||
CommonLibrary.Log.logLevel = CommonLibrary.LogLevel.Trace;
|
||||
|
||||
#region delete temp Directory
|
||||
|
||||
string tempDirectory = Path.GetFullPath("temp");
|
||||
CommonLibrary.Log.INFO("delete temp Directory Process");
|
||||
if (System.IO.Directory.Exists(tempDirectory))
|
||||
{
|
||||
System.IO.Directory.Delete(Path.GetFullPath("temp"), true);
|
||||
}
|
||||
|
||||
#endregion delete temp Directory
|
||||
|
||||
#region Crate CustomDirectory
|
||||
|
||||
string customDataDirectory = CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, "config");
|
||||
if (!System.IO.Directory.Exists(customDataDirectory))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(customDataDirectory);
|
||||
}
|
||||
customDataDirectory = CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, "mods");
|
||||
if (!System.IO.Directory.Exists(customDataDirectory))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(customDataDirectory);
|
||||
}
|
||||
|
||||
#endregion Crate CustomDirectory
|
||||
|
||||
#region LauncherUpdate
|
||||
|
||||
Updater.LauncherUpdate launcherUpdate = new Updater.LauncherUpdate();
|
||||
Updater.LauncherUpdateStatus status = launcherUpdate.Start();
|
||||
switch (status)
|
||||
{
|
||||
case Updater.LauncherUpdateStatus.Update:
|
||||
MessageBox.Show("Launcher has been update\r\n Press ok to Restart", "Update Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
Application.Restart();
|
||||
break;
|
||||
|
||||
case Updater.LauncherUpdateStatus.Same:
|
||||
Settings.LoadUserLauncherConfig();
|
||||
Settings.LoadUserClientVersion();
|
||||
|
||||
ProgramRun();
|
||||
break;
|
||||
|
||||
default:
|
||||
CommonLibrary.Log.FATAL("Launcher Update Failed");
|
||||
MessageBox.Show("Launcher update failed. \r\nPlease provide a log to the administrator and solve it.", "FATAL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
break;
|
||||
}
|
||||
|
||||
#endregion LauncherUpdate
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ProgramRun()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new LauncherForm());
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user