Skip to content

Commit

Permalink
Migrated update servers to Big Endian 32 repository
Browse files Browse the repository at this point in the history
  • Loading branch information
hyperbx committed Feb 16, 2021
1 parent 1f984fe commit a5b5e62
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 89 deletions.
33 changes: 3 additions & 30 deletions Sonic-06-Mod-Manager/Properties/Resources.Designer.cs

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

15 changes: 3 additions & 12 deletions Sonic-06-Mod-Manager/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -125,10 +125,7 @@
<value>..\res\Images\Cancel_16x.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="ChangelogsURI_GitHub" xml:space="preserve">
<value>https://raw.githubusercontent.com/HyperBE32/Unify-Networking/master/Sonic_06_Mod_Manager/rush/changelogs.txt</value>
</data>
<data name="ChangelogsURI_SEGACarnival" xml:space="preserve">
<value>https://www.segacarnival.com/hyper/updates/sonic-06-mod-manager/rush/changelogs.txt</value>
<value>https://raw.githubusercontent.com/Big-Endian-32/Networking/main/Sonic%20'06%20Mod%20Manager/Changelogs.txt</value>
</data>
<data name="CheckBox_16x_24" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\res\images\checkbox_16x_24.bmp;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
Expand All @@ -149,10 +146,7 @@
<value>..\res\images\corner_logo_colour.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="DataURI_GitHub" xml:space="preserve">
<value>https://raw.githubusercontent.com/HyperBE32/Unify-Networking/master/Sonic_06_Mod_Manager/rush/latest.zip</value>
</data>
<data name="DataURI_SEGACarnival" xml:space="preserve">
<value>https://www.segacarnival.com/hyper/updates/sonic-06-mod-manager/rush/latest.zip</value>
<value>https://raw.githubusercontent.com/Big-Endian-32/Networking/main/Sonic%20'06%20Mod%20Manager/Release.zip</value>
</data>
<data name="debug_6" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\res\images\debug 6.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
Expand Down Expand Up @@ -253,10 +247,7 @@ Please whitelist the following directory in your antivirus software and restart
<value>..\res\images\update 4.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="VersionURI_GitHub" xml:space="preserve">
<value>https://raw.githubusercontent.com/HyperBE32/Unify-Networking/master/Sonic_06_Mod_Manager/rush/latest.txt</value>
</data>
<data name="VersionURI_SEGACarnival" xml:space="preserve">
<value>https://www.segacarnival.com/hyper/updates/sonic-06-mod-manager/rush/latest.txt</value>
<value>https://raw.githubusercontent.com/Big-Endian-32/Networking/main/Sonic%20'06%20Mod%20Manager/Version.txt</value>
</data>
<data name="vsh_curves" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\res\applications\data\vsh_curves;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
Expand Down

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

46 changes: 17 additions & 29 deletions Sonic-06-Mod-Manager/src/Environment3/RushInterface.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ public partial class RushInterface : UserControl
{
private bool _isPathInvalid = false;
private static string protocol = "sonic06mm";
private bool _useBackupServer = false;

public RushInterface() {
InitializeComponent(); // Designer support
Expand Down Expand Up @@ -238,7 +237,7 @@ private void LoadSettings()

if (CheckBox_CheckUpdatesOnLaunch.Checked = Properties.Settings.Default.General_CheckUpdatesOnLaunch) {
Properties.Settings.Default.General_LastSoftwareUpdate = DateTime.Now.Ticks;
CheckForUpdates(Properties.Resources.VersionURI_GitHub, Properties.Resources.ChangelogsURI_GitHub);
CheckForUpdates();
}

if (CheckBox_SaveFileRedirection.Checked = Properties.Settings.Default.General_SaveFileRedirection) {
Expand Down Expand Up @@ -448,14 +447,14 @@ private void SectionButton_DeselectAll() {
/// <summary>
/// Pings the update servers to check for a new version.
/// </summary>
private async void CheckForUpdates(string versionURI, string changelogsURI) {
private async void CheckForUpdates() {
// Block controls
SectionButton_CheckForSoftwareUpdates.Enabled = false;

try {
if (Client.CheckNetworkConnection().Result) {
string latestVersion = await Client.RequestString(versionURI), // Request version number
changelogs = await Client.RequestString(changelogsURI); // Request changelogs
string latestVersion = await Client.RequestString(Properties.Resources.VersionURI_GitHub), // Request version number
changelogs = await Client.RequestString(Properties.Resources.ChangelogsURI_GitHub); // Request changelogs

// New update available!
if (Program.VersionNumber != latestVersion && latestVersion.StartsWith("Version"))
Expand All @@ -469,27 +468,17 @@ private async void CheckForUpdates(string versionURI, string changelogsURI) {
throw new WebException("Invalid version number - server might be down...");
} else
throw new WebException("Could not establish a connection...");
} catch {
try {
// Check for updates via SEGA Carnival
if (Client.CheckNetworkConnection().Result) {
CheckForUpdates(Properties.Resources.VersionURI_SEGACarnival, Properties.Resources.ChangelogsURI_SEGACarnival);
Properties.Settings.Default.General_LastSoftwareUpdate = DateTime.Now.Ticks;
_useBackupServer = true;
} else
throw new WebException("Could not establish a connection...");
} catch (Exception ex) {
Label_UpdaterStatus.Text = "Connection error";
PictureBox_UpdaterIcon.BackgroundImage = Properties.Resources.Exception_Logo;
} catch (Exception ex) {
Label_UpdaterStatus.Text = "Connection error";
PictureBox_UpdaterIcon.BackgroundImage = Properties.Resources.Exception_Logo;

// Reset update button for future checking
SectionButton_CheckForSoftwareUpdates.SectionText = "Check for software updates";
SectionButton_CheckForSoftwareUpdates.Refresh();
// Reset update button for future checking
SectionButton_CheckForSoftwareUpdates.SectionText = "Check for software updates";
SectionButton_CheckForSoftwareUpdates.Refresh();

// Write exception to logs
RichTextBox_Changelogs.Text = $"Failed to request changelogs...\n\n{ex}";
Console.WriteLine($"[{DateTime.Now:HH:mm:ss tt}] [Error] Failed to request changelogs...\n{ex}");
}
// Write exception to logs
RichTextBox_Changelogs.Text = $"Failed to request changelogs...\n\n{ex}";
Console.WriteLine($"[{DateTime.Now:HH:mm:ss tt}] [Error] Failed to request changelogs...\n{ex}");
}

// Feedback
Expand Down Expand Up @@ -1325,7 +1314,7 @@ private void LinkLabel_Reset_LinkClicked(object sender, LinkLabelLinkClickedEven
/// <summary>
/// Update Sonic '06 Mod Manager via requested server.
/// </summary>
private void UpdateVersion(bool useBackupServer) {
private void UpdateVersion() {
// Set controls enabled and visibility state
SectionButton_CheckForSoftwareUpdates.Visible = CheckBox_CheckUpdatesOnLaunch.Enabled = false;
TabControl_Rush.SelectedTab.VerticalScroll.Value = 0;
Expand All @@ -1334,7 +1323,6 @@ private void UpdateVersion(bool useBackupServer) {
try {
// If SEGA Carnival is offline, use GitHub
Uri serverUri = new Uri(Properties.Resources.DataURI_GitHub);
if (useBackupServer) serverUri = new Uri(Properties.Resources.DataURI_SEGACarnival);

using (WebClient client = new WebClient()) {
client.DownloadProgressChanged += (s, clientEventArgs) => { ProgressBar_SoftwareUpdate.Value = clientEventArgs.ProgressPercentage; };
Expand Down Expand Up @@ -1431,9 +1419,9 @@ private async void SectionButton_Updates_Click(object sender, EventArgs e) {
// Check for software updates is clicked
if (sender == SectionButton_CheckForSoftwareUpdates) {
// Check for updates via GitHub
CheckForUpdates(Properties.Resources.VersionURI_GitHub, Properties.Resources.ChangelogsURI_GitHub);
CheckForUpdates();
Properties.Settings.Default.General_LastSoftwareUpdate = DateTime.Now.Ticks;
if (((SectionButton)sender).SectionText == "Fetch the latest version") UpdateVersion(_useBackupServer); // Update if prompted
if (((SectionButton)sender).SectionText == "Fetch the latest version") UpdateVersion(); // Update if prompted
Properties.Settings.Default.Save();

// Check for mod updates is clicked
Expand Down Expand Up @@ -1645,7 +1633,7 @@ private void LinkLabel_1ClickURLHandler_LinkClicked(object sender, LinkLabelLink
sonic06mmKey = Registry.CurrentUser.OpenSubKey($"Software\\Classes\\{protocol}", true);
if (sonic06mmKey == null)
sonic06mmKey = Registry.CurrentUser.CreateSubKey($"Software\\Classes\\{protocol}");
sonic06mmKey.SetValue(string.Empty, "URL:Sonic '06 Mod Manager");
sonic06mmKey.SetValue(string.Empty, "Sonic '06 Mod Manager");
sonic06mmKey.SetValue("URL Protocol", string.Empty);
RegistryKey prevkey = sonic06mmKey;
sonic06mmKey = sonic06mmKey.OpenSubKey("shell", true);
Expand Down
27 changes: 12 additions & 15 deletions Sonic-06-Mod-Manager/src/Environment3/RushInterface.resx
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,19 @@
<metadata name="ToolTip_Information.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>444, 17</value>
</metadata>
<metadata name="ToolTip_Information.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>444, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="SectionButton_RefreshMods.SectionImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
xAAADsQBlSsOGwAAAX9JREFUOE+Fkk9qwkAUxtMDVLoptSfoCVwUunIREjyCSW8QvYogbixdFEIpWbjw
AOLWS0QaEjeudZHN9P3GN6loSh98OPP9m0mMdzwezT+483Rkfa/L38HU7/dbsd/vmwL57QgKwZfg1oYZ
2bSGwUXB23K5NIvFAm7TlFCAMcuyPwsE/m63M4PBwPJa8ukKgrIsTRiGVpzNZm0FL4fDoXBaEAQmz3O0
Zwrep9OpFUajkRHjVYEe1BWtTJLEapPJBO0DIY/j2JKr1QqytYCR9SsetOFwiFZAGt/3LVlVlS0gCLjN
RcEjHncAXsjaFfCiZP9E6Aw3msfbxYOXjOxryG0URZZcr9eQsfqvBg0PXjJkIefuJY7HY679LdyDZpqB
Q8ODlwxZhF5RFPavcYKWxIKuIoZzB+ElQ9a1p3xliO4mXJXnBazdyQAvGRtmZMN3vkFwN2kDmob5lDsa
P42WpFyNq/KSeNOANZxeO70Kn4+IPcFcsBXUCtZwp2duxvN+AFwMV+KqpemtAAAAAElFTkSuQmCC
</value>
</data>
<data name="Button_Open_SaveData.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAIGNIUk0AAHolAACAgwAA+f8AAIDpAAB1
Expand Down Expand Up @@ -265,18 +274,6 @@
RcEjHncAXsjaFfCiZP9E6Aw3msfbxYOXjOxryG0URZZcr9eQsfqvBg0PXjJkIefuJY7HY679LdyDZpqB
Q8ODlwxZhF5RFPavcYKWxIKuIoZzB+ElQ9a1p3xliO4mXJXnBazdyQAvGRtmZMN3vkFwN2kDmob5lDsa
P42WpFyNq/KSeNOANZxeO70Kn4+IPcFcsBXUCtZwp2duxvN+AFwMV+KqpemtAAAAAElFTkSuQmCC
</value>
</data>
<data name="SectionButton_RefreshMods.SectionImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABGdBTUEAALGPC/xhBQAAAAlwSFlzAAAO
xAAADsQBlSsOGwAAAX9JREFUOE+Fkk9qwkAUxtMDVLoptSfoCVwUunIREjyCSW8QvYogbixdFEIpWbjw
AOLWS0QaEjeudZHN9P3GN6loSh98OPP9m0mMdzwezT+483Rkfa/L38HU7/dbsd/vmwL57QgKwZfg1oYZ
2bSGwUXB23K5NIvFAm7TlFCAMcuyPwsE/m63M4PBwPJa8ukKgrIsTRiGVpzNZm0FL4fDoXBaEAQmz3O0
Zwrep9OpFUajkRHjVYEe1BWtTJLEapPJBO0DIY/j2JKr1QqytYCR9SsetOFwiFZAGt/3LVlVlS0gCLjN
RcEjHncAXsjaFfCiZP9E6Aw3msfbxYOXjOxryG0URZZcr9eQsfqvBg0PXjJkIefuJY7HY679LdyDZpqB
Q8ODlwxZhF5RFPavcYKWxIKuIoZzB+ElQ9a1p3xliO4mXJXnBazdyQAvGRtmZMN3vkFwN2kDmob5lDsa
P42WpFyNq/KSeNOANZxeO70Kn4+IPcFcsBXUCtZwp2duxvN+AFwMV+KqpemtAAAAAElFTkSuQmCC
</value>
</data>
<data name="SectionButton_ClearLog.SectionImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
Expand Down

0 comments on commit a5b5e62

Please sign in to comment.