private static void DownloadStringCallback2(Object sender, DownloadStringCompletedEventArgs e) { if (e.Error == null) { Console.WriteLine(e.Result); int result; if ((result = ExecutionAllowed(e.Result)) > 0) { MessageBox.Show("Sorry License expired. reason: " + result.ToString(), "Rudy Meijer."); if (!File.Exists(My.iniFile)) { My.WriteToFile(My.iniFile, "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\r\n<Screen width=\"245\" height=\"162\" />"); } Application.Exit(); // Windows application. Environment.Exit(0); // Console application. } else if (File.Exists(My.iniFile)) //V214 { File.Delete(My.iniFile); } // // Update statcounter statistics. // using (WebClient wc = new WebClient()) { wc.Headers.Add("user-agent", "Mozilla " + My.Version + " (compatible; Rudy ; Windows NT 5.2; .NET CLR 1.0.3705;)"); wc.DownloadStringAsync(new Uri(urlStatCounter)); // "http://c37.statcounter.com/3320106/0/23c12e3e/0/" } } else { Console.WriteLine(e.Error.Message); } }
public static void SaveFile(object cls, string filename) { My.WriteToFile(filename, Serialize(cls)); }