Example #1
0
        /// <summary>
        /// Shows the dialog with the assembly data.
        /// </summary>
        /// <param name="assemblyName">The name of the assembly.</param>
        /// <param name="version">The version of the assembly.</param>
        /// <param name="archivePreviousEntry">A value indicating if the user wishes to archive the previous <see cref="VersionInfo"/> entry.</param>
        /// <param name="usePreviousLocalizedData">A value indicating whether to use previous localized version data as a base for the new version.</param>
        /// <returns>An instance to <see cref="VersionInfo"/> class if the operation was successful; otherwise null.</returns>
        public static VersionInfo ShowDialog(string assemblyName, Version version, out bool archivePreviousEntry,
                                             out bool usePreviousLocalizedData)
        {
            int applicationId = -1;

            var info = VersionCheck.GetVersion(assemblyName);

            if (info == null)
            {
                info = VersionInfo.FromVersion(assemblyName, version);
            }
            else
            {
                info.SoftwareVersion = version.ToString();
                applicationId        = info.ID;
            }

            archivePreviousEntry     = false;
            usePreviousLocalizedData = false;
            using (
                var form = new FormDialogAddUpdateAssemblyVersion
            {
                cbDirectDownload = { Checked = info.IsDirectDownload },
                tbSoftwareName = { Text = info.SoftwareName },
                tbSoftwareVersion = { Text = info.SoftwareVersion },
                tbDownloadLink = { Text = info.DownloadLink },
                tbMetaData = { Text = info.MetaData },
                dtpReleaseDate = { Value = info.ReleaseDate },
                dtpReleaseTime = { Value = info.ReleaseDate },
                cbArchivePreviousVersion = { Enabled = applicationId != -1, Checked = applicationId != -1 },
                cbPreservePreviousVersionData = { Enabled = applicationId != -1, Checked = applicationId != -1 },
            })
            {
                if (form.ShowDialog() == DialogResult.OK)
                {
                    info.MetaData = form.tbMetaData.Text;
                    var dt1 = form.dtpReleaseDate.Value;
                    var dt2 = form.dtpReleaseTime.Value;
                    info.IsDirectDownload = form.cbDirectDownload.Checked;
                    info.DownloadLink     = form.tbDownloadLink.Text;
                    info.ReleaseDate      = new DateTime(dt1.Year, dt1.Month, dt1.Day, dt2.Hour, dt2.Minute, dt2.Second,
                                                         DateTimeKind.Utc);
                    if (form.cbArchivePreviousVersion.Checked)
                    {
                        archivePreviousEntry = applicationId != -1;
                    }

                    if (form.cbPreservePreviousVersionData.Checked)
                    {
                        usePreviousLocalizedData = applicationId != -1;
                    }
                }

                return(info);
            }
        }
Example #2
0
        public void Init(object gameInstance)
        {
            settings = new MySettings();
            settings.LoadSettings();
            settings.SaveSettings();

            updater = new VersionCheck();
            MyLog.Default.WriteLine("SEWorldGenPlugin - Version is " + updater.GetVersion());
            MyLog.Default.WriteLine("SEWorldGenPlugin - Latest Version is " + updater.GetNewestVersion());

            MyEntity.MyProceduralWorldGeneratorTrackEntityExtCallback += EntityExtension.ProceduralGeneratorTracking;

            MyPerGameSettings.GUI.MainMenu = typeof(PluginMainMenu);
            MyPerGameSettings.GUI.EditWorldSettingsScreen = typeof(PluginWorldSettings);
            MyPerGameSettings.GUI.AdminMenuScreen         = typeof(PluginAdminMenu);
        }
Example #3
0
        /// <summary>
        /// Called, when SE initializes the plugin. Loads the global settings, sets the procedural
        /// generator entity tracking extension method up, and replaces the GUI screens of SE if the plugin
        /// ones.
        /// </summary>
        /// <param name="gameInstance">Isntance of the game</param>
        public void Init(object gameInstance)
        {
            MyPluginLog.Log("Begin SEWorldGenPlugin init");

            settings = new MySettings();
            settings.LoadSettings();
            settings.SaveSettings();

            updater = new VersionCheck();
            MyPluginLog.Log("Version is " + updater.GetVersion());
            MyPluginLog.Log("Latest Version is " + updater.GetNewestVersion());

            MyPerGameSettings.GUI.MainMenu = typeof(MyPluginMainMenu);
            MyPerGameSettings.GUI.EditWorldSettingsScreen = typeof(PluginWorldSettings);
            MyPerGameSettings.GUI.AdminMenuScreen         = typeof(MyPluginAdminMenu);

            MyPluginLog.Log("Init completed");
        }
Example #4
0
        /// <summary>
        /// Called, when SE initializes the plugin. Loads the global settings, sets the procedural
        /// generator entity tracking extension method up, and replaces the GUI screens of SE if the plugin
        /// ones.
        /// </summary>
        /// <param name="gameInstance">Isntance of the game</param>
        public void Init(object gameInstance)
        {
            PluginLog.Log("Begin init");

            settings = new MySettings();
            settings.LoadSettings();
            settings.SaveSettings();

            updater = new VersionCheck();
            PluginLog.Log("Version is " + updater.GetVersion());
            PluginLog.Log("Latest Version is " + updater.GetNewestVersion());

            MyEntity.MyProceduralWorldGeneratorTrackEntityExtCallback += EntityExtension.ProceduralGeneratorTracking;

            MyPerGameSettings.GUI.MainMenu = typeof(PluginMainMenu);
            MyPerGameSettings.GUI.EditWorldSettingsScreen = typeof(PluginWorldSettings);
            MyPerGameSettings.GUI.AdminMenuScreen         = typeof(PluginAdminMenu);

            PluginLog.Log("Init completed");
        }