Example #1
0
        public static json.ModpackManager createModpackManager()
        {
            string rawjson = "";

            try
            {
                WebClient client = new WebClient();
                rawjson = client.DownloadString("http://modpack.bluebeta.net/packfile.json");
                client.Dispose();
            }
            catch
            {
            }

            if (rawjson.Equals(""))
            {
                try
                {
                    FileStream   stream = new FileStream(appdata + "/.bluebeta/packfile.json", FileMode.Open);
                    StreamReader reader = new StreamReader(stream);
                    rawjson = reader.ReadToEnd();
                    reader.Close();
                    stream.Close();
                }
                catch
                {
                }
            }

            if (rawjson.Equals(""))
            {
                System.Windows.Forms.MessageBox.Show("Could not download packfile and you don't have a cached version. Please connect to the internet and try again.");
                System.Windows.Forms.Application.Exit();
            }

            try
            {
                File.Delete(appdata + "/.bluebeta/packfile.json");
                File.WriteAllText(appdata + "/.bluebeta/packfile.json", rawjson);
            }
            catch { }

            rawjson = rawjson.Replace("\r", "");
            rawjson = rawjson.Replace("\n", "");
            rawjson = rawjson.Replace("\t", "");
            json.ModpackManager manager = Newtonsoft.Json.JsonConvert.DeserializeObject <BluebetaLauncher.json.ModpackManager>(rawjson);
            return(manager);
        }
Example #2
0
 public Launcher()
 {
     Utils.init();
     modpackManager = Utils.createModpackManager();
 }