Add files via upload

This commit is contained in:
Bouletmarc 2022-11-04 07:48:07 -04:00 committed by GitHub
parent 05b6a6bb69
commit c9d243c9dd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 204 additions and 42 deletions

81
Form1.Designer.cs generated
View File

@ -29,23 +29,88 @@
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.numericUpDown2 = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).BeginInit();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(12, 12);
this.button1.Location = new System.Drawing.Point(12, 60);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(188, 23);
this.button1.Size = new System.Drawing.Size(136, 45);
this.button1.TabIndex = 0;
this.button1.Text = "Apply level10 access to DDDL8";
this.button1.Text = "Apply access levels to DDDL8+";
this.button1.UseVisualStyleBackColor = true;
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(24, 12);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(62, 13);
this.label1.TabIndex = 1;
this.label1.Text = "Read Level";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(24, 37);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(61, 13);
this.label2.TabIndex = 2;
this.label2.Text = "Write Level";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(93, 8);
this.numericUpDown1.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(43, 20);
this.numericUpDown1.TabIndex = 3;
//
// numericUpDown2
//
this.numericUpDown2.Location = new System.Drawing.Point(93, 33);
this.numericUpDown2.Maximum = new decimal(new int[] {
10,
0,
0,
0});
this.numericUpDown2.Name = "numericUpDown2";
this.numericUpDown2.Size = new System.Drawing.Size(43, 20);
this.numericUpDown2.TabIndex = 4;
//
// label3
//
this.label3.AutoSize = true;
this.label3.ForeColor = System.Drawing.Color.Blue;
this.label3.Location = new System.Drawing.Point(9, 111);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(35, 13);
this.label3.TabIndex = 5;
this.label3.Text = "label3";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(211, 44);
this.ClientSize = new System.Drawing.Size(162, 133);
this.Controls.Add(this.label3);
this.Controls.Add(this.numericUpDown2);
this.Controls.Add(this.numericUpDown1);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
@ -53,13 +118,21 @@
this.Name = "Form1";
this.ShowIcon = false;
this.Text = "DDDL8 - Keygen (BMDevs)";
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown2)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.NumericUpDown numericUpDown2;
private System.Windows.Forms.Label label3;
}
}

165
Form1.cs
View File

@ -17,14 +17,71 @@ namespace DDDL8_Keygen
private string Path1 = @"C:\ProgramData\Detroit Diesel\Drumroll\Application Data\";
private string Filena = "Settings.xml";
private string FilenaBACKUP = "SettingsBACKUP.xml";
private bool ParamExist = false;
public Form1()
{
InitializeComponent();
label3.Text = "";
LoadParams();
//Path1 = Application.StartupPath + "\\";
}
private void LoadParams()
{
ParamExist = false;
if (File.Exists(Path1 + Filena))
{
string[] AllLines = File.ReadAllLines(Path1 + Filena);
bool RLvl = false;
bool WLvl = false;
for (int i = 0; i < AllLines.Length; i++)
{
if (AllLines[i].Contains("ReadLevel</Property>") && !RLvl)
{
try
{
string ThisLine = AllLines[i + 3].Substring(AllLines[i + 3].IndexOf('>') + 1);
ThisLine = ThisLine.Substring(0, ThisLine.IndexOf('<'));
int ReadLevell = int.Parse(ThisLine);
numericUpDown1.Value = ReadLevell;
label3.Text = "ReadLevel Loaded!";
RLvl = true;
}
catch { }
}
if (AllLines[i].Contains("WriteLevel</Property>") && !WLvl)
{
try
{
string ThisLine = AllLines[i + 3].Substring(AllLines[i + 3].IndexOf('>') + 1);
ThisLine = ThisLine.Substring(0, ThisLine.IndexOf('<'));
int WriteLevell = int.Parse(ThisLine);
numericUpDown2.Value = WriteLevell;
label3.Text = "WriteLevel Loaded!";
WLvl = true;
}
catch { }
}
}
if (RLvl && WLvl)
{
label3.Text = "Access Levels Loaded!";
ParamExist = true;
}
}
else
{
MessageBox.Show("Cannot find parameters file: '" + Path1 + Filena + "'");
}
}
private void button1_Click(object sender, EventArgs e)
{
if (File.Exists(Path1 + Filena))
@ -32,49 +89,79 @@ namespace DDDL8_Keygen
string[] AllLines = File.ReadAllLines(Path1 + Filena);
List<string> SaveLines = new List<string>();
for (int i = 0; i < AllLines.Length; i++)
if (ParamExist)
{
if (AllLines[i].Contains("RegistrationKey</Property>"))
for (int i = 0; i < AllLines.Length; i++)
{
int Counting = 0;
while (Counting < 9)
SaveLines.Add(AllLines[i]);
if (AllLines[i].Contains("ReadLevel</Property>"))
{
i++;
SaveLines.Add(AllLines[i]);
i++;
SaveLines.Add(AllLines[i]);
i++;
string ModdedLevel = " <Object type=\"System.Int32, mscorlib\">" + numericUpDown1.Value.ToString() + "</Object>";
SaveLines.Add(ModdedLevel);
}
if (AllLines[i].Contains("WriteLevel</Property>"))
{
i++;
SaveLines.Add(AllLines[i]);
i++;
SaveLines.Add(AllLines[i]);
i++;
string ModdedLevel = " <Object type=\"System.Int32, mscorlib\">" + numericUpDown2.Value.ToString() + "</Object>";
SaveLines.Add(ModdedLevel);
}
}
}
else
{
for (int i = 0; i < AllLines.Length; i++)
{
if (AllLines[i].Contains("RegistrationKey</Property>"))
{
int Counting = 0;
while (Counting < 9)
{
SaveLines.Add(AllLines[i]);
Counting++;
i++;
}
SaveLines.Add("<Object type=\"DetroitDiesel.Settings.SettingInformation, CommonCS\">");
SaveLines.Add(" <Property name=\"Name\">ReadLevel</Property>");
SaveLines.Add(" <Property name=\"Group\">Client</Property>");
SaveLines.Add(" <Property name=\"Obj\">");
SaveLines.Add(" <Object type=\"System.Int32, mscorlib\">" + numericUpDown1.Value.ToString() + "</Object>");
SaveLines.Add(" </Property>");
SaveLines.Add(" <Property name=\"Encrypt\">False</Property>");
SaveLines.Add("</Object>");
SaveLines.Add("<Object type=\"DetroitDiesel.Settings.SettingInformation, CommonCS\">");
SaveLines.Add(" <Property name=\"Name\">WriteLevel</Property>");
SaveLines.Add(" <Property name=\"Group\">Client</Property>");
SaveLines.Add(" <Property name=\"Obj\">");
SaveLines.Add(" <Object type=\"System.Int32, mscorlib\">" + numericUpDown2.Value.ToString() + "</Object>");
SaveLines.Add(" </Property>");
SaveLines.Add(" <Property name=\"Encrypt\">False</Property>");
SaveLines.Add("</Object>");
SaveLines.Add("<Object type=\"DetroitDiesel.Settings.SettingInformation, CommonCS\">");
SaveLines.Add(" <Property name=\"Name\">ComputerDescription</Property>");
SaveLines.Add(" <Property name=\"Group\">Client</Property>");
SaveLines.Add(" <Property name=\"Obj\">");
SaveLines.Add(" <Object type=\"DetroitDiesel.Settings.StringSetting, CommonCS\">");
SaveLines.Add(" <Property name=\"Value\">BMDevs</Property>");
SaveLines.Add(" </Object>");
SaveLines.Add(" </Property>");
SaveLines.Add(" <Property name=\"Encrypt\">False</Property>");
SaveLines.Add("</Object>");
SaveLines.Add(AllLines[i]);
}
else
{
SaveLines.Add(AllLines[i]);
Counting++;
i++;
}
SaveLines.Add("<Object type=\"DetroitDiesel.Settings.SettingInformation, CommonCS\">");
SaveLines.Add(" <Property name=\"Name\">ReadLevel</Property>");
SaveLines.Add(" <Property name=\"Group\">Client</Property>");
SaveLines.Add(" <Property name=\"Obj\">");
SaveLines.Add(" <Object type=\"System.Int32, mscorlib\">10</Object>");
SaveLines.Add(" </Property>");
SaveLines.Add(" <Property name=\"Encrypt\">False</Property>");
SaveLines.Add("</Object>");
SaveLines.Add("<Object type=\"DetroitDiesel.Settings.SettingInformation, CommonCS\">");
SaveLines.Add(" <Property name=\"Name\">WriteLevel</Property>");
SaveLines.Add(" <Property name=\"Group\">Client</Property>");
SaveLines.Add(" <Property name=\"Obj\">");
SaveLines.Add(" <Object type=\"System.Int32, mscorlib\">10</Object>");
SaveLines.Add(" </Property>");
SaveLines.Add(" <Property name=\"Encrypt\">False</Property>");
SaveLines.Add("</Object>");
SaveLines.Add("<Object type=\"DetroitDiesel.Settings.SettingInformation, CommonCS\">");
SaveLines.Add(" <Property name=\"Name\">ComputerDescription</Property>");
SaveLines.Add(" <Property name=\"Group\">Client</Property>");
SaveLines.Add(" <Property name=\"Obj\">");
SaveLines.Add(" <Object type=\"DetroitDiesel.Settings.StringSetting, CommonCS\">");
SaveLines.Add(" <Property name=\"Value\">BMDevs</Property>");
SaveLines.Add(" </Object>");
SaveLines.Add(" </Property>");
SaveLines.Add(" <Property name=\"Encrypt\">False</Property>");
SaveLines.Add("</Object>");
SaveLines.Add(AllLines[i]);
}
else
{
SaveLines.Add(AllLines[i]);
}
}
@ -89,6 +176,8 @@ namespace DDDL8_Keygen
File.Create(Path1 + Filena).Dispose();
File.WriteAllLines(Path1 + Filena, AllLinesFinal);
LoadParams();
MessageBox.Show("Done!");
}
else

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.