Skip to content

Commit

Permalink
Steam profiles Settings Import & Export
Browse files Browse the repository at this point in the history
  • Loading branch information
LIPtoH committed Jun 28, 2021
1 parent 61a7d1a commit 9258092
Show file tree
Hide file tree
Showing 5 changed files with 145 additions and 67 deletions.
2 changes: 1 addition & 1 deletion TS SE Tool/FormMain.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion TS SE Tool/FormMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public partial class FormMain : Form

public PlainTXTResourceManager ResourceManagerMain;

private Dictionary<string, string> dictionaryProfiles;
internal Dictionary<string, string> dictionaryProfiles;
public Dictionary<string, string> CompaniesLngDict, CargoLngDict, TruckBrandsLngDict, CountriesLngDict, UrgencyLngDict, DriverNames;

public static Dictionary<string, string> CitiesLngDict;//, CustomStringsDict;
Expand Down
27 changes: 15 additions & 12 deletions TS SE Tool/Forms/FormMainControlsMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,9 @@ public void FillAllProfilesPaths()
dc = new DataColumn("ProfileName", typeof(string));
combDT.Columns.Add(dc);

dc = new DataColumn("ProfileType", typeof(string));
combDT.Columns.Add(dc);

List<string> tempList = new List<string>();

if (MyDocFolderEx || SteamFolderEx)
Expand All @@ -478,7 +481,7 @@ public void FillAllProfilesPaths()
{
if (Directory.Exists(folder) && Directory.GetDirectories(folder).Count() > 0)
{
combDT.Rows.Add(folder, "[L] " + Path.GetFileName(folder));
combDT.Rows.Add(folder, "[L] " + Path.GetFileName(folder), "local");
tempList.Add(folder);
}
}
Expand All @@ -492,7 +495,7 @@ public void FillAllProfilesPaths()
{
if (Directory.Exists(folder) && Directory.GetDirectories(folder).Count() > 0)
{
combDT.Rows.Add(folder, "[S] " + Path.GetFileName(folder));
combDT.Rows.Add(folder, "[S] " + Path.GetFileName(folder), "steam");
tempList.Add(folder);
}
}
Expand All @@ -507,7 +510,7 @@ public void FillAllProfilesPaths()

if (Directory.Exists(folder) && Directory.GetDirectories(folder).Count() > 0)
{
combDT.Rows.Add(folder, "[L] profiles");
combDT.Rows.Add(folder, "[L] profiles", "local");
tempList.Add(folder);
}
}
Expand All @@ -517,7 +520,7 @@ public void FillAllProfilesPaths()

if (Directory.Exists(folder) && Directory.GetDirectories(folder).Count() > 0)
{
combDT.Rows.Add(folder, "[S] profiles");
combDT.Rows.Add(folder, "[S] profiles", "steam");
tempList.Add(folder);
}
}
Expand All @@ -532,12 +535,12 @@ public void FillAllProfilesPaths()
{
if (Directory.Exists(CustPath + @"\profiles"))
{
combDT.Rows.Add(CustPath + @"\profiles", "[C] Custom path " + cpIndex.ToString());
combDT.Rows.Add(CustPath + @"\profiles", "[C] Custom path " + cpIndex.ToString(), "custom");
tempList.Add(CustPath + @"\profiles");
}
else
{
combDT.Rows.Add(CustPath, "[C] Custom path " + cpIndex.ToString());
combDT.Rows.Add(CustPath, "[C] Custom path " + cpIndex.ToString(), "custom");
tempList.Add(CustPath);
}
}
Expand Down Expand Up @@ -624,7 +627,7 @@ public void FillProfiles()
return;
}

string Profile = "";
string ProfileName = "";
string SelectedFolder = "";
SelectedFolder = comboBoxPrevProfiles.SelectedValue.ToString();

Expand All @@ -648,25 +651,25 @@ public void FillProfiles()

dc = new DataColumn("ProfileName", typeof(string));
combDT.Columns.Add(dc);

List<string> NewProfileHex = new List<string>();

if (!includedFiles.Contains("game.sii"))
{
foreach (string profile in Globals.ProfilesHex)
{
Profile = Utilities.TextUtilities.FromHexToString(Path.GetFileName(profile));
if (Profile != null && Directory.Exists(profile + @"\save"))
ProfileName = Utilities.TextUtilities.FromHexToString(Path.GetFileName(profile));

if (ProfileName != null && Directory.Exists(profile + @"\save"))
{
combDT.Rows.Add(profile, Profile);
combDT.Rows.Add(profile, ProfileName);
NewProfileHex.Add(profile);
}
}
}
else
{
NewProfileHex.Add(SelectedFolder);
combDT.Rows.Add(SelectedFolder, "[C] Custom profile");
combDT.Rows.Add(SelectedFolder, "[C] Custom profile", "custom");
}

Globals.ProfilesHex = NewProfileHex;
Expand Down
12 changes: 11 additions & 1 deletion TS SE Tool/Forms/ProfileEditor/FormProfileEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public partial class FormProfileEditor : Form

private string WorkingProfilePath = "";
private string WorkingProfileName = "";
private string ProfileType = "";

public FormProfileEditor()
{
Expand All @@ -60,6 +61,10 @@ private void FormProfileEditor_Load(object sender, EventArgs e)
//Profile name
WorkingProfilePath = ParentForm.comboBoxProfiles.SelectedValue.ToString();
WorkingProfileName = Utilities.TextUtilities.FromHexToString(WorkingProfilePath.Split(new string[] { "\\" }, StringSplitOptions.None).Last());

//Profile type
ProfileType = ((DataTable)ParentForm.comboBoxPrevProfiles.DataSource).Rows[ParentForm.comboBoxPrevProfiles.SelectedIndex].ItemArray[2].ToString();

labelProfileNameValue.Text = WorkingProfileName;
}

Expand Down Expand Up @@ -127,11 +132,14 @@ private void buttonCloneProfile_Click(object sender, EventArgs e)
}

//Settings
//Export
private void buttonExportSettings_Click(object sender, EventArgs e)
{
using (var dForm = new FormProfileEditorSettingsImportExport(FormProfileEditorSettingsImportExport.Form4Mode.Export))
{
dForm.ParentForm = ParentForm;
dForm.ProfileType = ProfileType;

DialogResult result = dForm.ShowDialog();

if (result == DialogResult.OK)
Expand All @@ -142,12 +150,14 @@ private void buttonExportSettings_Click(object sender, EventArgs e)
}
}
}

//Import
private void buttonImportSettings_Click(object sender, EventArgs e)
{
using (var dForm = new FormProfileEditorSettingsImportExport(FormProfileEditorSettingsImportExport.Form4Mode.Import))
{
dForm.ParentForm = ParentForm;
dForm.ProfileType = ProfileType;

DialogResult result = dForm.ShowDialog();

if (result == DialogResult.OK)
Expand Down
Loading

0 comments on commit 9258092

Please sign in to comment.