private static void TestWohlJson() { WohlJsonObj wohl = new WohlJsonObj(); using (WebClient wc = new WebClient()) { string json = wc.DownloadString("http://engine.wohlnet.ru/LunaLua/get.php?showversions"); if (json != null) { wohl = JsonConvert.DeserializeObject<WohlJsonObj>(json); } } Console.WriteLine("latest: {0}\n\n", wohl.latest); foreach (var ver in wohl.versions) { Console.WriteLine("id: {0}, version: {1}", ver.id, ver.version); } }
private void OnWindowLoad() { string title = String.Format("LunaLua Module Manager - v{0} - {1}", Assembly.GetExecutingAssembly().GetName().Version.ToString(), SplashMessages[r.Next(SplashMessages.Length)]); this.Title = title; try { using (var client = new WebClient()) { string jsonDatabase = client.DownloadString("http://mrmiketheripper.x10.mx/luamodulemanager/test.json"); //if (jsonDatabase != null) //example = JsonConvert.DeserializeObject<List<LuaModuleManager.LuaModule>>(jsonDatabase); LoadDatabaseIntoTreeview(); } } catch(Exception ex) { MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Error loading database from: {0}\n\n{1}", Program.ProgramSettings.DatabaseURL, ex.Message); md.Icon = Image.LoadFromResource("Gtktester.Icons.PNG.256.png").Pixbuf; md.WindowPosition = WindowPosition.Center; md.Run(); md.Destroy(); if (Program.ProgramSettings.EnableSilentBugReporting) { BugReporter br = new BugReporter(); br.SubmitSilentBugReport(String.Format("An error ocurred while loading in the database from: {0}\nUsername: {3}\nMessage: {1}\n\nStack Trace: {2}", Program.ProgramSettings.DatabaseURL, ex.Message, ex.StackTrace, Program.ProgramSettings.OptionalUsername)); br.Destroy(); } Environment.Exit(-3); } try { using (WebClient wc = new WebClient()) { string json = wc.DownloadString("http://engine.wohlnet.ru/LunaLua/get.php?showversions"); if (json != null) { wohl = JsonConvert.DeserializeObject<WohlJsonObj>(json); LoadWohlDatabase(); this.lunaluainformation1.CheckForLunaDllUpdates(); } } } catch(Exception ex) { MessageDialog md = new MessageDialog(null, DialogFlags.Modal, MessageType.Error, ButtonsType.Ok, "Error loading database from: {0}\n\n{1}", Program.ProgramSettings.WohlstandJSON, ex.Message); md.Icon = Image.LoadFromResource("Gtktester.Icons.PNG.256.png").Pixbuf; md.WindowPosition = WindowPosition.Center; md.Run(); md.Destroy(); if (Program.ProgramSettings.EnableSilentBugReporting) { BugReporter br = new BugReporter(); br.SubmitSilentBugReport(String.Format("An error ocurred while loading in the database from: {0}\nUsername: {3}\nMessage: {1}\nStack Trace: {2}", Program.ProgramSettings.WohlstandJSON, ex.Message, ex.StackTrace, Program.ProgramSettings.OptionalUsername)); br.Destroy(); } Environment.Exit(-4); } }