コード例 #1
0
        private void InnerSelectFile(string fileName, LicenseKeyFileEventArgs args) {
            if (!UseInnerKeyFileChecker)
                return;

            if (!new FileInfo(fileName).Exists) {
                args.RefuseAcceptance(Msgs.Res.File_N_is_not_exist, fileName);
                return;
            }

            KeyFromFile keyFromFile = new KeyFromFile(fileName);
            if (!keyFromFile.KeyHashPairAreValid) {
                args.RefuseAcceptance(Msgs.Res.Invalid_file_format_Its_expected_two_lines_a_key_and_his_hash);
                return;
            }

            if (!keyFromFile.KeyHashPairAreMatch) {
                args.RefuseAcceptance(Msgs.Res.File_is_invalid);
                return;
            }
            args.AcceptFile = true;
        }
コード例 #2
0
 private void Label10_Click(object sender, EventArgs e) {
     Label14.Checked = true;
     if (Label19.ShowDialog() != DialogResult.OK)
         return;
     LicenseKeyFileEventArgs args = new LicenseKeyFileEventArgs();
     args.AcceptFile = true;
     string fileName = Label19.FileName;
     if (SelectFile != null)
         SelectFile(fileName, args);
     else
         InnerSelectFile(fileName, args);
     if (!args.AcceptFile) {
         Messenger.ShowError("{0}:\r\n{1}", Msgs.Res.A_key_file_error, args.Comment);
         return;
     }
     Label9.Text = fileName;
     KeyFromFile keyFromFile = new KeyFromFile(fileName);
     if (keyFromFile.KeyHashPairAreMatch)
         Label12.Text = keyFromFile.Key;
 }