void oFormActMain_UpdateCheckClicked()
{
int pluginId = 68;
try
{
DateTime localDate = ActGlobals.oFormActMain.PluginGetSelfDateUtc(this);
DateTime remoteDate = ActGlobals.oFormActMain.PluginGetRemoteDateUtc(pluginId);
string currentVersion = "1.1.4".Replace(".", string.Empty); //UPDATE ME
string newVersion = currentVersion;
var webRequest = WebRequest.Create(@"http://thejourneynetwork.net/chromatics/update/version.txt");
using (var response = webRequest.GetResponse())
using (var content = response.GetResponseStream())
using (var reader = new StreamReader(content))
{
string newVersionA = reader.ReadToEnd();
newVersion = newVersionA.Replace(".", string.Empty);
}
int cV = int.Parse(currentVersion);
int nV = int.Parse(newVersion);
if (nV > cV)
{
DialogResult result = MessageBox.Show("There is an updated version of Chromatics. Update it now?\n\n(If there is an update to ACT, you should click No and update ACT first.)", "New Version", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if (result == DialogResult.Yes)
{
ActPluginData pluginData = ActGlobals.oFormActMain.PluginGetSelfData(this);
string updatedFile = Path.GetDirectoryName(pluginData.pluginFile.FullName);
ProcessStartInfo startInfo = new ProcessStartInfo();
startInfo.FileName = updatedFile + @"\lib\updater.exe";
startInfo.Arguments = "\"" + updatedFile + "\"";
Process.Start(startInfo);
}
}
}
catch (Exception ex)
{
ActGlobals.oFormActMain.WriteExceptionLog(ex, "Plugin Update Check");
}
}