Skip to content

Commit

Permalink
System Tag&Write Info&Profile files only If Edited [update]
Browse files Browse the repository at this point in the history
  • Loading branch information
LIPtoH committed Nov 27, 2023
1 parent 1a614bc commit c0a3356
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 29 deletions.
2 changes: 2 additions & 0 deletions TS SE Tool/CustomClasses/Save/SaveFileInfoData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ class SaveFileInfoData : SiiNBlockCore
internal List<Dependency> Dependencies { get; set; } = new List<Dependency>();

//
internal bool isEdited { get; set; } = false;

int unsortedOrder = 0;

Dictionary<int, List<string>> unsortedDataDict = new Dictionary<int, List<string>>();
Expand Down
42 changes: 22 additions & 20 deletions TS SE Tool/CustomClasses/Save/SaveFileProfileData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,20 @@ class SaveFileProfileData : SiiNBlockCore
internal string UserProfileNameless { get; set; } = "";

//---
public bool GenederMale { get; set; } = false;
internal bool GenderMale { get; set; } = false;
internal ushort Face { get; set; } = 0;
internal string Brand { get; set; } = "";

public string Logo { get; set; } = "";
internal string Logo { get; set; } = "";

internal SCS_String CompanyName { get; set; } = "";

//---
internal string MapPath { get; set; } = "";

//---
public uint CachedExperiencePoints { get; set; } = 0;
public uint CachedDistance { get; set; } = 0;
internal uint CachedExperiencePoints { get; set; } = 0;
internal uint CachedDistance { get; set; } = 0;

//---
#region UserData
Expand All @@ -57,20 +57,20 @@ class SaveFileProfileData : SiiNBlockCore
internal string ud1_WoTLicensePlate { get; set; } = ""; //1 WoT licenseplate
internal string ud2_SomeCheckSum { get; set; } = ""; //2 ???
internal byte? ud3_WoTConnected { get; set; } = null; //3 isWoTConnected?
public decimal ud4_RoadsExplored { get; set; } = 0.0M; //4 Road explored persentage
public uint ud5_DeliveriesFinished { get; set; } = 0; //5 Finished deliveries
public uint ud6_OwnedTrucks { get; set; } = 0; //6 Owned trucks count
public uint ud7_OwnedGaradesSmall { get; set; } = 0; //7 Small garages
public uint ud8_OwnedGaradesLarge { get; set; } = 0; //8 Large garages
public ulong ud9_GameTimeSpent { get; set; } = 0; //9 Game time spent
public uint ud10_RealTimeSpent { get; set; } = 0; //10 Real time spent
public string ud11_CurrentTruck { get; set; } = ""; //11 Current truck //brand.model
public List<string> ud12_OwnedTruckList = new List<string>(); //12 Owned trucks //brand.model:count,brand.model:count,...;
internal decimal ud4_RoadsExplored { get; set; } = 0.0M; //4 Road explored persentage
internal uint ud5_DeliveriesFinished { get; set; } = 0; //5 Finished deliveries
internal uint ud6_OwnedTrucks { get; set; } = 0; //6 Owned trucks count
internal uint ud7_OwnedGaradesSmall { get; set; } = 0; //7 Small garages
internal uint ud8_OwnedGaradesLarge { get; set; } = 0; //8 Large garages
internal ulong ud9_GameTimeSpent { get; set; } = 0; //9 Game time spent
internal uint ud10_RealTimeSpent { get; set; } = 0; //10 Real time spent
internal string ud11_CurrentTruck { get; set; } = ""; //11 Current truck //brand.model

internal List<string> ud12_OwnedTruckList = new List<string>(); //12 Owned trucks //brand.model:count,brand.model:count,...;
internal string ud13_SomeUserData { get; set; } = ""; //13 ???
internal uint? ud14_SomeUserData { get; set; } = null; //14 ??? //0
internal string ud15_SomeUserData { get; set; } = ""; //15 ??? //production
public uint ud16_OwnedTrailers { get; set; } = 0; //16 Owned trailers
internal uint ud16_OwnedTrailers { get; set; } = 0; //16 Owned trailers

#region user data backend

Expand Down Expand Up @@ -260,11 +260,13 @@ private string user_data_16

internal SCS_String ProfileName { get; set; } = "";

public uint CreationTime { get; set; } = 0;
public uint SaveTime { get; set; } = 0;
internal uint CreationTime { get; set; } = 0;
internal uint SaveTime { get; set; } = 0;

//====


internal bool isEdited { get; set; } = false;

int unsortedOrder = 0;

Dictionary<int, List<string>> unsortedDataDict = new Dictionary<int, List<string>>();
Expand Down Expand Up @@ -363,7 +365,7 @@ public void ProcessData(string[] _fileLines)

case "male":
{
GenederMale = bool.Parse(dataLine);
GenderMale = bool.Parse(dataLine);
break;
}

Expand Down Expand Up @@ -521,7 +523,7 @@ public string PrintOut()
sbResult.AppendLine(" map_path: " + MapPath);
sbResult.AppendLine(" logo: " + Logo);
sbResult.AppendLine(" company_name: " + CompanyName.ToString());
sbResult.AppendLine(" male: " + GenederMale.ToString().ToLower());
sbResult.AppendLine(" male: " + GenderMale.ToString().ToLower());
sbResult.AppendLine(" cached_experience: " + CachedExperiencePoints.ToString());
sbResult.AppendLine(" cached_distance: " + CachedDistance.ToString());

Expand Down
6 changes: 5 additions & 1 deletion TS SE Tool/Forms/MainTabs/FormMethodsCompanyTab.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,11 @@ private void textBoxUserCompanyCompanyName_TextChanged(object sender, EventArgs

labelCompanyNameSize.Text = textBoxUserCompanyCompanyName.Text.Length.ToString() + " / 20";

MainSaveFileProfileData.CompanyName = new Save.DataFormat.SCS_String(textBoxUserCompanyCompanyName.Text);
if (textBoxUserCompanyCompanyName.Text != MainSaveFileProfileData.CompanyName.Value)
{
MainSaveFileProfileData.isEdited = true;
MainSaveFileProfileData.CompanyName = new Save.DataFormat.SCS_String(textBoxUserCompanyCompanyName.Text);
}
}

private void textBoxUserCompanyCompanyName_Validating(object sender, CancelEventArgs e)
Expand Down
18 changes: 10 additions & 8 deletions TS SE Tool/MethodsReadWrite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -996,16 +996,18 @@ private void NewWrireSaveFile(object sender, DoWorkEventArgs e)
File.Copy(SiiSavePath, SiiSavePathBackup, true);

//Write Profile data
using (StreamWriter writer = new StreamWriter(ProfileFolderPath, false))
{
writer.Write(MainSaveFileProfileData.PrintOut());
}
if (MainSaveFileProfileData.isEdited)
using (StreamWriter writer = new StreamWriter(ProfileFolderPath, false))
{
writer.Write(MainSaveFileProfileData.PrintOut());
}

//Write Info data
using (StreamWriter writer = new StreamWriter(SiiInfoPath, false))
{
writer.Write(MainSaveFileInfoData.PrintOut());
}
if (MainSaveFileInfoData.isEdited)
using (StreamWriter writer = new StreamWriter(SiiInfoPath, false))
{
writer.Write(MainSaveFileInfoData.PrintOut());
}

//Write Save data
using (StreamWriter writer = new StreamWriter(SiiSavePath, false))
Expand Down

0 comments on commit c0a3356

Please sign in to comment.