コード例 #1
0
ファイル: Launcher.cs プロジェクト: Romonov/EMCL
        private static void DecompressNatives(EMCL.Launcher.MainJson Json, string path, bool IsAutoDecompressLwjgl)
        {
            string name = "";

            for (int i = 0; i < Json.libraries.Length; i++)
            {
                if (Json.libraries[i].extract != null && Json.libraries[i].natives.windows != null)
                {
                    string[] tmp  = Json.libraries[i].name.Split(':');
                    string[] tmp2 = tmp[0].Split('.');
                    name = $@"{Main.GamePath}\libraries";
                    for (int j = 0; j < tmp2.Length; j++)
                    {
                        name += $@"\{tmp2[j]}";
                    }
                    name += $@"\{tmp[1]}";
                    name += $@"\{tmp[2]}";
                    name += $@"\{tmp[1]}-{tmp[2]}-natives-windows.jar";

                    try
                    {
                        (new FastZip()).ExtractZip(name.Replace("${arch}", "32"), path, "");
                    }
                    catch (Exception e)
                    {
                        MessageBox.Show(e.Message, "EMCL 启动错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }

                if (IsAutoDecompressLwjgl)
                {
                    if (Json.libraries[i].name.Contains("lwjgl"))
                    {
                        string[] tmp  = Json.libraries[i].name.Split(':');
                        string[] tmp2 = tmp[0].Split('.');
                        name = $@"{Main.GamePath}\libraries";
                        for (int j = 0; j < tmp2.Length; j++)
                        {
                            name += $@"\{tmp2[j]}";
                        }
                        name += $@"\{tmp[1]}";
                        name += $@"\{tmp[2]}";
                        name += $@"\{tmp[1]}-{tmp[2]}-natives-windows.jar";

                        (new FastZip()).ExtractZip(name.Replace("${arch}", "32"), path, "");
                    }
                }
            }
            FileWorker.DeleteFiles(path, new string[] { ".sha1", ".git" }, true, true);

            // Fixme: Delete META-INF
            //File.Delete(path + "\\META-INF");
        }
コード例 #2
0
ファイル: Launcher.cs プロジェクト: Romonov/EMCL
        private static string GetCP(EMCL.Launcher.MainJson Json)
        {
            string cp = "";

            for (int i = 0; i < Json.libraries.Length; i++)
            {
                string[] tmp  = Json.libraries[i].name.Split(':');
                string[] tmp2 = tmp[0].Split('.');
                string   path = $@"{Main.GamePath}\libraries";
                for (int j = 0; j < tmp2.Length; j++)
                {
                    path += $@"\{tmp2[j]}";
                }
                path += $@"\{tmp[1]}";
                path += $@"\{tmp[2]}";
                path += $@"\{tmp[1]}-{tmp[2]}.jar;";
                cp   += path;
            }
            return(cp);
        }