コード例 #1
0
        private void AttachToProfileCore(ServerProfile profile)
        {
            UnregisterForUpdates();

            this.ProfileSnapshot = new RuntimeProfileSnapshot
            {
                ProfileName          = profile.ProfileName,
                InstallDirectory     = profile.InstallDirectory,
                AltSaveDirectoryName = profile.AltSaveDirectoryName,
                AdminPassword        = profile.AdminPassword,
                ServerName           = profile.ServerName,
                ServerArgs           = profile.GetServerArgs(),
                ServerIP             = String.IsNullOrWhiteSpace(profile.ServerIP) ? IPAddress.Loopback.ToString() : profile.ServerIP,
                ServerConnectionPort = profile.ServerConnectionPort,
                QueryPort            = profile.ServerPort,
                UseRawSockets        = profile.UseRawSockets,
                RCONEnabled          = profile.RCONEnabled,
                RCONPort             = profile.RCONPort,
                SotFServer           = profile.SOTF_Enabled,
                ServerMap            = ServerProfile.GetProfileMapName(profile),
                ServerMapModId       = ServerProfile.GetProfileMapModId(profile),
                TotalConversionModId = profile.TotalConversionModId ?? string.Empty,
                ServerModIds         = ModUtils.GetModIdList(profile.ServerModIds),
                LastInstalledVersion = string.IsNullOrWhiteSpace(profile.LastInstalledVersion) ? new Version(0, 0).ToString() : profile.LastInstalledVersion,
            };

            Version lastInstalled;

            if (Version.TryParse(profile.LastInstalledVersion, out lastInstalled))
            {
                this.Version = lastInstalled;
            }

            RegisterForUpdates();
        }
コード例 #2
0
        private void AttachToProfileCore(ServerProfile profile)
        {
            UnregisterForUpdates();

            this.ProfileSnapshot = new RuntimeProfileSnapshot
            {
                InstallDirectory     = profile.InstallDirectory,
                QueryPort            = profile.ServerPort,
                ServerConnectionPort = profile.ServerConnectionPort,
                ServerIP             = String.IsNullOrWhiteSpace(profile.ServerIP) ? IPAddress.Loopback.ToString() : profile.ServerIP,
                LastInstalledVersion = profile.LastInstalledVersion,
                ProfileName          = profile.ProfileName,
                RCONEnabled          = profile.RCONEnabled,
                RCONPort             = profile.RCONPort,
                ServerName           = profile.ServerName,
                ServerArgs           = profile.GetServerArgs(),
                AdminPassword        = profile.AdminPassword
            };

            Version lastInstalled;

            if (Version.TryParse(profile.LastInstalledVersion, out lastInstalled))
            {
                this.Version = lastInstalled;
            }

            RegisterForUpdates();
        }
コード例 #3
0
        public static ServerProfileSnapshot Create(ServerProfile profile)
        {
            return(new ServerProfileSnapshot
            {
                ProfileId = profile.ProfileID,
                ProfileName = profile.ProfileName,
                InstallDirectory = profile.InstallDirectory,
                AltSaveDirectoryName = profile.AltSaveDirectoryName,
                PGM_Enabled = profile.PGM_Enabled,
                PGM_Name = profile.PGM_Name,
                AdminPassword = profile.AdminPassword,
                ServerName = profile.ServerName,
                ServerArgs = profile.GetServerArgs(),
                ServerIP = string.IsNullOrWhiteSpace(profile.ServerIP) ? IPAddress.Loopback.ToString() : profile.ServerIP.Trim(),
                ServerPort = profile.ServerPort,
                ServerPeerPort = profile.ServerPeerPort,
                QueryPort = profile.QueryPort,
                RCONEnabled = profile.RCONEnabled,
                RCONPort = profile.RCONPort,
                ServerMap = ServerProfile.GetProfileMapName(profile),
                ServerMapModId = ServerProfile.GetProfileMapModId(profile),
                TotalConversionModId = profile.TotalConversionModId ?? string.Empty,
                ServerModIds = ModUtils.GetModIdList(profile.ServerModIds),
                MOTD = profile.MOTD,
                MotDDuration = Math.Max(profile.MOTDDuration, 10),
                MOTDIntervalEnabled = profile.MOTDInterval.HasValue && !string.IsNullOrWhiteSpace(profile.MOTD),
                MOTDInterval = Math.Max(1, Math.Min(int.MaxValue, profile.MOTDInterval.Value)),
                ForceRespawnDinos = profile.ForceRespawnDinos,

                BranchName = profile.BranchName,
                BranchPassword = profile.BranchPassword,

                SchedulerKey = profile.GetProfileKey(),
                EnableAutoBackup = profile.EnableAutoBackup,
                EnableAutoUpdate = profile.EnableAutoUpdate,
                EnableAutoShutdown1 = profile.EnableAutoShutdown1,
                RestartAfterShutdown1 = profile.RestartAfterShutdown1,
                UpdateAfterShutdown1 = profile.UpdateAfterShutdown1,
                EnableAutoShutdown2 = profile.EnableAutoShutdown2,
                RestartAfterShutdown2 = profile.RestartAfterShutdown2,
                UpdateAfterShutdown2 = profile.UpdateAfterShutdown2,
                AutoRestartIfShutdown = profile.AutoRestartIfShutdown,

                SotFEnabled = profile.SOTF_Enabled,

                MaxPlayerCount = profile.MaxPlayers,

                ServerUpdated = false,
                LastInstalledVersion = profile.LastInstalledVersion ?? new Version(0, 0).ToString(),
                LastStarted = profile.LastStarted,
            });
        }