Ejemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            this.Show();

            if (System.Globalization.CultureInfo.CurrentCulture.TwoLetterISOLanguageName != "ko")
            {
                Button3.Visible = false;
                Button4.Visible = false;
            }
            int a = Screen.PrimaryScreen.Bounds.Width / 2;
            int b = Screen.PrimaryScreen.Bounds.Height / 2;

            this.Top  = b - this.Height / 2;
            this.Left = a - this.Width / 2;
            OpenFileDialog1.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/.minecraft/assets/indexes";
            // 설정파일 처음 세팅
            appPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + "/indexextract";
            if (!FileSystem.FileExists(appPath + "/lang.set"))
            {
                FileSystem.CreateDirectory(appPath);
                FileSystem.WriteAllText(appPath + "/lang.set", "lang=EN_US", false);
            }
            //설정 파일 불러오기
            string se   = FileSystem.ReadAllText(appPath + "/lang.set");
            string lang = "";

            try {
                lang = Strings.Split(se, "lang=")[1];
            } catch (IndexOutOfRangeException) {
                //todo button 3 click
            }
            if (lang == "EN_US")
            {
                Button3_Click(sender, e);
            }
            else if (lang == "KO_KR")
            {
                Button4_Click(sender, e);
            }
            else
            {
                FileSystem.DeleteFile(appPath + "/lang.set");
                Application.Restart();
            }
            this.MaximizeBox = false;

            Thread t = new Thread(AsyncUpCheck);

            t.Priority = ThreadPriority.Lowest;
            t.Start();

            if (lang == "ko")
            {
                Label4.Text = "대기";
            }
            else if (lang == "en")
            {
                Label4.Text = "Wait";
            }
        }
Ejemplo n.º 2
0
        private void WorkThread()
        {
            VoidDelegate vd = new VoidDelegate(RefreshIndexTexts);
            ControlStrD  cd = new ControlStrD(SetControlIntTxt);

            while (true)
            {
                for (int t = 1; t <= 50; t++)
                {
                    i++;
                    string file;
                    string hash;
                    try {
                        file   = WorkDataObj.dataJson[index];
                        hash   = WorkDataObj.dataJson[index + 4];
                        index += 8;
                    } catch (IndexOutOfRangeException) {
                        Invoke(vd);
                        VoidDelegate ed = new VoidDelegate(WorkEnd);
                        Invoke(ed);
                        return;
                    }
                    string sourceFile = ad + "assets\\objects\\" + Strings.Left(hash, 2) + "\\" + hash;
                    string targetFile = WorkDataObj.targetPath + "\\" + file;
                    if (FileSystem.FileExists(targetFile))
                    {
                        ale++;
                        Invoke(cd, new ControlStr(Label7, ale.ToString()));
                        continue;
                    }
                    try {
                        FileSystem.CopyFile(sourceFile, targetFile);
                    } catch (FileNotFoundException) {
                        ncp++;
                        Invoke(cd, new ControlStr(Label8, ncp.ToString()));
                    }
                }
                Invoke(vd);
            }
        }