From 6af45078ce3ca5653da4902f56508023d86f59e5 Mon Sep 17 00:00:00 2001 From: dhkim0800 Date: Wed, 3 Apr 2019 00:02:20 +0900 Subject: [PATCH] 2019.04.e0 New versions support --- indexextract-cs/Form1.Designer.cs | 2 +- indexextract-cs/Form2.cs | 34 ++++++++++++++++++------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/indexextract-cs/Form1.Designer.cs b/indexextract-cs/Form1.Designer.cs index 74a299d..b6d8181 100644 --- a/indexextract-cs/Form1.Designer.cs +++ b/indexextract-cs/Form1.Designer.cs @@ -293,7 +293,7 @@ private void InitializeComponent() { this.Controls.Add(this.Button1); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; this.Name = "Form1"; - this.Text = "Index Extractor 19.02e2"; + this.Text = "Index Extractor 19.04e0"; this.Load += new System.EventHandler(this.Form1_Load); this.Panel1.ResumeLayout(false); this.Panel1.PerformLayout(); diff --git a/indexextract-cs/Form2.cs b/indexextract-cs/Form2.cs index 0d8416a..e7fde3a 100644 --- a/indexextract-cs/Form2.cs +++ b/indexextract-cs/Form2.cs @@ -9,14 +9,14 @@ public partial class Form2 : Form { public Form2() { InitializeComponent(); } - private string sp = "legacy.json 1.7.10.json 1.8.json 1.9.json 1.9-aprilfools.json 1.10.json 1.11.json 1.12.json 1.13.json 1.13.1.json 1.14.json"; + private string[] sp = { "legacy.json", "1.7.10.json", "1.8.json", "1.9.json", "1.9-aprilfools.json", "1.10.json", "1.11.json", "1.12.json", "1.13.json", "1.13.1.json", "1.14.json", "1.14-af.json", "pre-1.6.json" }; public void Fds() { ComboBox1.Items.Clear(); foreach (string foundFile in FileSystem.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\.minecraft\\assets\\indexes")) { string[] its = Strings.Split(foundFile, "\\"); string it = its[its.Length - 1]; - if (!sp.Contains(it)) continue; - ComboBox1.Items.Add(it); + if (Array.IndexOf(sp, it) != -1) + ComboBox1.Items.Add(it); } } private OpenFileDialog OpenFileDialog; @@ -32,18 +32,20 @@ private void Button1_Click(object sender, EventArgs e) { int lastIdx; string[] fns = Strings.Split(OpenFileDialog.FileName, "\\"); lastIdx = fns.Length - 1; - if (!sp.Contains(fns[lastIdx])) { + if (Array.IndexOf(sp, fns[lastIdx]) == -1) { DialogResult? ad = null; Console.Beep(); if (lang == "ko") { ad = MessageBox.Show("지정된 파일만 열 수 있습니다.\n허가된 파일 목록을 확인하려면 '확인'을 클릭하십시오.", "Indexextract", MessageBoxButtons.OKCancel); - } else if (lang == "en") { + } + else if (lang == "en") { ad = MessageBox.Show("Incompatible version. Press OK to see list of compatible versions.", "Indexextract", MessageBoxButtons.OKCancel); } if (ad == DialogResult.OK) { Process.Start("https://github.com/dhkim0800/indexextract/wiki/%EC%82%AC%EC%9A%A9-%EA%B0%80%EB%8A%A5%ED%95%9C-%EB%B2%84%EC%A0%84"); } - } else + } + else Label3.Text = OpenFileDialog.FileName; } } @@ -67,7 +69,8 @@ private void Form2_Load(object sender, EventArgs e) { Button3.Text = "확인"; if (Label3.Text == "No file selected") Label3.Text = "파일 선택 안함"; - } else if (lang == "en") { + } + else if (lang == "en") { Text = "Browse"; Button1.Text = "Browse file"; GroupBox1.Text = "Browse file"; @@ -90,7 +93,7 @@ private void Button3_Click(object sender, EventArgs e) { if (Label3.Text == "No file selected" || Label3.Text == "파일 선택 안함") { if (lang == "ko") MessageBox.Show("파일을 선택하지 않았습니다.", "Indexextract", MessageBoxButtons.OK); - else if(lang == "en") + else if (lang == "en") MessageBox.Show("You didn't select any file.", "Indexextract", MessageBoxButtons.OK); return; } @@ -101,18 +104,20 @@ private void Button3_Click(object sender, EventArgs e) { private void ComboBox1_SelectedValueChanged(object sender, EventArgs e) { string fn = ComboBox1.Text; - if (!sp.Contains(fn)) { + if (Array.IndexOf(sp, fn) == -1) { DialogResult? ad = null; Console.Beep(); if (lang == "ko") { ad = MessageBox.Show("지정된 파일만 열 수 있습니다.\n허가된 파일 목록을 확인하려면 '확인'을 클릭하십시오.", "Indexextract", MessageBoxButtons.OKCancel); - } else if (lang == "en") { + } + else if (lang == "en") { ad = MessageBox.Show("Incompatible version. Press OK to see list of compatible versions.", "Indexextract", MessageBoxButtons.OKCancel); } if (ad == DialogResult.OK) { Process.Start("https://github.com/dhkim0800/indexextract/wiki/%EC%82%AC%EC%9A%A9-%EA%B0%80%EB%8A%A5%ED%95%9C-%EB%B2%84%EC%A0%84"); } - } else + } + else Label3.Text = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "\\.minecraft\\assets\\indexes\\" + fn; } @@ -133,10 +138,11 @@ private void Label3_TextChanged(object sender, EventArgs e) { int lastIdx; string[] fns = Strings.Split(Label3.Text, "\\"); lastIdx = fns.Length - 1; -// if (!sp.Contains(fns[lastIdx])) { - if (!FileSystem.FileExists(Label3.Text) || !sp.Contains(fns[lastIdx])) { + // if (!sp.Contains(fns[lastIdx])) { + if (!FileSystem.FileExists(Label3.Text) || Array.IndexOf(sp, fns[lastIdx]) == -1) { Button3.Enabled = false; - } else { + } + else { Button3.Enabled = true; } }