예제 #1
0
        public GamePackageTabPage(GamePackage package)
        {
            this.package = package;
            Text         = package.Title;

            settings  = new HtmlSettings(package.UserSettings);
            variables = new HtmlVariables();

            // set variables
            variables.SetText("version", package.Version.ToString());
            variables.SetFlag("is_update_available", Program.VersionControls.Count > 0 &&
                              !Program.PackageManager.HasFolderPackages && !Program.NoConnection);
            variables.SetFlag("is_updated", Program.VersionControls.Count == 0 &&
                              !Program.PackageManager.HasFolderPackages && !Program.NoConnection);

            variables.SetFlag("is_not_connected", !Program.PackageManager.HasFolderPackages &&
                              Program.NoConnection && !Program.Settings["autoupdate"].GetBool("disable_online"));
            variables.SetFlag("is_online_disabled", Program.Settings["autoupdate"].GetBool("disable_online"));
            variables.SetFlag("is_has_folders", Program.PackageManager.HasFolderPackages &&
                              !Program.Settings["autoupdate"].GetBool("disable_online"));

            // read change logs
            // string changeLogFile = ((package.Name != "launcher") ? package.Name : "Engine") + "-ChangeLog.txt";
            string changeLogFile = "ChangeLog.txt";

            if (System.IO.File.Exists(changeLogFile))
            {
                Stream changeLogStream = new FileStream(changeLogFile, FileMode.Open);
                variables.SetText("changelog", ChangelogToHtml.Convert(changeLogStream));
                changeLogStream.Close();
            }

            downloadPath = Program.Settings["autoupdate"].Get("downloads");
            updatePath   = Program.Settings["autoupdate"].Get("location");

            if (!Program.NoConnection && package.Name == Program.EnginePackage)
            {
                infoDownloader                     = new BackgroundWorker();
                infoDownloader.DoWork             += new DoWorkEventHandler(infoDownloader_DoWork);
                infoDownloader.RunWorkerCompleted += new RunWorkerCompletedEventHandler(infoDownloader_RunWorkerCompleted);
                infoDownloader.RunWorkerAsync();
            }
            else
            {
                readyFlag = true;
            }

            Uri url = new Uri(package.DataPath + "\\main.htm");

            browser.Url = url;
        }
예제 #2
0
        static void RefreshGamePackages()
        {
            games = new List <GamePackage>();

            // find all game packages
            foreach (PackageInfo info in packageManager.PackageInfos)
            {
                if (info.Type == Burntime.Framework.PackageType.Game && !info.IsHidden)
                {
                    GamePackage game = new GamePackage(info);
                    games.Add(game);
                }
            }

            // last, add engine page
            games.Add(new GamePackage(packageManager.GetInfo("launcher")));
        }