/// -----------------------------------------------------------------------------------
        /// <summary>
        /// Get spreadsheet details from the user
        /// </summary>
        /// -----------------------------------------------------------------------------------
        public override bool HandlePreScan(Seed seed)
        {
            _spreadSheetModel = new SpreadSheetModel(seed.Id);

            var chooser  = new ColumnChooser(_spreadSheetModel);
            var settings = SettingsHandler.GetSettings <SpreadsheetSettings>("SpreadSheetHandler");

            if (settings == null)
            {
                settings = new SpreadsheetSettings();
            }
            if (_spreadSheetModel.ColumnNames.Contains(settings.PathColumn))
            {
                _spreadSheetModel.SelectedPathColumn = _spreadSheetModel.GetColumnIndex(settings.PathColumn);
            }
            if (settings.SizeColumn != null)
            {
                _spreadSheetModel.SizeColumn = settings.SizeColumn;
            }
            if (settings.DoubleClickTemplate != null)
            {
                _spreadSheetModel.DoubleClickTemplate = settings.DoubleClickTemplate;
            }

            if (chooser.ShowDialog().Value)
            {
                var pathColumn = _spreadSheetModel.ColumnNames[_spreadSheetModel.SelectedPathColumn];
                _columnInfo = ColumnInfo.CreateFromFixedColumns(_spreadSheetModel.ColumnNames, _spreadSheetModel.ValueColumns, pathColumn);
                SizeColumn  = _spreadSheetModel.SizeColumn;

                settings.PathColumn          = pathColumn;
                settings.SizeColumn          = _spreadSheetModel.SizeColumn;
                settings.DoubleClickTemplate = _spreadSheetModel.DoubleClickTemplate;
                SettingsHandler.SaveSettings("SpreadSheetHandler", settings);
                return(true);
            }
            return(false);
        }
        private static void LoadSettingsAndGroups()
        {
            LunaLog.Normal("Loading groups...");
            GroupSystem.LoadGroups();
            LunaLog.Normal("Loading settings...");
            SettingsHandler.LoadSettings();
            ServerContext.ConfigsLoaded = true;
            SettingsHandler.ValidateDifficultySettings();

            if (GeneralSettings.SettingsStore.ModControl)
            {
                LunaLog.Normal("Loading mod control...");
                ModFileSystem.LoadModFile();
            }

            if (Common.PlatformIsWindows())
            {
                Console.Title += $" ({GeneralSettings.SettingsStore.ServerName})";
#if DEBUG
                Console.Title += " DEBUG";
#endif
            }
        }
        public IActionResult PutSettings(Guid guid, [FromBody] BodySettings settings)
        {
            if (guid == Guid.Empty)
            {
                return(Problem("Empty GUID is invalid."));
            }

            _logger.LogInformation("Enter PutSettings.");

            //database process id
            Guid processId = Guid.NewGuid();

            try
            {
                Task.Run(() =>
                {
                    using (SettingsHandler handler = new SettingsHandler(_settings, _eventHub, _preingestCollection))
                    {
                        handler.Logger = _logger;
                        handler.SetSessionGuid(guid);
                        handler.CurrentSettings = settings;
                        processId = handler.AddProcessAction(processId, typeof(SettingsHandler).Name, String.Format("Save user input setting(s) for folder {0}", guid), String.Concat(typeof(SettingsHandler).Name, ".json"));
                        _logger.LogInformation("Execute handler ({0}) with GUID {1}.", typeof(SettingsHandler).Name, guid.ToString());
                        handler.Execute();
                    }
                });
            }
            catch (Exception e)
            {
                _logger.LogError(e, "An exception was thrown in {0}: '{1}'.", typeof(SettingsHandler).Name, e.Message);
                return(ValidationProblem(e.Message, typeof(SettingsHandler).Name));
            }

            _logger.LogInformation("Exit PutSettings.");
            return(new JsonResult(new { Message = String.Format("Settings are stored."), SessionId = guid, ActionId = processId }));
        }
Beispiel #4
0
        public void Init(IHandler handler)
        {
            this.Handler              = handler;
            handler.OnError          += HandlerOnOnError;
            handler.OnSetCurrentPath += HandlerOnOnSetCurrentPath;

            if (this.Dispatcher != null)
            {
                this.Dispatcher.Invoke(() => {
                    this._freePb = ((GridView)this.MainView.View).Columns[3];
                    List(this.Handler.GetCurrentPath());
                });
            }
            else
            {
                try {
                    this._freePb = ((GridView)this.MainView.View).Columns[3];
                    List(this.Handler.GetCurrentPath());
                } catch (Exception e) {
                    SettingsHandler.OnError(e);
                    // ignored
                }
            }
        }
        public override void DoWindowContents(Rect inRect)
        {
            // Title
            GenUI.SetLabelAlign(TextAnchor.MiddleCenter);
            Text.Font = GameFont.Medium;
            var titleRect = new Rect(0f, 0f, inRect.width, 40f);

            Widgets.Label(titleRect, "Dialog_EditNames_Title".Translate());
            Text.Font = GameFont.Tiny;
            GenUI.ResetLabelAlign();

            //Name list
            var scrollViewVisible = new Rect(0f, titleRect.height + 10, inRect.width, inRect.height - titleRect.height - 60f);
            var scrollBarVisible  = SettingsHandler.STATE_LIMIT * 42f > scrollViewVisible.height;
            var scrollViewTotal   = new Rect(0f, 0f - 10f, scrollViewVisible.width - (scrollBarVisible ? ScrollBarWidthMargin : 0) - 20f, SettingsHandler.STATE_LIMIT * 42f);

            Widgets.BeginScrollView(scrollViewVisible, ref scrollPosition, scrollViewTotal);

            if (SettingsHandler.DoStateNamesDrawerContents(scrollViewTotal))
            {
                settingsHaveChanged = true;
            }
            Widgets.EndScrollView();
        }
        public void UpdateInteraction(InteractionInfo current)
        {
            _LastInteraction = current;

            this.ToolTip.enabled = current != null;

            if (current != null)
            {
                Sprite sprite = current.interactable.GetInteractionIcon(current.interaction);
                iconImage.sprite      = sprite;
                iconImage.color       = (sprite == null ? emptyColor : Color.white);
                backgroundImage.color = backgroundColor;
                frameImage.color      = Color.white;

                Pair <string, string>[] substitutions = new Pair <string, string>[] { new Pair <string, string>("keyBinding", Helper.GetKeyCodeName(SettingsHandler.GetCurrentSettings().keybindings[Keybinding.MultipleOrders])) };

                String tooltipTitle = current.interactable.GetInteractionName(current.interaction, this.Human);
                String tooltipText  = Helper.SubstituteCode("interactionChainIconDesc", substitutions);

                this.ToolTip.Init(tooltipTitle, tooltipText);
            }
            else
            {
                iconImage.color       = emptyColor;
                backgroundImage.color = emptyColor;
                frameImage.color      = emptyColor;
            }
        }
Beispiel #7
0
 /// <summary>
 /// Add our own Initialization for HugsLib
 /// </summary>
 public override void Initialize()
 {
     ModsConfigHandler.BackupCurrent();
     SettingsHandler.Update();
     SteamSyncHandler.UpdateAllStates();
 }
Beispiel #8
0
 public ServiceSettingsHostFactory(ILogger logger, SettingsHandler proxy)
 {
     _logger = logger;
     _proxy  = proxy;
 }
 private void SaveButton_Click(object sender, RoutedEventArgs e)
 {
     SettingsHandler.AvailableAxis = ChannelData.ToDictionary();
     SettingsHandler.Save();
     Close();
 }
 public override void Initialize(AnalysisContext context)
 {
     _settingsHandler = SettingsHandler.CreateHandler();
     context.RegisterSyntaxTreeAction(AnalyzeSyntaxTree);
 }
Beispiel #11
0
        static Core()
        {
            // Checks if the command line indicates we should be running in all users mode
            string[] args = Environment.GetCommandLineArgs();
            for (int i = 0; i < args.Length; i++) {
                if (args[i] == "-allusers") {
                    all_users_mode = true;
                }
            }

            Assembly temp = Assembly.GetExecutingAssembly();

            app_path = Path.GetDirectoryName(temp.Location);

            xml_settings.ConformanceLevel = ConformanceLevel.Auto;
            xml_settings.IgnoreWhitespace = true;
            xml_settings.IgnoreComments = true;
            xml_settings.IgnoreProcessingInstructions = false;
            xml_settings.DtdProcessing = DtdProcessing.Parse;
            //xml_settings.ProhibitDtd = false;
            xml_settings.ValidationType = ValidationType.Schema;
            xml_settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessIdentityConstraints;
            xml_settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessSchemaLocation;
            xml_settings.ValidationEventHandler += new ValidationEventHandler(validationHandler);

            settings = new SettingsHandler();
        }
        public void Setup()
        {
            ISettingsRepository repo = new MockSettingsRepository();

            handler = new SettingsHandler(repo);
        }
Beispiel #13
0
        // Метод для тестирования настроек по умолчанию
        public void TestDefaultSettings()
        {
            Settings defaultSettings = SettingsHandler.GetSettings("default");

            AssertEqual("data", defaultSettings.DataDirectory);
        }
Beispiel #14
0
        // Метод для тестирования пользовательских настроек
        public void TestUserSettings()
        {
            Settings userSettings = SettingsHandler.GetSettings("production");

            AssertEqual("data", userSettings.DataDirectory);
        }
Beispiel #15
0
        // Метод для тестирования настроек для разработки
        public void TestDevelopSettings()
        {
            Settings developSettings = SettingsHandler.GetSettings("develop");

            AssertEqual("developData", developerSettings.DataDirectory);
        }
Beispiel #16
0
        public static void LoadSettings(SettingsHandler settings, int context) //Pass the context so if I need to call SerializeSettings, I will have something to pass it.
        {                                                                      //For loading settings from the XML file.
            SettingsHandler loadedSettings = XmlHandler.DeSerialize_Settings();

            if (loadedSettings == null)
            {
                string dialogResult;
                if (!XmlHandler.XmlExists())
                {
                    if (settings.SilentStart == 0)
                    {
                        dialogResult = "I did not find an XML config file. A new one will be generated with default values.";
                        MessageBox.Show(dialogResult);
                    }
                }
                else
                {
                    dialogResult = "An XML config file was found, but I failed to load it properly. It is possible it is damaged. A new one will be generated.";
                    MessageBox.Show(dialogResult);
                    FileInfo fi = new FileInfo(XmlHandler.XmlPath);
                    if (fi.IsReadOnly && IsAdministrator())                                                                        //If the file is readonly for some reason, that will cause an unauthorizedaccessexception.
                    {
                        File.SetAttributes(XmlHandler.XmlPath, File.GetAttributes(XmlHandler.XmlPath) & ~FileAttributes.ReadOnly); //So make it not readonly.
                        //Since the application must be run as admin in order to set attributes, I check for that.
                    }
                    try
                    {
                        File.Delete(XmlHandler.XmlPath);
                    }
                    catch (UnauthorizedAccessException)
                    {
                        const string errText = "An error occurred whilst attempting to delete the corrupt config file. ";
                        if (!IsAdministrator()) //If the user isn't an administrator, then the file might be set to readonly.
                        {
                            dialogResult = "You are not running as administrator, so it's possible I do not have permission to access the file. Please re-run the tool as admin.";
                            MessageBox.Show(errText + dialogResult);
                            Application.Exit(); //Exit the tool so the user can re-run as admin. Really not much else I can do.
                        }
                    }
                }
                SaveSettings(settings, 2); //Try to generate a new config. Since I am calling from loadsettings, pass 2 to the context arg.
            }
            else
            {
                string dialogResult;
                try
                {
                    settings.AutoInject          = loadedSettings.AutoInject;
                    settings.CloseAfterInjection = loadedSettings.CloseAfterInjection;
                    settings.Dll              = loadedSettings.Dll;
                    settings.Process          = loadedSettings.Process;
                    settings.SaveDll          = loadedSettings.SaveDll;
                    settings.SaveProcessName  = loadedSettings.SaveProcessName;
                    settings.SilentStart      = loadedSettings.SilentStart;
                    settings.AutoCloseWarning = loadedSettings.AutoCloseWarning;
                    if (settings.SilentStart == 0)
                    {
                        dialogResult = "Successfully loaded the XML file.";
                        MessageBox.Show(dialogResult);
                    }
                }
                catch (Exception ex)
                {
                    if (ex is ArgumentOutOfRangeException)
                    {
                        dialogResult = "An error occurred whilst loading the settings file: One or more values were not set correctly. Did you manually edit the file? These settings have been set to their defaults.";
                    }
                    else
                    {
                        dialogResult = "An error occurred whilst loading the settings file: Unspecified error. Possible malformation of config file. Settings that failed to load have been set back to their defaults.";
                    }
                    MessageBox.Show(dialogResult);
                }
            }
        }
Beispiel #17
0
 private void ScanForm_Load(object sender, EventArgs e)
 {
     didScanChannels        = false;
     bandwidthComboBox.Text = SettingsHandler.LoadSettings().FirstOrDefault(x => x[0] == "default_bandwidth")[1];
 }
Beispiel #18
0
    /*public void AddNew(ScoreEntry newScore)
     * {
     *  int index = GameController.instance.highscores.FindIndex(new Predicate<ScoreEntry>((x) => { return x.Equals(newScore); }));
     *  GameObject go = InstantiateEntry(newScore, index);
     *  go.transform.SetSiblingIndex(index);
     *
     *  SetScrollSize();
     *  SnapTo(go.GetComponent<RectTransform>());
     * }*/

    private static void DeleteHighscores()
    {
        SettingsHandler.ReadToCache();
        PlayerPrefs.DeleteAll();
        SettingsHandler.WriteFromCache();
    }
Beispiel #19
0
 /// <summary>
 /// Called when a system-wide setting has change, like when WM_SETTINGCHANGE has been broadcast. This will
 /// make all settings which are being listened to update themselves.
 /// </summary>
 public void SystemSettingChanged()
 {
     SettingsHandler.SystemSettingChanged();
 }
Beispiel #20
0
 private Chimera()
 {
     _settings = new SettingsHandler ();
     InitSystems ();
 }
Beispiel #21
0
 void DataWindow_Closing(object sender, CancelEventArgs e)
 {
     SettingsHandler.Save();
 }
Beispiel #22
0
 public DatabaseService(LoggingService logging)
 {
     _connection = SettingsHandler.LoadValueString("dbConnectionString", JsonFile.Settings);
     _logging    = logging;
 }
 public override void PreOpen()
 {
     base.PreOpen();
     settingsHaveChanged = false;
     SettingsHandler.RefreshStateNameSettings();
 }
Beispiel #24
0
 private void Save_Click(object sender, RoutedEventArgs e)
 {
     SettingsHandler.SaveCurrentColor();
 }
 private void ResetSettingsBtn_Click(object sender, RoutedEventArgs e)
 {
     SettingsHandler.ResetSettings();
     Log.Dialog("Reset to default", "Please restart the app.");
 }
Beispiel #26
0
 private void Load_Click(object sender, RoutedEventArgs e)
 {
     SettingsHandler.LoadCurrentColor();
 }
Beispiel #27
0
 private void AddServerButton_OnClick(object sender, RoutedEventArgs e)
 {
     SettingsHandler.GetInstance().ServerList.Add(ServerNameTextBox.Text);
     ServerListViewBox.Items.Refresh();
 }
 ////////////////////////////////////////////////////////////////////////////////////////////////////
 /// <summary>	Constructor. </summary>
 ///
 /// <param name="gameVersion">	The game version. </param>
 public LightmapImporterController(BlamVersion gameVersion)
 {
     SettingsHandler.GetSettings();
 }
 public override void Initialize(AnalysisContext context)
 {
     _settingsHandler = SettingsHandler.CreateHandler();
     context.RegisterSymbolAction(AnalyzeSymbol, SymbolKind.Property);
 }
Beispiel #30
0
 private void InitializeSettings()
 {
     settings            = new SettingsHandler();
     SharedData.settings = settings;
     settings.loadSettings();
 }
Beispiel #31
0
 /// <summary>
 /// Gets called after all defs are loaded
 /// </summary>
 public override void DefsLoaded()
 {
     SettingsHandler.Update();
     SteamSyncHandler.UpdateAllStates();
 }
Beispiel #32
0
 public static bool SkipSymbolAnalysis(ISymbol symbol,
                                       SettingsHandler settingsHandler,
                                       IEnumerable <Type> suppressionAttributes) =>
 HasIgnoreRuleAttribute(symbol, suppressionAttributes) ||
 SkipSymbolAnalysisIgnoringAttributes(symbol, settingsHandler);