コード例 #1
0
ファイル: frmMain.cs プロジェクト: Neo-Desktop/FrappeMocha
        private string keygen(KeygenBase platform, KeygenProduct product, int type, string name)
        {
            if (name.Length <= 1)
            {
                MessageBox.Show(companyUserName[type] + " must be longer than one character", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return("");
            }

            if (name.Length > 80)
            {
                MessageBox.Show(companyUserName[type] + " must not be greater than eighty characters", "Error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return("");
            }

            string genlicense = platform.Generate(type, name, product.Licence);

            if (!platform.Check(genlicense, name, product.Licence))
            {
                MessageBox.Show("Generated license did not pass self check, please try again", "Warning",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Warning);
            }

            return(genlicense);
        }
コード例 #2
0
 public void TestJavaScriptPlatform()
 {
     platform = new PlatformJavaScript();
     foreach (var product in platform.Products)
     {
         var types = platform.GenerateLicencetypes(product);
         for (int i = 0; i < types.Count; i++)
         {
             foreach (string company in _testCompanyUserStrings)
             {
                 var key = platform.Generate(i, company, product.Licence);
                 Assert.IsTrue(platform.Check(key, company, product.Licence));
             }
         }
     }
 }