Skip to content

Commit

Permalink
2019.04.e0 New versions support
Browse files Browse the repository at this point in the history
  • Loading branch information
dhkim0800 committed Apr 2, 2019
1 parent 6206945 commit 6af4507
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion indexextract-cs/Form1.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 20 additions & 14 deletions indexextract-cs/Form2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
Expand All @@ -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";
Expand All @@ -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;
}
Expand All @@ -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;
}

Expand All @@ -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;
}
}
Expand Down

0 comments on commit 6af4507

Please sign in to comment.