private void VersionCheck() {
if (CheckForUpdates == "Never")
return;
try {
Version our_version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
WebRequest request = WebRequest.Create(Properties.Settings.Default.UpdateURL);
using (WebResponse response = request.GetResponse()) {
using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8)) {
string content = reader.ReadToEnd();
String[] arr = content.Split(new[] { '!' });
int pos = 0;
String version_str = arr[pos++];
String version_url = "";
String version_message = "";
if (arr.Length > 1)
version_url = arr[pos++];
if (arr.Length > 2)
version_message = arr[pos++];
Version latest_version = new Version(version_str);
if (latest_version.CompareTo(our_version) == 1) {
if (String.IsNullOrWhiteSpace(version_message))
version_message = "An update is available for FSClient.";
MessageBoxButton buttons = MessageBoxButton.OK;
if (!String.IsNullOrWhiteSpace(version_url)) {
if (!version_url.StartsWith("http")) //a bit of a security check, lets make sure the update website isn't trying to get the user to launch a local process
version_url = "https://" + version_url;
version_message += "\nDo you want to proceed to the url below(default browser will be launched) to obtain FSClient:\n" + version_url;
buttons = MessageBoxButton.YesNo;
}
MessageBoxResult res = MessageBox.Show(version_message, "FSClient Update", buttons, MessageBoxImage.Question);
if (res == MessageBoxResult.Yes)
System.Diagnostics.Process.Start(version_url);
}
}
}
}
catch (Exception){}
}
public bool UseNumberOnlyInput {