Esempio n. 1
0
        public SimulationProperties(SimulationPluginConfiguration configuration)
        {
            config = configuration;
            InitializeComponent();

            fillControls();
        }
Esempio n. 2
0
        public static string RequiredRightsList(SimulationPluginConfiguration config, PlayerInfo player)
        {
            List <string> securityRequests = new List <string>();

            // Security-Settings
            if (player.RequestFileAccess)
            {
                if (!config.configuration.AllowFileAccess)
                {
                    securityRequests.Add("- " + Resource.SimulatorPluginAntPropertiesIoAccess);
                }
            }

            if (player.RequestDatabaseAccess)
            {
                if (!config.configuration.AllowDatabaseAccess)
                {
                    securityRequests.Add("- " + Resource.SimulatorPluginAntPropertiesDbAccess);
                }
            }

            if (player.RequestUserInterfaceAccess)
            {
                if (!config.configuration.AllowUserinterfaceAccess)
                {
                    securityRequests.Add("- " + Resource.SimulatorPluginAntPropertiesUiAccess);
                }
            }

            if (player.RequestReferences)
            {
                if (!config.configuration.AllowReferences)
                {
                    securityRequests.Add("- " + Resource.SimulatorPluginAntPropertiesRefAccess);
                }
            }

            if (player.RequestNetworkAccess)
            {
                if (!config.configuration.AllowNetworkAccess)
                {
                    securityRequests.Add("- " + Resource.SimulatorPluginAntPropertiesNetAccess);
                }
            }

            if (securityRequests.Count > 0)
            {
                return
                    (Resource.SimulationPluginRightsLocked + Environment.NewLine +
                     string.Join(Environment.NewLine, securityRequests.ToArray()));
            }

            return(string.Empty);
        }
Esempio n. 3
0
        public TeamSetup(SimulationPluginConfiguration config, List <PlayerInfoFilename> players)
        {
            this.players  = players;
            Configuration = config;

            InitializeComponent();
            ignoreUpdates = true;

            ignoreUpdates = false;
            timer.Enabled = true;
            UpdatePanel();
        }
Esempio n. 4
0
        public static bool LockedRights(SimulationPluginConfiguration config, PlayerInfo player)
        {
            // Global check. If the player needs no rights there is no way to lock
            if (!RequestRights(player))
            {
                return(false);
            }

            // Fileaccess
            if (player.RequestFileAccess && !config.configuration.AllowFileAccess)
            {
                return(true);
            }

            // Database
            if (player.RequestDatabaseAccess && !config.configuration.AllowDatabaseAccess)
            {
                return(true);
            }

            // Refs
            if (player.RequestReferences && !config.configuration.AllowReferences)
            {
                return(true);
            }

            // Userinterfaces
            if (player.RequestUserInterfaceAccess && !config.configuration.AllowUserinterfaceAccess)
            {
                return(true);
            }

            // Network
            if (player.RequestNetworkAccess && !config.configuration.AllowNetworkAccess)
            {
                return(true);
            }

            // No locks
            return(false);
        }
Esempio n. 5
0
        public RightsRequest(SimulationPluginConfiguration config, PlayerInfoFilename player)
        {
            playerInfo = player;
            InitializeComponent();
            yesButton.Enabled = acceptCheckBox.Checked;

            colonyLabel.Text = player.ColonyName;
            authorLabel.Text =
                string.Format(Resource.SimulatorPluginAntPropertiesAuthorFormat, player.FirstName, player.LastName);

            if (player.RequestFileAccess)
            {
                if (config.configuration.AllowFileAccess)
                {
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesIoAccess, open);
                }
                else
                {
                    locked = true;
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesIoAccess, closed);
                }
            }
            if (player.RequestDatabaseAccess)
            {
                if (config.configuration.AllowDatabaseAccess)
                {
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesDbAccess, open);
                }
                else
                {
                    locked = true;
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesDbAccess, closed);
                }
            }
            if (player.RequestReferences)
            {
                if (config.configuration.AllowReferences)
                {
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesRefAccess, open);
                }
                else
                {
                    locked = true;
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesRefAccess, closed);
                }
            }
            if (player.RequestUserInterfaceAccess)
            {
                if (config.configuration.AllowUserinterfaceAccess)
                {
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesUiAccess, open);
                }
                else
                {
                    locked = true;
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesUiAccess, closed);
                }
            }
            if (player.RequestNetworkAccess)
            {
                if (config.configuration.AllowNetworkAccess)
                {
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesNetAccess, open);
                }
                else
                {
                    locked = true;
                    rightsListView.Items.Add(Resource.SimulatorPluginAntPropertiesNetAccess, closed);
                }
            }

            if (locked)
            {
                sorryPanel.Visible  = true;
                acceptPanel.Visible = false;
                AcceptButton        = closeButton;
                CancelButton        = closeButton;
            }
            else
            {
                sorryPanel.Visible  = false;
                acceptPanel.Visible = true;
                AcceptButton        = yesButton;
                CancelButton        = noButton;
            }
        }