Beispiel #1
0
        public void EditsExistingStsSettings()
        {
            // Arrange
            var initialStsSettings = new StsSettings {
                Realm = "r",
                SolutionUserSigningCertificatePath = "c",
                StsServiceEndpoint = "e"
            };

            var expectedStsSettings = new StsSettings {
                Realm = "realm",
                SolutionUserSigningCertificatePath = "certificate",
                StsServiceEndpoint = "endpoint"
            };

            var settings = new {
                RunspaceSettings = new {
                    A = "A",
                    B = "B"
                },
                StorageSettings = new {
                    C = "C",
                    D = "D"
                },
                StsSettings = initialStsSettings
            };
            var settingsFileContent = JsonConvert.SerializeObject(settings, Formatting.Indented);
            var mockFileData        = new MockFileData(settingsFileContent);
            var mockFilePath        = "/app/service/appsettings.json";
            var mockFileSystem      = new MockFileSystem();

            mockFileSystem.AddFile(mockFilePath, mockFileData);

            var settingsEditor = new SettingsEditor(mockFilePath, mockFileSystem);


            // Act
            settingsEditor.AddStsSettings(expectedStsSettings);
            settingsEditor.Save();

            // Assert
            string  json              = mockFileSystem.File.ReadAllText(mockFilePath);
            dynamic actual            = JsonConvert.DeserializeObject(json);
            var     actualStsSettings = actual.StsSettings;

            Assert.AreEqual(expectedStsSettings.Realm, actualStsSettings.Realm.ToString());
            Assert.AreEqual(expectedStsSettings.SolutionUserSigningCertificatePath, actualStsSettings.SolutionUserSigningCertificatePath.ToString());
            Assert.AreEqual(expectedStsSettings.StsServiceEndpoint, actualStsSettings.StsServiceEndpoint.ToString());
        }
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                AuthenticationConfig config = AuthenticationConfig.GetConfig(PortalId);
                SettingsEditor.DataSource = config;
                SettingsEditor.DataBind();
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #3
0
        public void WriteServiceStsSettings(StsSettings stsSettings)
        {
            const string configMapName    = Constants.StsSettingsConfigMapName;
            const string configMapDataKey = Constants.StsSettingsConfigMapDataKey;

            _logger.LogInformation($"Writing k8s config map with service settings");
            var settingsEditor = new SettingsEditor();

            settingsEditor.AddStsSettings(stsSettings);
            var settingsJson = settingsEditor.GetSettingsJsonContent();

            _k8sClient.RecreateConfigMap(configMapName, new Dictionary <string, string> {
                { configMapDataKey, settingsJson }
            });
        }
Beispiel #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            try
            {
                OAuthConfigBase config = OAuthConfigBase.GetConfig("LinkedIn", PortalId);
                SettingsEditor.DataSource = config;
                SettingsEditor.DataBind();
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #5
0
 public ProfilesControlHandler(string profileType, MainForm mainForm, ProfileControl p,
                               SettingsEditor <TSettings, TInfo> editor,
                               InfoGetter <TInfo> g2,
                               SettingsGetter <TSettings> getter,
                               SettingsSetter <TSettings> setter)
 {
     this.profileType        = profileType;
     this.SetCurrentSettings = setter;
     this.GetCurrentSettings = getter;
     this.EditSettings       = editor;
     this.GetInfo            = g2;
     this.mainForm           = mainForm;
     p.ProfileIndexChanged  += new EventHandler(avsProfile_SelectedIndexChanged);
     p.ConfigClick          += new EventHandler(avsConfigButton_Click);
     impl = p;
     RefreshProfiles();
 }
        /// <summary>
        /// The OnLoad method runs when the Control is loaded
        /// </summary>
        /// <param name="e">An EventArgs object</param>
        protected override void OnLoad(EventArgs e)
        {
            //Call the base classes method
            base.OnLoad(e);

            try
            {
                Config config = Config.GetConfig(this.PortalId);

                SettingsEditor.DataSource = config;
                SettingsEditor.DataBind();
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
Beispiel #7
0
        public ucMidiTextSettings(MainForm pParent, SettingsEditor pSetParent, int InNumber)
            : base(pParent, pSetParent, InNumber)
        {
            InitializeComponent();

            mSetParent.OnFormClosingMsg += OnFormClosingMsg;

            mParent = pParent;



            mIsUpdating = true;
            CreateControls();

            UpdateDlg();

            mIsUpdating = false;
        }
Beispiel #8
0
        public void GetPartialStsSettingsObjectFromJsonContent()
        {
            // Arrange
            var expectedSolutionServiceId = "61ea54dc-2e6f-4c0c-a9b1-7ed01395670d";
            var expectedSolutionOwnerId   = "ses-SolutionOwner-76ab7140-eb18-44ea-8427-ad3d52510a38";
            var sb           = new StringBuilder();
            var settingsJson = sb.AppendLine("{").
                               AppendLine("  'StsSettings': {").
                               AppendLine($"    'SolutionServiceId': '{expectedSolutionServiceId}',").
                               AppendLine($"    'SolutionOwnerId': '{expectedSolutionOwnerId}'").
                               AppendLine("  }").
                               AppendLine("}").
                               ToString();

            var settingsEditor = new SettingsEditor(settingsJson);
            // Act
            var actual = settingsEditor.GetStsSettings();

            // Assert
            Assert.NotNull(actual);
            Assert.AreEqual(expectedSolutionOwnerId, actual.SolutionOwnerId);
            Assert.AreEqual(expectedSolutionServiceId, actual.SolutionServiceId);
        }
Beispiel #9
0
        private void checkBoxDonotStartagain_CheckedChanged(object sender, EventArgs e)
        {
            bool DoNotViewINTRONextTime = checkBoxDonotStartagain.Checked;

            SettingsEditor.SetDonotViewIntro(DoNotViewINTRONextTime);
        }
Beispiel #10
0
        public int Run(UserInput userInput)
        {
            try {
                var certificatesCommonName = userInput.ServiceHostname;

                _logger.LogDebug($"User Input VC: {userInput.Psc}");
                _logger.LogDebug($"User Input VC User: {userInput.User}");
                _logger.LogDebug($"User Input VC Thumbprint: {userInput.VcThumbprint}");
                _logger.LogDebug($"User Input Force Specified: {userInput.ForceSpecified}");
                _logger.LogDebug($"User Input Sts Settings Path Specified: {userInput.StsSettingsPath}");
                _logger.LogDebug($"User Input Tls Certificate Path Specified: {userInput.TlsCertificatePath}");

                userInput.EnsureIsValid(SetupFlowType.UpdateTlsCertificate);

                var stsSettings = new SettingsEditor(File.ReadAllText(userInput.StsSettingsPath)).
                                  GetStsSettings();
                _logger.LogDebug($"Sts Settings SolutionServiceId: {stsSettings.SolutionServiceId}");
                _logger.LogDebug($"Sts Settings SolutionOwnerId: {stsSettings.SolutionOwnerId}");

                var setupServiceSettings = SetupServiceSettings.FromStsSettings(stsSettings);

                setupServiceSettings.TlsCertificatePath = userInput.TlsCertificatePath;
                setupServiceSettings.TlsCertificate     = new X509Certificate2(setupServiceSettings.TlsCertificatePath);
                _logger.LogDebug($"SetupServiceSettings ServiceId: {setupServiceSettings.ServiceId}");
                _logger.LogDebug($"SetupServiceSettings OwnerId: {setupServiceSettings.OwnerId}");
                _logger.LogDebug($"SetupServiceSettings TlsCertificatePath: {setupServiceSettings.TlsCertificatePath}");
                _logger.LogDebug($"SetupServiceSettings TlsCertificate Thumbprint: {setupServiceSettings.TlsCertificate?.Thumbprint}");

                K8sSettings k8sSettings = null;
                if (userInput.K8sSettings != null && File.Exists(userInput.K8sSettings))
                {
                    k8sSettings = JsonConvert.DeserializeObject <K8sSettings>(File.ReadAllText(userInput.K8sSettings));
                }

                // === VC Update Service Registration Actions ===
                X509CertificateValidator certificateValidator = null;
                if (userInput.ForceSpecified)
                {
                    certificateValidator = new AcceptAllX509CertificateValidator();
                }
                else if (!string.IsNullOrEmpty(userInput.VcThumbprint))
                {
                    certificateValidator = new SpecifiedCertificateThumbprintValidator(userInput.VcThumbprint);
                }

                var lookupServiceClient = new LookupServiceClient(
                    userInput.Psc,
                    certificateValidator);

                // --- Lookup Service Registration ---
                var lsRegistration = new LookupServiceRegistration(
                    _loggerFactory,
                    setupServiceSettings,
                    lookupServiceClient);
                lsRegistration.UpdateServiceRegistrationTlsCertificate(userInput.User, userInput.Password);
                // --- Lookup Service Registration ---

                // === VC Update Service Registration Actions ===
            } catch (InvalidUserInputException exc) {
                _logger.LogError(exc, exc.Message);
                return(1);
            } catch (Exception exc) {
                _logger.LogError(exc, exc.Message);
                return(2);
            }

            _logger.LogInformation("Success");
            return(0);
        }
Beispiel #11
0
        public static void ServerChatProcessing(SyncData receivedData)
        {
            if (receivedData.ChatMessage.StartsWith("/MES.SSCS") == true)
            {
                receivedData.ChatMessage = receivedData.ChatMessage.Replace("/MES.SSCS", "/MES.Spawn.SpaceCargoShip");
            }

            if (receivedData.ChatMessage.StartsWith("/MES.SRE") == true)
            {
                receivedData.ChatMessage = receivedData.ChatMessage.Replace("/MES.SRE", "/MES.Spawn.RandomEncounter");
            }

            if (receivedData.ChatMessage.StartsWith("/MES.SPCS") == true)
            {
                receivedData.ChatMessage = receivedData.ChatMessage.Replace("/MES.SPCS", "/MES.Spawn.PlanetaryCargoShip");
            }

            if (receivedData.ChatMessage.StartsWith("/MES.SPI") == true)
            {
                receivedData.ChatMessage = receivedData.ChatMessage.Replace("/MES.SPI", "/MES.Spawn.PlanetaryInstallation");
            }

            if (receivedData.ChatMessage.StartsWith("/MES.SBE") == true)
            {
                receivedData.ChatMessage = receivedData.ChatMessage.Replace("/MES.SBE", "/MES.Spawn.BossEncounter");
            }

            //Debug Commands
            if (receivedData.ChatMessage.StartsWith("/MES.") == true)
            {
                //Enable Debug Mode
                if (receivedData.ChatMessage.StartsWith("/MES.EnableDebugMode.") == true)
                {
                    var msgSplit = receivedData.ChatMessage.Split('.');

                    if (msgSplit.Length != 3)
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Invalid Command Received", 5000, "White", receivedData.PlayerId);
                        return;
                    }

                    bool mode = false;

                    if (bool.TryParse(msgSplit[2], out mode) == false)
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Invalid Command Received", 5000, "White", receivedData.PlayerId);
                        return;
                    }

                    Logger.LoggerDebugMode = mode;
                    MyVisualScriptLogicProvider.ShowNotification("Debug Mode Enabled: " + mode.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Debug: InitStoreBlocks
                if (receivedData.ChatMessage.StartsWith("/MES.Debug.InitStoreBlocks") == true)
                {
                    Debug.InitStoreBlocks();
                }

                if (receivedData.ChatMessage.StartsWith("/MES.Debug.Reputation.") == true)
                {
                    Debug.ReputationCheck(receivedData);
                }

                if (receivedData.ChatMessage.StartsWith("/MES.Debug.MoreEcMad") == true)
                {
                    var player = SpawnResources.GetPlayerById(receivedData.PlayerId);

                    if (player != null)
                    {
                        foreach (var faction in MyAPIGateway.Session.Factions.Factions.Keys)
                        {
                            var npcFaction = MyAPIGateway.Session.Factions.Factions[faction];
                            MyAPIGateway.Session.Factions.SetReputationBetweenPlayerAndFaction(player.IdentityId, npcFaction.FactionId, -501);
                        }
                    }
                }

                if (receivedData.ChatMessage.StartsWith("/MES.Debug.MoreEcHostile") == true)
                {
                    var player = SpawnResources.GetPlayerById(receivedData.PlayerId);

                    if (player != null)
                    {
                        foreach (var faction in MyAPIGateway.Session.Factions.Factions.Keys)
                        {
                            var npcFaction = MyAPIGateway.Session.Factions.Factions[faction];
                            MyAPIGateway.Session.Factions.SetReputationBetweenPlayerAndFaction(player.IdentityId, npcFaction.FactionId, -1500);
                        }
                    }
                }

                if (receivedData.ChatMessage.StartsWith("/MES.Debug.MoreEcNeutral") == true)
                {
                    var player = SpawnResources.GetPlayerById(receivedData.PlayerId);

                    if (player != null)
                    {
                        foreach (var faction in MyAPIGateway.Session.Factions.Factions.Keys)
                        {
                            var npcFaction = MyAPIGateway.Session.Factions.Factions[faction];
                            MyAPIGateway.Session.Factions.SetReputationBetweenPlayerAndFaction(player.IdentityId, npcFaction.FactionId, 0);
                        }
                    }
                }

                //Debug.CheckNight
                if (receivedData.ChatMessage.StartsWith("/MES.Debug.CheckNight") == true)
                {
                    MyVisualScriptLogicProvider.ShowNotification("Is Night: " + SpawnResources.IsNight(MyAPIGateway.Session.LocalHumanPlayer.GetPosition()).ToString(), 5000, "White", receivedData.PlayerId);
                    MyVisualScriptLogicProvider.ShowNotification("Time: " + MyAPIGateway.Session.GameDateTime.ToString(), 5000, "White", receivedData.PlayerId);
                    var gameTime = MyAPIGateway.Session.GameDateTime - new DateTime(2081, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                    MyVisualScriptLogicProvider.ShowNotification("Seconds: " + gameTime.TotalSeconds.ToString(), 5000, "White", receivedData.PlayerId);
                }

                //Debug.CheckRemovalStatus
                if (receivedData.ChatMessage.StartsWith("/MES.Debug.CheckRemovalStatus") == true)
                {
                    MyVisualScriptLogicProvider.ShowNotification("Number Of Pending Deletions: " + NPCWatcher.DeleteGridList.Count.ToString(), 5000, "White", receivedData.PlayerId);
                    MyVisualScriptLogicProvider.ShowNotification("Deletion Process Status: " + NPCWatcher.DeleteGrids.ToString(), 5000, "White", receivedData.PlayerId);
                }

                //Debug.Debug.CreateKPL
                if (receivedData.ChatMessage.StartsWith("/MES.Debug.CreateKPL") == true)
                {
                    KnownPlayerLocationManager.AddKnownPlayerLocation(MyAPIGateway.Session.LocalHumanPlayer.GetPosition(), "SPRT", 200, 1, -1);
                }

                //Joke: ComeAtMeBro
                if (receivedData.ChatMessage.StartsWith("/MES.ComeAtMeBro") == true)
                {
                    var playerList = new List <IMyPlayer>();
                    MyAPIGateway.Players.GetPlayers(playerList);
                    IMyPlayer thisPlayer = null;

                    foreach (var player in playerList)
                    {
                        if (player.IdentityId == receivedData.PlayerId)
                        {
                            thisPlayer = player;
                            break;
                        }
                    }

                    if (thisPlayer == null)
                    {
                        return;
                    }

                    int bros = 0;

                    foreach (var cubeGrid in NPCWatcher.ActiveNPCs.Keys.ToList())
                    {
                        if (cubeGrid == null || MyAPIGateway.Entities.Exist(cubeGrid) == false)
                        {
                            continue;
                        }

                        if (cubeGrid.Physics == null)
                        {
                            continue;
                        }

                        if (NPCWatcher.ActiveNPCs[cubeGrid].SpawnType == "SpaceCargoShip")
                        {
                            cubeGrid.Physics.LinearVelocity = Vector3D.Normalize(thisPlayer.GetPosition() - cubeGrid.GetPosition()) * 100;
                            bros++;
                        }
                    }

                    MyVisualScriptLogicProvider.ShowNotification(bros.ToString() + " Bros Coming At You!", 5000, "Red", thisPlayer.IdentityId);
                }

                //RemoveAllNPCs
                if (receivedData.ChatMessage.StartsWith("/MES.RemoveAllNPCs") == true)
                {
                    foreach (var cubeGrid in NPCWatcher.ActiveNPCs.Keys.ToList())
                    {
                        if (cubeGrid == null || MyAPIGateway.Entities.Exist(cubeGrid) == false)
                        {
                            continue;
                        }

                        if (cubeGrid.Physics == null)
                        {
                            continue;
                        }

                        if (NPCWatcher.ActiveNPCs[cubeGrid].CleanupIgnore == false)
                        {
                            NPCWatcher.ActiveNPCs[cubeGrid].FlagForDespawn = true;
                        }
                    }

                    MyVisualScriptLogicProvider.ShowNotification("All Eligible NPC Grids Processed For Removal", 5000, "White", receivedData.PlayerId);
                }

                //Settings
                if (receivedData.ChatMessage.StartsWith("/MES.Settings.") == true)
                {
                    var result = SettingsEditor.EditSettings(receivedData.ChatMessage);
                    MyVisualScriptLogicProvider.ShowNotification(result, 5000, "White", receivedData.PlayerId);
                    return;
                }

                //TryRandomSpawn
                if (receivedData.ChatMessage.StartsWith("/MES.Spawn.") == true)
                {
                    var playerList = new List <IMyPlayer>();
                    MyAPIGateway.Players.GetPlayers(playerList);
                    IMyPlayer thisPlayer = null;

                    foreach (var player in playerList)
                    {
                        if (player.IdentityId == receivedData.PlayerId)
                        {
                            thisPlayer = player;
                            break;
                        }
                    }

                    if (thisPlayer == null)
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Could Not Spawn Encounter: Player Not In Watch List", 5000, "White", receivedData.PlayerId);
                        return;
                    }

                    bool success = false;

                    if (receivedData.ChatMessage.Contains("SpaceCargoShip") == true || receivedData.ChatMessage.Contains("AllSpawns") == true)
                    {
                        if (MES_SessionCore.playerWatchList.ContainsKey(thisPlayer) == true)
                        {
                            SpawnGroupManager.AdminSpawnGroup  = SpecificSpawnGroupRequest(receivedData.ChatMessage, "SpaceCargoShip");
                            MES_SessionCore.PlayerWatcherTimer = 0;
                            MES_SessionCore.playerWatchList[thisPlayer].SpaceCargoShipTimer = 0;
                            MyVisualScriptLogicProvider.ShowNotification("Attempting Random Spawn: Space Cargo Ship", 5000, "White", receivedData.PlayerId);
                            success = true;
                        }
                    }

                    if (receivedData.ChatMessage.Contains("PlanetaryCargoShip") == true)
                    {
                        if (MES_SessionCore.playerWatchList.ContainsKey(thisPlayer) == true)
                        {
                            SpawnGroupManager.AdminSpawnGroup = SpecificSpawnGroupRequest(receivedData.ChatMessage, "PlanetaryCargoShip");
                            MES_SessionCore.playerWatchList[thisPlayer].AtmoCargoShipTimer = 0;
                            MES_SessionCore.PlayerWatcherTimer = 0;
                            MyVisualScriptLogicProvider.ShowNotification("Attempting Random Spawn: Planetary Cargo Ship", 5000, "White", receivedData.PlayerId);
                            success = true;
                        }
                    }

                    if (receivedData.ChatMessage.Contains("RandomEncounter") == true)
                    {
                        if (MES_SessionCore.playerWatchList.ContainsKey(thisPlayer) == true)
                        {
                            SpawnGroupManager.AdminSpawnGroup = SpecificSpawnGroupRequest(receivedData.ChatMessage, "RandomEncounter");

                            MES_SessionCore.PlayerWatcherTimer = 0;
                            MES_SessionCore.playerWatchList[thisPlayer].RandomEncounterCheckTimer    = 0;
                            MES_SessionCore.playerWatchList[thisPlayer].RandomEncounterCoolDownTimer = 0;
                            var fakeDistance = Settings.RandomEncounters.PlayerTravelDistance + 1000;
                            MES_SessionCore.playerWatchList[thisPlayer].RandomEncounterDistanceCoordCheck = fakeDistance * Vector3D.Up + thisPlayer.GetPosition();
                            MyVisualScriptLogicProvider.ShowNotification("Attempting Random Spawn: Random Encounter", 5000, "White", receivedData.PlayerId);
                            success = true;
                        }
                    }

                    if (receivedData.ChatMessage.Contains("PlanetaryInstallation") == true)
                    {
                        if (MES_SessionCore.playerWatchList.ContainsKey(thisPlayer) == true)
                        {
                            SpawnGroupManager.AdminSpawnGroup = SpecificSpawnGroupRequest(receivedData.ChatMessage, "PlanetaryInstallation");

                            MES_SessionCore.PlayerWatcherTimer = 0;
                            MES_SessionCore.playerWatchList[thisPlayer].PlanetaryInstallationCheckTimer    = 0;
                            MES_SessionCore.playerWatchList[thisPlayer].PlanetaryInstallationCooldownTimer = 0;

                            var fakeDistance = Settings.PlanetaryInstallations.PlayerDistanceSpawnTrigger + 1000;
                            var randomDir    = SpawnResources.GetRandomCompassDirection(thisPlayer.GetPosition(), SpawnResources.GetNearestPlanet(thisPlayer.GetPosition()));

                            MES_SessionCore.playerWatchList[thisPlayer].InstallationDistanceCoordCheck = fakeDistance * randomDir + thisPlayer.GetPosition();
                            MyVisualScriptLogicProvider.ShowNotification("Attempting Random Spawn: Planetary Installation", 5000, "White", receivedData.PlayerId);
                            success = true;
                        }
                    }

                    if (receivedData.ChatMessage.Contains("BossEncounter") == true)
                    {
                        if (BossEncounterSpawner.IsPlayerInBossEncounter(thisPlayer.IdentityId) == true)
                        {
                            MyVisualScriptLogicProvider.ShowNotification("Boss Encounter Already Active", 5000, "White", receivedData.PlayerId);
                        }

                        if (MES_SessionCore.playerWatchList.ContainsKey(thisPlayer) == true)
                        {
                            SpawnGroupManager.AdminSpawnGroup = SpecificSpawnGroupRequest(receivedData.ChatMessage, "BossEncounter");

                            MES_SessionCore.PlayerWatcherTimer = 0;
                            MES_SessionCore.playerWatchList[thisPlayer].BossEncounterCooldownTimer = 0;
                            MES_SessionCore.playerWatchList[thisPlayer].BossEncounterCheckTimer    = 0;
                            MyVisualScriptLogicProvider.ShowNotification("Attempting Random Spawn: Boss Encounter", 5000, "White", receivedData.PlayerId);
                            success = true;
                        }
                    }

                    if (success == false)
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Could Not Spawn Encounter: Player Not In Watch List", 5000, "White", receivedData.PlayerId);
                    }

                    return;
                }

                //WaveSpawner
                if (receivedData.ChatMessage.StartsWith("/MES.WaveSpawner.") == true)
                {
                    bool success = false;

                    if (receivedData.ChatMessage.Contains("SpaceCargoShip") == true && Settings.SpaceCargoShips.EnableWaveSpawner == true)
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Wave Spawner (Space Cargo Ship) Activated.", 5000, "White", receivedData.PlayerId);
                        MES_SessionCore.SpaceCargoShipWaveSpawner.CurrentWaveTimer = Settings.SpaceCargoShips.MaxWaveSpawnTime;
                        success = true;
                    }

                    if (success == false)
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Wave Spawner Could Not Be Triggered. Please Enable In Configuration.", 5000, "White", receivedData.PlayerId);
                    }
                }

                //Enable Territory
                if (receivedData.ChatMessage.StartsWith("/MES.EnableTerritory.") == true)
                {
                    var messageReplace = receivedData.ChatMessage.Replace("/MES.EnableTerritory.", "");

                    if (messageReplace == "")
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Invalid Command Received: No Territory Name Provided", 5000, "White", receivedData.PlayerId);
                        return;
                    }

                    MyAPIGateway.Utilities.SetVariable <bool>("MES-Territory-" + messageReplace, true);
                    TerritoryManager.TerritoryRefresh();
                    MyVisualScriptLogicProvider.ShowNotification("Territory Enabled: " + messageReplace, 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Disable Territory
                if (receivedData.ChatMessage.StartsWith("/MES.DisableTerritory.") == true)
                {
                    var messageReplace = receivedData.ChatMessage.Replace("/MES.DisableTerritory.", "");

                    if (messageReplace == "")
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Invalid Command Received: No Territory Name Provided", 5000, "White", receivedData.PlayerId);
                        return;
                    }

                    MyAPIGateway.Utilities.SetVariable <bool>("MES-Territory-" + messageReplace, false);
                    TerritoryManager.TerritoryRefresh();
                    MyVisualScriptLogicProvider.ShowNotification("Territory Disabled: " + messageReplace, 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Get SpawnGroups
                if (receivedData.ChatMessage.StartsWith("/MES.GetSpawnGroups") == true)
                {
                    var syncData = receivedData;
                    syncData.Instruction       = "MESClipboard";
                    syncData.ClipboardContents = Logger.SpawnGroupResults();
                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    MyVisualScriptLogicProvider.ShowNotification("Spawn Group Data To Clipboard. Success: " + sendStatus.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Get Active NPCs
                if (receivedData.ChatMessage.StartsWith("/MES.GetActiveNPCs") == true)
                {
                    var syncData = receivedData;
                    syncData.Instruction       = "MESClipboard";
                    syncData.ClipboardContents = Logger.GetActiveNPCs();
                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    MyVisualScriptLogicProvider.ShowNotification("Active NPC Data To Clipboard. Success: " + sendStatus.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Get Block Definition Info
                if (receivedData.ChatMessage.StartsWith("/MES.GetBlockDefinitions") == true)
                {
                    var syncData = receivedData;
                    syncData.Instruction       = "MESClipboard";
                    syncData.ClipboardContents = Logger.GetBlockDefinitionInfo();
                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    MyVisualScriptLogicProvider.ShowNotification("Block Data To Clipboard. Success: " + sendStatus.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Get Block Definition Info
                if (receivedData.ChatMessage.StartsWith("/MES.GetColorsFromGrid") == true)
                {
                    var syncData = receivedData;
                    syncData.Instruction       = "MESClipboard";
                    syncData.ClipboardContents = Logger.GetColorListFromGrid(SpawnResources.GetPlayerById(syncData.PlayerId));
                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    return;
                }

                //Get Player Watch Lists
                if (receivedData.ChatMessage.StartsWith("/MES.GetPlayerWatchList") == true)
                {
                    var syncData = receivedData;
                    syncData.Instruction       = "MESClipboard";
                    syncData.ClipboardContents = Logger.GetPlayerWatcherData();
                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    MyVisualScriptLogicProvider.ShowNotification("Player Watch Data To Clipboard. Success: " + sendStatus.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Get Local Threat Score
                if (receivedData.ChatMessage.StartsWith("/MES.GetThreatScore") == true || receivedData.ChatMessage.StartsWith("/MES.GTS") == true)
                {
                    var messageReplace = receivedData.ChatMessage.Replace("/MES.GetThreatScore.", "");
                    ImprovedSpawnGroup selectedSpawnGroup = null;

                    if (messageReplace == "")
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Default Threat Check Range Of 5000 Used. Spawngroup Not Provided or Detected.", 5000, "White", receivedData.PlayerId);
                        //return;
                        selectedSpawnGroup = new ImprovedSpawnGroup();
                    }

                    var playerList = new List <IMyPlayer>();
                    MyAPIGateway.Players.GetPlayers(playerList);
                    IMyPlayer thisPlayer = null;

                    foreach (var player in playerList)
                    {
                        if (player.IdentityId == receivedData.PlayerId)
                        {
                            thisPlayer = player;
                            break;
                        }
                    }

                    if (thisPlayer == null)
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Command Failed: Apparently you don't exist?", 5000, "White", receivedData.PlayerId);
                        return;
                    }

                    if (selectedSpawnGroup == null)
                    {
                        foreach (var spawnGroup in SpawnGroupManager.SpawnGroups)
                        {
                            if (spawnGroup.SpawnGroup.Id.SubtypeName == messageReplace)
                            {
                                selectedSpawnGroup = spawnGroup;
                                break;
                            }
                        }
                    }

                    if (selectedSpawnGroup == null)
                    {
                        MyVisualScriptLogicProvider.ShowNotification("Default Threat Check Range Of 5000 Used. Spawngroup Not Provided or Detected.", 5000, "White", receivedData.PlayerId);
                        //return;
                        selectedSpawnGroup = new ImprovedSpawnGroup();
                    }

                    SpawnResources.RefreshEntityLists();
                    SpawnResources.LastThreatRefresh = SpawnResources.GameStartTime;
                    var threatLevel = SpawnResources.GetThreatLevel(selectedSpawnGroup, thisPlayer.GetPosition());

                    MyVisualScriptLogicProvider.ShowNotification("Threat Level Score Near You: " + threatLevel.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Reset Active Territories
                if (receivedData.ChatMessage.StartsWith("/MES.ResetActiveTerritories") == true)
                {
                    TerritoryManager.TerritoryRefresh(true);

                    var syncData = receivedData;
                    syncData.Instruction = "MESResetActiveTerritories";
                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    MyVisualScriptLogicProvider.ShowNotification("Active Territories Reset To Default Values.", 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Get Spawned Unique Encounters
                if (receivedData.ChatMessage.StartsWith("/MES.GetSpawnedUniqueEncounters") == true)
                {
                    var syncData = receivedData;
                    syncData.Instruction       = "MESClipboard";
                    syncData.ClipboardContents = Logger.GetSpawnedUniqueEncounters();
                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    MyVisualScriptLogicProvider.ShowNotification("Spawned Unique Encounters List Sent To Clipboard. Success: " + sendStatus.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Get Spawn Group Eligibility At Position
                if (receivedData.ChatMessage.StartsWith("/MES.GetEligibleSpawnsAtPosition") == true || receivedData.ChatMessage.StartsWith("/MES.GESAP") == true)
                {
                    var syncData = receivedData;
                    syncData.Instruction       = "MESClipboard";
                    syncData.ClipboardContents = Logger.EligibleSpawnGroupsAtPosition(receivedData.PlayerPosition);
                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    MyVisualScriptLogicProvider.ShowNotification("List of Eligible Spawn Groups At Position Sent To Clipboard. Success: " + sendStatus.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }

                //Get Planet Direction At Position
                if (receivedData.ChatMessage.StartsWith("/MES.GetDirectionFromPlanetCore") == true)
                {
                    var syncData = receivedData;
                    syncData.Instruction = "MESClipboard";

                    var planet = SpawnResources.GetNearestPlanet(receivedData.PlayerPosition);

                    if (planet != null)
                    {
                        var planetEntity = planet as IMyEntity;
                        var dir          = Vector3D.Normalize(receivedData.PlayerPosition - planetEntity.GetPosition());
                        var sb           = new StringBuilder();
                        sb.Append("Direction Vector For ").Append(planet.Generator.Id.SubtypeName).Append(" At Position ").Append(planetEntity.GetPosition().ToString()).AppendLine();
                        sb.Append("X: ").Append(dir.X.ToString()).AppendLine();
                        sb.Append("Y: ").Append(dir.Y.ToString()).AppendLine();
                        sb.Append("Z: ").Append(dir.Z.ToString()).AppendLine();
                        syncData.ClipboardContents = sb.ToString();
                    }
                    else
                    {
                        syncData.ClipboardContents = "No Planets In Game World.";
                    }


                    var  sendData   = MyAPIGateway.Utilities.SerializeToBinary <SyncData>(syncData);
                    bool sendStatus = MyAPIGateway.Multiplayer.SendMessageTo(8877, sendData, receivedData.SteamUserId);
                    MyVisualScriptLogicProvider.ShowNotification("Direction From Planet Core Values Sent To Clipboard. Success: " + sendStatus.ToString(), 5000, "White", receivedData.PlayerId);
                    return;
                }
            }

            //Settings Commands
        }