diff --git a/CTZLauncher.sln b/CTZLauncher.sln index 060da44..c8a395b 100644 --- a/CTZLauncher.sln +++ b/CTZLauncher.sln @@ -1,10 +1,12 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 2013 -VisualStudioVersion = 12.0.21005.1 +# Visual Studio 14 +VisualStudioVersion = 14.0.23107.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CTZLauncher", "CTZLauncher\CTZLauncher.csproj", "{EC25362D-5BA7-4CB3-BDA2-C575B9318086}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "MinecraftServerInfo", "MinecraftServerInfo\MinecraftServerInfo.csproj", "{E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution CD_ROM|Any CPU = CD_ROM|Any CPU @@ -24,6 +26,16 @@ Global {EC25362D-5BA7-4CB3-BDA2-C575B9318086}.Release|Any CPU.Build.0 = Release|Any CPU {EC25362D-5BA7-4CB3-BDA2-C575B9318086}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU {EC25362D-5BA7-4CB3-BDA2-C575B9318086}.SingleImage|Any CPU.Build.0 = Release|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.CD_ROM|Any CPU.ActiveCfg = Release|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.CD_ROM|Any CPU.Build.0 = Release|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.DVD-5|Any CPU.ActiveCfg = Debug|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.DVD-5|Any CPU.Build.0 = Debug|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.Release|Any CPU.Build.0 = Release|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.SingleImage|Any CPU.ActiveCfg = Release|Any CPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5}.SingleImage|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/CTZLauncher/CTZLauncher.csproj b/CTZLauncher/CTZLauncher.csproj index 96f7b48..3ea860e 100644 --- a/CTZLauncher/CTZLauncher.csproj +++ b/CTZLauncher/CTZLauncher.csproj @@ -79,7 +79,9 @@ + + @@ -112,7 +114,7 @@ - + diff --git a/CTZLauncher/MainWindow.xaml.cs b/CTZLauncher/MainWindow.xaml.cs index e16ca91..7fecc59 100644 --- a/CTZLauncher/MainWindow.xaml.cs +++ b/CTZLauncher/MainWindow.xaml.cs @@ -1,27 +1,18 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Data; -using System.Windows.Documents; -using System.Windows.Input; -using System.Windows.Media; -using System.Windows.Media.Imaging; -using System.Windows.Navigation; -using System.Windows.Shapes; +using CTZLauncher.Modules.CTZServer; using KMCCC.Authentication; using KMCCC.Launcher; using KMCCC.Tools; -using KMCCC.Modules; -using KMCCC.Modules.JVersion; -using CityCraft; -using System.IO; -using System.Windows.Threading; -using System.Windows.Media.Animation; using LitJson; -using CTZLauncher.Modules.CTZServer; +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Linq; +using System.Windows; +using System.Windows.Controls; +using System.Windows.Input; +using System.Windows.Media; +using System.Windows.Media.Animation; namespace CTZLauncher { @@ -32,7 +23,7 @@ namespace CTZLauncher { LauncherCore launcher = null; LaunchOptions option = new LaunchOptions(); - string serveraddress = "127.0.0.1"; + string serveraddress = ConfigurationManager.AppSettings["Server"]; int serverport = 25580; #region 初始化部分 diff --git a/CTZLauncher/HttpHelper.cs b/CTZLauncher/Tools/HttpHelper.cs similarity index 100% rename from CTZLauncher/HttpHelper.cs rename to CTZLauncher/Tools/HttpHelper.cs diff --git a/CTZLauncher/app.config b/CTZLauncher/app.config index fcd0c93..8a17373 100644 --- a/CTZLauncher/app.config +++ b/CTZLauncher/app.config @@ -1,3 +1,9 @@ - + + + + + + + diff --git a/MinecraftServerInfo/App.config b/MinecraftServerInfo/App.config new file mode 100644 index 0000000..88fa402 --- /dev/null +++ b/MinecraftServerInfo/App.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/MinecraftServerInfo/MinecraftServerInfo.csproj b/MinecraftServerInfo/MinecraftServerInfo.csproj new file mode 100644 index 0000000..b3e8ed5 --- /dev/null +++ b/MinecraftServerInfo/MinecraftServerInfo.csproj @@ -0,0 +1,60 @@ + + + + + Debug + AnyCPU + {E178FD27-5F66-4B46-9DAD-4F8CC2D5A7A5} + Exe + Properties + MinecraftServerInfo + MinecraftServerInfo + v4.5.2 + 512 + true + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/MinecraftServerInfo/Program.cs b/MinecraftServerInfo/Program.cs new file mode 100644 index 0000000..fcadef5 --- /dev/null +++ b/MinecraftServerInfo/Program.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Sockets; +using System.Text; +using System.Threading.Tasks; + +namespace MinecraftServerInfo +{ + class Program + { + static void Main(string[] args) + { + using (Socket client = new Socket(SocketType.Stream, ProtocolType.Tcp)) + try + { + //01 00 + //0F 00-2F 09 31 32 37 2E 30 2E 30 2E 31 63 DD 01 + //client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.SendTimeout, 1000); + //client.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.ReceiveTimeout, 5000); + //client.Connect("CityCraft.cn", 25565); + client.Connect("four.mengcraft.com", 11133); + Console.WriteLine("开始连接"); + if (client.Connected) + { + Console.WriteLine("发送数据"); + client.Send(new byte[] { 0x0F, 0x00, 0x2F, 0x09, 0x31, 0x32, 0x37, 0x2E, 0x30, 0x2E, 0x30, 0x2E, 0x31, 0x63, 0xDD, 0x01 }); + client.Send(new byte[] { 0x01, 0x00 }); + Console.WriteLine("读取头数据"); + byte[] header = new byte[5]; + client.Receive(header, header.Length, SocketFlags.None); + Console.WriteLine(BitConverter.ToString(header)); + byte[] buffer = new byte[1024]; + int recover = client.Receive(buffer, buffer.Length, SocketFlags.None); + byte[] data = new byte[recover]; + Console.WriteLine("数据流长度: " + recover); + Array.Copy(buffer, data, recover); + Console.WriteLine(BitConverter.ToString(data)); + Console.WriteLine(Encoding.UTF8.GetString(data)); + } + } + catch (Exception e) + { + Console.WriteLine(e.Message); + } + Console.ReadLine(); + } + } +} diff --git a/MinecraftServerInfo/Properties/AssemblyInfo.cs b/MinecraftServerInfo/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..30316ef --- /dev/null +++ b/MinecraftServerInfo/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 有关程序集的一般信息由以下 +// 控制。更改这些特性值可修改 +// 与程序集关联的信息。 +[assembly: AssemblyTitle("MinecraftServerInfo")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("MinecraftServerInfo")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2015")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +//将 ComVisible 设置为 false 将使此程序集中的类型 +//对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型, +//请将此类型的 ComVisible 特性设置为 true。 +[assembly: ComVisible(false)] + +// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID +[assembly: Guid("e178fd27-5f66-4b46-9dad-4f8cc2d5a7a5")] + +// 程序集的版本信息由下列四个值组成: +// +// 主版本 +// 次版本 +// 生成号 +// 修订号 +// +//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值, +// 方法是按如下所示使用“*”: : +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")]