Skip to content

Commit

Permalink
Merge pull request #8 from RyanWalpoleEnterprises/220301
Browse files Browse the repository at this point in the history
220301 to be merged into the main branch with bug fixes, new features and up to date imagery and documentation.
  • Loading branch information
RyanWalpole authored Mar 3, 2022
2 parents 1e11194 + 31b7825 commit 36b53a6
Show file tree
Hide file tree
Showing 50 changed files with 895 additions and 55 deletions.
Binary file modified source-code/Mod Manager/.vs/Mod Manager/v16/.suo
Binary file not shown.
3 changes: 3 additions & 0 deletions source-code/Mod Manager/Stardew Mod Manager/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
<setting name="IsNetworkConnected" serializeAs="String">
<value />
</setting>
<setting name="Version" serializeAs="String">
<value>220301</value>
</setting>
</Stardew_Mod_Manager.Properties.Settings>
</userSettings>
</configuration>

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

Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Microsoft.VisualBasic;
using System.IO.Compression;
using Stardew_Mod_Manager.Properties;
using System.Xml;

namespace Stardew_Mod_Manager
{
Expand All @@ -21,6 +22,8 @@ public MainPage()
{
InitializeComponent();

SoftVer.Text = "v" + Properties.Settings.Default.Version;

try
{
var SMAPIVersion = FileVersionInfo.GetVersionInfo(Properties.Settings.Default.StardewDir + @"\StardewModdingAPI.exe");
Expand All @@ -36,7 +39,7 @@ public MainPage()
{
SMAPIVer.Text = "SMAPI Not Installed";
SMAPIWarning.Visible = true;
//SMAPIVer.Visible = false;
SMAPIVer.Visible = true;
}
}

Expand All @@ -46,13 +49,18 @@ private void MainPage_Load(object sender, EventArgs e)
string DisabledModsList = Properties.Settings.Default.InactiveModsDir;
string ModPresets = Properties.Settings.Default.StardewDir + @"\mod-presets\";

if(File.Exists(Properties.Settings.Default.StardewDir + "StardewModdingAPI.exe"))
if(File.Exists(Properties.Settings.Default.StardewDir + @"\StardewModdingAPI.exe"))
{
SMAPIWarning.Visible = false;
SMAPIVer.Visible = true;
//MessageBox.Show(Properties.Settings.Default.StardewDir + @"\StardewModdingAPI.exe");
}
else if (!File.Exists(Properties.Settings.Default.StardewDir + @"\StardewModdingAPI.exe"))
{
SMAPIWarning.Visible = true;
SMAPIVer.Visible = false;
SMAPIVer.Visible = true;
}


foreach (string folder in Directory.GetDirectories(EnabledModList))
{
InstalledModsList.Items.Add(Path.GetFileName(folder));
Expand Down Expand Up @@ -309,5 +317,62 @@ private void CloseRefreshPanel_Click(object sender, EventArgs e)
RefreshPanel.Enabled = false;
RefreshObjects();
}

private void UpdateCheckLabel_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
string CurrentUpdateVersion = "https://raw.githubusercontent.com/RyanWalpoleEnterprises/Stardew-Valley-Mod-Manager/main/web/uc.xml";
string LatestRelease = "https://github.com/RyanWalpoleEnterprises/Stardew-Valley-Mod-Manager/releases/latest";

//Change label text to "Checking for Updates"
UpdateCheckLabel.Text = "Checking for updates...";
UpdateCheckLabel.Enabled = false;

//Check for updates
try
{
//View current stable version number
XmlDocument document = new XmlDocument();
document.Load(CurrentUpdateVersion);
string CVER = document.InnerText;

//Compare current stable version against installed version
if (CVER.Contains(Properties.Settings.Default.Version))
{
//No updates available - install version matches stable version
UpdateCheckLabel.Text = "Up to date! Check again?";
UpdateCheckLabel.Enabled = true;
}
else
{
//Alert to available update
DialogResult dr = MessageBox.Show("There are updates available for Stardew Mod Manager. Would you like to view the latest release?", "Update | Stardew Valley Mod Manager", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

//User clicks yes
if (dr == DialogResult.Yes)
{
try
{
Process.Start(LatestRelease);
}
catch
{
//
}
}
}
}
catch (Exception ex)
{
//Error fetching update information.
MessageBox.Show("There was an issue checking for updates:" + Environment.NewLine + Environment.NewLine + ex.Message.ToString(), "An Error Occured", MessageBoxButtons.OK, MessageBoxIcon.Error);
UpdateCheckLabel.Text = "Connection Error";
}
}

private void SettingsLink_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
Settings set = new Settings();
set.Show();
}
}
}
Loading

0 comments on commit 36b53a6

Please sign in to comment.