Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
FelisDiligens committed Jul 8, 2020
2 parents c07adae + dba8c40 commit 6c99aad
Show file tree
Hide file tree
Showing 16 changed files with 1,190 additions and 897 deletions.
84 changes: 50 additions & 34 deletions Fo76ini/Form1.Designer.cs

Large diffs are not rendered by default.

22 changes: 8 additions & 14 deletions Fo76ini/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace Fo76ini
{
public partial class Form1 : Form
{
public const String VERSION = "1.6.2";
public const String VERSION = "1.6.3";

protected System.Globalization.CultureInfo enUS = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");

Expand Down Expand Up @@ -189,10 +189,7 @@ private void Form1_Load(object sender, EventArgs e)


if (IniFiles.Instance.GetBool(IniFile.Config, "Preferences", "bOpenModManagerOnLaunch", false))
{
Utils.SetFormPosition(this.formMods, this.Location.X + this.Width, this.Location.Y);
this.formMods.Show();
}
this.formMods.OpenUI();

IniFiles.Instance.LoadWindowState("Form1", this);

Expand Down Expand Up @@ -294,6 +291,9 @@ private void AddAllEventHandler()
IniFiles.Instance.SetINIsReadOnly
);

// Deny NTFS write-permission
uiLoader.LinkBool(this.checkBoxDenyNTFSWritePermission, IniFile.Config, "Preferences", "bDenyNTFSWritePermission", false);

/*
* Settings
*/
Expand Down Expand Up @@ -730,7 +730,7 @@ private void AddAllEventHandler()

// Fix aim sensitivity
uiLoader.LinkCustom(this.checkBoxFixAimSensitivity,
() => IniFiles.Instance.GetFloat("Main", "fIronSightsFOVRotateMult", 0f) - 2.14f < 0.1f,
() => Math.Abs(IniFiles.Instance.GetFloat("Main", "fIronSightsFOVRotateMult", 0f) - 2.14f) < 0.1f,
(value) => {
if (value)
{
Expand Down Expand Up @@ -888,9 +888,7 @@ private void buttonManageMods_Click(object sender, EventArgs e)
IniFiles.Instance.BackupAll("Backup_BeforeManageMods"); // Just to be sure...
formModsBackupCreated = true;
}
Utils.SetFormPosition(this.formMods, this.Location.X + this.Width, this.Location.Y);
this.formMods.UpdateUI();
this.formMods.Show();
this.formMods.OpenUI();
}

/*private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
Expand Down Expand Up @@ -962,11 +960,7 @@ private void checkBoxNWMode_CheckedChanged(object sender, EventArgs e)
if (MsgBox.ShowID("nwModeEnabledButModsAreDeployed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
ManagedMods.Instance.nuclearWinterMode = IniFiles.Instance.nuclearWinterMode;

Utils.SetFormPosition(this.formMods, this.Location.X + this.Width, this.Location.Y);
this.formMods.Show();
this.formMods.UpdateUI();

this.formMods.OpenUI();
this.formMods.Deploy();
}
}
Expand Down
230 changes: 115 additions & 115 deletions Fo76ini/FormModDetails.Designer.cs

Large diffs are not rendered by default.

20 changes: 15 additions & 5 deletions Fo76ini/FormModDetails.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,16 +448,17 @@ private void buttonModUnfreeze_Click(object sender, EventArgs e)
(text, percent) =>
{
Invoke(() => SetProgress(text, percent));
}, () =>
},
(success) =>
{
Invoke(() =>
{
this.formMods.ModDetailsFeedback(this.changedMod);
UpdateUI();
SetDone();
/*this.formMods.ModDetailsClosed();
Hide();
this.formMods.Deploy();*/
if (success)
SetDone();
else
SetFailed();
});
}
);
Expand Down Expand Up @@ -512,6 +513,15 @@ private void SetDone()
this.progressBar1.Style = ProgressBarStyle.Continuous;
}

private void SetFailed()
{
this.labelModDetailsStatus.Visible = true;
this.labelModDetailsStatus.ForeColor = Color.Red;
this.labelModDetailsStatus.Text = "Failed.";
this.progressBar1.Value = 100;
this.progressBar1.Style = ProgressBarStyle.Continuous;
}

private void SetProgress(String text, int percent)
{
this.labelModDetailsStatus.Text = text;
Expand Down
322 changes: 184 additions & 138 deletions Fo76ini/FormMods.Designer.cs

Large diffs are not rendered by default.

131 changes: 63 additions & 68 deletions Fo76ini/FormMods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,15 @@ public FormMods()
this.listViewMods.MouseUp += listViewMods_MouseUp;
}

public void OpenUI()
{
Utils.SetFormPosition(this, Form1.Instance.Location.X + Form1.Instance.Width, Form1.Instance.Location.Y);
this.WindowState = FormWindowState.Normal;
this.UpdateUI();
this.Show();
this.Focus();
}

public void UpdateUI()
{
UpdateModList();
Expand Down Expand Up @@ -256,18 +265,22 @@ private void UpdateSettings()
if (!IniFiles.Instance.IsLoaded())
return;
this.checkBoxDisableMods.Checked = ManagedMods.Instance.nuclearWinterMode;
this.checkBoxAddArchivesAsBundled.Checked = IniFiles.Instance.GetBool(IniFile.Config, "Mods", "bUnpackBA2ByDefault", false);
this.checkBoxModsUseHardlinks.Checked = IniFiles.Instance.GetBool(IniFile.Config, "Mods", "bUseHardlinks", false);
//this.textBoxGamePath.Text = ManagedMods.Instance.GamePath;

this.textBoxsResourceArchive2List.Text = String.Join(Environment.NewLine, IniFiles.Instance.GetString(IniFile.F76Custom, "Archive", "sResourceArchive2List", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
this.textBoxsResourceIndexFileList.Text = String.Join(Environment.NewLine, IniFiles.Instance.GetString(IniFile.F76Custom, "Archive", "sResourceIndexFileList", "").Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries));
}

private void UpdateLabel()
private void UpdateLabel(bool success = true)
{
if (ManagedMods.Instance.isDeploymentNecessary())
this.DisplayDeploymentNecessary();
else
else if (success)
this.DisplayAllDone();
else
this.DisplayFailState();
}

private void UpdateSelectedIndices()
Expand Down Expand Up @@ -829,60 +842,6 @@ private void repairddsFilesToolStripMenuItem_Click(object sender, EventArgs e)
* Settings
*/

// Pick game path
/*private void buttonPickGamePath_Click(object sender, EventArgs e)
{
if (ManagedMods.Instance.isDeploymentNecessary())
{
MsgBox.ShowID("modsDeploymentNecessary");
return;
}
if (this.openFileDialogGamePath.ShowDialog() == DialogResult.OK)
{
String path = Path.GetDirectoryName(this.openFileDialogGamePath.FileName); // We want the path where Fallout76.exe resides.
if (Directory.Exists(Path.Combine(path, "Data")))
{
this.textBoxGamePath.Text = path;
ManagedMods.Instance.GamePath = path;
IniFiles.Instance.Set(IniFile.Config, "Preferences", ManagedMods.Instance.GamePathKey, path);
IniFiles.Instance.SaveConfig();
ManagedMods.Instance.Load();
UpdateUI();
}
else
MsgBox.ShowID("modsGamePathInvalid");
}
}
// Game path textbox changed
private void textBoxGamePath_TextChanged(object sender, EventArgs e)
{
if (this.textBoxGamePath.Focused)
{
if (ManagedMods.Instance.isDeploymentNecessary())
{
if (this.textBoxGamePath.Text != ManagedMods.Instance.GamePath)
this.textBoxGamePath.Text = ManagedMods.Instance.GamePath;
return;
}
else if (Directory.Exists(Path.Combine(this.textBoxGamePath.Text, "Data")))
{
ManagedMods.Instance.GamePath = this.textBoxGamePath.Text;
IniFiles.Instance.Set(IniFile.Config, "Preferences", ManagedMods.Instance.GamePathKey, this.textBoxGamePath.Text);
IniFiles.Instance.SaveConfig();
ManagedMods.Instance.Load();
UpdateUI();
this.textBoxGamePath.ForeColor = Color.Black;
this.textBoxGamePath.BackColor = Color.White;
}
else
{
this.textBoxGamePath.ForeColor = Color.White;
this.textBoxGamePath.BackColor = Color.Red;
}
}
}*/

// Clean lists
private void buttonModsCleanLists_Click(object sender, EventArgs e)
{
Expand Down Expand Up @@ -940,6 +899,20 @@ public void ChangeGameEdition(GameEdition gameEdition)
UpdateUI();
}

// Alternative *.ba2 import method
private void checkBoxAddArchivesAsBundled_CheckedChanged(object sender, EventArgs e)
{
IniFiles.Instance.Set(IniFile.Config, "Mods", "bUnpackBA2ByDefault", this.checkBoxAddArchivesAsBundled.Checked);
IniFiles.Instance.SaveConfig();
}

// Hard links
private void checkBoxModsUseHardlinks_CheckedChanged(object sender, EventArgs e)
{
IniFiles.Instance.Set(IniFile.Config, "Mods", "bUseHardlinks", this.checkBoxModsUseHardlinks.Checked);
IniFiles.Instance.SaveConfig();
}


/*
* Threads
Expand All @@ -953,13 +926,13 @@ private void InstallModArchive(String path)
(text, percent) => {
Invoke(() => Display(text));
},
() => {
(success) => {
Invoke(() => ProgressBarContinuous(100));
Invoke(() => HideLabel());
Invoke(() => EnableUI());
Invoke(() => selectedIndex = ManagedMods.Instance.Mods.Count - 1);
Invoke(() => UpdateModList());
Invoke(() => UpdateLabel());
Invoke(() => UpdateLabel(success));
}
);
}
Expand All @@ -972,13 +945,13 @@ private void InstallModArchiveFrozen(String path)
(text, percent) => {
Invoke(() => Display(text));
},
() => {
(success) => {
Invoke(() => ProgressBarContinuous(100));
Invoke(() => HideLabel());
Invoke(() => EnableUI());
Invoke(() => selectedIndex = ManagedMods.Instance.Mods.Count - 1);
Invoke(() => UpdateModList());
Invoke(() => UpdateLabel());
Invoke(() => UpdateLabel(success));
}
);
}
Expand All @@ -992,13 +965,13 @@ private void InstallModFolder(String path)
Invoke(() => Display(text));
Invoke(() => { if (percent >= 0) { ProgressBarContinuous(percent); } else { ProgressBarMarquee(); } });
},
() => {
(success) => {
Invoke(() => ProgressBarContinuous(100));
Invoke(() => HideLabel());
Invoke(() => EnableUI());
Invoke(() => selectedIndex = ManagedMods.Instance.Mods.Count - 1);
Invoke(() => UpdateModList());
Invoke(() => UpdateLabel());
Invoke(() => UpdateLabel(success));
}
);
}
Expand All @@ -1007,6 +980,7 @@ private void InstallBulk(String[] files)
{
foreach (string filePath in files)
{
bool unpackBA2ByDefault = IniFiles.Instance.GetBool(IniFile.Config, "Mods", "bUnpackBA2ByDefault", false);
String fullFilePath = Path.GetFullPath(filePath);
if (fullFilePath.Length > 259 && Directory.Exists(@"\\?\" + fullFilePath))
fullFilePath = @"\\?\" + fullFilePath;
Expand All @@ -1017,7 +991,12 @@ private void InstallBulk(String[] files)
else if ((new String[] { ".zip", ".rar", ".7z", ".tar", ".tar.gz", ".gz" }).Contains(Path.GetExtension(fullFilePath)))
InstallModArchive(fullFilePath);
else if (Path.GetExtension(fullFilePath).ToLower() == ".ba2")
InstallModArchiveFrozen(fullFilePath);
{
if (unpackBA2ByDefault)
InstallModArchive(fullFilePath);
else
InstallModArchiveFrozen(fullFilePath);
}
else
MsgBox.Get("modsArchiveTypeNotSupported").FormatText(Path.GetExtension(fullFilePath)).Show(MessageBoxIcon.Error);
}
Expand Down Expand Up @@ -1080,17 +1059,26 @@ public void Deploy()
Invoke(() => Display(text));
Invoke(() => { if (percent >= 0) { ProgressBarContinuous(percent); } else { ProgressBarMarquee(); } });
},
() => {
(success) => {
Invoke(() => {
UpdateUI();
ProgressBarContinuous(100);
DisplayAllDone();
EnableUI();

if (ManagedMods.Instance.nuclearWinterMode)
MsgBox.Get("modsDisabledDone").Popup(MessageBoxIcon.Information);
if (success)
{
DisplayAllDone();

if (ManagedMods.Instance.nuclearWinterMode)
MsgBox.Get("modsDisabledDone").Popup(MessageBoxIcon.Information);
else
MsgBox.Get("modsDeployedDone").Popup(MessageBoxIcon.Information);
}
else
MsgBox.Get("modsDeployedDone").Popup(MessageBoxIcon.Information);
{
DisplayFailState();
MsgBox.Get("modsDeploymentFailed").Popup(MessageBoxIcon.Information);
}
});
}
);
Expand Down Expand Up @@ -1182,5 +1170,12 @@ private void DisplayAllDone()
this.labelModsDeploy.ForeColor = Color.DarkGreen;
this.labelModsDeploy.Text = Translation.localizedStrings["modsAllDone"];
}

private void DisplayFailState()
{
this.labelModsDeploy.Visible = true;
this.labelModsDeploy.ForeColor = Color.Red;
this.labelModsDeploy.Text = Translation.localizedStrings["modsFailed"];
}
}
}
6 changes: 6 additions & 0 deletions Fo76ini/FormMods.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,12 @@
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>222, 17</value>
</metadata>
<metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value>
</metadata>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>222, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="toolStripButtonMoveUp.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
Expand Down
Loading

0 comments on commit 6c99aad

Please sign in to comment.