- First Update

This commit is contained in:
2022-03-07 14:35:38 +09:00
parent 1ab1cfd4ea
commit f53695b228
48 changed files with 17003 additions and 0 deletions

513
.gitignore vendored Normal file
View File

@@ -0,0 +1,513 @@
# Created by https://www.toptal.com/developers/gitignore/api/windows,linux,c,c++,csharp,powershell
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,linux,c,c++,csharp,powershell
### C ###
# Prerequisites
*.d
# Object files
*.o
*.ko
*.obj
*.elf
# Linker output
*.ilk
*.map
*.exp
# Precompiled Headers
*.gch
*.pch
# Libraries
*.lib
*.a
*.la
*.lo
# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib
# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex
# Debug files
*.dSYM/
*.su
*.idb
*.pdb
# Kernel Module Compile Results
*.mod*
*.cmd
.tmp_versions/
modules.order
Module.symvers
Mkfile.old
dkms.conf
### C++ ###
# Prerequisites
# Compiled Object files
*.slo
# Precompiled Headers
# Compiled Dynamic libraries
# Fortran module files
*.mod
*.smod
# Compiled Static libraries
*.lai
# Executables
### Csharp ###
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.meta
*.iobj
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
### Linux ###
# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*
# KDE directory preferences
.directory
# Linux trash folder which might appear on any partition or disk
.Trash-*
# .nfs files are created when an open file is removed but is still being accessed
.nfs*
### PowerShell ###
# Exclude packaged modules
*.zip
# Exclude .NET assemblies from source
### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db
# Dump file
*.stackdump
# Folder config file
[Dd]esktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Windows Installer files
# Windows shortcuts
*.lnk
# End of https://www.toptal.com/developers/gitignore/api/windows,linux,c,c++,csharp,powershell

View File

@@ -0,0 +1,58 @@
<?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>{57098662-9A1B-45E7-B932-5299343629F2}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>CommonLibrary</RootNamespace>
<AssemblyName>CommonLibrary</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<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' ">
<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.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.IO.Compression.ZipFile" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataModel.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="Log.cs" />
<Compile Include="Packer.cs" />
<Compile Include="XMLSystem.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace CommonLibrary
{
[Serializable]
public struct LauncherPatchInformation // 런처 패치정보
{
public string Version { get; set; } // 런처 버전
public string LauncherUrl { get; set; } // 런처 URL
public string LauncherFileName { get; set; } // 런처 파일명
}
[Serializable]
public struct DataPatchInformation // 패치데이터 정보
{
public string RuntimeVersion { get; set; } // 런타임(자바) 버전
public string RuntimeUrl { get; set; } // 런타임(자바) URL
public string RuntimeFileName { get; set; } // 런타임(자바) 파일명
public string PackageVersion { get; set; } // 패키지(기본데이터) 버전
public string PackageUrl { get; set; } // 패키지(기본데이터) URL
public string PackageFileName { get; set; } // 패키지(기본데이터) 파일명
public List<string> PackageDirectorys { get; set; } // 패키지(기본데이터) 폴더들
public string ComponentVersion { get; set; } // 컴포넌트(패키지외) 버전
public string ComponentUrl { get; set; } // 컴포넌트(패키지외) URl
public List<string> ComponentDirectorys { get; set; } // 패키지(패키지외) 파일명
public List<FileDetail> ComponentList { get; set; } // 컴포넌트(패키지외) 폴더 리스트
}
[Serializable]
public struct FileDetail
{
public string Directory { get; set; }
public string FileName { get; set; }
public long FileSize { get; set; }
public string HashCode { get; set; }
}
}

View File

@@ -0,0 +1,57 @@
using System.Text;
namespace CommonLibrary
{
public static class Extensions
{
public static string PathCombineL(params string[] paths)
{
string directorySeparatorChar = System.IO.Path.AltDirectorySeparatorChar.ToString();
return PathCombine(directorySeparatorChar, paths).Replace("\\", "/");
}
public static string PathCombineW(params string[] paths)
{
string directorySeparatorChar = System.IO.Path.DirectorySeparatorChar.ToString();
return PathCombine(directorySeparatorChar, paths).Replace("/", "\\");
}
private static string PathCombine(string directorySeparator, params string[] paths)
{
if (paths.Length == 0)
{
return string.Empty;
}
StringBuilder path = new StringBuilder();
path.Append(paths[0]);
for (int i = 1; i < paths.Length; i++)
{
if (path.ToString().Substring(path.Length - 1, 1) == directorySeparator)
{
if (paths[i].Substring(0, 1) == directorySeparator)
{
path.Append(paths[i].Substring(1, paths[i].Length - 1));
}
else
{
path.Append(paths[i]);
}
}
else
{
if (paths[i].Substring(0, 1) == directorySeparator)
{
path.Append(paths[i]);
}
else
{
path.Append(directorySeparator);
path.Append(paths[i]);
}
}
}
return path.ToString();
}
}
}

175
CommonLibrary/Log.cs Normal file
View File

@@ -0,0 +1,175 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Text;
namespace CommonLibrary
{
public static class Log
{
//로그파일 이름 규칙 어셈블리명-날짜.log
public static LogLevel logLevel { get; set; }
private static string logDateTime;
static Log()
{
SetLogFile(DateTime.Now.ToString("yyyy-MM-dd")); // Log파일 이름 세팅을 위한 함수 호출
logLevel = LogLevel.Info;
}
/// <summary>
/// 로그 파일 리스너 세팅
/// </summary>
/// <param name="dateTimeString">로그파일 이름에 들어갈 DateTime String</param>
private static void SetLogFile(string dateTimeString)
{
logDateTime = dateTimeString;
if (!System.IO.Directory.Exists("logs"))
{
System.IO.Directory.CreateDirectory("logs");
}
var logFileName = $"logs\\{logDateTime}.log";
Trace.Listeners.Clear();
Trace.Listeners.Add(new TextWriterTraceListener(new FileStream(logFileName, FileMode.Append, FileAccess.Write, FileShare.Read)));
Trace.Write("====================================================================================================// ");
Trace.Write(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
Trace.WriteLine(" //====================================================================================================");
Trace.Flush();
}
//FATAL > ERROR > WARN > INFO > DEBUG > TRACE
public static void FATAL(string message)
{
if (LogLevel.FATAL >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.FATAL, location + "\t" + message);
}
}
public static void ERROR(string message)
{
if (LogLevel.Error >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Error, location + "\t" + message);
}
}
public static void WARN(string message)
{
if (LogLevel.Warn >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Warn, location + "\t" + message);
}
}
public static void INFO(string message)
{
if (LogLevel.Info >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Info, location + "\t" + message);
}
}
public static void DEBUG(string message)
{
if (LogLevel.Debug >= logLevel)
{
// Call Location
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Debug, location + "\t" + message);
}
}
public static void TRACE(string message)
{
if (LogLevel.Trace >= logLevel)
{
var stackTrace = new StackTrace();
var methodBase = stackTrace.GetFrame(1).GetMethod();
string location = methodBase.DeclaringType != null
? methodBase.DeclaringType.Name + "/"
: "null/";
location += methodBase.Name;
// Call Location End
WriteLog(LogLevel.Debug, location + "\t" + message);
WriteLog(LogLevel.Trace, message);
}
}
/// <summary>
///
/// </summary>
/// <param name="logLevel">enum LogLevel</param>
/// <param name="message">로그 메세지</param>
private static void WriteLog(LogLevel logLevel, string message)
{
string nowDateTime = DateTime.Now.ToString("yyyy-MM-dd");
if (nowDateTime != logDateTime)
{
SetLogFile(nowDateTime);
}
// Log String
var stringBuilder = new StringBuilder();
stringBuilder.Append("[");
stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"));
stringBuilder.Append("]");
stringBuilder.Append("\t");
stringBuilder.Append(logLevel);
stringBuilder.Append("\t");
stringBuilder.Append(message.Trim());
Trace.WriteLine(stringBuilder.ToString());
Trace.Flush();
}
}
public enum LogLevel
{
Trace,
Debug,
Info,
Warn,
Error,
FATAL
}
}

147
CommonLibrary/Packer.cs Normal file
View File

@@ -0,0 +1,147 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.IO.Compression;
namespace CommonLibrary
{
internal class ProgressStream : Stream
{
private readonly Stream insideStream;
private readonly IProgress<int> insideReadProgress;
private readonly IProgress<int> insideWriteProgress;
public ProgressStream(Stream stream, IProgress<int> readProgress, IProgress<int> writeProgress)
{
insideStream = stream;
insideReadProgress = readProgress;
insideWriteProgress = writeProgress;
}
public override bool CanRead { get { return insideStream.CanRead; } }
public override bool CanSeek { get { return insideStream.CanSeek; } }
public override bool CanWrite { get { return insideStream.CanWrite; } }
public override long Length { get { return insideStream.Length; } }
public override long Position
{
get { return insideStream.Position; }
set { insideStream.Position = value; }
}
public override void Flush()
{
insideStream.Flush();
}
public override long Seek(long offset, SeekOrigin origin)
{
return insideStream.Seek(offset, origin);
}
public override void SetLength(long value)
{
insideStream.SetLength(value);
}
public override int Read(byte[] buffer, int offset, int count)
{
int bytesRead = insideStream.Read(buffer, offset, count);
insideReadProgress?.Report(bytesRead);
return bytesRead;
}
public override void Write(byte[] buffer, int offset, int count)
{
insideStream.Write(buffer, offset, count);
insideWriteProgress?.Report(count);
}
}
public class ProgressPacker
{
public void Pack(string sourceDirectoryName, string packFileName, IProgress<double> progress)
{
sourceDirectoryName = Path.GetFullPath(sourceDirectoryName);
FileInfo[] sourceFiles = new DirectoryInfo(sourceDirectoryName).GetFiles("*", SearchOption.AllDirectories);
double totalBytes = sourceFiles.Sum(f => f.Length);
long currentBytes = 0;
using (ZipArchive zipArchive = ZipFile.Open(packFileName, ZipArchiveMode.Create))
{
foreach (FileInfo file in sourceFiles)
{
string entryName = file.FullName.Substring(sourceDirectoryName.Length + 1);
ZipArchiveEntry entry = zipArchive.CreateEntry(entryName);
entry.LastWriteTime = file.LastWriteTime;
using (Stream inputStream = file.OpenRead())
{
using (Stream outputStream = entry.Open())
{
Stream progressStream = new ProgressStream(inputStream,
new BasicProgress<int>(i =>
{
currentBytes += i;
progress.Report(currentBytes / totalBytes);
}), null);
progressStream.CopyTo(outputStream);
}
}
}
}
}
public void UnPack(string packFileName, string destinationDirectoryName, IProgress<double> progress)
{
using (ZipArchive zipArchive = ZipFile.OpenRead(packFileName))
{
double totalBytes = zipArchive.Entries.Sum(f => f.Length);
long currentBytes = 0;
foreach (ZipArchiveEntry entry in zipArchive.Entries)
{
string fileName = Path.Combine(destinationDirectoryName, entry.FullName);
if (entry.Name == "") continue;
Directory.CreateDirectory(Path.GetDirectoryName(fileName));
using (Stream inputStream = entry.Open())
{
using (Stream outputStream = File.OpenWrite(fileName))
{
Stream progressStream = new ProgressStream(outputStream, null,
new BasicProgress<int>(i =>
{
currentBytes += i;
progress.Report(currentBytes / totalBytes);
}));
inputStream.CopyTo(progressStream);
}
File.SetLastWriteTime(fileName, entry.LastWriteTime.LocalDateTime);
}
}
}
}
}
public class BasicProgress<T> : IProgress<T>
{
private readonly Action<T> actionHandler;
public BasicProgress(Action<T> handler)
{
actionHandler = handler;
}
void IProgress<T>.Report(T value)
{
actionHandler(value);
}
}
}

View File

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

View File

@@ -0,0 +1,84 @@
using System;
using System.IO;
using System.Xml.Serialization;
namespace CommonLibrary
{
public static class XMLSystem
{
public static bool Save<T>(string path, T data) where T : struct
{
if (string.IsNullOrWhiteSpace(path))
{
return false;
}
string directory = Path.GetDirectoryName(System.IO.Path.GetFullPath(path));
if (!System.IO.Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
using (StreamWriter sw = new StreamWriter(path))
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
XmlSerializerNamespaces xmlSerializerNamespaces = new XmlSerializerNamespaces();
xmlSerializerNamespaces.Add("", "");
xmlSerializer.Serialize(sw, data, xmlSerializerNamespaces);
sw.Close();
}
return true;
}
public static T LoadFromPath<T>(string path) where T : struct
{
if (string.IsNullOrWhiteSpace(path))
{
return default;
}
string directory = Path.GetDirectoryName(System.IO.Path.GetFullPath(path));
if (!System.IO.Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
if (!File.Exists(path))
{
return default;
}
using (StreamReader sr = new StreamReader(path))
{
try
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
T data = (T)xmlSerializer.Deserialize(sr);
return data;
}
catch (Exception ex)
{
CommonLibrary.Log.ERROR(ex.Message);
return default;
}
}
}
public static T LoadFromData<T>(string data) where T : struct
{
if (string.IsNullOrWhiteSpace(data))
{
return default;
}
using (StringReader sr = new StringReader(data))
{
try
{
XmlSerializer xmlSerializer = new XmlSerializer(typeof(T));
return (T)xmlSerializer.Deserialize(sr);
}
catch (Exception ex)
{
CommonLibrary.Log.ERROR(ex.Message);
return default;
}
}
}
}
}

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,91 @@
using CommonLibrary;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace Mitria_Minecraft_Launcher
{
public class AuditFile
{
private string GetFileHash(FileInfo fileInfo)
{
using (MD5 md5 = MD5.Create())
{
using (Stream stream = fileInfo.OpenRead())
{
byte[] hashCode = md5.ComputeHash(stream);
StringBuilder hashStringBuilder = new StringBuilder();
foreach (byte b in hashCode)
{
hashStringBuilder.AppendFormat("{0:x2}", b);
}
return hashStringBuilder.ToString();
}
}
}
public List<FileDetail> GetLocalFileList(List<string> directorys)
{
List<DirectoryInfo> directoryInfos = new List<DirectoryInfo>();
foreach (string directory in directorys)
{
System.IO.DirectoryInfo directoryInfo = new DirectoryInfo(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, directory));
directoryInfos.Add(directoryInfo);
}
return GetLocalFileList(directoryInfos);
}
public List<FileDetail> GetLocalFileList(List<DirectoryInfo> directorys)
{
List<FileDetail> resultFiles = new List<FileDetail>();
List<FileInfo> files = new List<FileInfo>();
foreach (var directory in directorys)
{
if (!directory.Exists)
{
directory.Create();
}
files.AddRange(directory.GetFiles("*.*", SearchOption.AllDirectories).ToArray());
}
foreach (var file in files)
{
FileDetail fileDetail = new FileDetail();
fileDetail.Directory = file.DirectoryName.Replace(Settings.UserLauncherConfig.GameDirectory + "\\", "").Replace("\\", "/");
fileDetail.FileName = file.Name;
fileDetail.FileSize = file.Length;
fileDetail.HashCode = GetFileHash(file);
resultFiles.Add(fileDetail);
}
return resultFiles;
}
public List<FileDetail> GetRemoveFiles(List<FileDetail> oldFiles, List<FileDetail> newFiles)
{
List<FileDetail> removeFiles = new List<FileDetail>();
foreach (FileDetail oldFile in oldFiles)
{
if (!newFiles.Contains(oldFile))
{
removeFiles.Add(oldFile);
}
}
return removeFiles;
}
public List<FileDetail> GetNeedFiles(List<FileDetail> oldFiles, List<FileDetail> newFiles)
{
List<FileDetail> needFiles = new List<FileDetail>();
foreach (FileDetail newFile in newFiles)
{
if (!oldFiles.Contains(newFile))
{
needFiles.Add(newFile);
}
}
return needFiles;
}
}
}

View File

@@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
namespace Mitria_Minecraft_Launcher
{
[Serializable]
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; }
}
[Serializable]
public struct ClientVersion
{
public string PackageVersion { get; set; }
public List<string> PackageDirectorys { get; set; }
public string ComponentVersion { get; set; }
public List<string> ComponentDirectorys { get; set; }
}
[Serializable]
public struct ExcuteArgument
{
public string Argument { get; set; }
public List<Parameter> Parameters { get; set; }
}
[Serializable]
public struct Parameter
{
public string Key { get; set; }
public string Value { get; set; }
public Parameter(string key, string value)
{
Key = key;
Value = value;
}
}
}

View File

@@ -0,0 +1,86 @@
using System;
using System.ComponentModel;
using System.IO;
using System.Net;
namespace Mitria_Minecraft_Launcher
{
public class Downloader
{
private static int BufferSize = 1024 * 1240 * 1; //1MB
public delegate void DownloaderProgressChangedEventHandler(object sender, DownloaderProgressChangedEventArgs downloaderProgressChangedEventArgs);
public event DownloaderProgressChangedEventHandler DownloaderProgressChangedEvent;
public void DownloadFile(string url, string path)
{
HttpWebRequest request = WebRequest.CreateHttp(url);
WebResponse response = request.GetResponse();
long fileSize = long.Parse(response.Headers.Get("Content-Length"));
Stream webStream = response.GetResponseStream();
Stream fileStream = File.Open(path, FileMode.Create);
byte[] buffer = new byte[BufferSize];
int length = 0;
int processedByte = 0;
while ((length = webStream.Read(buffer, 0, BufferSize)) > 0)
{
fileStream.Write(buffer, 0, length);
processedByte += length;
var e = new DownloaderProgressChangedEventArgs(processedByte, fileSize);
DownloaderProgressChangedEvent?.Invoke(this, e);
}
webStream.Dispose();
fileStream.Dispose();
}
public string DownloadString(string url)
{
try
{
HttpWebRequest request = WebRequest.CreateHttp(url);
WebResponse response = request.GetResponse();
StreamReader streamReader = new StreamReader(response.GetResponseStream());
string resultString = streamReader.ReadToEnd();
streamReader.Close();
return resultString;
}
catch (WebException ex)
{
switch (ex.Status)
{
case WebExceptionStatus.ConnectFailure:
CommonLibrary.Log.FATAL("ConnectFailure : " + url);
break;
case WebExceptionStatus.Timeout:
CommonLibrary.Log.FATAL("TimeOut : " + url);
break;
case WebExceptionStatus.ProtocolError:
CommonLibrary.Log.FATAL("Not Found Page : " + url);
break;
default:
break;
}
return string.Empty;
}
}
}
public class DownloaderProgressChangedEventArgs : EventArgs
{
public long ProcessedByte { get; set; }
public long FileSize { get; set; }
public DownloaderProgressChangedEventArgs(long processByte, long fileSize)
{
ProcessedByte = processByte;
FileSize = fileSize;
}
}
}

View File

@@ -0,0 +1,114 @@
using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Text.RegularExpressions;
namespace Mitria_Minecraft_Launcher
{
public static class Extensions
{
public static bool EmptyDirectory(string location)
{
bool error = false;
DirectoryInfo directoryInfo = new DirectoryInfo(location);
foreach (var fi in directoryInfo.EnumerateFiles())
{
try
{
fi.IsReadOnly = false;
fi.Delete();
while (fi.Exists)
{
System.Threading.Thread.Sleep(10);
fi.Refresh();
}
}
catch (IOException e)
{
CommonLibrary.Log.ERROR(e.Message);
error = true;
}
}
foreach (var di in directoryInfo.EnumerateDirectories())
{
try
{
EmptyDirectory(di.FullName);
di.Delete();
while (di.Exists)
{
System.Threading.Thread.Sleep(10);
di.Refresh();
}
}
catch (IOException e)
{
CommonLibrary.Log.ERROR(e.Message);
error = true;
}
}
return error;
}
public static string ApplyExcuteCommand(ExcuteArgument excuteArgument)
{
string command = excuteArgument.Argument;
string regexPattern = @"\{[A-z]*\}";
Regex regex = new Regex(regexPattern);
MatchCollection resultCollection = regex.Matches(command);
List<string> commandList = new List<string>();
foreach (Match match in resultCollection)
{
string key = match.Value.Substring(1, match.Value.Length - 2);
if (!commandList.Contains(key))
{
commandList.Add(key);
}
}
foreach (string commandKey in commandList)
{
Parameter option = excuteArgument.Parameters.Find(x => x.Key == commandKey);
command = command.Replace("{" + commandKey + "}", option.Value);
}
return command;
}
public static bool IsDefault<T>(ref this T data) where T : struct
{
return default(T).Equals(data);
}
public static string UnitSeparator(this long value)
{
return string.Format("{0:#,0}", (object)value);
}
public static string UnitSeparator(this int value)
{
return string.Format("{0:#,0}", (object)value);
}
public static string GetFileHashCode(this FileInfo file)
{
using (MD5 md5 = MD5.Create())
{
using (Stream stream = file.OpenRead())
{
byte[] hashCode = md5.ComputeHash(stream);
StringBuilder hashStringBuilder = new StringBuilder();
foreach (byte b in hashCode)
{
hashStringBuilder.AppendFormat("{0:x2}", b);
}
return hashStringBuilder.ToString();
}
}
}
}
}

View File

@@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<Costura />
</Weavers>

View File

@@ -0,0 +1,8 @@
// This file is used by Code Analysis to maintain SuppressMessage
// attributes that are applied to this project.
// Project-level suppressions either have no target or are given
// a specific target and scoped to a namespace, type, member, etc.
using System.Diagnostics.CodeAnalysis;
[assembly: SuppressMessage("Critical Code Smell", "S2223:Non-constant static fields should not be visible", Justification = "<보류 중>", Scope = "member", Target = "~F:Mitria_Minecraft_Launcher.Settings.UserClientVersion")]

View File

@@ -0,0 +1,294 @@

namespace Mitria_Minecraft_Launcher
{
partial class LauncherForm
{
/// <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()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LauncherForm));
this.button_Run = new System.Windows.Forms.Button();
this.label_MinecraftPlayerName = new System.Windows.Forms.Label();
this.textBox_MinecraftPlayerName = new System.Windows.Forms.TextBox();
this.label_First = new System.Windows.Forms.Label();
this.label_Second = new System.Windows.Forms.Label();
this.groupBox_MinecraftRun = new System.Windows.Forms.GroupBox();
this.groupBox_Progress = new System.Windows.Forms.GroupBox();
this.label_Second_Percentage = new System.Windows.Forms.Label();
this.label_First_Percentage = new System.Windows.Forms.Label();
this.textBox_ProgressLog = new System.Windows.Forms.TextBox();
this.progressBar_Second = new System.Windows.Forms.ProgressBar();
this.progressBar_First = new System.Windows.Forms.ProgressBar();
this.groupBox_LauncherSettings = new System.Windows.Forms.GroupBox();
this.button_Open_GameDirectory = new System.Windows.Forms.Button();
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.groupBox_MinecraftRun.SuspendLayout();
this.groupBox_Progress.SuspendLayout();
this.groupBox_LauncherSettings.SuspendLayout();
this.SuspendLayout();
//
// button_Run
//
this.button_Run.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
this.button_Run.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button_Run.Location = new System.Drawing.Point(230, 30);
this.button_Run.Name = "button_Run";
this.button_Run.Size = new System.Drawing.Size(50, 41);
this.button_Run.TabIndex = 1;
this.button_Run.Text = "Run";
this.button_Run.UseVisualStyleBackColor = false;
this.button_Run.Click += new System.EventHandler(this.button_Run_Click);
//
// label_MinecraftPlayerName
//
this.label_MinecraftPlayerName.AutoSize = true;
this.label_MinecraftPlayerName.Location = new System.Drawing.Point(20, 30);
this.label_MinecraftPlayerName.Name = "label_MinecraftPlayerName";
this.label_MinecraftPlayerName.Size = new System.Drawing.Size(131, 12);
this.label_MinecraftPlayerName.TabIndex = 0;
this.label_MinecraftPlayerName.Text = "Minecraft PlayerName";
//
// textBox_MinecraftPlayerName
//
this.textBox_MinecraftPlayerName.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(68)))), ((int)(((byte)(75)))));
this.textBox_MinecraftPlayerName.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_MinecraftPlayerName.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.textBox_MinecraftPlayerName.Location = new System.Drawing.Point(35, 50);
this.textBox_MinecraftPlayerName.Name = "textBox_MinecraftPlayerName";
this.textBox_MinecraftPlayerName.Size = new System.Drawing.Size(178, 21);
this.textBox_MinecraftPlayerName.TabIndex = 0;
//
// label_First
//
this.label_First.AutoSize = true;
this.label_First.Location = new System.Drawing.Point(30, 30);
this.label_First.Name = "label_First";
this.label_First.Size = new System.Drawing.Size(35, 12);
this.label_First.TabIndex = 1;
this.label_First.Text = "[0/0]";
//
// label_Second
//
this.label_Second.AutoSize = true;
this.label_Second.Location = new System.Drawing.Point(30, 110);
this.label_Second.Name = "label_Second";
this.label_Second.Size = new System.Drawing.Size(35, 12);
this.label_Second.TabIndex = 1;
this.label_Second.Text = "[0/0]";
//
// groupBox_MinecraftRun
//
this.groupBox_MinecraftRun.Controls.Add(this.label_MinecraftPlayerName);
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.Name = "groupBox_MinecraftRun";
this.groupBox_MinecraftRun.Size = new System.Drawing.Size(300, 90);
this.groupBox_MinecraftRun.TabIndex = 0;
this.groupBox_MinecraftRun.TabStop = false;
this.groupBox_MinecraftRun.Text = "Minecarft Run";
//
// groupBox_Progress
//
this.groupBox_Progress.Controls.Add(this.label_Second_Percentage);
this.groupBox_Progress.Controls.Add(this.label_First_Percentage);
this.groupBox_Progress.Controls.Add(this.label_First);
this.groupBox_Progress.Controls.Add(this.textBox_ProgressLog);
this.groupBox_Progress.Controls.Add(this.label_Second);
this.groupBox_Progress.Controls.Add(this.progressBar_Second);
this.groupBox_Progress.Controls.Add(this.progressBar_First);
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.TabIndex = 0;
this.groupBox_Progress.TabStop = false;
this.groupBox_Progress.Text = "Progress";
//
// label_Second_Percentage
//
this.label_Second_Percentage.Location = new System.Drawing.Point(178, 110);
this.label_Second_Percentage.Name = "label_Second_Percentage";
this.label_Second_Percentage.Size = new System.Drawing.Size(52, 12);
this.label_Second_Percentage.TabIndex = 2;
this.label_Second_Percentage.Text = "100%";
this.label_Second_Percentage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label_First_Percentage
//
this.label_First_Percentage.Location = new System.Drawing.Point(180, 30);
this.label_First_Percentage.Name = "label_First_Percentage";
this.label_First_Percentage.Size = new System.Drawing.Size(50, 12);
this.label_First_Percentage.TabIndex = 2;
this.label_First_Percentage.Text = "100%";
this.label_First_Percentage.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// textBox_ProgressLog
//
this.textBox_ProgressLog.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
this.textBox_ProgressLog.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_ProgressLog.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.textBox_ProgressLog.Location = new System.Drawing.Point(260, 30);
this.textBox_ProgressLog.Multiline = true;
this.textBox_ProgressLog.Name = "textBox_ProgressLog";
this.textBox_ProgressLog.ReadOnly = true;
this.textBox_ProgressLog.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox_ProgressLog.Size = new System.Drawing.Size(270, 170);
this.textBox_ProgressLog.TabIndex = 0;
this.textBox_ProgressLog.TabStop = false;
//
// progressBar_Second
//
this.progressBar_Second.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(187)))), ((int)(((byte)(190)))));
this.progressBar_Second.Location = new System.Drawing.Point(30, 130);
this.progressBar_Second.Name = "progressBar_Second";
this.progressBar_Second.Size = new System.Drawing.Size(200, 30);
this.progressBar_Second.TabIndex = 0;
//
// progressBar_First
//
this.progressBar_First.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(185)))), ((int)(((byte)(187)))), ((int)(((byte)(190)))));
this.progressBar_First.Location = new System.Drawing.Point(30, 50);
this.progressBar_First.Name = "progressBar_First";
this.progressBar_First.Size = new System.Drawing.Size(200, 30);
this.progressBar_First.TabIndex = 0;
//
// groupBox_LauncherSettings
//
this.groupBox_LauncherSettings.Controls.Add(this.button_Open_GameDirectory);
this.groupBox_LauncherSettings.Controls.Add(this.button_Report);
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.Name = "groupBox_LauncherSettings";
this.groupBox_LauncherSettings.Size = new System.Drawing.Size(244, 90);
this.groupBox_LauncherSettings.TabIndex = 0;
this.groupBox_LauncherSettings.TabStop = false;
this.groupBox_LauncherSettings.Text = "Launcher Settings";
//
// button_Open_GameDirectory
//
this.button_Open_GameDirectory.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
this.button_Open_GameDirectory.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button_Open_GameDirectory.Location = new System.Drawing.Point(120, 55);
this.button_Open_GameDirectory.Name = "button_Open_GameDirectory";
this.button_Open_GameDirectory.Size = new System.Drawing.Size(110, 25);
this.button_Open_GameDirectory.TabIndex = 2;
this.button_Open_GameDirectory.TabStop = false;
this.button_Open_GameDirectory.Text = "Game Folder";
this.button_Open_GameDirectory.UseVisualStyleBackColor = false;
this.button_Open_GameDirectory.Click += new System.EventHandler(this.button_Open_GameDirectory_Click);
//
// button_Report
//
this.button_Report.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
this.button_Report.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button_Report.Location = new System.Drawing.Point(20, 55);
this.button_Report.Name = "button_Report";
this.button_Report.Size = new System.Drawing.Size(85, 25);
this.button_Report.TabIndex = 1;
this.button_Report.TabStop = false;
this.button_Report.Text = "Report";
this.button_Report.UseVisualStyleBackColor = false;
this.button_Report.Click += new System.EventHandler(this.button_Report_Click);
//
// button_Open_LauncherDirectory
//
this.button_Open_LauncherDirectory.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
this.button_Open_LauncherDirectory.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button_Open_LauncherDirectory.Location = new System.Drawing.Point(120, 20);
this.button_Open_LauncherDirectory.Name = "button_Open_LauncherDirectory";
this.button_Open_LauncherDirectory.Size = new System.Drawing.Size(110, 25);
this.button_Open_LauncherDirectory.TabIndex = 1;
this.button_Open_LauncherDirectory.TabStop = false;
this.button_Open_LauncherDirectory.Text = "Launcher Folder";
this.button_Open_LauncherDirectory.UseVisualStyleBackColor = false;
this.button_Open_LauncherDirectory.Click += new System.EventHandler(this.button_Open_LauncherDirectory_Click);
//
// button_Setup
//
this.button_Setup.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(54)))), ((int)(((byte)(57)))), ((int)(((byte)(63)))));
this.button_Setup.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button_Setup.Location = new System.Drawing.Point(20, 20);
this.button_Setup.Name = "button_Setup";
this.button_Setup.Size = new System.Drawing.Size(85, 25);
this.button_Setup.TabIndex = 0;
this.button_Setup.TabStop = false;
this.button_Setup.Text = "Base Setup";
this.button_Setup.UseVisualStyleBackColor = false;
this.button_Setup.Click += new System.EventHandler(this.button_Setup_Click);
//
// 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.Controls.Add(this.groupBox_LauncherSettings);
this.Controls.Add(this.groupBox_Progress);
this.Controls.Add(this.groupBox_MinecraftRun);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LauncherForm";
this.Text = "This";
this.Load += new System.EventHandler(this.LauncherForm_Load);
this.groupBox_MinecraftRun.ResumeLayout(false);
this.groupBox_MinecraftRun.PerformLayout();
this.groupBox_Progress.ResumeLayout(false);
this.groupBox_Progress.PerformLayout();
this.groupBox_LauncherSettings.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button_Run;
private System.Windows.Forms.Label label_MinecraftPlayerName;
private System.Windows.Forms.TextBox textBox_MinecraftPlayerName;
private System.Windows.Forms.Label label_First;
private System.Windows.Forms.Label label_Second;
private System.Windows.Forms.GroupBox groupBox_MinecraftRun;
private System.Windows.Forms.GroupBox groupBox_Progress;
private System.Windows.Forms.TextBox textBox_ProgressLog;
private System.Windows.Forms.ProgressBar progressBar_Second;
private System.Windows.Forms.ProgressBar progressBar_First;
private System.Windows.Forms.GroupBox groupBox_LauncherSettings;
private System.Windows.Forms.Button button_Setup;
private System.Windows.Forms.Label label_Second_Percentage;
private System.Windows.Forms.Label label_First_Percentage;
private System.Windows.Forms.Button button_Report;
private System.Windows.Forms.Button button_Open_LauncherDirectory;
private System.Windows.Forms.Button button_Open_GameDirectory;
}
}

View File

@@ -0,0 +1,266 @@
using Mitria_Minecraft_Launcher.Updater;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Mitria_Minecraft_Launcher
{
public partial class LauncherForm : Form
{
private LoadingScreen _loadingScreen;
public LauncherForm()
{
InitializeComponent();
}
private void LauncherForm_Load(object sender, EventArgs e)
{
this.Text = ProductName + " v" + ProductVersion;
LoadingScreenInitialize();
this.textBox_MinecraftPlayerName.Text = Settings.UserLauncherConfig.MinecraftPlayerName;
}
private void LoadingScreenInitialize()
{
_loadingScreen = new LoadingScreen(Properties.Resources.Loading)
{
Location = groupBox_MinecraftRun.Location,
Size = groupBox_MinecraftRun.Size
};
_loadingScreen.Visible = false;
_loadingScreen.BackColor = Color.FromArgb(220, 220, 220);
Controls.Add(_loadingScreen);
}
private void Loading(bool loading)
{
label_First.Text = "[0/0]";
label_Second.Text = "[0/0]";
label_First_Percentage.Text = "100%";
label_Second_Percentage.Text = "100%";
progressBar_First.Value = 0;
progressBar_Second.Value = 0;
if (loading)
{
_loadingScreen.Visible = true;
groupBox_MinecraftRun.Visible = false;
}
else
{
_loadingScreen.Visible = true;
groupBox_MinecraftRun.Visible = true;
}
}
private void button_Setup_Click(object sender, EventArgs e)
{
LauncherSetupForm launcherSetupForm = new LauncherSetupForm();
launcherSetupForm.ShowDialog();
}
private async void button_Run_Click(object sender, EventArgs e)
{
if(Settings.UserLauncherConfig.GameDirectory == System.Windows.Forms.Application.StartupPath)
{
MessageBox.Show("The launcher directory and the game directory cannot be the same.", "FATAL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
textBox_ProgressLog.Text = string.Empty;
Loading(true);
string minecraftPalyerName = this.textBox_MinecraftPlayerName.Text.Trim();
if (minecraftPalyerName == string.Empty)
{
MessageBox.Show("please type Minecraft PlayerName", "FATAL Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
Loading(false);
textBox_MinecraftPlayerName.Focus();
return;
}
Settings.UserLauncherConfig.MinecraftPlayerName = minecraftPalyerName;
var gameProcess = Task.Run(() => GameProcess());
bool processResult = await gameProcess;
if (processResult)
{
MinecraftRun();
}
else
{
Loading(false);
}
}
private bool GameProcess()
{
Updater.GameUpdateManager gameUpdateManager = new Updater.GameUpdateManager();
gameUpdateManager.GameUpdateManagerMessage += GameUpdateManager_GameUpdateManagerMessage;
GameUpdateStatus updateResult = gameUpdateManager.Start();
if (updateResult == GameUpdateStatus.Success)
return true;
else
{
return false;
}
}
private void GameUpdateManager_GameUpdateManagerMessage(object sender, Updater.GameUpdateManagerMessageEventArgs e)
{
switch (e.MessageType)
{
case Updater.GameUpdateManagerMessageType.First:
this.Invoke(new MethodInvoker(
delegate ()
{
textBox_ProgressLog.Text += e.Message + Environment.NewLine;
label_First.Text = "[" + e.MinValue.UnitSeparator() + "/" + e.MaxValue.UnitSeparator() + "]";
int percent = GetPercent(e.MinValue, e.MaxValue);
label_First_Percentage.Text = percent + "%";
progressBar_First.Value = percent;
label_Second.Text = "[0/0]";
label_Second_Percentage.Text = "100%";
progressBar_Second.Value = 100;
}));
break;
case Updater.GameUpdateManagerMessageType.Second:
this.Invoke(new MethodInvoker(delegate ()
{
label_Second.Text = "[" + e.MinValue.UnitSeparator() + "/" + e.MaxValue.UnitSeparator() + "]";
int percent = GetPercent(e.MinValue, e.MaxValue);
label_Second_Percentage.Text = percent + "%";
progressBar_Second.Value = percent;
}));
break;
case Updater.GameUpdateManagerMessageType.Message:
this.Invoke(new MethodInvoker(delegate ()
{
textBox_ProgressLog.Text += e.Message + Environment.NewLine;
}));
break;
}
}
private int GetPercent(long minValue, long maxValue)
{
return (int)((double)minValue / maxValue * 100);
}
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");
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"; // 버전초기화
return;
}
string excuteArgumentXml = Settings.UserLauncherConfig.GameDirectory + @"\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("userName", Settings.UserLauncherConfig.MinecraftPlayerName));
launcherParameters.Add(new Parameter("uuid", Settings.UserLauncherConfig.MinecraftPlayerName + "uuid"));
launcherParameters.Add(new Parameter("accessToken", Settings.UserLauncherConfig.MinecraftPlayerName + "accessToken"));
excuteArgument.Parameters.AddRange(launcherParameters);
string argumentsCommand = Extensions.ApplyExcuteCommand(excuteArgument);
Process process = new Process();
ProcessStartInfo processStartInfo = new ProcessStartInfo
{
FileName = runtime,
CreateNoWindow = true,
Arguments = argumentsCommand,
UseShellExecute = Settings.UserLauncherConfig.ShellView,
WorkingDirectory = Settings.UserLauncherConfig.GameDirectory
};
process.StartInfo = processStartInfo;
CommonLibrary.Log.INFO("[Minecraft Process] FilName : " + processStartInfo.FileName);
CommonLibrary.Log.INFO("[Minecraft Process] CreateNoWindow : " + processStartInfo.CreateNoWindow);
CommonLibrary.Log.INFO("[Minecraft Process] Arguments : " + processStartInfo.Arguments);
CommonLibrary.Log.INFO("[Minecraft Process] UseShellExecute : " + processStartInfo.UseShellExecute);
CommonLibrary.Log.INFO("[Minecraft Process] WorkingDirectory : " + processStartInfo.WorkingDirectory);
// 크래쉬 확인을 위한 시작시간 저장
DateTime criteriaDateTime = DateTime.Now;
process.Start();
this.Hide();
process.WaitForExit();
process.Close();
this.Show();
Loading(false);
string reportPath = ReportCheck(criteriaDateTime);
if (reportPath != string.Empty)
{
string reportText = System.IO.File.ReadAllText(reportPath);
ReportView rv = new ReportView(reportText);
rv.ShowDialog();
}
}
private void button_Report_Click(object sender, EventArgs e)
{
}
private string ReportCheck(DateTime criteriaDateTime)
{
string crashDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfigPath, "crash-reports");
string lastFileName = string.Empty;
if (System.IO.Directory.Exists(crashDirectory))
{
var reportList = System.IO.Directory.GetFiles(crashDirectory);
DateTime lastDateTime = criteriaDateTime;
foreach (var report in reportList)
{
FileInfo fi = new FileInfo(report);
if (lastDateTime < fi.CreationTime)
{
lastDateTime = fi.CreationTime;
lastFileName = fi.Name;
}
}
}
return lastFileName;
}
private void button_Open_LauncherDirectory_Click(object sender, EventArgs e)
{
if (!System.IO.Directory.Exists(System.Windows.Forms.Application.StartupPath))
{
System.IO.Directory.CreateDirectory(System.Windows.Forms.Application.StartupPath);
}
System.Diagnostics.Process.Start(System.Windows.Forms.Application.StartupPath);
}
private void button_Open_GameDirectory_Click(object sender, EventArgs e)
{
if (!System.IO.Directory.Exists(Settings.UserLauncherConfig.GameDirectory))
{
System.IO.Directory.CreateDirectory(Settings.UserLauncherConfig.GameDirectory);
}
System.Diagnostics.Process.Start(Settings.UserLauncherConfig.GameDirectory);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,225 @@

namespace Mitria_Minecraft_Launcher
{
partial class LauncherSetupForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(LauncherSetupForm));
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.button_GameDirectory_Open = new System.Windows.Forms.Button();
this.textBox_GameDirectory = new System.Windows.Forms.TextBox();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.button_Argument_Initialize = new System.Windows.Forms.Button();
this.textBox_Argument = new System.Windows.Forms.TextBox();
this.button_Save = new System.Windows.Forms.Button();
this.button_Cancel = new System.Windows.Forms.Button();
this.checkBox_ShellView = new System.Windows.Forms.CheckBox();
this.button_Package_Initialize = new System.Windows.Forms.Button();
this.button_Component_Initialize = new System.Windows.Forms.Button();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// groupBox1
//
this.groupBox1.Controls.Add(this.button_GameDirectory_Open);
this.groupBox1.Controls.Add(this.textBox_GameDirectory);
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.TabIndex = 0;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Game Directory";
//
// button_GameDirectory_Open
//
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.Name = "button_GameDirectory_Open";
this.button_GameDirectory_Open.Size = new System.Drawing.Size(90, 30);
this.button_GameDirectory_Open.TabIndex = 1;
this.button_GameDirectory_Open.Text = "Open";
this.button_GameDirectory_Open.UseVisualStyleBackColor = true;
this.button_GameDirectory_Open.Click += new System.EventHandler(this.button_GameDirectory_Open_Click);
//
// textBox_GameDirectory
//
this.textBox_GameDirectory.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(68)))), ((int)(((byte)(75)))));
this.textBox_GameDirectory.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_GameDirectory.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
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.TabIndex = 0;
this.textBox_GameDirectory.TabStop = false;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.button_Argument_Initialize);
this.groupBox2.Controls.Add(this.textBox_Argument);
this.groupBox2.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.groupBox2.Location = new System.Drawing.Point(10, 120);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(480, 270);
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "Argument";
//
// button_Argument_Initialize
//
this.button_Argument_Initialize.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button_Argument_Initialize.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.button_Argument_Initialize.Location = new System.Drawing.Point(370, 229);
this.button_Argument_Initialize.Name = "button_Argument_Initialize";
this.button_Argument_Initialize.Size = new System.Drawing.Size(90, 30);
this.button_Argument_Initialize.TabIndex = 1;
this.button_Argument_Initialize.Text = "Initialize";
this.button_Argument_Initialize.UseVisualStyleBackColor = true;
this.button_Argument_Initialize.Click += new System.EventHandler(this.button_Argument_Initialize_Click);
//
// textBox_Argument
//
this.textBox_Argument.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(68)))), ((int)(((byte)(75)))));
this.textBox_Argument.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.textBox_Argument.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.textBox_Argument.Location = new System.Drawing.Point(20, 20);
this.textBox_Argument.Multiline = true;
this.textBox_Argument.Name = "textBox_Argument";
this.textBox_Argument.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.textBox_Argument.Size = new System.Drawing.Size(440, 200);
this.textBox_Argument.TabIndex = 0;
//
// 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.Location = new System.Drawing.Point(496, 275);
this.button_Save.Name = "button_Save";
this.button_Save.Size = new System.Drawing.Size(80, 50);
this.button_Save.TabIndex = 2;
this.button_Save.Text = "Save";
this.button_Save.UseVisualStyleBackColor = true;
this.button_Save.Click += new System.EventHandler(this.button_Save_Click);
//
// 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.Location = new System.Drawing.Point(496, 339);
this.button_Cancel.Name = "button_Cancel";
this.button_Cancel.Size = new System.Drawing.Size(80, 50);
this.button_Cancel.TabIndex = 3;
this.button_Cancel.Text = "Cancel";
this.button_Cancel.UseVisualStyleBackColor = true;
this.button_Cancel.Click += new System.EventHandler(this.button_Cancel_Click);
//
// checkBox_ShellView
//
this.checkBox_ShellView.AutoSize = true;
this.checkBox_ShellView.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(242)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
this.checkBox_ShellView.Location = new System.Drawing.Point(406, 396);
this.checkBox_ShellView.Name = "checkBox_ShellView";
this.checkBox_ShellView.Size = new System.Drawing.Size(84, 16);
this.checkBox_ShellView.TabIndex = 4;
this.checkBox_ShellView.Text = "Shell View";
this.checkBox_ShellView.UseVisualStyleBackColor = true;
//
// button_Package_Initialize
//
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.Name = "button_Package_Initialize";
this.button_Package_Initialize.Size = new System.Drawing.Size(80, 50);
this.button_Package_Initialize.TabIndex = 5;
this.button_Package_Initialize.TabStop = false;
this.button_Package_Initialize.Text = "Initialize\r\nPackage";
this.button_Package_Initialize.UseVisualStyleBackColor = true;
this.button_Package_Initialize.Click += new System.EventHandler(this.button_Package_Initialize_Click);
//
// button_Component_Initialize
//
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.Name = "button_Component_Initialize";
this.button_Component_Initialize.Size = new System.Drawing.Size(80, 50);
this.button_Component_Initialize.TabIndex = 6;
this.button_Component_Initialize.TabStop = false;
this.button_Component_Initialize.Text = "Initialize\r\nComponent\r\n";
this.button_Component_Initialize.UseVisualStyleBackColor = true;
this.button_Component_Initialize.Click += new System.EventHandler(this.button_Component_Initialize_Click);
//
// LauncherSetupForm
//
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(584, 421);
this.Controls.Add(this.button_Component_Initialize);
this.Controls.Add(this.button_Package_Initialize);
this.Controls.Add(this.checkBox_ShellView);
this.Controls.Add(this.button_Cancel);
this.Controls.Add(this.button_Save);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "LauncherSetupForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "Base Setup";
this.Load += new System.EventHandler(this.LauncherSetupForm_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Button button_GameDirectory_Open;
private System.Windows.Forms.TextBox textBox_GameDirectory;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.Button button_Argument_Initialize;
private System.Windows.Forms.TextBox textBox_Argument;
private System.Windows.Forms.Button button_Save;
private System.Windows.Forms.Button button_Cancel;
private System.Windows.Forms.CheckBox checkBox_ShellView;
private System.Windows.Forms.Button button_Package_Initialize;
private System.Windows.Forms.Button button_Component_Initialize;
}
}

View File

@@ -0,0 +1,73 @@
using System;
using System.Windows.Forms;
namespace Mitria_Minecraft_Launcher
{
public partial class LauncherSetupForm : Form
{
public LauncherSetupForm()
{
InitializeComponent();
}
private void LauncherSetupForm_Load(object sender, EventArgs e)
{
textBox_GameDirectory.Text = Settings.UserLauncherConfig.GameDirectory;
textBox_Argument.Text = Settings.UserLauncherConfig.Argument;
checkBox_ShellView.Checked = Settings.UserLauncherConfig.ShellView;
}
private void button_GameDirectory_Open_Click(object sender, EventArgs e)
{
FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
DialogResult result = folderBrowserDialog.ShowDialog();
if(result == DialogResult.OK)
{
textBox_GameDirectory.Text = folderBrowserDialog.SelectedPath + "\\Mitria";
}
}
private void button_Argument_Initialize_Click(object sender, EventArgs e)
{
textBox_Argument.Text = Settings.BaseArgument;
}
private void button_Save_Click(object sender, EventArgs e)
{
if(Settings.UserLauncherConfig.GameDirectory != textBox_GameDirectory.Text)
{
if (System.IO.Directory.Exists(Settings.UserLauncherConfig.GameDirectory))
{
System.IO.Directory.Delete(Settings.UserLauncherConfig.GameDirectory, true);
}
if (!System.IO.Directory.Exists(textBox_GameDirectory.Text))
{
System.IO.Directory.CreateDirectory(textBox_GameDirectory.Text);
}
}
Settings.UserLauncherConfig.GameDirectory = textBox_GameDirectory.Text;
Settings.UserLauncherConfig.Argument = textBox_Argument.Text;
Settings.UserLauncherConfig.ShellView = checkBox_ShellView.Checked;
Settings.SaveUserLauncherConfig();
Settings.LoadUserClientVersion();
this.Close();
}
private void button_Cancel_Click(object sender, EventArgs e)
{
this.Close();
}
private void button_Package_Initialize_Click(object sender, EventArgs e)
{
Settings.UserClientVersion.PackageVersion = "0.0.0.0";
Settings.SaveUserClientVersion();
}
private void button_Component_Initialize_Click(object sender, EventArgs e)
{
Settings.UserClientVersion.ComponentVersion = "0.0.0.0";
Settings.SaveUserClientVersion();
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,49 @@

namespace Mitria_Minecraft_Launcher
{
partial class LoadingScreen
{
/// <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
/// <summary>
/// 디자이너 지원에 필요한 메서드입니다.
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
/// </summary>
private void InitializeComponent()
{
this.SuspendLayout();
//
// LoadingScreen
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.Transparent;
this.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.Name = "LoadingScreen";
this.Size = new System.Drawing.Size(148, 148);
this.SizeChanged += new System.EventHandler(this.LoadingScreen_SizeChanged);
this.ResumeLayout(false);
}
#endregion
}
}

View File

@@ -0,0 +1,81 @@
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Mitria_Minecraft_Launcher
{
public partial class LoadingScreen : UserControl
{
private readonly Bitmap _bitmap;
private Size imageSize;
private int LocationX;
private int LocationY;
public LoadingScreen(Bitmap bitmap)
{
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.SetStyle(ControlStyles.UserPaint, true);
_bitmap = bitmap;
imageSize = ResizeCalculator(this.Size.Width, this.Size.Height, _bitmap.Width, _bitmap.Height);
LocationChange();
this.TabStop = false;
InitializeComponent();
}
protected override void OnLoad(EventArgs e)
{
ImageAnimator.Animate(_bitmap, new EventHandler(this.OnFrameChanged));
base.OnLoad(e);
}
protected override void OnPaint(PaintEventArgs e)
{
ImageAnimator.UpdateFrames();
e.Graphics.DrawImage(this._bitmap, LocationX, LocationY, imageSize.Width, imageSize.Height);
base.OnPaint(e);
}
private void OnFrameChanged(object sender, EventArgs e)
{
this.Invalidate();
}
private Size ResizeCalculator(int paletteWidth, int paletteHeight, int imageWidth, int imageHeigh)
{
double ratioX = paletteWidth / (double)imageWidth;
double ratioY = paletteHeight / (double)imageHeigh;
double ratio = Math.Min(ratioX, ratioY);
int newWidth = (int)(imageWidth * ratio);
int newHeight = (int)(imageHeigh * ratio);
Size newSize = new Size(newWidth, newHeight);
return newSize;
}
private void LocationChange()
{
// 로케이션 계산
int needx = imageSize.Width / 2;
int needy = imageSize.Height / 2;
int locationXCenter = this.Size.Width / 2;
int locationYCenter = this.Size.Height / 2;
LocationX = locationXCenter - needx;
LocationY = locationYCenter - needy;
}
private void LoadingScreen_SizeChanged(object sender, EventArgs e)
{
imageSize = ResizeCalculator(this.Size.Width, this.Size.Height, _bitmap.Width, _bitmap.Height);
LocationChange();
}
}
}

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,289 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props" Condition="Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" />
<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>{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Mitria_Minecraft_Launcher</RootNamespace>
<AssemblyName>MitriaMLauncher</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>false</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</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>
<PropertyGroup>
<ApplicationIcon>Program.Icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<TargetZone>LocalIntranet</TargetZone>
</PropertyGroup>
<PropertyGroup>
<GenerateManifests>false</GenerateManifests>
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="Costura, Version=5.7.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Win32.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Win32.Primitives.4.3.0\lib\net46\Microsoft.Win32.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.AppContext, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.AppContext.4.3.0\lib\net463\System.AppContext.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Diagnostics.Tracing, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Globalization.Calendars, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Globalization.Calendars.4.3.0\lib\net46\System.Globalization.Calendars.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Compression, Version=4.1.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.4.3.0\lib\net46\System.IO.Compression.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.Compression.FileSystem" />
<Reference Include="System.IO.Compression.ZipFile, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.Compression.ZipFile.4.3.0\lib\net46\System.IO.Compression.ZipFile.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.4.3.0\lib\net46\System.IO.FileSystem.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.IO.FileSystem.Primitives, Version=4.0.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.IO.FileSystem.Primitives.4.3.0\lib\net46\System.IO.FileSystem.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Linq, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Linq.4.3.0\lib\net463\System.Linq.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Linq.Expressions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Linq.Expressions.4.3.0\lib\net463\System.Linq.Expressions.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Net.Sockets, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Net.Sockets.4.3.0\lib\net46\System.Net.Sockets.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Reflection, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.4.3.0\lib\net463\System.Runtime.InteropServices.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Runtime.InteropServices.RuntimeInformation, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.InteropServices.RuntimeInformation.4.3.0\lib\net45\System.Runtime.InteropServices.RuntimeInformation.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<Reference Include="System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
<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.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
<Private>True</Private>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="AuditFile.cs" />
<Compile Include="DataModel.cs" />
<Compile Include="Downloader.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="ReportView.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="ReportView.Designer.cs">
<DependentUpon>ReportView.cs</DependentUpon>
</Compile>
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="LauncherSetupForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LauncherSetupForm.Designer.cs">
<DependentUpon>LauncherSetupForm.cs</DependentUpon>
</Compile>
<Compile Include="LauncherForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="LauncherForm.Designer.cs">
<DependentUpon>LauncherForm.cs</DependentUpon>
</Compile>
<Compile Include="LoadingScreen.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="LoadingScreen.Designer.cs">
<DependentUpon>LoadingScreen.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Updater\LauncherUpdate.cs" />
<Compile Include="Updater\GameUpdateManager.cs" />
<EmbeddedResource Include="ReportView.resx">
<DependentUpon>ReportView.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LauncherForm.resx">
<DependentUpon>LauncherForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LauncherSetupForm.resx">
<DependentUpon>LauncherSetupForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="LoadingScreen.resx">
<DependentUpon>LoadingScreen.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>
<DesignTime>True</DesignTime>
</Compile>
<None Include="packages.config" />
<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>
<ItemGroup>
<Folder Include="API\" />
</ItemGroup>
<ItemGroup>
<Content Include="Program.Icon.ico" />
<None Include="Resources\Loading.gif" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\CommonLibrary\CommonLibrary.csproj">
<Project>{57098662-9a1b-45e7-b932-5299343629f2}</Project>
<Name>CommonLibrary</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.6.5.5\build\Fody.targets" Condition="Exists('..\packages\Fody.6.5.5\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>이 프로젝트는 이 컴퓨터에 없는 NuGet 패키지를 참조합니다. 해당 패키지를 다운로드하려면 NuGet 패키지 복원을 사용하십시오. 자세한 내용은 http://go.microsoft.com/fwlink/?LinkID=322105를 참조하십시오. 누락된 파일은 {0}입니다.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.6.5.5\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.5.5\build\Fody.targets'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props'))" />
<Error Condition="!Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets'))" />
</Target>
<Import Project="..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" />
</Project>

View File

@@ -0,0 +1,94 @@
<?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>{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>Mitria_Minecraft_Launcher</RootNamespace>
<AssemblyName>MML</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.IO.Compression" />
<Reference Include="System.IO.Compression.FileSystem" />
<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="Downloader.cs" />
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="Log.cs" />
<Compile Include="Packer.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Settings.cs" />
<Compile Include="Updater\LauncherUpdate.cs" />
<Compile Include="XMLSystem.cs" />
<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>
<ItemGroup>
<Folder Include="API\" />
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31321.278
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mitria_Minecraft_Launcher", "Mitria_Minecraft_Launcher\Mitria_Minecraft_Launcher.csproj", "{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {27A6C985-FFEA-498D-AD18-4E25B1275D3F}
EndGlobalSection
EndGlobal

Binary file not shown.

After

Width:  |  Height:  |  Size: 345 KiB

View File

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

View File

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

View File

@@ -0,0 +1,73 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 이 코드는 도구를 사용하여 생성되었습니다.
// 런타임 버전:4.0.30319.42000
//
// 파일 내용을 변경하면 잘못된 동작이 발생할 수 있으며, 코드를 다시 생성하면
// 이러한 변경 내용이 손실됩니다.
// </auto-generated>
//------------------------------------------------------------------------------
namespace Mitria_Minecraft_Launcher.Properties {
using System;
/// <summary>
/// 지역화된 문자열 등을 찾기 위한 강력한 형식의 리소스 클래스입니다.
/// </summary>
// 이 클래스는 ResGen 또는 Visual Studio와 같은 도구를 통해 StronglyTypedResourceBuilder
// 클래스에서 자동으로 생성되었습니다.
// 멤버를 추가하거나 제거하려면 .ResX 파일을 편집한 다음 /str 옵션을 사용하여 ResGen을
// 다시 실행하거나 VS 프로젝트를 다시 빌드하십시오.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.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 (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Mitria_Minecraft_Launcher.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;
}
}
/// <summary>
/// System.Drawing.Bitmap 형식의 지역화된 리소스를 찾습니다.
/// </summary>
internal static System.Drawing.Bitmap Loading {
get {
object obj = ResourceManager.GetObject("Loading", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
}
}

View File

@@ -0,0 +1,124 @@
<?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>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="Loading" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Loading.gif;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

View File

@@ -0,0 +1,29 @@
//------------------------------------------------------------------------------
// <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_Minecraft_Launcher.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

@@ -0,0 +1,80 @@
namespace Mitria_Minecraft_Launcher
{
partial class ReportView
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ReportView));
this.button_Close = new System.Windows.Forms.Button();
this.richTextBox_Report = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// button_Close
//
this.button_Close.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button_Close.Location = new System.Drawing.Point(670, 510);
this.button_Close.Name = "button_Close";
this.button_Close.Size = new System.Drawing.Size(120, 40);
this.button_Close.TabIndex = 1;
this.button_Close.Text = "Close";
this.button_Close.UseVisualStyleBackColor = true;
this.button_Close.Click += new System.EventHandler(this.button_Close_Click);
//
// richTextBox_Report
//
this.richTextBox_Report.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox_Report.Location = new System.Drawing.Point(10, 10);
this.richTextBox_Report.Margin = new System.Windows.Forms.Padding(0);
this.richTextBox_Report.Name = "richTextBox_Report";
this.richTextBox_Report.ReadOnly = true;
this.richTextBox_Report.Size = new System.Drawing.Size(780, 490);
this.richTextBox_Report.TabIndex = 2;
this.richTextBox_Report.TabStop = false;
this.richTextBox_Report.Text = "";
//
// ReportView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(804, 561);
this.Controls.Add(this.richTextBox_Report);
this.Controls.Add(this.button_Close);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ReportView";
this.Text = "Report View";
this.Load += new System.EventHandler(this.ReportView_Load);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Button button_Close;
private System.Windows.Forms.RichTextBox richTextBox_Report;
}
}

View File

@@ -0,0 +1,32 @@
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_Minecraft_Launcher
{
public partial class ReportView : Form
{
private string report;
public ReportView(string reportData)
{
report = reportData;
InitializeComponent();
}
private void button_Close_Click(object sender, EventArgs e)
{
this.Close();
}
private void ReportView_Load(object sender, EventArgs e)
{
richTextBox_Report.Text = report;
}
}
}

View File

@@ -0,0 +1,213 @@
<?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>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
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
xwAAAABJRU5ErkJggg==
</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

View File

@@ -0,0 +1,86 @@
using System;
using System.Collections.Generic;
namespace Mitria_Minecraft_Launcher
{
public static class Settings
{
#pragma warning disable S1104 // Fields should not have public accessibility
#pragma warning disable S2223 // Non-constant static fields should not be visible
public static LauncherConfig UserLauncherConfig;
public static ClientVersion UserClientVersion;
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 void LoadUserLauncherConfig()
{
string path = System.IO.Path.GetFullPath(UserLauncherConfigPath);
if (System.IO.File.Exists(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()
{
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);
}
public static void LoadUserClientVersion()
{
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, UserClientVersionPath);
if (System.IO.File.Exists(path))
{
UserClientVersion = CommonLibrary.XMLSystem.LoadFromPath<ClientVersion>(path);
}
else
{
UserClientVersion = new ClientVersion();
UserClientVersion.PackageVersion = "0.0.0.0";
UserClientVersion.PackageDirectorys = new List<string>();
UserClientVersion.ComponentVersion = "0.0.0.0";
UserClientVersion.ComponentDirectorys = new List<string>();
}
}
public static void SaveUserClientVersion()
{
string path = CommonLibrary.Extensions.PathCombineW(UserLauncherConfig.GameDirectory, UserClientVersionPath);
string pathDirectory = System.IO.Path.GetDirectoryName(path);
if (!System.IO.Directory.Exists(pathDirectory))
{
System.IO.Directory.CreateDirectory(pathDirectory);
}
CommonLibrary.XMLSystem.Save(path, UserClientVersion);
}
}
}

View File

@@ -0,0 +1,390 @@
using CommonLibrary;
using System;
using System.Collections.Generic;
namespace Mitria_Minecraft_Launcher.Updater
{
public class GameUpdateManager
{
public delegate void GameUpdateManagerMessageHandler(object sender, GameUpdateManagerMessageEventArgs downloaderProgressChangedEventArgs);
public event GameUpdateManagerMessageHandler GameUpdateManagerMessage;
public GameUpdateManager()
{
}
public GameUpdateStatus Start()
{
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.Message, 0, 0, "[0/9] GameUpdatStart"));
CommonLibrary.Log.INFO("Game Update Start");
// Downloader 선언
var downloader = new Downloader();
downloader.DownloaderProgressChangedEvent += Downloader_DownloaderProgressChangedEvent;
// Version File Download
CommonLibrary.Log.INFO("download version file.");
var verionData = downloader.DownloadString(Settings.ServerBaseUrl + Settings.ServerDataPatchInformationFile);
// Versoin File 받기에 실패하였을때 업데이트 전체 실패처리
if (verionData == string.Empty)
{
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.Message, 0, 0, "★★ Update Fail ★★"));
CommonLibrary.Log.FATAL("Failed to download version file");
return GameUpdateStatus.Fail;
}
// Version File Xml 형태로 변환
var dataPatchInformation = CommonLibrary.XMLSystem.LoadFromData<DataPatchInformation>(verionData);
// 임시 폴더 생성
var tempDirectory = System.IO.Path.GetFullPath("temp");
if (!System.IO.Directory.Exists(tempDirectory))
{
System.IO.Directory.CreateDirectory(tempDirectory);
Log.INFO("[GameUpdateManager] +[F] " + tempDirectory);
}
// 런타임 업데이트
#region Runtime Update
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 1, 9, "[1/9] Runtime Version Check"));
Log.INFO("[Runtime] Version Check");
// 버전 비교
var thisVersion = Version.Parse(Settings.UserLauncherConfig.RuntimeVersion);
var remoteVersion = Version.Parse(dataPatchInformation.RuntimeVersion);
CommonLibrary.Log.INFO("[Runtime] LocalVersion : " + thisVersion);
CommonLibrary.Log.INFO("[Runtime] RemoteVersion : " + remoteVersion);
var result = remoteVersion.CompareTo(thisVersion);
// 1 : 리모트가 큼, 0 : 같음, -1 리모트가 적음
if (result == 0)
{
CommonLibrary.Log.INFO("[Runtime] Version Same");
}
else
{
CommonLibrary.Log
.INFO(string.Format("{0}", result == 1 ? "remote is the upper version" : "remote is the lower version"));
CommonLibrary.Log.INFO("Runtime delete it for update.");
// 런타임 폴더 경로 가져오기
var rootDirectoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(Settings.RuntimeLocation));
// 런타임 폴더 삭제후 새로만들기
if (!rootDirectoryInfo.Exists)
{
rootDirectoryInfo.Create();
Log.INFO("[Runtime] +[D] " + rootDirectoryInfo.FullName);
}
else
{
rootDirectoryInfo.Delete(true);
Log.INFO("[Runtime] -[D] " + rootDirectoryInfo.FullName);
rootDirectoryInfo.Create();
Log.INFO("[Runtime] +[D] " + rootDirectoryInfo.FullName);
}
// 런타임 다운로드 시작
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 targetPath = System.IO.Path.Combine(tempDirectory, dataPatchInformation.RuntimeFileName); // 임시폴더에 다운로드
downloader.DownloadFile(downloadUrl, targetPath);
Log.INFO("[Runtime] Data Download End");
// 런타임 다운로드 완료
// 런타임 언패킹 작업
var progressPacker = new ProgressPacker();
var unpackPath = System.IO.Path.GetFullPath(Settings.RuntimeLocation);
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();
//임시폴더 삭제
System.IO.File.Delete(targetPath);
Log.INFO("[Runtime] -[F] " + targetPath);
Log.INFO("[Runtime] Unpack End");
}
#endregion Runtime Update
#region Package Update
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 4, 9, "[4/9] Package Version Check"));
Log.INFO("[Package] Version Check");
thisVersion = Version.Parse(Settings.UserClientVersion.PackageVersion);
remoteVersion = Version.Parse(dataPatchInformation.PackageVersion);
CommonLibrary.Log.INFO("[Package] LocalVersion : " + thisVersion);
CommonLibrary.Log.INFO("[Package] RemoteVersion : " + remoteVersion);
result = remoteVersion.CompareTo(thisVersion);
// 1 : 리모트가 큼, 0 : 같음, -1 리모트가 적음
if (result == 0)
{
CommonLibrary.Log.INFO("[Package] Version Same");
}
else
{
CommonLibrary.Log
.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));
if (!rootDirectoryInfo.Exists)
{
rootDirectoryInfo.Create();
Log.INFO("[Package] +[D] " + rootDirectoryInfo.FullName);
}
else
{
// 비우기 전에 스크린샷폴더 보존 /screenshots
string oldScreenshotsDirectory = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, "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);
System.IO.Directory.Move(oldScreenshotsDirectory, newScreenshotsDirectory);
}
Extensions.EmptyDirectory(rootDirectoryInfo.FullName);
Log.INFO("[Package] Empty GameDirectory");
}
var downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, 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");
downloader.DownloadFile(downloadUrl, targetPath);
Log.INFO("[Package] Download End");
if (Settings.UserClientVersion.PackageDirectorys != null)
{
foreach (var item in Settings.UserClientVersion.PackageDirectorys)
{
var directoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(item));
if (directoryInfo.Exists)
{
directoryInfo.Delete(true);
Log.INFO("[Package] -[D] " + directoryInfo.FullName);
}
}
}
if (dataPatchInformation.PackageDirectorys != null)
{
foreach (var item in dataPatchInformation.PackageDirectorys)
{
var directoryInfo = new System.IO.DirectoryInfo(System.IO.Path.GetFullPath(item));
if (directoryInfo.Exists)
{
directoryInfo.Delete(true);
Log.INFO("[Package] -[D] " + directoryInfo.FullName);
}
}
}
// 패키지 언팩
var progressPacker = new ProgressPacker();
var unpackPath = System.IO.Path.GetFullPath(rootDirectoryInfo.FullName);
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 6, 9, "[6/9] Package Unpack"));
Log.INFO("[Package] Unpack Start");
progressPacker.UnPack(targetPath, unpackPath, new BasicProgress<double>(p => Change(p)));
Settings.UserClientVersion.PackageVersion = remoteVersion.ToString();
//임시파일 삭제
System.IO.File.Delete(targetPath);
Log.INFO("[Package] -[F] " + targetPath);
Log.INFO("[Package] Unpack End");
}
#endregion Package Update
#region Coomponent Update
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 7, 9, "[7/9] Component Version Check"));
Log.INFO("[Component] Version Check");
thisVersion = Version.Parse(Settings.UserClientVersion.ComponentVersion);
remoteVersion = Version.Parse(dataPatchInformation.ComponentVersion);
CommonLibrary.Log.INFO("[Component] LocalVersion : " + thisVersion);
CommonLibrary.Log.INFO("[Component] RemoteVersion : " + remoteVersion);
result = remoteVersion.CompareTo(thisVersion);
if (result == 0)
{
CommonLibrary.Log.INFO("[Component] Version Same");
}
else
{
var resultDirectorys = new List<string>();
foreach (var directory in Settings.UserClientVersion.ComponentDirectorys)
{
if (!dataPatchInformation.ComponentDirectorys.Contains(directory))
{
resultDirectorys.Add(directory);
}
}
foreach (var directory in resultDirectorys)
{
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, directory));
if (System.IO.Directory.Exists(directoryPath))
{
System.IO.Directory.Delete(directoryPath, true);
Log.INFO("[Component] -[D] " + directoryPath);
}
}
foreach (var directory in dataPatchInformation.ComponentDirectorys)
{
var directoryPath = System.IO.Path.GetFullPath(CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, directory));
if (!System.IO.Directory.Exists(directoryPath))
{
System.IO.Directory.CreateDirectory(directoryPath);
Log.INFO("[Component] +[D] " + directoryPath);
}
}
var auditFile = new AuditFile();
var localFiles = auditFile.GetLocalFileList(dataPatchInformation.ComponentDirectorys);
var removeFiles = auditFile.GetRemoveFiles(localFiles, dataPatchInformation.ComponentList);
var needFiles = auditFile.GetNeedFiles(localFiles, dataPatchInformation.ComponentList);
//var customFiles =
foreach (var fileDetail in removeFiles)
{
var filePath = CommonLibrary.Extensions.PathCombineW(Settings.UserLauncherConfig.GameDirectory, fileDetail.Directory, fileDetail.FileName);
if (System.IO.File.Exists(filePath))
{
Log.INFO("[Component] -[F] " + filePath);
System.IO.File.Delete(filePath);
}
}
// 디렉토리 삭제
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 8, 9, "[8/9] Component Download"));
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);
downloader.DownloadFile(url, path);
Log.INFO("[Component] +[F] " + path);
}
Log.INFO("[Component] Download End");
Settings.UserClientVersion.ComponentVersion = remoteVersion.ToString();
Settings.UserClientVersion.ComponentDirectorys = dataPatchInformation.ComponentDirectorys;
#endregion Coomponent Update
}
// 커스텀 폴더, Config
#region CustomData
// 삭제된 파일 찾기
string rootCustomPath = System.IO.Path.GetFullPath(Settings.CustomDataDirectory);
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")));
for (int i = 0; i < files.Count; i++)
{
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);
if (System.IO.File.Exists(targetPath))
{
System.IO.FileInfo sourceFile = new System.IO.FileInfo(sourcePath);
System.IO.FileInfo targetFile = new System.IO.FileInfo(targetPath);
if (sourceFile.GetFileHashCode() != targetFile.GetFileHashCode())
{
System.IO.File.Copy(sourcePath, targetPath,true);
Log.INFO("[CustomData] +[F] " + targetPath);
}
}
else
{
System.IO.File.Copy(sourcePath, targetPath);
Log.INFO("[CustomData] +[F] " + targetPath);
}
Settings.UserLauncherConfig.CustomData = files;
Settings.SaveUserLauncherConfig();
}
#endregion CustomData
GameUpdateManagerMessage(this, new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.First, 9, 9, "[9/9] Update Complete"));
Log.INFO("GameUpdate All Success");
return GameUpdateStatus.Success;
}
private void Change(double value)
{
var e = new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.Second, (long)(value * 100), 100, string.Empty);
GameUpdateManagerMessage?.Invoke(this, e);
}
private void Downloader_DownloaderProgressChangedEvent(object sender, DownloaderProgressChangedEventArgs downloaderProgressChangedEventArgs)
{
var e = new GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType.Second, downloaderProgressChangedEventArgs.ProcessedByte, downloaderProgressChangedEventArgs.FileSize, string.Empty);
GameUpdateManagerMessage?.Invoke(this, e);
}
}
public enum GameUpdateStatus
{
Success,
Fail
}
public enum GameUpdateManagerMessageType
{
First,
Second,
Message
}
public class GameUpdateManagerMessageEventArgs : EventArgs
{
public GameUpdateManagerMessageType MessageType { get; set; }
public long MinValue { get; set; }
public long MaxValue { get; set; }
public string Message { get; set; }
public GameUpdateManagerMessageEventArgs(GameUpdateManagerMessageType messageType, long minValue, long maxValue, string message)
{
MessageType = messageType;
MinValue = minValue;
MaxValue = maxValue;
Message = message;
}
}
}

View File

@@ -0,0 +1,59 @@
using System;
using System.IO;
using CommonLibrary;
namespace Mitria_Minecraft_Launcher.Updater
{
internal class LauncherUpdate
{
public LauncherUpdateStatus Start()
{
Downloader downloader = new Downloader();
CommonLibrary.Log.INFO("Launcher Update Process Start");
string verionData = downloader.DownloadString(Settings.ServerBaseUrl + Settings.ServerLauncherPatchInformationFile);
if (verionData == string.Empty)
{
return LauncherUpdateStatus.Fail;
}
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);
CommonLibrary.Log.INFO("Remote Launcher Version : " + remoteVersion);
int result = remoteVersion.CompareTo(thisVersion);
if (result <= 0)
{
CommonLibrary.Log.INFO("Version Same");
return LauncherUpdateStatus.Same;
}
else
{
CommonLibrary.Log.INFO("Launcher Update");
string tempDirectory = Path.GetFullPath("temp");
if (!System.IO.Directory.Exists(tempDirectory))
{
System.IO.Directory.CreateDirectory("temp");
}
string downloadUrl = CommonLibrary.Extensions.PathCombineL(Settings.ServerBaseUrl, launcherPatchInformation.LauncherUrl, launcherPatchInformation.LauncherFileName);
string newLauncherFile = CommonLibrary.Extensions.PathCombineW(tempDirectory, launcherPatchInformation.LauncherFileName);
downloader.DownloadFile(downloadUrl, newLauncherFile);
string launcherFile = System.Reflection.Assembly.GetExecutingAssembly().Location;
string oldLauncherFile = CommonLibrary.Extensions.PathCombineW(tempDirectory, System.Reflection.Assembly.GetExecutingAssembly().GetName().Name + "_old");
System.IO.File.Move(launcherFile, oldLauncherFile);
System.IO.File.Move(newLauncherFile, launcherFile);
return LauncherUpdateStatus.Update;
}
}
}
internal enum LauncherUpdateStatus
{
Update,
Same,
Fail
}
}

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="5.7.0" targetFramework="net472" developmentDependency="true" />
<package id="Fody" version="6.5.5" targetFramework="net472" developmentDependency="true" />
<package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net472" />
<package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net472" />
<package id="NETStandard.Library" version="1.6.1" targetFramework="net472" />
<package id="System.AppContext" version="4.3.0" targetFramework="net472" />
<package id="System.Collections" version="4.3.0" targetFramework="net472" />
<package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net472" />
<package id="System.Console" version="4.3.0" targetFramework="net472" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net472" />
<package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net472" />
<package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net472" />
<package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net472" />
<package id="System.Globalization" version="4.3.0" targetFramework="net472" />
<package id="System.Globalization.Calendars" version="4.3.0" targetFramework="net472" />
<package id="System.IO" version="4.3.0" targetFramework="net472" />
<package id="System.IO.Compression" version="4.3.0" targetFramework="net472" />
<package id="System.IO.Compression.ZipFile" version="4.3.0" targetFramework="net472" />
<package id="System.IO.FileSystem" version="4.3.0" targetFramework="net472" />
<package id="System.IO.FileSystem.Primitives" version="4.3.0" targetFramework="net472" />
<package id="System.Linq" version="4.3.0" targetFramework="net472" />
<package id="System.Linq.Expressions" version="4.3.0" targetFramework="net472" />
<package id="System.Net.Http" version="4.3.0" targetFramework="net472" />
<package id="System.Net.Primitives" version="4.3.0" targetFramework="net472" />
<package id="System.Net.Sockets" version="4.3.0" targetFramework="net472" />
<package id="System.ObjectModel" version="4.3.0" targetFramework="net472" />
<package id="System.Reflection" version="4.3.0" targetFramework="net472" />
<package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net472" />
<package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net472" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.Handles" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net472" />
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net472" />
<package id="System.Text.Encoding" version="4.3.0" targetFramework="net472" />
<package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net472" />
<package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net472" />
<package id="System.Threading" version="4.3.0" targetFramework="net472" />
<package id="System.Threading.Tasks" version="4.3.0" targetFramework="net472" />
<package id="System.Threading.Timer" version="4.3.0" targetFramework="net472" />
<package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net472" />
<package id="System.Xml.XDocument" version="4.3.0" targetFramework="net472" />
</packages>

View File

@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.32014.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Mitria_Minecraft_Launcher", "Mitria_Minecraft_Launcher\Mitria_Minecraft_Launcher.csproj", "{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Mitria_Minecraft_Updater", "Mitria_Minecraft_Updater\Mitria_Minecraft_Updater.csproj", "{5634157E-06CA-4435-8937-861B2A112519}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommonLibrary", "CommonLibrary\CommonLibrary.csproj", "{57098662-9A1B-45E7-B932-5299343629F2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DA6D1992-18C5-4244-AF9E-7DF5B90EEA15}.Release|Any CPU.Build.0 = Release|Any CPU
{5634157E-06CA-4435-8937-861B2A112519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5634157E-06CA-4435-8937-861B2A112519}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5634157E-06CA-4435-8937-861B2A112519}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5634157E-06CA-4435-8937-861B2A112519}.Release|Any CPU.Build.0 = Release|Any CPU
{57098662-9A1B-45E7-B932-5299343629F2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{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
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {27A6C985-FFEA-498D-AD18-4E25B1275D3F}
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,69 @@
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace Mitria_Minecraft_Updater
{
public static class Extensions
{
public static void DirectoryCheckCrate(string path)
{
if (!System.IO.Directory.Exists(path))
{
System.IO.Directory.CreateDirectory(path);
}
}
public static void DeleteEmptyDirectory(string path)
{
if (!System.IO.Directory.Exists(path))
{
return;
}
string[] directorys = System.IO.Directory.GetDirectories(path, "*", System.IO.SearchOption.AllDirectories);
for (int i = directorys.Length; i > 0; i--)
{
int countDirectory = System.IO.Directory.GetDirectories(directorys[i - 1], "*", System.IO.SearchOption.AllDirectories).Length;
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]);
}
}
}
public static string[] GetDirectoriesRelativePath(string path, string searchPattern, System.IO.SearchOption searchOption)
{
string[] directories = System.IO.Directory.GetDirectories(path, searchPattern, searchOption);
for (int i = 0; i < directories.Length; i++)
{
directories[i] = System.IO.Path.GetRelativePath(path, directories[i]);
}
return directories;
}
public static string[] GetFilesRelativePath(string path, string searchPattern, System.IO.SearchOption searchOption)
{
string[] files = System.IO.Directory.GetFiles(path, searchPattern, searchOption);
for (int i = 0; i < files.Length; i++)
{
files[i] = System.IO.Path.GetRelativePath(path, files[i]);
}
return files;
}
public static string GetFileHash(string filePath)
{
FileInfo fileInfo = new FileInfo(filePath);
byte[] hashCode = MD5.Create().ComputeHash(fileInfo.OpenRead());
StringBuilder hashStringBuilder = new StringBuilder();
foreach (byte b in hashCode)
{
hashStringBuilder.AppendFormat("{0:x2}", b);
}
return hashStringBuilder.ToString();
}
}
}

View File

@@ -0,0 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net6.0</TargetFramework>
<StartupObject>Mitria_Minecraft_Updater.Program</StartupObject>
<AssemblyName>mmu</AssemblyName>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\CommonLibrary\CommonLibrary.csproj" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,452 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Mitria_Minecraft_Updater
{
internal static class Program
{
static int nowPosTop;
static int nowPosLeft;
static void Main(string[] args)
{
if (args.Length < 1)
{
HelpMessage();
return;
}
var versionType = VersionType.Major;
var checkArg = false;
if (args.Length >= 2)
{
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())
{
case "LAUNCHER":
LauncherUpdate();
break;
case "RUNTIME":
if (!checkArg)
{
HelpMessage();
return;
}
RuntimeUpdate(versionType);
break;
case "PACKAGE":
if (!checkArg)
{
HelpMessage();
return;
}
PackageUpdate(versionType);
break;
case "COMPONENT":
if (!checkArg)
{
HelpMessage();
return;
}
ComponentUpdate(versionType);
break;
default:
HelpMessage();
return;
}
}
public static void HelpMessage()
{
Console.WriteLine("dotnet mmu.dll [option1] [option2]");
Console.WriteLine(" [option1] Launcher, Runtime, Package, Component");
Console.WriteLine(" [option2] Major, Minor, Build, Revision");
}
public static void LauncherUpdate()
{
Settings.LoadConfig();
var launcherPatchInformation = Settings.LoadLauncherPatchInformation(); // 런처 패치정보 Load
Console.WriteLine("Start Launcher Update");
var launcherSourceDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Source , Settings.config.LauncherSource);
var launcherTargetDirectory = CommonLibrary.Extensions.PathCombineL(Settings.config.Target, Settings.config.LauncherUrl);
var launcherSourceFile = CommonLibrary.Extensions.PathCombineL(launcherSourceDirectory, Settings.config.LauncherFileName);
var launcherTargetFile = CommonLibrary.Extensions.PathCombineL(launcherTargetDirectory, Settings.config.LauncherFileName);
Extensions.DirectoryCheckCrate(launcherSourceDirectory);
Extensions.DirectoryCheckCrate(launcherTargetDirectory);
if (!System.IO.File.Exists(launcherSourceFile))
{
Console.WriteLine("The source file could not be found.");
return;
}
System.Diagnostics.FileVersionInfo fileVersionInfo = System.Diagnostics.FileVersionInfo.GetVersionInfo(launcherSourceFile);
var sourceVersion = new Version(fileVersionInfo.ProductVersion);
Version oldVersoin;
if (!System.IO.File.Exists(launcherTargetFile))
{
oldVersoin = Version.Parse("0.0.0.0");
}
else
{
oldVersoin = Version.Parse(launcherPatchInformation.Version);
}
var result = sourceVersion.CompareTo(oldVersoin);
if (result == 0)
{
Console.WriteLine("Version Same");
return;
}
else if (result == -1)
{
Console.WriteLine("The existing version is higher.");
return;
}
if (System.IO.File.Exists(launcherTargetFile))
{
System.IO.File.Delete(launcherTargetFile);
}
System.IO.File.Copy(launcherSourceFile, launcherTargetFile);
Console.WriteLine("update Version : " + launcherPatchInformation.Version + " → " + sourceVersion);
launcherPatchInformation.Version = sourceVersion.ToString();
Settings.SaveLauncherPatchInformation(launcherPatchInformation);
Console.WriteLine("Update Complete");
}
public static void RuntimeUpdate(VersionType versionType)
{
Settings.LoadConfig();
var dataPatchInformation = Settings.LoadDataPatchInformation();
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);
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.");
return;
}
// Packing 임시 파일명
var tempFile = "runtime.temp";
// Pakcing 작업 시작
Packing(runtimeSourceDirectory, tempFile);
// 최종 저장 경로 할당
var finalTarget = CommonLibrary.Extensions.PathCombineL(runtimeTargetDirectory, Settings.config.RuntimeFilename);
// 최종 저장 경로에 이미 파일이 있다면 삭제
if (System.IO.File.Exists(finalTarget))
{
System.IO.File.Delete(finalTarget);
}
System.IO.File.Move(tempFile, finalTarget);
var newVersion = VersionChange(dataPatchInformation.RuntimeVersion, versionType);
Console.WriteLine("update Version : " + dataPatchInformation.RuntimeVersion + " → " + newVersion);
dataPatchInformation.RuntimeVersion = newVersion;
Settings.SaveDataPatchInformation(dataPatchInformation);
Console.WriteLine("Update Complete");
}
public static void PackageUpdate(VersionType versionType)
{
Settings.LoadConfig();
var dataPatchInformation = Settings.LoadDataPatchInformation();
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);
Extensions.DirectoryCheckCrate(packageSourceDirectory);
Extensions.DirectoryCheckCrate(packageTargetDirectory);
// 파일이 하나도 없을경우 조회실패
if (System.IO.Directory.GetFiles(packageSourceDirectory, "*.*", System.IO.SearchOption.AllDirectories).Length == 0)
{
Console.WriteLine("The source file could not be found.");
return;
}
// Packing 임시 파일명
var tempFile = "package.temp";
// Pakcing 작업 시작
Packing(packageSourceDirectory, tempFile);
// 최종 저장 경로 할당
var finalTarget = CommonLibrary.Extensions.PathCombineL(packageTargetDirectory , Settings.config.PackageFilename);
// 최종 저장 경로에 이미 파일이 있다면 삭제
if (System.IO.File.Exists(finalTarget))
{
System.IO.File.Delete(finalTarget);
}
System.IO.File.Move(tempFile, finalTarget);
var directories = System.IO.Directory.GetDirectories(packageSourceDirectory);
for (int i = 0; i < directories.Length; i++)
{
directories[i] = System.IO.Path.GetRelativePath(Settings.config.Source, directories[i]);
}
dataPatchInformation.PackageDirectorys = directories.ToList();
var newVersion = VersionChange(dataPatchInformation.PackageVersion, versionType);
Console.WriteLine("Update Version : " + dataPatchInformation.PackageVersion + " → " + newVersion);
dataPatchInformation.PackageVersion = newVersion;
Settings.SaveDataPatchInformation(dataPatchInformation);
Console.WriteLine("Update Complete");
}
public static void ComponentUpdate(VersionType versionType)
{
Settings.LoadConfig();
CommonLibrary.DataPatchInformation dataPatchInformation = Settings.LoadDataPatchInformation();
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);
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.");
return;
}
Extensions.DeleteEmptyDirectory(componentSourceDirectory);
var sourceDirectorys = Extensions.GetDirectoriesRelativePath(componentSourceDirectory, "*", System.IO.SearchOption.AllDirectories);
var sourceFiles = Extensions.GetFilesRelativePath(componentSourceDirectory, "*", System.IO.SearchOption.AllDirectories);
var oldDirectorys = Extensions.GetDirectoriesRelativePath(componentTargetDirectory, "*", System.IO.SearchOption.AllDirectories);
var oldFiles = Extensions.GetFilesRelativePath(componentTargetDirectory, "*", System.IO.SearchOption.AllDirectories);
// 없어진 파일 삭제
foreach (string oFile in oldFiles)
{
if (!sourceFiles.Contains(oFile))
{
var fullPath = CommonLibrary.Extensions.PathCombineL(componentTargetDirectory, oFile);
System.IO.File.Delete(fullPath);
Console.WriteLine("DeleteFile : " + oFile);
}
}
foreach (string oDirectory in oldDirectorys)
{
if (!sourceDirectorys.Contains(oDirectory))
{
var fullPath = CommonLibrary.Extensions.PathCombineL(componentTargetDirectory, oDirectory);
System.IO.Directory.Delete(fullPath);
Console.WriteLine("DeleteDirectory : " + oDirectory);
}
}
// 새로운 파일 추가
foreach (string sDirectory in sourceDirectorys)
{
if (!oldDirectorys.Contains(sDirectory))
{
var fullPath = CommonLibrary.Extensions.PathCombineL(componentTargetDirectory, sDirectory);
System.IO.Directory.CreateDirectory(fullPath);
Console.WriteLine("CreateDirectory : " + sDirectory);
}
}
foreach (string sFile in sourceFiles)
{
if (!oldFiles.Contains(sFile))
{
var sourceFileFullPath = CommonLibrary.Extensions.PathCombineL(componentSourceDirectory, sFile);
var targetFileFullPath = CommonLibrary.Extensions.PathCombineL(componentTargetDirectory, sFile);
System.IO.File.Copy(sourceFileFullPath, targetFileFullPath);
Console.WriteLine("Copy NewFile : " + sFile);
}
}
// 무결성 검사 후 업데이트
oldFiles = Extensions.GetFilesRelativePath(componentTargetDirectory, "*", System.IO.SearchOption.AllDirectories);
foreach (string oFile in oldFiles)
{
var sourceFileFullPath = CommonLibrary.Extensions.PathCombineL(componentSourceDirectory, oFile);
var targetFileFullPath = CommonLibrary.Extensions.PathCombineL(componentTargetDirectory, oFile);
var sourceHash = Extensions.GetFileHash(sourceFileFullPath);
var targetHash = Extensions.GetFileHash(targetFileFullPath);
if (targetHash != sourceHash)
{
System.IO.File.Delete(targetFileFullPath);
System.IO.File.Copy(sourceFileFullPath, targetFileFullPath);
Console.Write("Update File : " + oFile);
}
}
List<CommonLibrary.FileDetail> fileDetails = new List<CommonLibrary.FileDetail>();
for (int i = 0; i < sourceFiles.Length; i++)
{
CommonLibrary.FileDetail fileDetail = new CommonLibrary.FileDetail();
string fullPath = CommonLibrary.Extensions.PathCombineL(componentTargetDirectory, sourceFiles[i]);
fileDetail.Directory = System.IO.Path.GetDirectoryName(sourceFiles[i]);
fileDetail.FileName = System.IO.Path.GetFileName(sourceFiles[i]);
System.IO.FileInfo fi = new System.IO.FileInfo(fullPath);
fileDetail.FileSize = fi.Length;
fileDetail.HashCode = Extensions.GetFileHash(fullPath);
fileDetails.Add(fileDetail);
}
// 시작
dataPatchInformation.ComponentList = fileDetails;
dataPatchInformation.ComponentDirectorys = sourceDirectorys.ToList();
// 파일 디테일
var newVersion = VersionChange(dataPatchInformation.ComponentVersion, versionType);
Console.WriteLine("Update Version : " + dataPatchInformation.ComponentVersion + " → " + newVersion);
dataPatchInformation.ComponentVersion = newVersion;
Settings.SaveDataPatchInformation(dataPatchInformation);
Console.WriteLine("Update Complete");
// 무결성 검사후 업데이트
}
static void Packing(string source, string target)
{
if (System.IO.File.Exists(target))
{
System.IO.File.Delete(target);
}
var progressPacker = new CommonLibrary.ProgressPacker();
Console.WriteLine("Packing Start");
Console.WriteLine("----------------------------------------");
Console.WriteLine("");
nowPosLeft = Console.CursorLeft;
nowPosTop = Console.CursorTop;
Console.CursorVisible = false;
progressPacker.Pack(source, target, new CommonLibrary.BasicProgress<double>(ProgressChange));
Console.CursorVisible = true;
Console.WriteLine();
Console.WriteLine("");
Console.WriteLine("----------------------------------------");
Console.WriteLine("Packing Complite");
}
static string VersionChange(string version, VersionType versionType)
{
var v = Version.Parse(version);
switch (versionType)
{
case VersionType.Major:
v = new Version(v.Major + 1, 0, 0, 0);
break;
case VersionType.Minor:
v = new Version(v.Major, v.Minor + 1, 0, 0);
break;
case VersionType.Build:
v = new Version(v.Major, v.Minor, v.Build + 1, 0);
break;
case VersionType.Revision:
v = new Version(v.Major, v.Minor, v.Build, v.Revision + 1);
break;
}
return v.ToString();
}
static void ProgressChange(double obj)
{
Console.SetCursorPosition(nowPosLeft, nowPosTop);
var Progress = (int)(obj * 10);
for (int i = 0; i < Progress; i++)
Console.Write("■");
for (int i = 0; i < 10 - Progress; i++)
Console.Write("□");
Console.Write(" " + $"{obj:P2}");
}
}
internal enum UpdateType
{
Launcher,
Runtime,
Package,
Component
}
internal enum VersionType
{
Major,
Minor,
Build,
Revision
}
}

View File

@@ -0,0 +1,12 @@
{
"profiles": {
"Mitria_Minecraft_Updater": {
"commandName": "Project"
},
"WSL": {
"commandName": "WSL2",
"environmentVariables": {},
"distributionName": ""
}
}
}

View File

@@ -0,0 +1,145 @@
using System;
namespace Mitria_Minecraft_Updater
{
public static class Settings
{
#pragma warning disable S1104 // Fields should not have public accessibility
#pragma warning disable S2223 // Non-constant static fields should not be visible
public static Config config;
#pragma warning restore S2223 // Non-constant static fields should not be visible
#pragma warning restore S1104 // Fields should not have public accessibility
public static readonly string configPath = "config.xml";
private static void InitializationConfig()
{
// 줄여야함
config.Source = "./Source";
config.Target = "./Target";
config.InformationToLauncher = "/Launcher.xml";
config.InformationToData = "/Data.xml";
config.LauncherSource = "/Launcher";
config.LauncherUrl = "/Data/Launcher";
config.LauncherFileName = "MitriaMLauncher.exe";
config.RuntimeSource = "/Runtime";
config.RuntimeUrl = "/Data/Runtime";
config.RuntimeFilename = "Runtime.pack";
config.PackageSource = "/Package";
config.PackageUrl = "/Data/Package";
config.PackageFilename = "Package.pack";
config.ComponentSource = "/Component";
config.ComponentUrl = "/Data/Component";
}
public static void LoadConfig()
{
if (System.IO.File.Exists(configPath))
{
config = CommonLibrary.XMLSystem.LoadFromPath<Config>(configPath);
}
else
{
InitializationConfig();
SaveConfig();
}
}
public static void SaveConfig()
{
CommonLibrary.XMLSystem.Save(configPath, config);
}
public static CommonLibrary.LauncherPatchInformation LoadLauncherPatchInformation()
{
CommonLibrary.LauncherPatchInformation launcherPatchInformation = new CommonLibrary.LauncherPatchInformation();
string fullPath = CommonLibrary.Extensions.PathCombineL(config.Target, config.InformationToLauncher);
if (System.IO.File.Exists(fullPath))
{
launcherPatchInformation = CommonLibrary.XMLSystem.LoadFromPath<CommonLibrary.LauncherPatchInformation>(fullPath);
}
else
{
launcherPatchInformation.Version = "0.0.0.0";
}
// 혹시모를 변경 될수도 있음
launcherPatchInformation.LauncherUrl = config.LauncherUrl;
launcherPatchInformation.LauncherFileName = config.LauncherFileName;
return launcherPatchInformation;
}
public static void SaveLauncherPatchInformation(CommonLibrary.LauncherPatchInformation launcherPatchInformation)
{
string fullPath = CommonLibrary.Extensions.PathCombineL(config.Target, config.InformationToLauncher);
if (!System.IO.Directory.Exists(config.Target))
{
System.IO.Directory.CreateDirectory(config.Target);
}
CommonLibrary.XMLSystem.Save(fullPath, launcherPatchInformation);
}
public static CommonLibrary.DataPatchInformation LoadDataPatchInformation()
{
CommonLibrary.DataPatchInformation dataPatchInformation = new CommonLibrary.DataPatchInformation();
string fullPath = config.Target + config.InformationToData;
if (System.IO.File.Exists(fullPath))
{
dataPatchInformation = CommonLibrary.XMLSystem.LoadFromPath<CommonLibrary.DataPatchInformation>(fullPath);
}
else
{
dataPatchInformation.RuntimeVersion = "0.0.0.0";
dataPatchInformation.PackageVersion = "0.0.0.0";
dataPatchInformation.PackageDirectorys = new System.Collections.Generic.List<string>();
dataPatchInformation.ComponentVersion = "0.0.0.0";
dataPatchInformation.ComponentDirectorys = new System.Collections.Generic.List<string>();
dataPatchInformation.ComponentList = new System.Collections.Generic.List<CommonLibrary.FileDetail>();
}
dataPatchInformation.RuntimeUrl = config.RuntimeUrl;
dataPatchInformation.RuntimeFileName = config.RuntimeFilename;
dataPatchInformation.PackageUrl = config.PackageUrl;
dataPatchInformation.PackageFileName = config.PackageFilename;
dataPatchInformation.ComponentUrl = config.ComponentUrl;
return dataPatchInformation;
}
public static void SaveDataPatchInformation(CommonLibrary.DataPatchInformation dataPatchInformation)
{
string fullPath = CommonLibrary.Extensions.PathCombineL(config.Target , config.InformationToData);
if (!System.IO.Directory.Exists(config.Target))
{
System.IO.Directory.CreateDirectory(config.Target);
}
CommonLibrary.XMLSystem.Save(fullPath, dataPatchInformation);
}
}
[Serializable]
public struct Config
{
public string Source { get; set; } //./Source
public string Target { get; set; } ///usr/share/nginx/html/Patchdata
public string DataDirectory { get; set; } // {Target}/Data
public string InformationToLauncher { get; set; } //{InformationDirectory}/Launcher.xml
public string InformationToData { get; set; } // {InformationDirectory}/Data.xml
public string LauncherSource { get; set; } // {Source}/Launcher
public string LauncherUrl { get; set; } // {Target}/Launcher
public string LauncherFileName { get; set; } // 런처 파일이름
public string RuntimeSource { get; set; } // {Source}/Runtime
public string RuntimeUrl { get; set; } // {Target}/Runtime
public string RuntimeFilename { get; set; } // Runtime.pack
public string PackageSource { get; set; } // {Source}/Package
public string PackageUrl { get; set; } // {Target}/Package
public string PackageFilename { get; set; } // Package.pack
public string ComponentSource { get; set; } // {Source}/GameFile
public string ComponentUrl { get; set; } // {Target}/GameFile
}
}