Skip to content

Commit

Permalink
Added pin code
Browse files Browse the repository at this point in the history
  • Loading branch information
Chuanhsing committed Dec 10, 2019
1 parent 6336950 commit e19d7c1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 4 deletions.
7 changes: 4 additions & 3 deletions VPatchGGPK/Form1.Designer.cs

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

38 changes: 37 additions & 1 deletion VPatchGGPK/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ dynamic getPatchInfo()
ignoreCertificateCheckWhenSSL();

string remoteUri = "https://poedb.tw/fg/";
string fileName = "version.json";
string fileName = "pin.json";
var json = wc.DownloadString(remoteUri + fileName);
dynamic patch = JObject.Parse(json);

Expand Down Expand Up @@ -473,12 +473,48 @@ private void buttonApplyChinese_Click(object objsender, EventArgs e)
OutputLine("Server Version not match Patch Version");
return;
}
string promptValue = ShowDialog("https://poedb.tw/tw/chinese", "Pin Code");
if (promptValue != (string)patch.pin)
{
OutputLine("pin code at https://poedb.tw/tw/chinese");
return;
}
string patch_md5 = patch.md5;
if (downloadAndVerifyPatch(patch_md5))
{
InitGgpk();
HandlePatchArchive(patch_md5 + ".zip");
}
}

public static string ShowDialog(string text, string caption)
{
Form prompt = new Form()
{
Width = 500,
Height = 150,
FormBorderStyle = FormBorderStyle.FixedDialog,
Text = caption,
StartPosition = FormStartPosition.CenterScreen
};
Label textLabel = new Label() { Left = 50, Top = 20, Width = 400, Text = text };
textLabel.Click += delegate {
System.Diagnostics.Process.Start(text);
};
TextBox textBox = new TextBox() { Left = 50, Top = 40, Width = 400 };
Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70, DialogResult = DialogResult.OK };
confirmation.Click += (sender, e) => { prompt.Close(); };
prompt.Controls.Add(textBox);
prompt.Controls.Add(confirmation);
prompt.Controls.Add(textLabel);
prompt.AcceptButton = confirmation;

return prompt.ShowDialog() == DialogResult.OK ? textBox.Text : "";
}

private void label2_Click(object sender, EventArgs e)
{
System.Diagnostics.Process.Start("https://poedb.tw/tw/chinese");
}
}
}

0 comments on commit e19d7c1

Please sign in to comment.