Esempio n. 1
0
 /// <summary>
 /// Конструктор
 /// </summary>
 public WebSettings()
 {
     CommSettings    = new CommSettings();
     ScriptPaths     = new ScriptPaths();
     PluginFileNames = new List <string>();
     SetToDefault();
 }
Esempio n. 2
0
        public bool Equals(SaveFileVC other)
        {
            if (other == null)
            {
                return(false);
            }

            return(SimpleVars.Equals(other.SimpleVars) &&
                   Scripts.Equals(other.Scripts) &&
                   PedPool.Equals(other.PedPool) &&
                   Garages.Equals(other.Garages) &&
                   GameLogic.Equals(other.GameLogic) &&
                   Vehicles.Equals(other.Vehicles) &&
                   Objects.Equals(other.Objects) &&
                   Paths.Equals(other.Paths) &&
                   Cranes.Equals(other.Cranes) &&
                   Pickups.Equals(other.Pickups) &&
                   PhoneInfo.Equals(other.PhoneInfo) &&
                   RestartPoints.Equals(other.RestartPoints) &&
                   RadarBlips.Equals(other.RadarBlips) &&
                   Zones.Equals(other.Zones) &&
                   Gangs.Equals(other.Gangs) &&
                   CarGenerators.Equals(other.CarGenerators) &&
                   ParticleObjects.Equals(other.ParticleObjects) &&
                   AudioScriptObjects.Equals(other.AudioScriptObjects) &&
                   ScriptPaths.Equals(other.ScriptPaths) &&
                   PlayerInfo.Equals(other.PlayerInfo) &&
                   Stats.Equals(other.Stats) &&
                   SetPieces.Equals(other.SetPieces) &&
                   Streaming.Equals(other.Streaming) &&
                   PedTypeInfo.Equals(other.PedTypeInfo));
        }
Esempio n. 3
0
 /// <summary>
 /// Конструктор
 /// </summary>
 public WebSettings()
 {
     CommSettings    = new CommSettings();
     ScriptPaths     = new ScriptPaths();
     PluginFileNames = new List <string>();
     CustomOptions   = new SortedList <string, OptionList>();
     SetToDefault();
 }
Esempio n. 4
0
        private void Load()
        {
            IScriptPaths              scriptPaths              = new ScriptPaths();
            IExecutePowerShellScript  executePowerShellScript  = new ExecutePowerShellScript();
            ITaskbarIconConfiguration taskbarIconConfiguration = new TaskbarIconConfiguration(this, PowerShellRunnerTaskbarIcon, executePowerShellScript, scriptPaths);

            taskbarIconConfiguration.StartMinimized();
            taskbarIconConfiguration.Run();

            //MessageBox.Show(stringBuilder.ToString());
        }
Esempio n. 5
0
        private void Load()
        {
            IRoundCorners     roundCorners = new RoundCorners();
            IApplicationStyle style        = new ApplicationStyle(roundCorners, true, true);

            style.Run();

            IScriptPaths              scriptPaths              = new ScriptPaths();
            IExecutePowerShellScript  executePowerShellScript  = new ExecutePowerShellScript();
            ITaskBarIconConfiguration taskBarIconConfiguration =
                new TaskBarIconConfiguration(this, PowerShellRunnerTaskBarIcon, executePowerShellScript, scriptPaths);

            taskBarIconConfiguration.StartMinimized();
            taskBarIconConfiguration.Run();

            //MessageBox.Show(stringBuilder.ToString());
        }
Esempio n. 6
0
        /// <summary>
        /// Установить значения настроек по умолчанию
        /// </summary>
        protected void SetToDefault()
        {
            Culture       = "";
            DataRefrRate  = 1000;
            ArcRefrRate   = 10000;
            DispEventCnt  = 100;
            ChartGap      = 90;
            StartPage     = "";
            CmdEnabled    = true;
            CmdPassword   = true;
            RemEnabled    = false;
            ViewsFromBase = true;
            ShareStats    = true;

            CommSettings.SetToDefault();
            ScriptPaths.SetToDefault();
            PluginFileNames.Clear();
        }
Esempio n. 7
0
        private void CheckScriptPaths()
        {
            ScriptPaths = ScriptPaths
                          .Where(s => s.StartsWith("[root]"))
                          .Select(s => s.Replace("[root]", AppDomain.CurrentDomain.BaseDirectory))
                          .ToArray <string>();

            string[] nonExistingPaths = Array.FindAll <string>(ScriptPaths, s => !Directory.Exists(s));

            if (nonExistingPaths.Length > 0)
            {
                string missingPaths = string.Empty;
                Array.ForEach <string>(nonExistingPaths, s => missingPaths += s + Environment.NewLine);

                throw new DirectoryNotFoundException("One or more script directories do not exist!" + Environment.NewLine +
                                                     missingPaths);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// Отобразить настройки
        /// </summary>
        private void SettingsToControls(WebSettings webSettings)
        {
            CommSettings commSettings = webSettings.CommSettings;

            txtServerHost.Text    = commSettings.ServerHost;
            txtServerPort.Text    = commSettings.ServerPort.ToString();
            txtServerTimeout.Text = commSettings.ServerTimeout.ToString();
            txtServerUser.Text    = commSettings.ServerUser;
            txtServerPwd.Text     = "";

            txtCulture.Text          = webSettings.Culture;
            txtDataRefrRate.Text     = webSettings.DataRefrRate.ToString();
            txtArcRefrRate.Text      = webSettings.ArcRefrRate.ToString();
            txtDispEventCnt.Text     = webSettings.DispEventCnt.ToString();
            txtChartGap.Text         = webSettings.ChartGap.ToString();
            txtStartPage.Text        = webSettings.StartPage;
            chkCmdEnabled.Checked    = webSettings.CmdEnabled;
            chkCmdPassword.Checked   = webSettings.CmdPassword;
            chkRemEnabled.Checked    = webSettings.RemEnabled;
            chkViewsFromBase.Checked = webSettings.ViewsFromBase;
            chkShareStats.Checked    = webSettings.ShareStats;

            // заполнение списков плагинов
            ddlChartScript.Items.Clear();
            ddlCmdScript.Items.Clear();
            ddlEventAckScript.Items.Clear();

            ddlChartScript.Items.Add("");
            ddlCmdScript.Items.Add("");
            ddlEventAckScript.Items.Add("");

            string curChartScriptPath    = webSettings.ScriptPaths.ChartScriptPath;
            string curCmdScriptPath      = webSettings.ScriptPaths.CmdScriptPath;
            string curEventAckScriptPath = webSettings.ScriptPaths.EventAckScriptPath;
            int    chartScriptInd        = 0;
            int    cmdScriptInd          = 0;
            int    eventAckScriptInd     = 0;

            foreach (PluginSpec pluginSpec in userData.PluginSpecs)
            {
                ScriptPaths scriptPaths = pluginSpec.ScriptPaths;

                if (scriptPaths != null)
                {
                    if (!string.IsNullOrEmpty(scriptPaths.ChartScriptPath))
                    {
                        ddlChartScript.Items.Add(new ListItem(pluginSpec.Name, scriptPaths.ChartScriptPath));
                        if (string.Equals(curChartScriptPath, scriptPaths.ChartScriptPath,
                                          StringComparison.OrdinalIgnoreCase))
                        {
                            chartScriptInd = ddlChartScript.Items.Count - 1;
                        }
                    }

                    if (!string.IsNullOrEmpty(scriptPaths.CmdScriptPath))
                    {
                        ddlCmdScript.Items.Add(new ListItem(pluginSpec.Name, scriptPaths.CmdScriptPath));
                        if (string.Equals(curCmdScriptPath, scriptPaths.CmdScriptPath,
                                          StringComparison.OrdinalIgnoreCase))
                        {
                            cmdScriptInd = ddlCmdScript.Items.Count - 1;
                        }
                    }

                    if (!string.IsNullOrEmpty(scriptPaths.EventAckScriptPath))
                    {
                        ddlEventAckScript.Items.Add(new ListItem(pluginSpec.Name, scriptPaths.EventAckScriptPath));
                        if (string.Equals(curEventAckScriptPath, scriptPaths.EventAckScriptPath,
                                          StringComparison.OrdinalIgnoreCase))
                        {
                            eventAckScriptInd = ddlEventAckScript.Items.Count - 1;
                        }
                    }
                }
            }

            // установка выбранных элементов выпадающих списков
            if (chartScriptInd > 0 || string.IsNullOrEmpty(curChartScriptPath))
            {
                ddlChartScript.SelectedIndex = chartScriptInd;
            }
            else
            {
                ddlChartScript.Items.Add(new ListItem(PlgPhrases.UnknownPlugin, curChartScriptPath));
                ddlChartScript.SelectedIndex = ddlChartScript.Items.Count - 1;
            }

            if (cmdScriptInd > 0 || string.IsNullOrEmpty(curCmdScriptPath))
            {
                ddlCmdScript.SelectedIndex = cmdScriptInd;
            }
            else
            {
                ddlCmdScript.Items.Add(new ListItem(PlgPhrases.UnknownPlugin, curCmdScriptPath));
                ddlCmdScript.SelectedIndex = ddlCmdScript.Items.Count - 1;
            }

            if (eventAckScriptInd > 0 || string.IsNullOrEmpty(curEventAckScriptPath))
            {
                ddlEventAckScript.SelectedIndex = eventAckScriptInd;
            }
            else
            {
                ddlEventAckScript.Items.Add(new ListItem(PlgPhrases.UnknownPlugin, curEventAckScriptPath));
                ddlEventAckScript.SelectedIndex = ddlEventAckScript.Items.Count - 1;
            }
        }
Esempio n. 9
0
 public bool Equals(ScriptPaths sp)
 {
     return(Default == sp.Default &&
            Custom == sp.Custom);
 }
Esempio n. 10
0
 private void RemoveDuplicates()
 {
     ScriptPaths    = ScriptPaths.Distinct().ToArray();
     FileExtensions = FileExtensions.Distinct().ToArray();
 }