Полностью реализовано второе окно

Signed-off-by: Lev Rusanov <30170278+JDM170@users.noreply.github.com>
This commit is contained in:
2025-03-02 12:49:45 +07:00
parent dab5ebefc1
commit 20e4376e9e
6 changed files with 1130 additions and 0 deletions

1
MainForm.Designer.cs generated
View File

@@ -491,6 +491,7 @@
this.btn_unlock_garages.TabIndex = 20; this.btn_unlock_garages.TabIndex = 20;
this.btn_unlock_garages.Text = "Unlock garages"; this.btn_unlock_garages.Text = "Unlock garages";
this.btn_unlock_garages.UseVisualStyleBackColor = true; this.btn_unlock_garages.UseVisualStyleBackColor = true;
this.btn_unlock_garages.Click += new System.EventHandler(this.btn_unlock_garages_Click);
// //
// btn_recover_backup // btn_recover_backup
// //

View File

@@ -219,6 +219,13 @@ namespace SaveWizard_rewritten
} }
} }
private void btn_unlock_garages_Click(object sender, EventArgs e)
{
SecondForm dlg = new SecondForm(selected_game, owns);
dlg.ShowDialog();
dlg.Focus();
}
private void btn_recover_backup_Click(object sender, EventArgs e) private void btn_recover_backup_Click(object sender, EventArgs e)
{ {
string backup_path = opened_file_path + ".swbak"; string backup_path = opened_file_path + ".swbak";

View File

@@ -51,6 +51,12 @@
<Reference Include="System.Xml" /> <Reference Include="System.Xml" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="SecondForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SecondForm.Designer.cs">
<DependentUpon>SecondForm.cs</DependentUpon>
</Compile>
<Compile Include="UpdateForm.cs"> <Compile Include="UpdateForm.cs">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
@@ -70,6 +76,9 @@
<EmbeddedResource Include="MainForm.resx"> <EmbeddedResource Include="MainForm.resx">
<DependentUpon>MainForm.cs</DependentUpon> <DependentUpon>MainForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="SecondForm.resx">
<DependentUpon>SecondForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UpdateForm.resx"> <EmbeddedResource Include="UpdateForm.resx">
<DependentUpon>UpdateForm.cs</DependentUpon> <DependentUpon>UpdateForm.cs</DependentUpon>
</EmbeddedResource> </EmbeddedResource>

649
SecondForm.Designer.cs generated Normal file
View File

@@ -0,0 +1,649 @@
namespace SaveWizard_rewritten
{
partial class SecondForm
{
/// <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()
{
this.tbl_owned_garages = new System.Windows.Forms.TableLayoutPanel();
this.lb_owned_garages = new System.Windows.Forms.ListBox();
this.lbl_owned_garages = new System.Windows.Forms.Label();
this.btn_owned_garages_analyze = new System.Windows.Forms.Button();
this.tbl_add_garage = new System.Windows.Forms.TableLayoutPanel();
this.lbl_garage_name = new System.Windows.Forms.Label();
this.txt_garage_name = new System.Windows.Forms.TextBox();
this.cb_garage_size = new System.Windows.Forms.ComboBox();
this.btn_garage_unlock = new System.Windows.Forms.Button();
this.btn_garage_unlock_all = new System.Windows.Forms.Button();
this.tbl_headquarter = new System.Windows.Forms.TableLayoutPanel();
this.lbl_headquarter = new System.Windows.Forms.Label();
this.txt_headquarter = new System.Windows.Forms.TextBox();
this.btn_headquarter_change = new System.Windows.Forms.Button();
this.tbl_visited_cities = new System.Windows.Forms.TableLayoutPanel();
this.lbl_visited_cities = new System.Windows.Forms.Label();
this.lb_visited_cities = new System.Windows.Forms.ListBox();
this.tbl_add_city = new System.Windows.Forms.TableLayoutPanel();
this.lbl_city_name = new System.Windows.Forms.Label();
this.txt_city_name = new System.Windows.Forms.TextBox();
this.btn_visit_city = new System.Windows.Forms.Button();
this.btn_visit_all = new System.Windows.Forms.Button();
this.tbl_dealerships = new System.Windows.Forms.TableLayoutPanel();
this.lb_dealerships = new System.Windows.Forms.ListBox();
this.lbl_dealership = new System.Windows.Forms.Label();
this.tbl_agencies = new System.Windows.Forms.TableLayoutPanel();
this.lbl_agencies = new System.Windows.Forms.Label();
this.lb_agencies = new System.Windows.Forms.ListBox();
this.tbl_add_dealer = new System.Windows.Forms.TableLayoutPanel();
this.lbl_dealer_name = new System.Windows.Forms.Label();
this.txt_dealer_name = new System.Windows.Forms.TextBox();
this.btn_dealer_research_all = new System.Windows.Forms.Button();
this.btn_dealer_research = new System.Windows.Forms.Button();
this.tbl_add_agency = new System.Windows.Forms.TableLayoutPanel();
this.btn_agency_research_all = new System.Windows.Forms.Button();
this.txt_agency_name = new System.Windows.Forms.TextBox();
this.btn_agency_research = new System.Windows.Forms.Button();
this.lbl_agency_name = new System.Windows.Forms.Label();
this.tbl_owned_garages.SuspendLayout();
this.tbl_add_garage.SuspendLayout();
this.tbl_headquarter.SuspendLayout();
this.tbl_visited_cities.SuspendLayout();
this.tbl_add_city.SuspendLayout();
this.tbl_dealerships.SuspendLayout();
this.tbl_agencies.SuspendLayout();
this.tbl_add_dealer.SuspendLayout();
this.tbl_add_agency.SuspendLayout();
this.SuspendLayout();
//
// tbl_owned_garages
//
this.tbl_owned_garages.ColumnCount = 1;
this.tbl_owned_garages.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tbl_owned_garages.Controls.Add(this.lb_owned_garages, 0, 1);
this.tbl_owned_garages.Controls.Add(this.lbl_owned_garages, 0, 0);
this.tbl_owned_garages.Controls.Add(this.btn_owned_garages_analyze, 0, 2);
this.tbl_owned_garages.Location = new System.Drawing.Point(12, 36);
this.tbl_owned_garages.Name = "tbl_owned_garages";
this.tbl_owned_garages.RowCount = 3;
this.tbl_owned_garages.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 13.19797F));
this.tbl_owned_garages.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 69.54314F));
this.tbl_owned_garages.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.01031F));
this.tbl_owned_garages.Size = new System.Drawing.Size(143, 197);
this.tbl_owned_garages.TabIndex = 0;
//
// lb_owned_garages
//
this.lb_owned_garages.Dock = System.Windows.Forms.DockStyle.Fill;
this.lb_owned_garages.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lb_owned_garages.FormattingEnabled = true;
this.lb_owned_garages.ItemHeight = 15;
this.lb_owned_garages.Location = new System.Drawing.Point(3, 29);
this.lb_owned_garages.Name = "lb_owned_garages";
this.lb_owned_garages.SelectionMode = System.Windows.Forms.SelectionMode.None;
this.lb_owned_garages.Size = new System.Drawing.Size(137, 131);
this.lb_owned_garages.TabIndex = 1;
//
// lbl_owned_garages
//
this.lbl_owned_garages.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_owned_garages.AutoSize = true;
this.lbl_owned_garages.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_owned_garages.Location = new System.Drawing.Point(3, 3);
this.lbl_owned_garages.Name = "lbl_owned_garages";
this.lbl_owned_garages.Size = new System.Drawing.Size(137, 19);
this.lbl_owned_garages.TabIndex = 0;
this.lbl_owned_garages.Text = "Owned garages";
this.lbl_owned_garages.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// btn_owned_garages_analyze
//
this.btn_owned_garages_analyze.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_owned_garages_analyze.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_owned_garages_analyze.Location = new System.Drawing.Point(3, 168);
this.btn_owned_garages_analyze.Name = "btn_owned_garages_analyze";
this.btn_owned_garages_analyze.Size = new System.Drawing.Size(137, 23);
this.btn_owned_garages_analyze.TabIndex = 2;
this.btn_owned_garages_analyze.Text = "Analyze";
this.btn_owned_garages_analyze.UseVisualStyleBackColor = true;
this.btn_owned_garages_analyze.Visible = false;
//
// tbl_add_garage
//
this.tbl_add_garage.ColumnCount = 1;
this.tbl_add_garage.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tbl_add_garage.Controls.Add(this.lbl_garage_name, 0, 0);
this.tbl_add_garage.Controls.Add(this.txt_garage_name, 0, 1);
this.tbl_add_garage.Controls.Add(this.cb_garage_size, 0, 2);
this.tbl_add_garage.Controls.Add(this.btn_garage_unlock, 0, 3);
this.tbl_add_garage.Controls.Add(this.btn_garage_unlock_all, 0, 4);
this.tbl_add_garage.Location = new System.Drawing.Point(161, 12);
this.tbl_add_garage.Name = "tbl_add_garage";
this.tbl_add_garage.RowCount = 5;
this.tbl_add_garage.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tbl_add_garage.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tbl_add_garage.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tbl_add_garage.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tbl_add_garage.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tbl_add_garage.Size = new System.Drawing.Size(153, 151);
this.tbl_add_garage.TabIndex = 1;
//
// lbl_garage_name
//
this.lbl_garage_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_garage_name.AutoSize = true;
this.lbl_garage_name.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_garage_name.Location = new System.Drawing.Point(3, 5);
this.lbl_garage_name.Name = "lbl_garage_name";
this.lbl_garage_name.Size = new System.Drawing.Size(147, 19);
this.lbl_garage_name.TabIndex = 0;
this.lbl_garage_name.Text = "Enter garage name:";
this.lbl_garage_name.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// txt_garage_name
//
this.txt_garage_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txt_garage_name.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txt_garage_name.Location = new System.Drawing.Point(3, 33);
this.txt_garage_name.Name = "txt_garage_name";
this.txt_garage_name.Size = new System.Drawing.Size(147, 23);
this.txt_garage_name.TabIndex = 1;
//
// cb_garage_size
//
this.cb_garage_size.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.cb_garage_size.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cb_garage_size.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.cb_garage_size.Location = new System.Drawing.Point(3, 63);
this.cb_garage_size.Name = "cb_garage_size";
this.cb_garage_size.Size = new System.Drawing.Size(147, 23);
this.cb_garage_size.TabIndex = 2;
//
// btn_garage_unlock
//
this.btn_garage_unlock.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_garage_unlock.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_garage_unlock.Location = new System.Drawing.Point(3, 93);
this.btn_garage_unlock.Name = "btn_garage_unlock";
this.btn_garage_unlock.Size = new System.Drawing.Size(147, 23);
this.btn_garage_unlock.TabIndex = 3;
this.btn_garage_unlock.Text = "Unlock";
this.btn_garage_unlock.UseVisualStyleBackColor = true;
this.btn_garage_unlock.Click += new System.EventHandler(this.btn_garage_unlock_Click);
//
// btn_garage_unlock_all
//
this.btn_garage_unlock_all.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_garage_unlock_all.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_garage_unlock_all.Location = new System.Drawing.Point(3, 124);
this.btn_garage_unlock_all.Name = "btn_garage_unlock_all";
this.btn_garage_unlock_all.Size = new System.Drawing.Size(147, 23);
this.btn_garage_unlock_all.TabIndex = 4;
this.btn_garage_unlock_all.Text = "Unlock all";
this.btn_garage_unlock_all.UseVisualStyleBackColor = true;
this.btn_garage_unlock_all.Click += new System.EventHandler(this.btn_garage_unlock_all_Click);
//
// tbl_headquarter
//
this.tbl_headquarter.ColumnCount = 1;
this.tbl_headquarter.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tbl_headquarter.Controls.Add(this.lbl_headquarter, 0, 0);
this.tbl_headquarter.Controls.Add(this.txt_headquarter, 0, 1);
this.tbl_headquarter.Controls.Add(this.btn_headquarter_change, 0, 2);
this.tbl_headquarter.Location = new System.Drawing.Point(161, 169);
this.tbl_headquarter.Name = "tbl_headquarter";
this.tbl_headquarter.RowCount = 3;
this.tbl_headquarter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tbl_headquarter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tbl_headquarter.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tbl_headquarter.Size = new System.Drawing.Size(153, 89);
this.tbl_headquarter.TabIndex = 2;
//
// lbl_headquarter
//
this.lbl_headquarter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_headquarter.AutoSize = true;
this.lbl_headquarter.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_headquarter.Location = new System.Drawing.Point(3, 5);
this.lbl_headquarter.Name = "lbl_headquarter";
this.lbl_headquarter.Size = new System.Drawing.Size(147, 19);
this.lbl_headquarter.TabIndex = 0;
this.lbl_headquarter.Text = "Your headquarter:";
this.lbl_headquarter.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// txt_headquarter
//
this.txt_headquarter.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txt_headquarter.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txt_headquarter.Location = new System.Drawing.Point(3, 32);
this.txt_headquarter.Name = "txt_headquarter";
this.txt_headquarter.Size = new System.Drawing.Size(147, 23);
this.txt_headquarter.TabIndex = 1;
//
// btn_headquarter_change
//
this.btn_headquarter_change.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_headquarter_change.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_headquarter_change.Location = new System.Drawing.Point(3, 62);
this.btn_headquarter_change.Name = "btn_headquarter_change";
this.btn_headquarter_change.Size = new System.Drawing.Size(147, 23);
this.btn_headquarter_change.TabIndex = 2;
this.btn_headquarter_change.Text = "Change";
this.btn_headquarter_change.UseVisualStyleBackColor = true;
this.btn_headquarter_change.Click += new System.EventHandler(this.btn_headquarter_change_Click);
//
// tbl_visited_cities
//
this.tbl_visited_cities.ColumnCount = 1;
this.tbl_visited_cities.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tbl_visited_cities.Controls.Add(this.lbl_visited_cities, 0, 0);
this.tbl_visited_cities.Controls.Add(this.lb_visited_cities, 0, 1);
this.tbl_visited_cities.Location = new System.Drawing.Point(12, 281);
this.tbl_visited_cities.Name = "tbl_visited_cities";
this.tbl_visited_cities.RowCount = 2;
this.tbl_visited_cities.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.22843F));
this.tbl_visited_cities.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 84.77158F));
this.tbl_visited_cities.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tbl_visited_cities.Size = new System.Drawing.Size(140, 189);
this.tbl_visited_cities.TabIndex = 3;
//
// lbl_visited_cities
//
this.lbl_visited_cities.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_visited_cities.AutoSize = true;
this.lbl_visited_cities.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_visited_cities.Location = new System.Drawing.Point(3, 4);
this.lbl_visited_cities.Name = "lbl_visited_cities";
this.lbl_visited_cities.Size = new System.Drawing.Size(134, 19);
this.lbl_visited_cities.TabIndex = 0;
this.lbl_visited_cities.Text = "Visited cities";
this.lbl_visited_cities.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lb_visited_cities
//
this.lb_visited_cities.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lb_visited_cities.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lb_visited_cities.FormattingEnabled = true;
this.lb_visited_cities.ItemHeight = 15;
this.lb_visited_cities.Location = new System.Drawing.Point(3, 31);
this.lb_visited_cities.Name = "lb_visited_cities";
this.lb_visited_cities.SelectionMode = System.Windows.Forms.SelectionMode.None;
this.lb_visited_cities.Size = new System.Drawing.Size(134, 154);
this.lb_visited_cities.TabIndex = 1;
//
// tbl_add_city
//
this.tbl_add_city.ColumnCount = 1;
this.tbl_add_city.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tbl_add_city.Controls.Add(this.lbl_city_name, 0, 0);
this.tbl_add_city.Controls.Add(this.txt_city_name, 0, 1);
this.tbl_add_city.Controls.Add(this.btn_visit_city, 0, 2);
this.tbl_add_city.Controls.Add(this.btn_visit_all, 0, 3);
this.tbl_add_city.Location = new System.Drawing.Point(161, 302);
this.tbl_add_city.Name = "tbl_add_city";
this.tbl_add_city.RowCount = 4;
this.tbl_add_city.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_city.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_city.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_city.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_city.Size = new System.Drawing.Size(153, 138);
this.tbl_add_city.TabIndex = 4;
//
// lbl_city_name
//
this.lbl_city_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_city_name.AutoSize = true;
this.lbl_city_name.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_city_name.Location = new System.Drawing.Point(3, 7);
this.lbl_city_name.Name = "lbl_city_name";
this.lbl_city_name.Size = new System.Drawing.Size(147, 19);
this.lbl_city_name.TabIndex = 0;
this.lbl_city_name.Text = "Enter city name:";
this.lbl_city_name.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// txt_city_name
//
this.txt_city_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txt_city_name.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txt_city_name.Location = new System.Drawing.Point(3, 39);
this.txt_city_name.Name = "txt_city_name";
this.txt_city_name.Size = new System.Drawing.Size(147, 23);
this.txt_city_name.TabIndex = 1;
//
// btn_visit_city
//
this.btn_visit_city.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_visit_city.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_visit_city.Location = new System.Drawing.Point(3, 73);
this.btn_visit_city.Name = "btn_visit_city";
this.btn_visit_city.Size = new System.Drawing.Size(147, 23);
this.btn_visit_city.TabIndex = 2;
this.btn_visit_city.Text = "Visit";
this.btn_visit_city.UseVisualStyleBackColor = true;
this.btn_visit_city.Click += new System.EventHandler(this.btn_visit_city_Click);
//
// btn_visit_all
//
this.btn_visit_all.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_visit_all.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_visit_all.Location = new System.Drawing.Point(3, 108);
this.btn_visit_all.Name = "btn_visit_all";
this.btn_visit_all.Size = new System.Drawing.Size(147, 23);
this.btn_visit_all.TabIndex = 3;
this.btn_visit_all.Text = "Visit all";
this.btn_visit_all.UseVisualStyleBackColor = true;
this.btn_visit_all.Click += new System.EventHandler(this.btn_visit_all_Click);
//
// tbl_dealerships
//
this.tbl_dealerships.ColumnCount = 1;
this.tbl_dealerships.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tbl_dealerships.Controls.Add(this.lb_dealerships, 0, 1);
this.tbl_dealerships.Controls.Add(this.lbl_dealership, 0, 0);
this.tbl_dealerships.Location = new System.Drawing.Point(338, 36);
this.tbl_dealerships.Name = "tbl_dealerships";
this.tbl_dealerships.RowCount = 2;
this.tbl_dealerships.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 14.81481F));
this.tbl_dealerships.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 85.18519F));
this.tbl_dealerships.Size = new System.Drawing.Size(140, 189);
this.tbl_dealerships.TabIndex = 5;
//
// lb_dealerships
//
this.lb_dealerships.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lb_dealerships.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lb_dealerships.FormattingEnabled = true;
this.lb_dealerships.ItemHeight = 15;
this.lb_dealerships.Location = new System.Drawing.Point(3, 30);
this.lb_dealerships.Name = "lb_dealerships";
this.lb_dealerships.SelectionMode = System.Windows.Forms.SelectionMode.None;
this.lb_dealerships.Size = new System.Drawing.Size(134, 154);
this.lb_dealerships.TabIndex = 0;
//
// lbl_dealership
//
this.lbl_dealership.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_dealership.AutoSize = true;
this.lbl_dealership.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_dealership.Location = new System.Drawing.Point(3, 4);
this.lbl_dealership.Name = "lbl_dealership";
this.lbl_dealership.Size = new System.Drawing.Size(134, 19);
this.lbl_dealership.TabIndex = 9;
this.lbl_dealership.Text = "Dealerships";
this.lbl_dealership.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// tbl_agencies
//
this.tbl_agencies.ColumnCount = 1;
this.tbl_agencies.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tbl_agencies.Controls.Add(this.lbl_agencies, 0, 0);
this.tbl_agencies.Controls.Add(this.lb_agencies, 0, 1);
this.tbl_agencies.Location = new System.Drawing.Point(338, 281);
this.tbl_agencies.Name = "tbl_agencies";
this.tbl_agencies.RowCount = 2;
this.tbl_agencies.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 15.34391F));
this.tbl_agencies.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 84.65608F));
this.tbl_agencies.Size = new System.Drawing.Size(140, 189);
this.tbl_agencies.TabIndex = 6;
//
// lbl_agencies
//
this.lbl_agencies.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_agencies.AutoSize = true;
this.lbl_agencies.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_agencies.Location = new System.Drawing.Point(3, 4);
this.lbl_agencies.Name = "lbl_agencies";
this.lbl_agencies.Size = new System.Drawing.Size(134, 19);
this.lbl_agencies.TabIndex = 10;
this.lbl_agencies.Text = "Agencies";
this.lbl_agencies.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// lb_agencies
//
this.lb_agencies.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lb_agencies.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lb_agencies.FormattingEnabled = true;
this.lb_agencies.ItemHeight = 15;
this.lb_agencies.Location = new System.Drawing.Point(3, 31);
this.lb_agencies.Name = "lb_agencies";
this.lb_agencies.SelectionMode = System.Windows.Forms.SelectionMode.None;
this.lb_agencies.Size = new System.Drawing.Size(134, 154);
this.lb_agencies.TabIndex = 9;
//
// tbl_add_dealer
//
this.tbl_add_dealer.ColumnCount = 1;
this.tbl_add_dealer.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tbl_add_dealer.Controls.Add(this.lbl_dealer_name, 0, 0);
this.tbl_add_dealer.Controls.Add(this.txt_dealer_name, 0, 1);
this.tbl_add_dealer.Controls.Add(this.btn_dealer_research_all, 0, 3);
this.tbl_add_dealer.Controls.Add(this.btn_dealer_research, 0, 2);
this.tbl_add_dealer.Location = new System.Drawing.Point(484, 65);
this.tbl_add_dealer.Name = "tbl_add_dealer";
this.tbl_add_dealer.RowCount = 4;
this.tbl_add_dealer.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_dealer.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_dealer.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_dealer.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_dealer.Size = new System.Drawing.Size(168, 138);
this.tbl_add_dealer.TabIndex = 7;
//
// lbl_dealer_name
//
this.lbl_dealer_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_dealer_name.AutoSize = true;
this.lbl_dealer_name.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_dealer_name.Location = new System.Drawing.Point(3, 7);
this.lbl_dealer_name.Name = "lbl_dealer_name";
this.lbl_dealer_name.Size = new System.Drawing.Size(162, 19);
this.lbl_dealer_name.TabIndex = 9;
this.lbl_dealer_name.Text = "Enter dealership name:";
this.lbl_dealer_name.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// txt_dealer_name
//
this.txt_dealer_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txt_dealer_name.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txt_dealer_name.Location = new System.Drawing.Point(3, 39);
this.txt_dealer_name.Name = "txt_dealer_name";
this.txt_dealer_name.Size = new System.Drawing.Size(162, 23);
this.txt_dealer_name.TabIndex = 9;
//
// btn_dealer_research_all
//
this.btn_dealer_research_all.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_dealer_research_all.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_dealer_research_all.Location = new System.Drawing.Point(3, 108);
this.btn_dealer_research_all.Name = "btn_dealer_research_all";
this.btn_dealer_research_all.Size = new System.Drawing.Size(162, 23);
this.btn_dealer_research_all.TabIndex = 10;
this.btn_dealer_research_all.Text = "Research All";
this.btn_dealer_research_all.UseVisualStyleBackColor = true;
this.btn_dealer_research_all.Click += new System.EventHandler(this.dealer_agency_research_all_Click);
//
// btn_dealer_research
//
this.btn_dealer_research.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_dealer_research.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_dealer_research.Location = new System.Drawing.Point(3, 73);
this.btn_dealer_research.Name = "btn_dealer_research";
this.btn_dealer_research.Size = new System.Drawing.Size(162, 23);
this.btn_dealer_research.TabIndex = 9;
this.btn_dealer_research.Text = "Research";
this.btn_dealer_research.UseVisualStyleBackColor = true;
this.btn_dealer_research.Click += new System.EventHandler(this.dealer_agency_research_Click);
//
// tbl_add_agency
//
this.tbl_add_agency.ColumnCount = 1;
this.tbl_add_agency.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tbl_add_agency.Controls.Add(this.btn_agency_research_all, 0, 3);
this.tbl_add_agency.Controls.Add(this.txt_agency_name, 0, 1);
this.tbl_add_agency.Controls.Add(this.btn_agency_research, 0, 2);
this.tbl_add_agency.Controls.Add(this.lbl_agency_name, 0, 0);
this.tbl_add_agency.Location = new System.Drawing.Point(484, 309);
this.tbl_add_agency.Name = "tbl_add_agency";
this.tbl_add_agency.RowCount = 4;
this.tbl_add_agency.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_agency.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_agency.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_agency.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tbl_add_agency.Size = new System.Drawing.Size(168, 131);
this.tbl_add_agency.TabIndex = 8;
//
// btn_agency_research_all
//
this.btn_agency_research_all.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_agency_research_all.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_agency_research_all.Location = new System.Drawing.Point(3, 102);
this.btn_agency_research_all.Name = "btn_agency_research_all";
this.btn_agency_research_all.Size = new System.Drawing.Size(162, 23);
this.btn_agency_research_all.TabIndex = 12;
this.btn_agency_research_all.Text = "Research All";
this.btn_agency_research_all.UseVisualStyleBackColor = true;
this.btn_agency_research_all.Click += new System.EventHandler(this.dealer_agency_research_all_Click);
//
// txt_agency_name
//
this.txt_agency_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.txt_agency_name.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txt_agency_name.Location = new System.Drawing.Point(3, 36);
this.txt_agency_name.Name = "txt_agency_name";
this.txt_agency_name.Size = new System.Drawing.Size(162, 23);
this.txt_agency_name.TabIndex = 10;
//
// btn_agency_research
//
this.btn_agency_research.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.btn_agency_research.Font = new System.Drawing.Font("Calibri", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.btn_agency_research.Location = new System.Drawing.Point(3, 68);
this.btn_agency_research.Name = "btn_agency_research";
this.btn_agency_research.Size = new System.Drawing.Size(162, 23);
this.btn_agency_research.TabIndex = 11;
this.btn_agency_research.Text = "Research";
this.btn_agency_research.UseVisualStyleBackColor = true;
this.btn_agency_research.Click += new System.EventHandler(this.dealer_agency_research_Click);
//
// lbl_agency_name
//
this.lbl_agency_name.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.lbl_agency_name.AutoSize = true;
this.lbl_agency_name.Font = new System.Drawing.Font("Calibri", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.lbl_agency_name.Location = new System.Drawing.Point(3, 6);
this.lbl_agency_name.Name = "lbl_agency_name";
this.lbl_agency_name.Size = new System.Drawing.Size(162, 19);
this.lbl_agency_name.TabIndex = 10;
this.lbl_agency_name.Text = "Enter agency name:";
this.lbl_agency_name.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// SecondForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(659, 481);
this.Controls.Add(this.tbl_add_agency);
this.Controls.Add(this.tbl_add_dealer);
this.Controls.Add(this.tbl_agencies);
this.Controls.Add(this.tbl_dealerships);
this.Controls.Add(this.tbl_add_city);
this.Controls.Add(this.tbl_visited_cities);
this.Controls.Add(this.tbl_headquarter);
this.Controls.Add(this.tbl_add_garage);
this.Controls.Add(this.tbl_owned_garages);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "SecondForm";
this.Text = "Unlock garages, cities and etc...";
this.Load += new System.EventHandler(this.SecondForm_Load);
this.tbl_owned_garages.ResumeLayout(false);
this.tbl_owned_garages.PerformLayout();
this.tbl_add_garage.ResumeLayout(false);
this.tbl_add_garage.PerformLayout();
this.tbl_headquarter.ResumeLayout(false);
this.tbl_headquarter.PerformLayout();
this.tbl_visited_cities.ResumeLayout(false);
this.tbl_visited_cities.PerformLayout();
this.tbl_add_city.ResumeLayout(false);
this.tbl_add_city.PerformLayout();
this.tbl_dealerships.ResumeLayout(false);
this.tbl_dealerships.PerformLayout();
this.tbl_agencies.ResumeLayout(false);
this.tbl_agencies.PerformLayout();
this.tbl_add_dealer.ResumeLayout(false);
this.tbl_add_dealer.PerformLayout();
this.tbl_add_agency.ResumeLayout(false);
this.tbl_add_agency.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tbl_owned_garages;
private System.Windows.Forms.ListBox lb_owned_garages;
private System.Windows.Forms.Label lbl_owned_garages;
private System.Windows.Forms.Button btn_owned_garages_analyze;
private System.Windows.Forms.TableLayoutPanel tbl_add_garage;
private System.Windows.Forms.Label lbl_garage_name;
private System.Windows.Forms.TextBox txt_garage_name;
private System.Windows.Forms.ComboBox cb_garage_size;
private System.Windows.Forms.Button btn_garage_unlock;
private System.Windows.Forms.Button btn_garage_unlock_all;
private System.Windows.Forms.TableLayoutPanel tbl_headquarter;
private System.Windows.Forms.Label lbl_headquarter;
private System.Windows.Forms.TextBox txt_headquarter;
private System.Windows.Forms.Button btn_headquarter_change;
private System.Windows.Forms.TableLayoutPanel tbl_visited_cities;
private System.Windows.Forms.Label lbl_visited_cities;
private System.Windows.Forms.ListBox lb_visited_cities;
private System.Windows.Forms.TableLayoutPanel tbl_add_city;
private System.Windows.Forms.Label lbl_city_name;
private System.Windows.Forms.TextBox txt_city_name;
private System.Windows.Forms.Button btn_visit_city;
private System.Windows.Forms.Button btn_visit_all;
private System.Windows.Forms.TableLayoutPanel tbl_dealerships;
private System.Windows.Forms.ListBox lb_dealerships;
private System.Windows.Forms.Label lbl_dealership;
private System.Windows.Forms.TableLayoutPanel tbl_agencies;
private System.Windows.Forms.Label lbl_agencies;
private System.Windows.Forms.ListBox lb_agencies;
private System.Windows.Forms.TableLayoutPanel tbl_add_dealer;
private System.Windows.Forms.Label lbl_dealer_name;
private System.Windows.Forms.TextBox txt_dealer_name;
private System.Windows.Forms.Button btn_dealer_research_all;
private System.Windows.Forms.Button btn_dealer_research;
private System.Windows.Forms.TableLayoutPanel tbl_add_agency;
private System.Windows.Forms.Button btn_agency_research_all;
private System.Windows.Forms.TextBox txt_agency_name;
private System.Windows.Forms.Button btn_agency_research;
private System.Windows.Forms.Label lbl_agency_name;
}
}

344
SecondForm.cs Normal file
View File

@@ -0,0 +1,344 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System.Windows.Forms;
namespace SaveWizard_rewritten
{
public partial class SecondForm: Form
{
private readonly Dictionary<string, List<int>> garages_stat = new Dictionary<string, List<int>>
{
{ "Small", new List<int>{ 1, 1 } },
{ "Medium", new List<int>{ 2, 3 } },
{ "Big", new List<int>{ 3, 5 } },
};
private readonly string selected_game;
private readonly Dictionary<string, bool> owns = null;
private List<string> dealers = null;
private List<string> agencies = null;
private List<string> AllCities()
{
List<string> cities = new List<string>();
string city;
foreach (string line in RegexHandler.GetArrayItems("companies:"))
{
city = Regex.Match(line, "company.volatile.[a-z0-9_]+[.]([a-z_]+)").Groups[1].ToString();
if (!cities.Contains(city))
cities.Add(city);
}
return cities;
}
private void AddVehiclesAndDrivers(int start_line, int garage_size)
{
int vehicles_array = RegexHandler.SearchLine("vehicles:", start: start_line);
int drivers_array = RegexHandler.SearchLine("drivers:", start: start_line);
for (int i = 1; i <= garage_size; i++)
{
RegexHandler.AddArrayValue(vehicles_array, "null");
RegexHandler.AddArrayValue(drivers_array + i, "null");
}
}
private List<string> PurchasedGarages()
{
List<string> garages = new List<string>();
string city;
foreach (int index in RegexHandler.SearchAllLines("garage : garage."))
{
city = Regex.Match(RegexHandler.GetLine(index), "garage : garage.(.+) {$").Groups[1].ToString();
if (RegexHandler.GetValue(RegexHandler.SearchLine("status:", start: index)) != "0")
garages.Add(city);
}
return garages;
}
private void CheckGarages()
{
lb_owned_garages.Items.Clear();
List<string> owned_garages = PurchasedGarages();
foreach (string garage in owned_garages)
lb_owned_garages.Items.Add(garage);
}
private void CheckCities()
{
txt_headquarter.Text = RegexHandler.GetValue(RegexHandler.SearchLine("hq_city:"));
lb_visited_cities.Items.Clear();
List<string> visited_cities = RegexHandler.GetArrayItems("visited_cities:");
if (visited_cities == null)
{
lb_visited_cities.Items.Add("No cities visited yet.");
return;
}
foreach (string city in visited_cities)
lb_visited_cities.Items.Add(city);
}
private void CheckDealers()
{
lb_dealerships.Items.Clear();
List<string> visited_dealers = RegexHandler.GetArrayItems("unlocked_dealers:");
if (visited_dealers == null)
{
lb_dealerships.Items.Add("No dealerships unlocked yet.");
return;
}
foreach (string city in visited_dealers)
lb_dealerships.Items.Add(city);
}
private void CheckAgencies()
{
lb_agencies.Items.Clear();
List<string> visited_agencies = RegexHandler.GetArrayItems("unlocked_recruitments:");
if (visited_agencies == null)
{
lb_agencies.Items.Add("No recruitment agencies unlocked yet.");
return;
}
foreach (string city in visited_agencies)
lb_agencies.Items.Add(city);
}
public SecondForm(string _selected_game, Dictionary<string, bool> _owns)
{
InitializeComponent();
selected_game = _selected_game;
//owns = new Dictionary<string, bool>(_owns);
owns = _owns;
KeyValuePair<string, string>[] kvpArr = new KeyValuePair<string, string>[] {
new KeyValuePair<string, string>("Small", "Small"),
new KeyValuePair<string, string>("Medium", "Medium"),
new KeyValuePair<string, string>("Big", "Big"),
};
cb_garage_size.DataSource = kvpArr;
cb_garage_size.DisplayMember = "value";
cb_garage_size.ValueMember = "key";
}
private void SecondForm_Load(object sender, EventArgs e)
{
if (selected_game != null && owns != null)
{
string config_path = $"configs/{selected_game}";
if (File.Exists($"{config_path}/dealers.json"))
{
dealers = new List<string>();
Dictionary<string, string[]> dealers_file = JsonConvert.DeserializeObject<Dictionary<string, string[]>>(File.ReadAllText($"{config_path}/dealers.json"));
foreach (KeyValuePair<string, bool> dlc in owns)
if (dlc.Value)
if (dealers_file.Keys.Contains(dlc.Key))
dealers.AddRange(dealers_file[dlc.Key]);
}
else
{
txt_dealer_name.Enabled = false;
btn_dealer_research.Enabled = false;
btn_dealer_research_all.Enabled = false;
}
if (File.Exists($"{config_path}/agencies.json"))
{
agencies = new List<string>();
Dictionary<string, string[]> agencies_file = JsonConvert.DeserializeObject<Dictionary<string, string[]>>(File.ReadAllText($"{config_path}/agencies.json"));
foreach (KeyValuePair<string, bool> dlc in owns)
if (dlc.Value)
if (agencies_file.Keys.Contains(dlc.Key))
agencies.AddRange(agencies_file[dlc.Key]);
}
else
{
txt_agency_name.Enabled = false;
btn_agency_research.Enabled = false;
btn_agency_research_all.Enabled = false;
}
CheckGarages();
CheckCities();
CheckDealers();
CheckAgencies();
}
}
private void btn_garage_unlock_Click(object sender, EventArgs e)
{
string garage = txt_garage_name.Text.ToLower();
if (string.IsNullOrWhiteSpace(garage))
{
Utils.ShowError("Enter city name!");
return;
}
int garage_line = RegexHandler.SearchLine($"garage : garage.{garage} {{");
if (garage_line == 0)
{
Utils.ShowError($"Garage in \"{garage}\" not found.");
return;
}
int garage_status = RegexHandler.SearchLineInUnit("status:", $"garage.{garage}");
if (RegexHandler.GetValue(garage_status) != "0")
{
Utils.ShowError($"Garage in \"{garage}\" already unlocked.");
return;
}
List<int> garage_stat = garages_stat[cb_garage_size.SelectedValue.ToString()];
RegexHandler.SetValue(garage_status, garage_stat[0].ToString());
AddVehiclesAndDrivers(garage_status, garage_stat[1]);
Utils.ShowInfo($"Garage in \"{garage}\" successfully unlocked.");
CheckGarages();
}
private void btn_garage_unlock_all_Click(object sender, EventArgs e)
{
List<int> garage_stat = garages_stat[cb_garage_size.SelectedValue.ToString()];
string garage_match;
int current_garage, current_status;
foreach (string item in RegexHandler.GetArrayItems("garages:"))
{
garage_match = Regex.Match(item, "garage.(.+)$").Groups[1].ToString();
current_garage = RegexHandler.SearchLine($"garage : garage.{garage_match} {{");
current_status = RegexHandler.SearchLine("status:", start: current_garage);
if (RegexHandler.GetValue(current_status) == "0")
{
RegexHandler.SetValue(current_status, garage_stat[0].ToString());
AddVehiclesAndDrivers(current_garage, garage_stat[1]);
}
}
Utils.ShowInfo("All garages successfully unlocked.");
CheckGarages();
}
private void btn_headquarter_change_Click(object sender, EventArgs e)
{
string hq = txt_headquarter.Text.ToLower();
if (string.IsNullOrWhiteSpace(hq))
{
Utils.ShowError("Enter city name!");
return;
}
if (RegexHandler.GetValue(RegexHandler.SearchLine("hq_city:")) == hq)
Utils.ShowInfo("Your headquarter is already in this city.");
else if (!PurchasedGarages().Contains(hq))
Utils.ShowError($"You need a garage in \"{hq}\" to set headquarter.");
else
{
RegexHandler.SetValue(RegexHandler.SearchLine("hq_city:"), hq);
Utils.ShowInfo($"Headquarter successfully set to \"{hq}\".");
}
}
private void btn_visit_city_Click(object sender, EventArgs e)
{
string city = txt_city_name.Text.ToLower();
if (string.IsNullOrWhiteSpace(city))
{
Utils.ShowError("Enter city name!");
return;
}
txt_city_name.Text = "";
if (RegexHandler.GetArrayItems("visited_cities:").Contains(city))
{
Utils.ShowError($"You've already visited \"{city}\".");
return;
}
RegexHandler.AddArrayValue(RegexHandler.SearchLine("visited_cities:"), city);
RegexHandler.AddArrayValue(RegexHandler.SearchLine("visited_cities_count:"), "1");
Utils.ShowInfo($"City \"{city}\" successfully visited.");
}
private void btn_visit_all_Click(object sender, EventArgs e)
{
List<string> all_cities = AllCities();
List<string> visited_cities = RegexHandler.GetArrayItems("visited_cities:");
foreach (string city in all_cities)
{
if (!visited_cities.Contains(city))
{
RegexHandler.AddArrayValue(RegexHandler.SearchLine("visited_cities:"), city);
RegexHandler.AddArrayValue(RegexHandler.SearchLine("visited_cities_count:"), "1");
}
}
Utils.ShowInfo("All cities successfully visited.");
CheckCities();
}
private void dealer_agency_research_Click(object sender, EventArgs e)
{
TextBox new_city;
List<string> cities_list;
Action check_func;
string search_line, message;
if ((sender as Button) == btn_dealer_research)
{
new_city = txt_dealer_name;
cities_list = dealers;
search_line = "unlocked_dealers:";
check_func = CheckDealers;
message = "Dealership";
}
else
{
new_city = txt_agency_name;
cities_list = agencies;
search_line = "unlocked_recruitments:";
check_func = CheckAgencies;
message = "Recruitment agency";
}
string element = new_city.Text.ToLower();
if (string.IsNullOrWhiteSpace(element))
{
Utils.ShowError("Enter city name!");
return;
}
new_city.Text = "";
if (!cities_list.Contains(element))
{
Utils.ShowError($"There is no {message.ToLower()} in that city.");
return;
}
List<string> already_visited = RegexHandler.GetArrayItems(search_line);
if (already_visited != null && already_visited.Contains(element))
{
Utils.ShowInfo($"{message} in \"{element}\" is already unlocked.");
return;
}
RegexHandler.AddArrayValue(RegexHandler.SearchLine(search_line), element);
Utils.ShowInfo($"{message} in \"{element}\" successfully unlocked.");
check_func();
}
private void dealer_agency_research_all_Click(object sender, EventArgs e)
{
List<string> cities_list;
string search_line, message;
Action check_func;
if ((sender as Button) == btn_dealer_research_all)
{
cities_list = dealers;
search_line = "unlocked_dealers:";
check_func = CheckDealers;
message = "All dealerships unlocked.";
}
else
{
cities_list = agencies;
search_line = "unlocked_recruitments:";
check_func = CheckAgencies;
message = "All recruitment agencies unlocked.";
}
List<string> all_cities = AllCities();
int file_line = RegexHandler.SearchLine(search_line);
List<string> unlocked_cities = RegexHandler.GetArrayItems(search_line);
foreach (string element in cities_list)
if (all_cities.Contains(element) && (unlocked_cities == null || !unlocked_cities.Contains(element)))
RegexHandler.AddArrayValue(file_line, element);
Utils.ShowInfo(message);
check_func();
}
}
}

120
SecondForm.resx Normal file
View File

@@ -0,0 +1,120 @@
<?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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>