Initial code, everything seems to be working
This commit is contained in:
1 parent
67e3873714
commit
78c897f542
15 files changed
+8513
No files matched your search
@@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{04AB5523-E679-4628-8B8B-B928A5DA5107}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>FrappeMocha</RootNamespace>
|
||||
<AssemblyName>FrappeMocha</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.0</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ApplicationIcon>Resources\logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Deployment" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Keygen.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
<DesignTime>True</DesignTime>
|
||||
</Compile>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Resources\logo.ico" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,25 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.1022
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FrappeMocha", "FrappeMocha.csproj", "{04AB5523-E679-4628-8B8B-B928A5DA5107}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{04AB5523-E679-4628-8B8B-B928A5DA5107}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{04AB5523-E679-4628-8B8B-B928A5DA5107}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{04AB5523-E679-4628-8B8B-B928A5DA5107}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{04AB5523-E679-4628-8B8B-B928A5DA5107}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {0125FC47-F477-4F21-BE83-56EF1850412D}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace FrappeMocha
|
||||
{
|
||||
public class Keygen
|
||||
{
|
||||
private int param_encoding;
|
||||
|
||||
public enum LicenseTypes
|
||||
{
|
||||
License3270 = 140,
|
||||
License5250 = 128,
|
||||
License3812 = 160,
|
||||
LicenseTelnet = 155,
|
||||
LicenseJava3270 = 30,
|
||||
LicenseJava5250 = 30,
|
||||
LicenseJavaTelnet = 0x1b,
|
||||
LicenseMac3270 = 0x5d,
|
||||
LicenseMac5250 = 0x16,
|
||||
}
|
||||
|
||||
public Keygen()
|
||||
{
|
||||
this.param_encoding = 0;
|
||||
}
|
||||
|
||||
public bool CheckLicense(string param_lickey, string param_company, LicenseTypes license)
|
||||
{
|
||||
switch (license)
|
||||
{
|
||||
case LicenseTypes.License3270:
|
||||
case LicenseTypes.License3812:
|
||||
case LicenseTypes.License5250:
|
||||
case LicenseTypes.LicenseTelnet:
|
||||
return CheckLicenseWindows(param_lickey, param_company, license);
|
||||
|
||||
case LicenseTypes.LicenseJavaTelnet:
|
||||
case LicenseTypes.LicenseJava3270:
|
||||
// case LicenseTypes.LicenseJava5250:
|
||||
return CheckLicenseJava(param_lickey, param_company, license);
|
||||
|
||||
case LicenseTypes.LicenseMac3270:
|
||||
case LicenseTypes.LicenseMac5250:
|
||||
return CheckLicenseMac(param_lickey, param_company, license);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public bool CheckLicenseJava(string param_lickey, string param_company, LicenseTypes license)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CheckLicenseMac(string param_lickey, string param_company, LicenseTypes license)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool CheckLicenseWindows(string param_lickey, string param_company, LicenseTypes license)
|
||||
{
|
||||
uint num1 = 0;
|
||||
if (param_company == null || param_company.Length < 2)
|
||||
return false;
|
||||
byte[] byteArray = this.StrToByteArray(param_company);
|
||||
if (param_lickey == null || param_lickey.Length < 6)
|
||||
return false;
|
||||
for (int index = 0; index < byteArray.Length; ++index)
|
||||
{
|
||||
// >= 'A' && <= 'Z'
|
||||
if ((int)byteArray[index] >= 65 && (int)byteArray[index] <= 90)
|
||||
byteArray[index] += (byte)32;
|
||||
}
|
||||
for (int index = 0; index < byteArray.Length; ++index)
|
||||
{
|
||||
if ((int)byteArray[index] >= 65) // 'A'
|
||||
num1 += (uint)byteArray[index] + (uint)license;
|
||||
}
|
||||
uint num2 = num1 * (uint)param_lickey[0];
|
||||
uint num3 = (uint)((int)num2 * ((int)num2 & (int)byte.MaxValue) & (int)ushort.MaxValue);
|
||||
if (num3 < 100U)
|
||||
num3 = 2728U;
|
||||
|
||||
if (param_lickey.StartsWith((param_lickey[0].ToString() ?? "") + (object)num3))
|
||||
{
|
||||
//this.aa = param_lickey.Substring(0, 1);
|
||||
return true;
|
||||
}
|
||||
//this.aa = "";
|
||||
return false;
|
||||
}
|
||||
|
||||
public string GenLicense(int type, string param_company, LicenseTypes license)
|
||||
{
|
||||
switch (license)
|
||||
{
|
||||
case LicenseTypes.License3270:
|
||||
case LicenseTypes.License3812:
|
||||
case LicenseTypes.License5250:
|
||||
case LicenseTypes.LicenseTelnet:
|
||||
return GenLicenseWindows(type, param_company, license);
|
||||
|
||||
case LicenseTypes.LicenseJavaTelnet:
|
||||
case LicenseTypes.LicenseJava3270:
|
||||
// case LicenseTypes.LicenseJava5250:
|
||||
return GenLicenseJava(type, param_company, license);
|
||||
|
||||
case LicenseTypes.LicenseMac3270:
|
||||
case LicenseTypes.LicenseMac5250:
|
||||
return GenLicenseMac(type, param_company, license);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public string GenLicenseWindows(int type, string param_company, LicenseTypes license)
|
||||
{
|
||||
string param_lickey = type.ToString();
|
||||
uint num1 = 0;
|
||||
byte[] byteArray = this.StrToByteArray(param_company);
|
||||
for (int index = 0; index < byteArray.Length; ++index)
|
||||
{
|
||||
if ((int)byteArray[index] >= 65 && (int)byteArray[index] <= 90)
|
||||
byteArray[index] += (byte)32; // this is basically str.toLower()
|
||||
}
|
||||
|
||||
for (int index = 0; index < byteArray.Length; ++index)
|
||||
{
|
||||
if ((int)byteArray[index] >= 65) // 'A'
|
||||
num1 += (uint)byteArray[index] + (uint)license;
|
||||
}
|
||||
uint num2 = num1 * (uint)param_lickey[0];
|
||||
uint num3 = (uint)((int)num2 * ((int)num2 & (int)byte.MaxValue) & (int)ushort.MaxValue);
|
||||
if (num3 < 100U)
|
||||
num3 = 2728U;
|
||||
|
||||
param_lickey = ((param_lickey[0].ToString() ?? "") + (object)num3) + '-' +
|
||||
(Int32)(DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1))).TotalSeconds;
|
||||
|
||||
|
||||
return param_lickey;
|
||||
}
|
||||
|
||||
public string GenLicenseJava(int itype, string param_company, LicenseTypes license)
|
||||
{
|
||||
char type = (char)(itype + (int)'A');
|
||||
string param_lickey = type.ToString() + '@';
|
||||
byte[] byteArray = this.StrToByteArray(param_company);
|
||||
uint num1 = 0;
|
||||
|
||||
for (int b = 0; b < byteArray.Length; b++)
|
||||
{
|
||||
if (param_company.ToCharArray()[b] > ' ')
|
||||
num1 += param_company.ToCharArray()[b] + (uint)license;
|
||||
}
|
||||
|
||||
uint num2 = num1 * (uint)param_lickey[0];
|
||||
uint num3 = (uint)((int)num2 * ((int)num2 & (int)byte.MaxValue) & (int)ushort.MaxValue);
|
||||
param_lickey += (object) num3;
|
||||
return param_lickey;
|
||||
}
|
||||
|
||||
public string GenLicenseMac(int itype, string param_company, LicenseTypes license)
|
||||
{
|
||||
char type = (char)(itype + (int)'a');
|
||||
string param_lickey = type.ToString() + '@';
|
||||
byte[] byteArray = this.StrToByteArray(param_company);
|
||||
uint num1 = 0;
|
||||
|
||||
for (int b = 0; b < byteArray.Length; b++)
|
||||
{
|
||||
if (param_company.ToCharArray()[b] > ' ')
|
||||
num1 += param_company.ToCharArray()[b] + (uint)license;
|
||||
}
|
||||
|
||||
uint num2 = num1 * (uint)param_lickey[0];
|
||||
uint num3 = (uint)((int)num2 * ((int)num2 & (int)byte.MaxValue) & (int)ushort.MaxValue);
|
||||
param_lickey += (object)num3;
|
||||
return param_lickey;
|
||||
}
|
||||
|
||||
public byte[] StrToByteArray(string str)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Encoding.GetEncoding(this.param_encoding).GetBytes(str);
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Encoding.GetEncoding(0).GetBytes(str);
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
return new byte[1] { (byte)63 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string ByteArrayToStr(byte[] barr, int index, int length)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Encoding.GetEncoding(this.param_encoding).GetString(barr, index, length);
|
||||
}
|
||||
catch (Exception ex1)
|
||||
{
|
||||
try
|
||||
{
|
||||
return Encoding.GetEncoding(0).GetString(barr, index, length);
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Generated
+179
@@ -0,0 +1,179 @@
|
||||
namespace FrappeMocha
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm));
|
||||
this.TypeDropDown = new System.Windows.Forms.ComboBox();
|
||||
this.companytext = new System.Windows.Forms.TextBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.companyusernamelabel = new System.Windows.Forms.Label();
|
||||
this.label3 = new System.Windows.Forms.Label();
|
||||
this.licensebox = new System.Windows.Forms.TextBox();
|
||||
this.submit = new System.Windows.Forms.Button();
|
||||
this.label2 = new System.Windows.Forms.Label();
|
||||
this.productSelect = new System.Windows.Forms.ComboBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// TypeDropDown
|
||||
//
|
||||
this.TypeDropDown.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.TypeDropDown.FormattingEnabled = true;
|
||||
this.TypeDropDown.Items.AddRange(new object[] {
|
||||
"Company License",
|
||||
"Single User License"});
|
||||
this.TypeDropDown.Location = new System.Drawing.Point(12, 65);
|
||||
this.TypeDropDown.Name = "TypeDropDown";
|
||||
this.TypeDropDown.Size = new System.Drawing.Size(146, 21);
|
||||
this.TypeDropDown.TabIndex = 0;
|
||||
this.TypeDropDown.SelectedIndexChanged += new System.EventHandler(this.TypeDropDown_SelectedIndexChanged);
|
||||
//
|
||||
// companytext
|
||||
//
|
||||
this.companytext.Location = new System.Drawing.Point(12, 105);
|
||||
this.companytext.MaxLength = 512;
|
||||
this.companytext.Name = "companytext";
|
||||
this.companytext.Size = new System.Drawing.Size(146, 20);
|
||||
this.companytext.TabIndex = 1;
|
||||
this.companytext.Text = "FrappeMocha";
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(9, 49);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(71, 13);
|
||||
this.label1.TabIndex = 2;
|
||||
this.label1.Text = "License Type";
|
||||
//
|
||||
// companyusernamelabel
|
||||
//
|
||||
this.companyusernamelabel.AutoSize = true;
|
||||
this.companyusernamelabel.Location = new System.Drawing.Point(9, 89);
|
||||
this.companyusernamelabel.Name = "companyusernamelabel";
|
||||
this.companyusernamelabel.Size = new System.Drawing.Size(115, 13);
|
||||
this.companyusernamelabel.TabIndex = 3;
|
||||
this.companyusernamelabel.Text = "Company / User Name";
|
||||
//
|
||||
// label3
|
||||
//
|
||||
this.label3.AutoSize = true;
|
||||
this.label3.Location = new System.Drawing.Point(9, 128);
|
||||
this.label3.Name = "label3";
|
||||
this.label3.Size = new System.Drawing.Size(65, 13);
|
||||
this.label3.TabIndex = 4;
|
||||
this.label3.Text = "License Key";
|
||||
//
|
||||
// licensebox
|
||||
//
|
||||
this.licensebox.Location = new System.Drawing.Point(12, 144);
|
||||
this.licensebox.Name = "licensebox";
|
||||
this.licensebox.ReadOnly = true;
|
||||
this.licensebox.Size = new System.Drawing.Size(146, 20);
|
||||
this.licensebox.TabIndex = 5;
|
||||
//
|
||||
// submit
|
||||
//
|
||||
this.submit.Location = new System.Drawing.Point(12, 175);
|
||||
this.submit.Name = "submit";
|
||||
this.submit.Size = new System.Drawing.Size(146, 23);
|
||||
this.submit.TabIndex = 6;
|
||||
this.submit.Text = "Frappe Mocha";
|
||||
this.submit.UseVisualStyleBackColor = true;
|
||||
this.submit.Click += new System.EventHandler(this.submit_Click);
|
||||
//
|
||||
// label2
|
||||
//
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(12, 9);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(44, 13);
|
||||
this.label2.TabIndex = 7;
|
||||
this.label2.Text = "Product";
|
||||
//
|
||||
// productSelect
|
||||
//
|
||||
this.productSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.productSelect.FormattingEnabled = true;
|
||||
this.productSelect.Items.AddRange(new object[] {
|
||||
"TN3270 for Windows",
|
||||
"TN5250 for Windows",
|
||||
"TN3812 for Windows",
|
||||
"Telnet for Windows",
|
||||
"TN3270 for Java",
|
||||
"TN5250 for Java",
|
||||
"Telnet for Java",
|
||||
"TN3270 for Mac OS X",
|
||||
"TN5250 for Mac OS X"});
|
||||
this.productSelect.Location = new System.Drawing.Point(12, 25);
|
||||
this.productSelect.Name = "productSelect";
|
||||
this.productSelect.Size = new System.Drawing.Size(146, 21);
|
||||
this.productSelect.TabIndex = 8;
|
||||
this.productSelect.SelectedIndexChanged += new System.EventHandler(this.productSelect_SelectedIndexChanged);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AcceptButton = this.submit;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.BackColor = System.Drawing.SystemColors.Window;
|
||||
this.ClientSize = new System.Drawing.Size(173, 210);
|
||||
this.Controls.Add(this.productSelect);
|
||||
this.Controls.Add(this.label2);
|
||||
this.Controls.Add(this.submit);
|
||||
this.Controls.Add(this.licensebox);
|
||||
this.Controls.Add(this.label3);
|
||||
this.Controls.Add(this.companyusernamelabel);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.companytext);
|
||||
this.Controls.Add(this.TypeDropDown);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "MainForm";
|
||||
this.Text = "FrappeMocha";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.ComboBox TypeDropDown;
|
||||
private System.Windows.Forms.TextBox companytext;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Label companyusernamelabel;
|
||||
private System.Windows.Forms.Label label3;
|
||||
private System.Windows.Forms.TextBox licensebox;
|
||||
private System.Windows.Forms.Button submit;
|
||||
private System.Windows.Forms.Label label2;
|
||||
private System.Windows.Forms.ComboBox productSelect;
|
||||
}
|
||||
}
|
||||
|
||||
+175
@@ -0,0 +1,175 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FrappeMocha
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
protected Keygen frappeKeygen;
|
||||
private object[] windowsLicenseTypeItems = new object[2];
|
||||
private object[] macLicenseTypeItems = new object[2];
|
||||
private object[] javaLicenseTypeItems = new object[5];
|
||||
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
TypeDropDown.SelectedIndex = 0;
|
||||
productSelect.SelectedIndex = 0;
|
||||
frappeKeygen = new Keygen();
|
||||
this.initDropDownMenuItems();
|
||||
}
|
||||
|
||||
private void initDropDownMenuItems()
|
||||
{
|
||||
TypeDropDown.Items.CopyTo(windowsLicenseTypeItems, 0);
|
||||
|
||||
initJavaLicenseTypeItems();
|
||||
initMacLicenseTypeItems();
|
||||
|
||||
TypeDropDown.Items.Clear();
|
||||
TypeDropDown.Items.AddRange(this.windowsLicenseTypeItems);
|
||||
TypeDropDown.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
private void initJavaLicenseTypeItems()
|
||||
{
|
||||
TypeDropDown.Items.Clear();
|
||||
for (int i = 0; i < 5; i++)
|
||||
{
|
||||
TypeDropDown.Items.Add((char) ('A' + i));
|
||||
}
|
||||
TypeDropDown.Items.CopyTo(this.javaLicenseTypeItems, 0);
|
||||
}
|
||||
|
||||
private void initMacLicenseTypeItems()
|
||||
{
|
||||
TypeDropDown.Items.Clear();
|
||||
for (int i = 0; i < 2; i++)
|
||||
{
|
||||
TypeDropDown.Items.Add((char)('a' + i));
|
||||
}
|
||||
TypeDropDown.Items.CopyTo(this.macLicenseTypeItems, 0);
|
||||
}
|
||||
|
||||
private void submit_Click(object sender, EventArgs e)
|
||||
{
|
||||
switch (productSelect.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
this.keygen(Keygen.LicenseTypes.License3270);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
this.keygen(Keygen.LicenseTypes.License5250);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
this.keygen(Keygen.LicenseTypes.License3812);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
this.keygen(Keygen.LicenseTypes.LicenseTelnet);
|
||||
break;
|
||||
|
||||
case 4:
|
||||
this.keygen(Keygen.LicenseTypes.LicenseJava3270);
|
||||
break;
|
||||
|
||||
case 5:
|
||||
this.keygen(Keygen.LicenseTypes.LicenseJava5250);
|
||||
break;
|
||||
|
||||
case 6:
|
||||
this.keygen(Keygen.LicenseTypes.LicenseJavaTelnet);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
this.keygen(Keygen.LicenseTypes.LicenseMac3270);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
this.keygen(Keygen.LicenseTypes.LicenseMac5250);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void TypeDropDown_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (TypeDropDown.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
companyusernamelabel.Text = "Company Name";
|
||||
break;
|
||||
|
||||
case 1:
|
||||
companyusernamelabel.Text = "User Name";
|
||||
break;
|
||||
}
|
||||
|
||||
if (TypeDropDown.Items.Count > 2)
|
||||
{
|
||||
companyusernamelabel.Text = "Name";
|
||||
}
|
||||
}
|
||||
|
||||
private void keygen(Keygen.LicenseTypes license)
|
||||
{
|
||||
if (companytext.Text.Length <= 1)
|
||||
{
|
||||
MessageBox.Show(
|
||||
(TypeDropDown.SelectedIndex == 0
|
||||
? "Company Name"
|
||||
: "User Name") + " must be longer than one character", "Error",
|
||||
MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
string genlicense = frappeKeygen.GenLicense(TypeDropDown.SelectedIndex, companytext.Text, license);
|
||||
if (!frappeKeygen.CheckLicense(genlicense, companytext.Text, license))
|
||||
{
|
||||
MessageBox.Show("Generated license did not pass self check, please try again", "Warning",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Warning);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
licensebox.Text = genlicense;
|
||||
}
|
||||
|
||||
private void productSelect_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
switch (productSelect.SelectedIndex)
|
||||
{
|
||||
case 0:
|
||||
case 1:
|
||||
case 2:
|
||||
case 3:
|
||||
if (this.windowsLicenseTypeItems[0] != null)
|
||||
{
|
||||
TypeDropDown.Items.Clear();
|
||||
TypeDropDown.Items.AddRange(this.windowsLicenseTypeItems);
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
case 5:
|
||||
case 6:
|
||||
TypeDropDown.Items.Clear();
|
||||
TypeDropDown.Items.AddRange(this.javaLicenseTypeItems);
|
||||
break;
|
||||
|
||||
case 7:
|
||||
case 8:
|
||||
TypeDropDown.Items.Clear();
|
||||
TypeDropDown.Items.AddRange(this.macLicenseTypeItems);
|
||||
break;
|
||||
}
|
||||
TypeDropDown.SelectedIndex = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
+7528
File diff suppressed because it is too large.
Load diff
+20
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace FrappeMocha
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point for the application.
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("FrappeMocha")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("HP Inc.")]
|
||||
[assembly: AssemblyProduct("FrappeMocha")]
|
||||
[assembly: AssemblyCopyright("Copyright © HP Inc. 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("04ab5523-e679-4628-8b8b-b928a5da5107")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
Generated
+73
@@ -0,0 +1,73 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FrappeMocha.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FrappeMocha.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
|
||||
/// </summary>
|
||||
internal static System.Drawing.Icon logo {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("logo", resourceCulture);
|
||||
return ((System.Drawing.Icon)(obj));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
|
||||
<data name="logo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\logo.ico;System.Drawing.Icon, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
Generated
+30
@@ -0,0 +1,30 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace FrappeMocha.Properties
|
||||
{
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
|
||||
{
|
||||
|
||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
|
||||
public static Settings Default
|
||||
{
|
||||
get
|
||||
{
|
||||
return defaultInstance;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -1,2 +1,12 @@
|
||||
# FrappeMocha
|
||||
Generates keys for an aptly named 3270 terminal emulator
|
||||
|
||||
### Note
|
||||
This is mostly for educational purposes only
|
||||
Documentation is non-existant
|
||||
|
||||
I just /really/ enjoy taking things apart and trying to put them back together
|
||||
|
||||
If this helps someone, sweet!
|
||||
|
||||
Keep on hacking
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 434 KiB |
Reference in new issue
Block a user