- Recovery

This commit is contained in:
2022-10-09 12:27:47 +09:00
parent f53695b228
commit 9052652122
30 changed files with 1112 additions and 219 deletions

View File

@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CommonLibrary
{
@@ -14,6 +11,20 @@ namespace CommonLibrary
public string LauncherFileName { get; set; } // 런처 파일명
}
[Serializable]
public struct ServerInformation // 서버데이터 정보
{
public List<Server> Servers { get; set; }
public struct Server
{
public string ServerName { get; set; } // Majesty
public string ServerFullName { get; set; } // Mitria Minecraft Majesty Server
public string Explain { get; set; } // 서버설명
public string BaseArgument { get; set; } // 기본 Argument
}
}
[Serializable]
public struct DataPatchInformation // 패치데이터 정보
{

View File

@@ -53,5 +53,9 @@ namespace CommonLibrary
}
return path.ToString();
}
public static bool IsDefault<T>(ref this T data) where T : struct
{
return default(T).Equals(data);
}
}
}

View File

@@ -4,7 +4,7 @@ using System.Xml.Serialization;
namespace CommonLibrary
{
public static class XMLSystem
public static class XmlSystem
{
public static bool Save<T>(string path, T data) where T : struct
{

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
</configuration>

View File

@@ -0,0 +1,107 @@
namespace Mitria_Argument_Creater
{
partial class MainForm
{
/// <summary>
/// 필수 디자이너 변수입니다.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 사용 중인 모든 리소스를 정리합니다.
/// </summary>
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.listView_Version = new System.Windows.Forms.ListView();
this.textBox_ResultArgument = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(50, 50);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(450, 21);
this.textBox1.TabIndex = 0;
//
// button1
//
this.button1.Location = new System.Drawing.Point(520, 50);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(100, 23);
this.button1.TabIndex = 1;
this.button1.Text = "button1";
this.button1.UseVisualStyleBackColor = true;
//
// button2
//
this.button2.Location = new System.Drawing.Point(520, 100);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(100, 97);
this.button2.TabIndex = 3;
this.button2.Text = "button2";
this.button2.UseVisualStyleBackColor = true;
//
// listView_Version
//
this.listView_Version.HideSelection = false;
this.listView_Version.Location = new System.Drawing.Point(50, 100);
this.listView_Version.Name = "listView_Version";
this.listView_Version.Size = new System.Drawing.Size(450, 97);
this.listView_Version.TabIndex = 4;
this.listView_Version.UseCompatibleStateImageBehavior = false;
this.listView_Version.View = System.Windows.Forms.View.List;
//
// textBox_ResultArgument
//
this.textBox_ResultArgument.Location = new System.Drawing.Point(50, 231);
this.textBox_ResultArgument.Name = "textBox_ResultArgument";
this.textBox_ResultArgument.Size = new System.Drawing.Size(100, 21);
this.textBox_ResultArgument.TabIndex = 5;
//
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 450);
this.Controls.Add(this.textBox_ResultArgument);
this.Controls.Add(this.listView_Version);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.textBox1);
this.Name = "MainForm";
this.Text = "Form1";
this.Load += new System.EventHandler(this.MainForm_Load);
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ListView listView_Version;
private System.Windows.Forms.TextBox textBox_ResultArgument;
}
}

View File

@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mitria_Argument_Creater
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
textBox1.Text = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),".minecraft");
listView_Version.Items.Add("1");
listView_Version.Items.Add("1");
listView_Version.Items.Add("1");
listView_Version.Items.Add("1");
listView_Version.Items.Add("1");
}
}
}

View File

@@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{52250463-A90A-4DF7-B17D-A08940858305}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Mitria_Argument_Creater</RootNamespace>
<AssemblyName>Mitria_Argument_Creater</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="MainForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="MainForm.Designer.cs">
<DependentUpon>MainForm.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mitria_Argument_Creater
{
internal static class Program
{
/// <summary>
/// 해당 애플리케이션의 주 진입점입니다.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
// 이러한 특성 값을 변경하세요.
[assembly: AssemblyTitle("Mitria_Argument_Creater")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Mitria_Argument_Creater")]
[assembly: AssemblyCopyright("Copyright © 2022")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
[assembly: ComVisible(false)]
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
[assembly: Guid("52250463-a90a-4df7-b17d-a08940858305")]
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
//
// 주 버전
// 부 버전
// 빌드 번호
// 수정 버전
//
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
// 기본값으로 할 수 있습니다.
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@@ -0,0 +1,71 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Mitria_Argument_Creater.Properties
{
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여
// ResGen을 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
}
/// <summary>
/// 이 클래스에서 사용하는 캐시된 ResourceManager 인스턴스를 반환합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Mitria_Argument_Creater.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 이 강력한 형식의 리소스 클래스를 사용하여 모든 리소스 조회에 대해 현재 스레드의 CurrentUICulture 속성을
/// 재정의합니다.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
return resourceCulture;
}
set
{
resourceCulture = value;
}
}
}
}

View File

@@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@@ -0,0 +1,30 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Mitria_Argument_Creater.Properties
{
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

View File

@@ -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);

View File

@@ -9,12 +9,19 @@ 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 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]
public struct ClientVersion

View File

@@ -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;
}
}

View File

@@ -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);
}
}
}

View File

@@ -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;

View File

@@ -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();
}

View File

@@ -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>

View File

@@ -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;
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();

View File

@@ -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);
}
}
}

View File

@@ -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")));
@@ -303,20 +316,10 @@ namespace Mitria_Minecraft_Launcher.Updater
}
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();
}

View File

@@ -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);

View File

@@ -9,6 +9,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mitria_Minecraft_Updater",
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonLibrary", "CommonLibrary\CommonLibrary.csproj", "{57098662-9A1B-45E7-B932-5299343629F2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mitria_Argument_Creater", "Mitria_Argument_Creater\Mitria_Argument_Creater.csproj", "{52250463-A90A-4DF7-B17D-A08940858305}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -27,6 +29,10 @@ Global
{57098662-9A1B-45E7-B932-5299343629F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{57098662-9A1B-45E7-B932-5299343629F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{57098662-9A1B-45E7-B932-5299343629F2}.Release|Any CPU.Build.0 = Release|Any CPU
{52250463-A90A-4DF7-B17D-A08940858305}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{52250463-A90A-4DF7-B17D-A08940858305}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52250463-A90A-4DF7-B17D-A08940858305}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52250463-A90A-4DF7-B17D-A08940858305}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -27,7 +27,7 @@ namespace Mitria_Minecraft_Updater
int countFiles = System.IO.Directory.GetFiles(directorys[i - 1], "*", System.IO.SearchOption.AllDirectories).Length;
if (countDirectory + countFiles == 0)
{
System.IO.Directory.Delete(directorys[i - 1]);
System.IO.Directory.Delete(directorys[i - 1],true);
}
}
}

View File

@@ -5,6 +5,7 @@
<TargetFramework>net6.0</TargetFramework>
<StartupObject>Mitria_Minecraft_Updater.Program</StartupObject>
<AssemblyName>mmu</AssemblyName>
<DebugType>embedded</DebugType>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,89 +6,86 @@ namespace Mitria_Minecraft_Updater
{
internal static class Program
{
static int nowPosTop;
static int nowPosLeft;
private static int nowPosTop;
private static int nowPosLeft;
static void Main(string[] args)
private static void Main(string[] args)
{
Settings.LoadConfig();
if (args.Length < 1)
{
HelpMessage();
return;
}
var versionType = VersionType.Major;
var checkArg = false;
UpdateType? updateType = GetUpdateType(args[0]);
if (args.Length >= 2)
if( updateType == null)
{
switch (args[1].ToUpper())
{
case "MAJOR":
versionType = VersionType.Major;
break;
case "MINOR":
versionType = VersionType.Minor;
break;
case "BUILD":
versionType = VersionType.Build;
break;
case "REVISION":
versionType = VersionType.Revision;
break;
default:
HelpMessage();
return;
}
checkArg = true;
}
switch (args[0].ToUpper())
if(updateType == UpdateType.Launcher)
{
case "LAUNCHER":
LauncherUpdate();
break;
case "RUNTIME":
if (!checkArg)
return;
}
if (args.Length < 3)
{
HelpMessage();
return;
}
RuntimeUpdate(versionType);
break;
case "PACKAGE":
if (!checkArg)
VersionType? versionType = GetVersionType(args[1]);
if (versionType == null)
{
HelpMessage();
return;
}
CommonLibrary.ServerInformation serverInformation = Settings.LoadServerInformation();
if(CommonLibrary.Extensions.IsDefault(ref serverInformation))
{
Console.WriteLine("not found ServerData Location : " + Settings.config.Target + Settings.config.InformationToServer);
return;
}
PackageUpdate(versionType);
break;
case "COMPONENT":
if (!checkArg)
bool serverIs = false;
string serverOriginalName = string.Empty;
string serverList = string.Empty;
foreach (var item in serverInformation.Servers)
{
serverList += item.ServerName + ", ";
if( item.ServerName.ToUpper() == args[2].ToUpper())
{
serverIs = true;
serverOriginalName = item.ServerName;
}
}
if(!serverIs)
{
HelpMessage();
if (serverList.Length > 1)
{
serverList = serverList.Substring(0, serverList.Length - 2);
Console.WriteLine(" [ServerList] " + serverList);
return;
}
}
ComponentUpdate(versionType);
switch(updateType)
{
case UpdateType.Runtime:
RuntimeUpdate(serverOriginalName, (VersionType)versionType);
break;
case UpdateType.Package:
PackageUpdate(serverOriginalName, (VersionType)versionType);
break;
case UpdateType.Component:
ComponentUpdate(serverOriginalName, (VersionType)versionType);
break;
default:
HelpMessage();
return;
}
}
public static void HelpMessage()
@@ -96,11 +93,11 @@ namespace Mitria_Minecraft_Updater
Console.WriteLine("dotnet mmu.dll [option1] [option2]");
Console.WriteLine(" [option1] Launcher, Runtime, Package, Component");
Console.WriteLine(" [option2] Major, Minor, Build, Revision");
Console.WriteLine(" [option3] ServerName");
}
public static void LauncherUpdate()
{
Settings.LoadConfig();
var launcherPatchInformation = Settings.LoadLauncherPatchInformation(); // 런처 패치정보 Load
Console.WriteLine("Start Launcher Update");
@@ -113,7 +110,7 @@ namespace Mitria_Minecraft_Updater
if (!System.IO.File.Exists(launcherSourceFile))
{
Console.WriteLine("The source file could not be found.");
Console.WriteLine("The source file could not be found. Location : " + launcherSourceFile);
return;
}
@@ -157,24 +154,21 @@ namespace Mitria_Minecraft_Updater
Console.WriteLine("Update Complete");
}
public static void RuntimeUpdate(VersionType versionType)
public static void RuntimeUpdate(string serverName, VersionType versionType)
{
Settings.LoadConfig();
var dataPatchInformation = Settings.LoadDataPatchInformation();
var dataPatchInformation = Settings.LoadDataPatchInformation(serverName);
Console.WriteLine("Start Runtime Update - version " + versionType.ToString());
var runtimeSourceDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Source, Settings.config.RuntimeSource);
var runtimeTargetDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Target, Settings.config.RuntimeUrl);
var runtimeSourceDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Source,"Servers" , serverName, Settings.config.RuntimeSource);
var runtimeTargetDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Target,"Servers", serverName, Settings.config.RuntimeUrl);
Extensions.DirectoryCheckCrate(runtimeSourceDirectory);
Extensions.DirectoryCheckCrate(runtimeTargetDirectory);
// 파일이 하나도 없을경우 조회실패
if (System.IO.Directory.GetFiles(runtimeSourceDirectory, "*.*", System.IO.SearchOption.AllDirectories).Length == 0)
{
Console.WriteLine("The source file could not be found.");
Console.WriteLine("The source file could not be found. Location : " + runtimeSourceDirectory );
return;
}
@@ -198,19 +192,18 @@ namespace Mitria_Minecraft_Updater
var newVersion = VersionChange(dataPatchInformation.RuntimeVersion, versionType);
Console.WriteLine("update Version : " + dataPatchInformation.RuntimeVersion + " → " + newVersion);
dataPatchInformation.RuntimeVersion = newVersion;
Settings.SaveDataPatchInformation(dataPatchInformation);
Settings.SaveDataPatchInformation(serverName,dataPatchInformation);
Console.WriteLine("Update Complete");
}
public static void PackageUpdate(VersionType versionType)
public static void PackageUpdate(string serverName, VersionType versionType)
{
Settings.LoadConfig();
var dataPatchInformation = Settings.LoadDataPatchInformation();
var dataPatchInformation = Settings.LoadDataPatchInformation(serverName);
Console.WriteLine("Start Package Update - version " + versionType.ToString());
var packageSourceDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Source, Settings.config.PackageSource);
var packageTargetDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Target, Settings.config.PackageUrl);
var packageSourceDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Source, "Servers", serverName, Settings.config.PackageSource);
var packageTargetDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Target, "Servers", serverName, Settings.config.PackageUrl);
Extensions.DirectoryCheckCrate(packageSourceDirectory);
Extensions.DirectoryCheckCrate(packageTargetDirectory);
@@ -218,7 +211,7 @@ namespace Mitria_Minecraft_Updater
// 파일이 하나도 없을경우 조회실패
if (System.IO.Directory.GetFiles(packageSourceDirectory, "*.*", System.IO.SearchOption.AllDirectories).Length == 0)
{
Console.WriteLine("The source file could not be found.");
Console.WriteLine("The source file could not be found. Location : " + packageSourceDirectory );
return;
}
@@ -242,7 +235,6 @@ namespace Mitria_Minecraft_Updater
for (int i = 0; i < directories.Length; i++)
{
directories[i] = System.IO.Path.GetRelativePath(Settings.config.Source, directories[i]);
}
@@ -250,26 +242,25 @@ namespace Mitria_Minecraft_Updater
var newVersion = VersionChange(dataPatchInformation.PackageVersion, versionType);
Console.WriteLine("Update Version : " + dataPatchInformation.PackageVersion + " → " + newVersion);
dataPatchInformation.PackageVersion = newVersion;
Settings.SaveDataPatchInformation(dataPatchInformation);
Settings.SaveDataPatchInformation(serverName,dataPatchInformation);
Console.WriteLine("Update Complete");
}
public static void ComponentUpdate(VersionType versionType)
public static void ComponentUpdate(string serverName, VersionType versionType)
{
Settings.LoadConfig();
CommonLibrary.DataPatchInformation dataPatchInformation = Settings.LoadDataPatchInformation();
CommonLibrary.DataPatchInformation dataPatchInformation = Settings.LoadDataPatchInformation(serverName);
Console.WriteLine("Start Component Update - version " + versionType.ToString());
var componentSourceDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Source, Settings.config.ComponentSource);
var componentTargetDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Target, Settings.config.ComponentUrl);
var componentSourceDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Source, "Servers", serverName, Settings.config.ComponentSource);
var componentTargetDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Target, "Servers", serverName, Settings.config.ComponentUrl);
Extensions.DirectoryCheckCrate(componentSourceDirectory);
Extensions.DirectoryCheckCrate(componentTargetDirectory);
if (System.IO.Directory.GetFiles(componentSourceDirectory, "*.*", System.IO.SearchOption.AllDirectories).Length == 0)
{
Console.WriteLine("The source file could not be found.");
Console.WriteLine("The source file could not be found. Location : " + componentSourceDirectory);
return;
}
@@ -338,7 +329,7 @@ namespace Mitria_Minecraft_Updater
{
System.IO.File.Delete(targetFileFullPath);
System.IO.File.Copy(sourceFileFullPath, targetFileFullPath);
Console.Write("Update File : " + oFile);
Console.WriteLine("Update File : " + oFile);
}
}
@@ -359,16 +350,15 @@ namespace Mitria_Minecraft_Updater
dataPatchInformation.ComponentDirectorys = sourceDirectorys.ToList();
// 파일 디테일
var newVersion = VersionChange(dataPatchInformation.ComponentVersion, versionType);
Console.WriteLine("Update Version : " + dataPatchInformation.ComponentVersion + " → " + newVersion);
dataPatchInformation.ComponentVersion = newVersion;
Settings.SaveDataPatchInformation(dataPatchInformation);
Settings.SaveDataPatchInformation(serverName,dataPatchInformation);
Console.WriteLine("Update Complete");
// 무결성 검사후 업데이트
}
static void Packing(string source, string target)
private static void Packing(string source, string target)
{
if (System.IO.File.Exists(target))
{
@@ -393,7 +383,7 @@ namespace Mitria_Minecraft_Updater
Console.WriteLine("Packing Complite");
}
static string VersionChange(string version, VersionType versionType)
private static string VersionChange(string version, VersionType versionType)
{
var v = Version.Parse(version);
@@ -419,7 +409,7 @@ namespace Mitria_Minecraft_Updater
return v.ToString();
}
static void ProgressChange(double obj)
private static void ProgressChange(double obj)
{
Console.SetCursorPosition(nowPosLeft, nowPosTop);
var Progress = (int)(obj * 10);
@@ -432,6 +422,66 @@ namespace Mitria_Minecraft_Updater
Console.Write(" " + $"{obj:P2}");
}
private static UpdateType? GetUpdateType(string data)
{
UpdateType? updateType;
switch (data.ToUpper())
{
case "LAUNCHER":
updateType = UpdateType.Launcher;
break;
case "RUNTIME":
updateType = UpdateType.Runtime;
break;
case "PACKAGE":
updateType = UpdateType.Package;
break;
case "COMPONENT":
updateType = UpdateType.Component;
break;
default:
updateType = null;
break;
}
return updateType;
}
private static VersionType? GetVersionType(string data)
{
VersionType? versionType;
switch (data.ToUpper())
{
case "MAJOR":
versionType = VersionType.Major;
break;
case "MINOR":
versionType = VersionType.Minor;
break;
case "BUILD":
versionType = VersionType.Build;
break;
case "REVISION":
versionType = VersionType.Revision;
break;
default:
versionType = null;
break;
}
return versionType;
}
}
internal enum UpdateType

View File

@@ -14,14 +14,15 @@ namespace Mitria_Minecraft_Updater
private static void InitializationConfig()
{
// 줄여야함
config.Source = "./Source";
config.Target = "./Target";
config.Source = "../Source";
config.Target = "../Target";
config.InformationToLauncher = "/Launcher.xml";
config.InformationToData = "/Data.xml";
config.InformationToLauncher = "/launcher.xml";
config.InformationToData = "/data.xml";
config.InformationToServer = "/server.xml";
config.LauncherSource = "/Launcher";
config.LauncherUrl = "/Data/Launcher";
config.LauncherUrl = "/Launcher";
config.LauncherFileName = "MitriaMLauncher.exe";
config.RuntimeSource = "/Runtime";
config.RuntimeUrl = "/Data/Runtime";
@@ -37,7 +38,7 @@ namespace Mitria_Minecraft_Updater
{
if (System.IO.File.Exists(configPath))
{
config = CommonLibrary.XMLSystem.LoadFromPath<Config>(configPath);
config = CommonLibrary.XmlSystem.LoadFromPath<Config>(configPath);
}
else
{
@@ -48,7 +49,7 @@ namespace Mitria_Minecraft_Updater
public static void SaveConfig()
{
CommonLibrary.XMLSystem.Save(configPath, config);
CommonLibrary.XmlSystem.Save(configPath, config);
}
public static CommonLibrary.LauncherPatchInformation LoadLauncherPatchInformation()
@@ -57,7 +58,7 @@ namespace Mitria_Minecraft_Updater
string fullPath = CommonLibrary.Extensions.PathCombineL(config.Target, config.InformationToLauncher);
if (System.IO.File.Exists(fullPath))
{
launcherPatchInformation = CommonLibrary.XMLSystem.LoadFromPath<CommonLibrary.LauncherPatchInformation>(fullPath);
launcherPatchInformation = CommonLibrary.XmlSystem.LoadFromPath<CommonLibrary.LauncherPatchInformation>(fullPath);
}
else
{
@@ -69,6 +70,18 @@ namespace Mitria_Minecraft_Updater
return launcherPatchInformation;
}
public static CommonLibrary.ServerInformation LoadServerInformation()
{
CommonLibrary.ServerInformation serverInformation = new CommonLibrary.ServerInformation();
string fullPath = CommonLibrary.Extensions.PathCombineL(config.Target, config.InformationToServer);
if(System.IO.File.Exists(fullPath))
{
serverInformation = CommonLibrary.XmlSystem.LoadFromPath<CommonLibrary.ServerInformation>(fullPath);
}
return serverInformation;
}
public static void SaveLauncherPatchInformation(CommonLibrary.LauncherPatchInformation launcherPatchInformation)
{
@@ -77,16 +90,16 @@ namespace Mitria_Minecraft_Updater
{
System.IO.Directory.CreateDirectory(config.Target);
}
CommonLibrary.XMLSystem.Save(fullPath, launcherPatchInformation);
CommonLibrary.XmlSystem.Save(fullPath, launcherPatchInformation);
}
public static CommonLibrary.DataPatchInformation LoadDataPatchInformation()
public static CommonLibrary.DataPatchInformation LoadDataPatchInformation(string serverName)
{
CommonLibrary.DataPatchInformation dataPatchInformation = new CommonLibrary.DataPatchInformation();
string fullPath = config.Target + config.InformationToData;
string fullPath = CommonLibrary.Extensions.PathCombineL(config.Target, "Servers", serverName, config.InformationToData);
if (System.IO.File.Exists(fullPath))
{
dataPatchInformation = CommonLibrary.XMLSystem.LoadFromPath<CommonLibrary.DataPatchInformation>(fullPath);
dataPatchInformation = CommonLibrary.XmlSystem.LoadFromPath<CommonLibrary.DataPatchInformation>(fullPath);
}
else
{
@@ -106,14 +119,14 @@ namespace Mitria_Minecraft_Updater
return dataPatchInformation;
}
public static void SaveDataPatchInformation(CommonLibrary.DataPatchInformation dataPatchInformation)
public static void SaveDataPatchInformation(string serverName, CommonLibrary.DataPatchInformation dataPatchInformation)
{
string fullPath = CommonLibrary.Extensions.PathCombineL(config.Target , config.InformationToData);
string fullPath = CommonLibrary.Extensions.PathCombineL(config.Target, "Servers", serverName, config.InformationToData);
if (!System.IO.Directory.Exists(config.Target))
{
System.IO.Directory.CreateDirectory(config.Target);
}
CommonLibrary.XMLSystem.Save(fullPath, dataPatchInformation);
CommonLibrary.XmlSystem.Save(fullPath, dataPatchInformation);
}
}
@@ -126,7 +139,7 @@ namespace Mitria_Minecraft_Updater
public string InformationToLauncher { get; set; } //{InformationDirectory}/Launcher.xml
public string InformationToData { get; set; } // {InformationDirectory}/Data.xml
public string InformationToServer { get; set; }
public string LauncherSource { get; set; } // {Source}/Launcher
public string LauncherUrl { get; set; } // {Target}/Launcher
public string LauncherFileName { get; set; } // 런처 파일이름