- Recovery
This commit is contained in:
@@ -31,7 +31,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
List<DirectoryInfo> directoryInfos = new List<DirectoryInfo>();
|
||||
foreach (string directory in directorys)
|
||||
{
|
||||
System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, directory));
|
||||
System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory,Settings.NowProfile.ServerName, directory));
|
||||
directoryInfos.Add(directoryInfo);
|
||||
}
|
||||
return GetLocalFileList(directoryInfos);
|
||||
@@ -52,7 +52,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
foreach (var file in files)
|
||||
{
|
||||
FileDetail fileDetail = new FileDetail();
|
||||
fileDetail.Directory = file.DirectoryName.Replace(Settings.UserLauncherConfig.GameDirectory + "\\", "").Replace("\\", "/");
|
||||
fileDetail.Directory = file.DirectoryName.Replace(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName) + "\\", "").Replace("\\", "/");
|
||||
fileDetail.FileName = file.Name;
|
||||
fileDetail.FileSize = file.Length;
|
||||
fileDetail.HashCode = GetFileHash(file);
|
||||
|
@@ -9,11 +9,18 @@ namespace Mitria_Minecraft_Launcher
|
||||
public struct LauncherConfig
|
||||
{
|
||||
public string MinecraftPlayerName { get; set; }
|
||||
public string Argument { get; set; }
|
||||
public string GameDirectory { get; set; }
|
||||
public bool ShellView { get; set; }
|
||||
public string RuntimeVersion { get; set; }
|
||||
public List<string> CustomData { get; set; }
|
||||
public string LastServerName { get; set; }
|
||||
public List<Profile> Profiles { get; set; }
|
||||
public struct Profile
|
||||
{
|
||||
public string ServerName { get; set; }
|
||||
public string Argument { get; set; }
|
||||
public string OriginalArgument { get; set; }
|
||||
public string RuntimeVersion { get; set; }
|
||||
public List<string> CustomData { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
|
39
Mitria_Minecraft_Launcher/LauncherForm.Designer.cs
generated
39
Mitria_Minecraft_Launcher/LauncherForm.Designer.cs
generated
@@ -47,6 +47,8 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.button_Report = new System.Windows.Forms.Button();
|
||||
this.button_Open_LauncherDirectory = new System.Windows.Forms.Button();
|
||||
this.button_Setup = new System.Windows.Forms.Button();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.comboBox_selectServer = new System.Windows.Forms.ComboBox();
|
||||
this.groupBox_MinecraftRun.SuspendLayout();
|
||||
this.groupBox_Progress.SuspendLayout();
|
||||
this.groupBox_LauncherSettings.SuspendLayout();
|
||||
@@ -107,7 +109,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.groupBox_MinecraftRun.Controls.Add(this.textBox_MinecraftPlayerName);
|
||||
this.groupBox_MinecraftRun.Controls.Add(this.button_Run);
|
||||
this.groupBox_MinecraftRun.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.groupBox_MinecraftRun.Location = new System.Drawing.Point(262, 260);
|
||||
this.groupBox_MinecraftRun.Location = new System.Drawing.Point(262, 280);
|
||||
this.groupBox_MinecraftRun.Name = "groupBox_MinecraftRun";
|
||||
this.groupBox_MinecraftRun.Size = new System.Drawing.Size(300, 90);
|
||||
this.groupBox_MinecraftRun.TabIndex = 0;
|
||||
@@ -126,7 +128,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.groupBox_Progress.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.groupBox_Progress.Location = new System.Drawing.Point(12, 12);
|
||||
this.groupBox_Progress.Name = "groupBox_Progress";
|
||||
this.groupBox_Progress.Size = new System.Drawing.Size(550, 240);
|
||||
this.groupBox_Progress.Size = new System.Drawing.Size(550, 220);
|
||||
this.groupBox_Progress.TabIndex = 0;
|
||||
this.groupBox_Progress.TabStop = false;
|
||||
this.groupBox_Progress.Text = "Progress";
|
||||
@@ -186,7 +188,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.groupBox_LauncherSettings.Controls.Add(this.button_Open_LauncherDirectory);
|
||||
this.groupBox_LauncherSettings.Controls.Add(this.button_Setup);
|
||||
this.groupBox_LauncherSettings.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.groupBox_LauncherSettings.Location = new System.Drawing.Point(12, 260);
|
||||
this.groupBox_LauncherSettings.Location = new System.Drawing.Point(12, 280);
|
||||
this.groupBox_LauncherSettings.Name = "groupBox_LauncherSettings";
|
||||
this.groupBox_LauncherSettings.Size = new System.Drawing.Size(244, 90);
|
||||
this.groupBox_LauncherSettings.TabIndex = 0;
|
||||
@@ -245,12 +247,38 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.button_Setup.UseVisualStyleBackColor = false;
|
||||
this.button_Setup.Click += new System.EventHandler(this.button_Setup_Click);
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.label1.Location = new System.Drawing.Point(220, 250);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(41, 12);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "Server";
|
||||
//
|
||||
// comboBox_selectServer
|
||||
//
|
||||
this.comboBox_selectServer.DropDownHeight = 150;
|
||||
this.comboBox_selectServer.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBox_selectServer.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.comboBox_selectServer.Font = new System.Drawing.Font("맑은 고딕", 9F);
|
||||
this.comboBox_selectServer.FormattingEnabled = true;
|
||||
this.comboBox_selectServer.IntegralHeight = false;
|
||||
this.comboBox_selectServer.Location = new System.Drawing.Point(270, 247);
|
||||
this.comboBox_selectServer.Name = "comboBox_selectServer";
|
||||
this.comboBox_selectServer.Size = new System.Drawing.Size(292, 23);
|
||||
this.comboBox_selectServer.TabIndex = 4;
|
||||
this.comboBox_selectServer.SelectedIndexChanged += new System.EventHandler(this.comboBox_selectServer_SelectedIndexChanged);
|
||||
//
|
||||
// LauncherForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
|
||||
this.ClientSize = new System.Drawing.Size(574, 360);
|
||||
this.ClientSize = new System.Drawing.Size(574, 381);
|
||||
this.Controls.Add(this.comboBox_selectServer);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.groupBox_LauncherSettings);
|
||||
this.Controls.Add(this.groupBox_Progress);
|
||||
this.Controls.Add(this.groupBox_MinecraftRun);
|
||||
@@ -267,6 +295,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.groupBox_Progress.PerformLayout();
|
||||
this.groupBox_LauncherSettings.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
@@ -289,6 +318,8 @@ namespace Mitria_Minecraft_Launcher
|
||||
private System.Windows.Forms.Button button_Report;
|
||||
private System.Windows.Forms.Button button_Open_LauncherDirectory;
|
||||
private System.Windows.Forms.Button button_Open_GameDirectory;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.ComboBox comboBox_selectServer;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -6,13 +6,13 @@ using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using System.Linq;
|
||||
|
||||
namespace Mitria_Minecraft_Launcher
|
||||
{
|
||||
public partial class LauncherForm : Form
|
||||
{
|
||||
private LoadingScreen _loadingScreen;
|
||||
|
||||
public LauncherForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
@@ -23,6 +23,14 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.Text = ProductName + " v" + ProductVersion;
|
||||
LoadingScreenInitialize();
|
||||
this.textBox_MinecraftPlayerName.Text = Settings.UserLauncherConfig.MinecraftPlayerName;
|
||||
int index = 0;
|
||||
foreach (var server in Settings.ServerInformation.Servers)
|
||||
{
|
||||
comboBox_selectServer.Items.Add(server.ServerFullName);
|
||||
if (server.ServerName == Settings.UserLauncherConfig.LastServerName)
|
||||
index = comboBox_selectServer.Items.Count - 1;
|
||||
}
|
||||
comboBox_selectServer.SelectedIndex = index;
|
||||
}
|
||||
|
||||
private void LoadingScreenInitialize()
|
||||
@@ -157,26 +165,28 @@ namespace Mitria_Minecraft_Launcher
|
||||
|
||||
private void MinecraftRun()
|
||||
{
|
||||
CommonLibrary.XMLSystem.Save(System.IO.Path.GetFullPath(Settings.UserLauncherConfigPath), Settings.UserLauncherConfig);
|
||||
CommonLibrary.XMLSystem.Save(System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.UserClientVersionPath)), Settings.UserClientVersion);
|
||||
string runtime = System.IO.Path.GetFullPath(Settings.RuntimeLocation + "\\bin\\javaw.exe");
|
||||
Settings.UserLauncherConfig.LastServerName = Settings.NowProfile.ServerName;
|
||||
Settings.SaveUserLauncherConfig();
|
||||
Settings.SaveUserClientVersion();
|
||||
|
||||
string runtime = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.RuntimeLocation , Settings.NowProfile.ServerName, "\\bin\\javaw.exe"));
|
||||
if (!System.IO.File.Exists(runtime))
|
||||
{
|
||||
CommonLibrary.Log.FATAL("not found java");
|
||||
MessageBox.Show("the java could not be found.", "FATAL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
Loading(false);
|
||||
Settings.UserLauncherConfig.RuntimeVersion = "0.0.0.0"; // 버전초기화
|
||||
Settings.NowProfile.RuntimeVersion = "0.0.0.0"; // 버전초기화
|
||||
return;
|
||||
}
|
||||
string excuteArgumentXml = Settings.UserLauncherConfig.GameDirectory + @"\Mitria\ExcuteArgument.xml";
|
||||
ExcuteArgument excuteArgument = CommonLibrary.XMLSystem.LoadFromPath<ExcuteArgument>(excuteArgumentXml);
|
||||
string excuteArgumentXml = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, @"\Mitria\ExcuteArgument.xml");
|
||||
ExcuteArgument excuteArgument = CommonLibrary.XmlSystem.LoadFromPath<ExcuteArgument>(excuteArgumentXml);
|
||||
|
||||
List<Parameter> launcherParameters = new List<Parameter>();
|
||||
launcherParameters.Add(new Parameter("GameDirectory", "\"" + Settings.UserLauncherConfig.GameDirectory + "\""));
|
||||
launcherParameters.Add(new Parameter("argument", Settings.UserLauncherConfig.Argument));
|
||||
launcherParameters.Add(new Parameter("GameDirectory", "\"" + CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName) + "\""));
|
||||
launcherParameters.Add(new Parameter("argument", Settings.NowProfile.Argument));
|
||||
launcherParameters.Add(new Parameter("userName", Settings.UserLauncherConfig.MinecraftPlayerName));
|
||||
launcherParameters.Add(new Parameter("uuid", Settings.UserLauncherConfig.MinecraftPlayerName + "uuid"));
|
||||
launcherParameters.Add(new Parameter("accessToken", Settings.UserLauncherConfig.MinecraftPlayerName + "accessToken"));
|
||||
launcherParameters.Add(new Parameter("uuid", "uuid"));
|
||||
launcherParameters.Add(new Parameter("accessToken", "accessToken"));
|
||||
|
||||
excuteArgument.Parameters.AddRange(launcherParameters);
|
||||
|
||||
@@ -189,7 +199,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
CreateNoWindow = true,
|
||||
Arguments = argumentsCommand,
|
||||
UseShellExecute = Settings.UserLauncherConfig.ShellView,
|
||||
WorkingDirectory = Settings.UserLauncherConfig.GameDirectory
|
||||
WorkingDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory , Settings.NowProfile.ServerName),
|
||||
};
|
||||
|
||||
process.StartInfo = processStartInfo;
|
||||
@@ -221,6 +231,10 @@ namespace Mitria_Minecraft_Launcher
|
||||
|
||||
private void button_Report_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 개발중..? 뭐 만들려고 했지...?
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
private string ReportCheck(DateTime criteriaDateTime)
|
||||
@@ -262,5 +276,10 @@ namespace Mitria_Minecraft_Launcher
|
||||
}
|
||||
System.Diagnostics.Process.Start(Settings.UserLauncherConfig.GameDirectory);
|
||||
}
|
||||
|
||||
private void comboBox_selectServer_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Settings.ChangeProfile(Settings.ServerInformation.Servers[comboBox_selectServer.SelectedIndex].ServerName);
|
||||
}
|
||||
}
|
||||
}
|
@@ -52,7 +52,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.groupBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.groupBox1.Location = new System.Drawing.Point(10, 10);
|
||||
this.groupBox1.Name = "groupBox1";
|
||||
this.groupBox1.Size = new System.Drawing.Size(480, 100);
|
||||
this.groupBox1.Size = new System.Drawing.Size(566, 100);
|
||||
this.groupBox1.TabIndex = 0;
|
||||
this.groupBox1.TabStop = false;
|
||||
this.groupBox1.Text = "Game Directory";
|
||||
@@ -61,7 +61,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
//
|
||||
this.button_GameDirectory_Open.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button_GameDirectory_Open.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.button_GameDirectory_Open.Location = new System.Drawing.Point(370, 47);
|
||||
this.button_GameDirectory_Open.Location = new System.Drawing.Point(460, 50);
|
||||
this.button_GameDirectory_Open.Name = "button_GameDirectory_Open";
|
||||
this.button_GameDirectory_Open.Size = new System.Drawing.Size(90, 30);
|
||||
this.button_GameDirectory_Open.TabIndex = 1;
|
||||
@@ -77,7 +77,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
this.textBox_GameDirectory.Location = new System.Drawing.Point(20, 20);
|
||||
this.textBox_GameDirectory.Name = "textBox_GameDirectory";
|
||||
this.textBox_GameDirectory.ReadOnly = true;
|
||||
this.textBox_GameDirectory.Size = new System.Drawing.Size(440, 21);
|
||||
this.textBox_GameDirectory.Size = new System.Drawing.Size(530, 21);
|
||||
this.textBox_GameDirectory.TabIndex = 0;
|
||||
this.textBox_GameDirectory.TabStop = false;
|
||||
//
|
||||
@@ -119,8 +119,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
//
|
||||
// button_Save
|
||||
//
|
||||
this.button_Save.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button_Save.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.button_Save.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
|
||||
this.button_Save.Location = new System.Drawing.Point(496, 275);
|
||||
this.button_Save.Name = "button_Save";
|
||||
this.button_Save.Size = new System.Drawing.Size(80, 50);
|
||||
@@ -131,8 +130,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
//
|
||||
// button_Cancel
|
||||
//
|
||||
this.button_Cancel.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button_Cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.button_Cancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
|
||||
this.button_Cancel.Location = new System.Drawing.Point(496, 339);
|
||||
this.button_Cancel.Name = "button_Cancel";
|
||||
this.button_Cancel.Size = new System.Drawing.Size(80, 50);
|
||||
@@ -156,7 +154,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
//
|
||||
this.button_Package_Initialize.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button_Package_Initialize.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.button_Package_Initialize.Location = new System.Drawing.Point(496, 30);
|
||||
this.button_Package_Initialize.Location = new System.Drawing.Point(496, 150);
|
||||
this.button_Package_Initialize.Name = "button_Package_Initialize";
|
||||
this.button_Package_Initialize.Size = new System.Drawing.Size(80, 50);
|
||||
this.button_Package_Initialize.TabIndex = 5;
|
||||
@@ -169,7 +167,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
//
|
||||
this.button_Component_Initialize.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||
this.button_Component_Initialize.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
|
||||
this.button_Component_Initialize.Location = new System.Drawing.Point(496, 86);
|
||||
this.button_Component_Initialize.Location = new System.Drawing.Point(496, 210);
|
||||
this.button_Component_Initialize.Name = "button_Component_Initialize";
|
||||
this.button_Component_Initialize.Size = new System.Drawing.Size(80, 50);
|
||||
this.button_Component_Initialize.TabIndex = 6;
|
||||
|
@@ -11,9 +11,12 @@ namespace Mitria_Minecraft_Launcher
|
||||
}
|
||||
private void LauncherSetupForm_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
Text = "Base Setup For " + Settings.NowProfile.ServerName;
|
||||
textBox_GameDirectory.Text = Settings.UserLauncherConfig.GameDirectory;
|
||||
textBox_Argument.Text = Settings.UserLauncherConfig.Argument;
|
||||
checkBox_ShellView.Checked = Settings.UserLauncherConfig.ShellView;
|
||||
|
||||
textBox_Argument.Text = Settings.NowProfile.Argument;
|
||||
}
|
||||
private void button_GameDirectory_Open_Click(object sender, EventArgs e)
|
||||
{
|
||||
@@ -27,7 +30,7 @@ namespace Mitria_Minecraft_Launcher
|
||||
|
||||
private void button_Argument_Initialize_Click(object sender, EventArgs e)
|
||||
{
|
||||
textBox_Argument.Text = Settings.BaseArgument;
|
||||
textBox_Argument.Text = Settings.NowProfile.OriginalArgument;
|
||||
}
|
||||
|
||||
private void button_Save_Click(object sender, EventArgs e)
|
||||
@@ -44,12 +47,9 @@ namespace Mitria_Minecraft_Launcher
|
||||
}
|
||||
}
|
||||
Settings.UserLauncherConfig.GameDirectory = textBox_GameDirectory.Text;
|
||||
Settings.UserLauncherConfig.Argument = textBox_Argument.Text;
|
||||
Settings.UserLauncherConfig.ShellView = checkBox_ShellView.Checked;
|
||||
Settings.NowProfile.Argument = textBox_Argument.Text;
|
||||
Settings.SaveUserLauncherConfig();
|
||||
Settings.LoadUserClientVersion();
|
||||
|
||||
|
||||
this.Close();
|
||||
}
|
||||
|
||||
|
@@ -231,6 +231,7 @@
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="LauncherForm.resx">
|
||||
<DependentUpon>LauncherForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="LauncherSetupForm.resx">
|
||||
<DependentUpon>LauncherSetupForm.cs</DependentUpon>
|
||||
|
@@ -36,15 +36,9 @@ namespace Mitria_Minecraft_Launcher
|
||||
|
||||
#region Crate CustomDirectory
|
||||
|
||||
string customDataDirectory = CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, "config");
|
||||
if (!System.IO.Directory.Exists(customDataDirectory))
|
||||
if (!System.IO.Directory.Exists(Settings.CustomDataDirectory))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(customDataDirectory);
|
||||
}
|
||||
customDataDirectory = CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, "mods");
|
||||
if (!System.IO.Directory.Exists(customDataDirectory))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(customDataDirectory);
|
||||
System.IO.Directory.CreateDirectory(Settings.CustomDataDirectory);
|
||||
}
|
||||
|
||||
#endregion Crate CustomDirectory
|
||||
@@ -62,9 +56,61 @@ namespace Mitria_Minecraft_Launcher
|
||||
|
||||
case Updater.LauncherUpdateStatus.Same:
|
||||
Settings.LoadUserLauncherConfig();
|
||||
Settings.LoadUserClientVersion();
|
||||
bool result = DownloadServerList();
|
||||
if (result)
|
||||
{
|
||||
if (Settings.UserLauncherConfig.Profiles != null)
|
||||
{
|
||||
var newList = Settings.UserLauncherConfig.Profiles;
|
||||
|
||||
ProgramRun();
|
||||
for (int i = 0; i < Settings.UserLauncherConfig.Profiles.Count; i++)
|
||||
{
|
||||
bool existence = false;
|
||||
for (int j = 0; j < Settings.ServerInformation.Servers.Count; j++)
|
||||
{
|
||||
if (Settings.UserLauncherConfig.Profiles[i].ServerName == Settings.ServerInformation.Servers[j].ServerName)
|
||||
{
|
||||
existence = true;
|
||||
if (Settings.UserLauncherConfig.Profiles[i].OriginalArgument != Settings.ServerInformation.Servers[j].BaseArgument)
|
||||
{
|
||||
Settings.UserLauncherConfig.Profiles[i] = new LauncherConfig.Profile()
|
||||
{
|
||||
ServerName = Settings.UserLauncherConfig.Profiles[i].ServerName,
|
||||
Argument = Settings.ServerInformation.Servers[j].BaseArgument,
|
||||
OriginalArgument = Settings.ServerInformation.Servers[j].BaseArgument,
|
||||
RuntimeVersion = Settings.UserLauncherConfig.Profiles[i].RuntimeVersion,
|
||||
CustomData = Settings.UserLauncherConfig.Profiles[i].CustomData
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!existence)
|
||||
{
|
||||
newList.Remove(Settings.UserLauncherConfig.Profiles[i]);
|
||||
string path = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.UserLauncherConfig.Profiles[i].ServerName);
|
||||
if (File.Exists(path))
|
||||
{
|
||||
Directory.Delete(path, true);
|
||||
}
|
||||
path = CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, Settings.UserLauncherConfig.Profiles[i].ServerName);
|
||||
if (System.IO.Directory.Exists(path))
|
||||
{
|
||||
System.IO.Directory.Delete(path, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
Settings.UserLauncherConfig.Profiles = newList;
|
||||
}
|
||||
|
||||
|
||||
ProgramRun();
|
||||
}
|
||||
else
|
||||
{
|
||||
CommonLibrary.Log.FATAL("ServerList Get Failed");
|
||||
MessageBox.Show("ServerList get failed. \r\nPlease provide a log to the administrator and solve it.", "FATAL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -78,6 +124,18 @@ namespace Mitria_Minecraft_Launcher
|
||||
}
|
||||
}
|
||||
|
||||
private static bool DownloadServerList()
|
||||
{
|
||||
Downloader downloader = new Downloader();
|
||||
string data = downloader.DownloadString(Settings.ServerBaseUrl + Settings.ServerInformationFile);
|
||||
if (data == string.Empty)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
Settings.ServerInformation = CommonLibrary.XmlSystem.LoadFromData<CommonLibrary.ServerInformation>(data);
|
||||
return true;
|
||||
}
|
||||
|
||||
private static void ProgramRun()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
|
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Mitria_Minecraft_Launcher
|
||||
{
|
||||
@@ -9,55 +8,119 @@ namespace Mitria_Minecraft_Launcher
|
||||
#pragma warning disable S2223 // Non-constant static fields should not be visible
|
||||
public static LauncherConfig UserLauncherConfig;
|
||||
public static ClientVersion UserClientVersion;
|
||||
public static LauncherConfig.Profile NowProfile;
|
||||
|
||||
public static CommonLibrary.ServerInformation ServerInformation;
|
||||
|
||||
public static readonly string UserLauncherConfigPath = "config.xml";
|
||||
public static readonly string UserClientVersionPath = "version.xml"; // 위치 // 게임 디렉토리 +
|
||||
public static readonly string CustomDataDirectory = "CustomData";
|
||||
public static readonly string RuntimeLocation = "runtime";
|
||||
#pragma warning disable S1075 // URIs should not be hardcoded
|
||||
|
||||
public static readonly string ServerBaseUrl = "http://mitria.kr/Patchdata";
|
||||
|
||||
|
||||
#pragma warning restore S1075 // URIs should not be hardcoded
|
||||
public static readonly string ServerLauncherPatchInformationFile = "/Launcher.xml";
|
||||
public static readonly string ServerDataPatchInformationFile = "/Data.xml";
|
||||
public static readonly string BaseArgument = @"-XX:+UseG1GC -Xmx8G -Xms8G -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M";
|
||||
public static readonly string ServerLauncherPatchInformationFile = "/launcher.xml";
|
||||
public static readonly string ServerInformationFile = "/server.xml";
|
||||
public static readonly string ServerDataPatchInformationFile = "/data.xml";
|
||||
//public static readonly string BaseArgument = @"-XX:+UseG1GC -Xmx8G -Xms8G -Dsun.rmi.dgc.server.gcInterval=2147483646 -XX:+UnlockExperimentalVMOptions -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M";
|
||||
|
||||
public static void LoadUserLauncherConfig()
|
||||
{
|
||||
string path = System.IO.Path.GetFullPath(UserLauncherConfigPath);
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
UserLauncherConfig = CommonLibrary.XMLSystem.LoadFromPath<LauncherConfig>(path);
|
||||
UserLauncherConfig = CommonLibrary.XmlSystem.LoadFromPath<LauncherConfig>(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
UserLauncherConfig = new LauncherConfig();
|
||||
UserLauncherConfig.MinecraftPlayerName = string.Empty;
|
||||
UserLauncherConfig.Argument = Settings.BaseArgument;
|
||||
UserLauncherConfig.GameDirectory = @"C:\Games\Mitria";
|
||||
UserLauncherConfig.ShellView = false;
|
||||
UserLauncherConfig.RuntimeVersion = "0.0.0.0";
|
||||
UserLauncherConfig.CustomData = new List<string>();
|
||||
}
|
||||
}
|
||||
|
||||
public static void SaveUserLauncherConfig()
|
||||
{
|
||||
SaveProfile();
|
||||
string path = System.IO.Path.GetFullPath(UserLauncherConfigPath);
|
||||
string pathDirectory = System.IO.Path.GetDirectoryName(path);
|
||||
if (!System.IO.Directory.Exists(pathDirectory))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(pathDirectory);
|
||||
}
|
||||
CommonLibrary.XMLSystem.Save(path, UserLauncherConfig);
|
||||
CommonLibrary.XmlSystem.Save(path, UserLauncherConfig);
|
||||
}
|
||||
|
||||
public static void ChangeProfile(string serverName)
|
||||
{
|
||||
LauncherConfig.Profile myProfile = new LauncherConfig.Profile();
|
||||
bool exists = false;
|
||||
if (Settings.UserLauncherConfig.Profiles != null)
|
||||
{
|
||||
foreach (var profile in Settings.UserLauncherConfig.Profiles)
|
||||
{
|
||||
if (profile.ServerName == serverName)
|
||||
{
|
||||
myProfile = profile;
|
||||
exists = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!exists)
|
||||
{
|
||||
foreach (var server in Settings.ServerInformation.Servers)
|
||||
{
|
||||
if (server.ServerName == serverName)
|
||||
{
|
||||
myProfile.ServerName = server.ServerName;
|
||||
myProfile.Argument = server.BaseArgument;
|
||||
myProfile.OriginalArgument = server.BaseArgument;
|
||||
myProfile.RuntimeVersion = "0.0.0.0";
|
||||
myProfile.CustomData = new List<string>();
|
||||
}
|
||||
}
|
||||
}
|
||||
NowProfile = myProfile;
|
||||
LoadUserClientVersion();
|
||||
}
|
||||
private static void SaveProfile()
|
||||
{
|
||||
|
||||
if(NowProfile.ServerName == string.Empty)
|
||||
{
|
||||
return;
|
||||
}
|
||||
bool isSave = false;
|
||||
if(Settings.UserLauncherConfig.Profiles == null)
|
||||
{
|
||||
Settings.UserLauncherConfig.Profiles = new List<LauncherConfig.Profile>();
|
||||
Settings.UserLauncherConfig.Profiles.Add(NowProfile);
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < Settings.UserLauncherConfig.Profiles.Count; i++)
|
||||
{
|
||||
if (NowProfile.ServerName == Settings.UserLauncherConfig.Profiles[i].ServerName)
|
||||
{
|
||||
Settings.UserLauncherConfig.Profiles[i] = NowProfile;
|
||||
isSave = true;
|
||||
}
|
||||
}
|
||||
if(!isSave)
|
||||
{
|
||||
Settings.UserLauncherConfig.Profiles.Add(NowProfile);
|
||||
}
|
||||
|
||||
}
|
||||
public static void LoadUserClientVersion()
|
||||
{
|
||||
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, UserClientVersionPath);
|
||||
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, NowProfile.ServerName, UserClientVersionPath);
|
||||
if (System.IO.File.Exists(path))
|
||||
{
|
||||
UserClientVersion = CommonLibrary.XMLSystem.LoadFromPath<ClientVersion>(path);
|
||||
UserClientVersion = CommonLibrary.XmlSystem.LoadFromPath<ClientVersion>(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -72,15 +135,13 @@ namespace Mitria_Minecraft_Launcher
|
||||
|
||||
public static void SaveUserClientVersion()
|
||||
{
|
||||
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, UserClientVersionPath);
|
||||
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, NowProfile.ServerName, UserClientVersionPath);
|
||||
string pathDirectory = System.IO.Path.GetDirectoryName(path);
|
||||
if (!System.IO.Directory.Exists(pathDirectory))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(pathDirectory);
|
||||
}
|
||||
CommonLibrary.XMLSystem.Save(path, UserClientVersion);
|
||||
CommonLibrary.XmlSystem.Save(path, UserClientVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -25,7 +25,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
// Version File Download
|
||||
CommonLibrary.Log.INFO("download version file.");
|
||||
var verionData = downloader.DownloadString(Settings.ServerBaseUrl + Settings.ServerDataPatchInformationFile);
|
||||
var verionData = downloader.DownloadString(CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl,"Servers", Settings.NowProfile.ServerName, Settings.ServerDataPatchInformationFile));
|
||||
|
||||
// Versoin File 받기에 실패하였을때 업데이트 전체 실패처리
|
||||
if (verionData == string.Empty)
|
||||
@@ -36,7 +36,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
}
|
||||
|
||||
// Version File Xml 형태로 변환
|
||||
var dataPatchInformation = CommonLibrary.XMLSystem.LoadFromData<DataPatchInformation>(verionData);
|
||||
var dataPatchInformation = CommonLibrary.XmlSystem.LoadFromData<DataPatchInformation>(verionData);
|
||||
|
||||
// 임시 폴더 생성
|
||||
var tempDirectory = System.IO.Path.GetFullPath("temp");
|
||||
@@ -54,7 +54,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
Log.INFO("[Runtime] Version Check");
|
||||
|
||||
// 버전 비교
|
||||
var thisVersion = Version.Parse(Settings.UserLauncherConfig.RuntimeVersion);
|
||||
var thisVersion = Version.Parse(Settings.NowProfile.RuntimeVersion);
|
||||
var remoteVersion = Version.Parse(dataPatchInformation.RuntimeVersion);
|
||||
CommonLibrary.Log.INFO("[Runtime] LocalVersion : " + thisVersion);
|
||||
CommonLibrary.Log.INFO("[Runtime] RemoteVersion : " + remoteVersion);
|
||||
@@ -72,7 +72,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
CommonLibrary.Log.INFO("Runtime delete it for update.");
|
||||
|
||||
// 런타임 폴더 경로 가져오기
|
||||
var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(Settings.RuntimeLocation));
|
||||
var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.RuntimeLocation,Settings.NowProfile.ServerName)));
|
||||
|
||||
// 런타임 폴더 삭제후 새로만들기
|
||||
if (!rootDirectoryInfo.Exists)
|
||||
@@ -91,7 +91,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
// 런타임 다운로드 시작
|
||||
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 2, 9, "[2/9] Runtime Download"));
|
||||
Log.INFO("[Runtime] Data Download Start");
|
||||
var downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, dataPatchInformation.RuntimeUrl, dataPatchInformation.RuntimeFileName);
|
||||
var downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.RuntimeUrl, dataPatchInformation.RuntimeFileName);
|
||||
var targetPath = System.IO.Path.Combine(tempDirectory, dataPatchInformation.RuntimeFileName); // 임시폴더에 다운로드
|
||||
downloader.DownloadFile(downloadUrl, targetPath);
|
||||
Log.INFO("[Runtime] Data Download End");
|
||||
@@ -99,11 +99,11 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
// 런타임 언패킹 작업
|
||||
var progressPacker = new ProgressPacker();
|
||||
var unpackPath = System.IO.Path.GetFullPath(Settings.RuntimeLocation);
|
||||
var unpackPath = rootDirectoryInfo.FullName;
|
||||
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 3, 9, "[3/9] Runtime Unpack"));
|
||||
Log.INFO("[Runtime] Unpack Start");
|
||||
progressPacker.UnPack(targetPath, unpackPath, new BasicProgress<double>(p => Change(p)));
|
||||
Settings.UserLauncherConfig.RuntimeVersion = remoteVersion.ToString();
|
||||
Settings.NowProfile.RuntimeVersion = remoteVersion.ToString();
|
||||
|
||||
//임시폴더 삭제
|
||||
System.IO.File.Delete(targetPath);
|
||||
@@ -134,7 +134,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
.INFO(string.Format("{0}", result == 1 ? "remote is the upper version" : "remote is the lower version"));
|
||||
CommonLibrary.Log.INFO("[Package] delete it for update.");
|
||||
|
||||
var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(Settings.UserLauncherConfig.GameDirectory));
|
||||
var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory,Settings.NowProfile.ServerName)));
|
||||
|
||||
if (!rootDirectoryInfo.Exists)
|
||||
{
|
||||
@@ -144,11 +144,15 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
else
|
||||
{
|
||||
// 비우기 전에 스크린샷폴더 보존 /screenshots
|
||||
string oldScreenshotsDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, "screenshots");
|
||||
string oldScreenshotsDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, "screenshots");
|
||||
string newScreenshotsDirectory = CommonLibrary.Extensions.PathCombineW("screenshots " + DateTime.Now.ToString());
|
||||
if (System.IO.Directory.Exists(oldScreenshotsDirectory) && System.IO.Directory.GetFiles(oldScreenshotsDirectory, "*", System.IO.SearchOption.AllDirectories).Length > 0)
|
||||
{
|
||||
Log.INFO("[Package] Screenshots Directory Backup : " + newScreenshotsDirectory);
|
||||
if(!System.IO.Directory.Exists(newScreenshotsDirectory))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(newScreenshotsDirectory);
|
||||
}
|
||||
System.IO.Directory.Move(oldScreenshotsDirectory, newScreenshotsDirectory);
|
||||
}
|
||||
|
||||
@@ -156,7 +160,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
Log.INFO("[Package] Empty GameDirectory");
|
||||
}
|
||||
|
||||
var downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, dataPatchInformation.PackageUrl, dataPatchInformation.PackageFileName);
|
||||
var downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.PackageUrl, dataPatchInformation.PackageFileName);
|
||||
var targetPath = System.IO.Path.Combine(tempDirectory, dataPatchInformation.PackageFileName);
|
||||
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 5, 9, "[5/9] Package Download"));
|
||||
Log.INFO("[Package] Download Start");
|
||||
@@ -203,6 +207,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
System.IO.File.Delete(targetPath);
|
||||
Log.INFO("[Package] -[F] " + targetPath);
|
||||
Log.INFO("[Package] Unpack End");
|
||||
Settings.UserClientVersion.ComponentVersion = "0.0.0.0";
|
||||
}
|
||||
|
||||
#endregion Package Update
|
||||
@@ -236,7 +241,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
foreach (var directory in resultDirectorys)
|
||||
{
|
||||
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, directory));
|
||||
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory,Settings.NowProfile.ServerName, directory));
|
||||
|
||||
if (System.IO.Directory.Exists(directoryPath))
|
||||
{
|
||||
@@ -247,7 +252,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
foreach (var directory in dataPatchInformation.ComponentDirectorys)
|
||||
{
|
||||
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, directory));
|
||||
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName, directory));
|
||||
|
||||
if (!System.IO.Directory.Exists(directoryPath))
|
||||
{
|
||||
@@ -265,7 +270,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
|
||||
foreach (var fileDetail in removeFiles)
|
||||
{
|
||||
var filePath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, fileDetail.Directory, fileDetail.FileName);
|
||||
var filePath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory,Settings.NowProfile.ServerName, fileDetail.Directory, fileDetail.FileName);
|
||||
if (System.IO.File.Exists(filePath))
|
||||
{
|
||||
Log.INFO("[Component] -[F] " + filePath);
|
||||
@@ -277,8 +282,8 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
Log.INFO("[Component] Download Start");
|
||||
for (int i = 0; i < needFiles.Count; i++)
|
||||
{
|
||||
var url = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, dataPatchInformation.ComponentUrl, needFiles[i].Directory, needFiles[i].FileName);
|
||||
var path = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, needFiles[i].Directory, needFiles[i].FileName);
|
||||
var url = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, "Servers", Settings.NowProfile.ServerName, dataPatchInformation.ComponentUrl, needFiles[i].Directory, needFiles[i].FileName);
|
||||
var path = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory,Settings.NowProfile.ServerName, needFiles[i].Directory, needFiles[i].FileName);
|
||||
downloader.DownloadFile(url, path);
|
||||
Log.INFO("[Component] +[F] " + path);
|
||||
}
|
||||
@@ -293,7 +298,15 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
#region CustomData
|
||||
// 삭제된 파일 찾기
|
||||
|
||||
string rootCustomPath = System.IO.Path.GetFullPath(Settings.CustomDataDirectory);
|
||||
string rootCustomPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.CustomDataDirectory, Settings.NowProfile.ServerName));
|
||||
if(!System.IO.Directory.Exists(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "config")))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "config"));
|
||||
}
|
||||
if (!System.IO.Directory.Exists(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "mods")))
|
||||
{
|
||||
System.IO.Directory.CreateDirectory(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "mods"));
|
||||
}
|
||||
List<string> files = new List<string>();
|
||||
files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "config")));
|
||||
files.AddRange(System.IO.Directory.GetFiles(CommonLibrary.Extensions.PathCombineW(rootCustomPath, "mods")));
|
||||
@@ -302,21 +315,11 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
files[i] = files[i].Replace(rootCustomPath + '\\', string.Empty);
|
||||
|
||||
}
|
||||
|
||||
for (int i = 0; i < Settings.UserLauncherConfig.CustomData.Count; i++)
|
||||
{
|
||||
if (!files.Contains(Settings.UserLauncherConfig.CustomData[i]))
|
||||
{
|
||||
|
||||
string filePath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, Settings.UserLauncherConfig.CustomData[i]);
|
||||
System.IO.File.Delete(filePath);
|
||||
Log.INFO("[CustomData] -[F] " + filePath);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var file in files)
|
||||
{
|
||||
string sourcePath = CommonLibrary.Extensions.PathCombineW(rootCustomPath, file);
|
||||
string targetPath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, file);
|
||||
string targetPath = CommonLibrary.Extensions.PathCombineW( Settings.UserLauncherConfig.GameDirectory, Settings.NowProfile.ServerName,file);
|
||||
|
||||
|
||||
if (System.IO.File.Exists(targetPath))
|
||||
@@ -335,7 +338,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
System.IO.File.Copy(sourcePath, targetPath);
|
||||
Log.INFO("[CustomData] +[F] " + targetPath);
|
||||
}
|
||||
Settings.UserLauncherConfig.CustomData = files;
|
||||
//Settings.UserLauncherConfig.CustomData = files;
|
||||
Settings.SaveUserLauncherConfig();
|
||||
}
|
||||
|
||||
|
@@ -16,7 +16,7 @@ namespace Mitria_Minecraft_Launcher.Updater
|
||||
return LauncherUpdateStatus.Fail;
|
||||
}
|
||||
|
||||
LauncherPatchInformation launcherPatchInformation = CommonLibrary.XMLSystem.LoadFromData<LauncherPatchInformation>(verionData);
|
||||
LauncherPatchInformation launcherPatchInformation = CommonLibrary.XmlSystem.LoadFromData<LauncherPatchInformation>(verionData);
|
||||
Version thisVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
|
||||
Version remoteVersion = Version.Parse(launcherPatchInformation.Version);
|
||||
CommonLibrary.Log.INFO("Launcher Version : " + thisVersion);
|
||||
|
Reference in New Issue
Block a user