public void SaveAndLoadConfigData()
        {
            try {
                var config = new BuildStatusConfig();
                config.Settings.Add("PollFrequency", "15");

                var setting = new Settings();
                setting.Add("Host", "nzakledci01:8080");
                setting.Add("ProjectID", "project8");

                var monitor1 = config.Monitors.Add("Monitor1", "Assembly1", "Class1", setting);
                var monitor2 = config.Monitors.Add("Monitor2", "Assembly2", "Class2", setting);

                var visualiser1 = config.Visualisers.Add("Visualiser1", "Assembly1", "Class1",setting);
                var visualiser2 = config.Visualisers.Add("Visualiser2", "Assembly2", "Class2",setting);

                config.Schedules.Add(new Schedule("6:00AM", "8:00PM", "ON", "Week"));
                config.Schedules.DefaultState = "OFF";

                config.Save("C:\\Test.xml");

                BuildStatusConfig newConfig = BuildStatusConfig.Load("C:\\Test.xml");

                Assert.AreEqual(config.Settings["PollFrequency"], newConfig.Settings["PollFrequency"]);
            }
            catch (Exception ex) {
                Console.WriteLine(ex.Message);
            }
        }
 public void TestMonitorInstantiation()
 {
     var settings = new Settings();
     settings.Add("Host", "nzakledci01:8080");
     settings.Add("ProjectID", "project8");
     var instance = ComponentFactory<IMonitor>.CreateComponent(new Monitor("TestMonitor", "BuildStatusMonitor", "BuildStatusMonitor.Monitors.TeamCityMonitor", settings));
     Assert.IsNotNull(instance);
 }
 public void ConnectedTest2()
 {
     var monitor = new TeamCityMonitor();
     var setting = new Settings();
     setting.Add("Host", "nzakledci01:8080");
     setting.Add("ProjectID", "project8");
     monitor.Initialise("Test", setting);
     Assert.IsTrue(monitor.IsInitialised);
 }
 public void PollTest()
 {
     var monitor = new TeamCityMonitor();
     var setting = new Settings();
     setting.Add("Host", "nzakledci01:8080");
     setting.Add("ProjectID", "project8");
     monitor.Initialise("Test", setting);
     var result = monitor.Poll();
     Assert.IsNotNull(result);
 }
 public void MinimalConstructorTest()
 {
     var monitor = new TeamCityMonitor();
     var setting = new Settings();
     setting.Add("Host", "Host");
     monitor.Initialise("Test", setting);
     Assert.IsTrue(monitor.IsInitialised);
 }
        void IUtilityCommand.Run(Utility utility, string[] args)
        {
            Game.ModData = utility.ModData;
            Console.WriteLine(
                "This documentation is aimed at server administrators. It displays all settings with default values and description. " +
                "Please do not edit it directly, but add new `[Desc(\"String\")]` tags to the source code. This file has been " +
                "automatically generated for version {0} of OpenRA.", utility.ModData.Manifest.Metadata.Version);
            Console.WriteLine();
            Console.WriteLine("All settings can be changed by starting the game via a command-line parameter like `Game.Mod=ra`.");
            Console.WriteLine();
            Console.WriteLine("## Location");
            Console.WriteLine("* Windows: `My Documents\\OpenRA\\settings.yaml`");
            Console.WriteLine("* Mac OS X: `~/Library/Application Support/OpenRA/settings.yaml`");
            Console.WriteLine("* Linux `~/.openra/settings.yaml`");
            Console.WriteLine();
            Console.WriteLine(
                "If you create the folder `Support` relative to the OpenRA main directory, everything " +
                "including settings gets stored there to aid portable installations.");
            Console.WriteLine();

            var sections = new Settings(null, new Arguments()).Sections;
            sections.Add("Launch", new LaunchArguments(new Arguments(new string[0])));
            foreach (var section in sections.OrderBy(s => s.Key))
            {
                var fields = section.Value.GetType().GetFields();
                if (fields.Length > 0 && fields.Where(field => field.GetCustomAttributes<DescAttribute>(false).Length > 0).Count() > 0)
                    Console.WriteLine("## {0}", section.Key);
                else
                    Console.WriteLine();

                foreach (var field in fields)
                {
                    if (!field.HasAttribute<DescAttribute>())
                        continue;

                    Console.WriteLine("### {0}", field.Name);
                    var lines = field.GetCustomAttributes<DescAttribute>(false).SelectMany(d => d.Lines);
                    foreach (var line in lines)
                    {
                        Console.WriteLine("{0}", line);
                        Console.WriteLine();
                    }

                    var value = field.GetValue(section.Value);
                    if (value != null && !value.ToString().StartsWith("System."))
                    {
                        Console.WriteLine("**Default Value:** {0}", value);
                        Console.WriteLine();
                        Console.WriteLine("```yaml");
                        Console.WriteLine("{0}: ", section.Key);
                        Console.WriteLine("\t{0}: {1}", field.Name, value);
                        Console.WriteLine("```  ");
                    }
                    else
                        Console.WriteLine();
                }
            }
        }
        public HealthCheckBuilder Add <TCheck>(IHealthCheckSettings settings) where TCheck : class, IHealthCheck
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }

            if (string.IsNullOrEmpty(settings.Name))
            {
                throw new ArgumentException($"Property {nameof(settings.Name)} cannot be null or empty.", nameof(settings));
            }

            Services.TryAddTransient <TCheck>();
            Settings.Add(typeof(TCheck), settings);
            return(this);
        }
Example #8
0
 public MainMenuViewModel(IDialogCoordinator instance)
 {
     // Set the DialogCoordinator to the one define in App.xaml.cs
     Dialogs = instance;
     // Establish the settings dictionary with default values.
     Settings.Add("amount_begin_with", 1500.0);
     Settings.Add("passing_go_amount", 200.0);
     Settings.Add("passing_go_amount_multiplier", 1.0);
     Settings.Add("do_trigger_auctions", true);
     Settings.Add("do_taxation_in_free_parking", false);
     Settings.Add("allow_rent_collection_while_jailed", true);
     Settings.Add("allow_uneven_house_construction", false);
     Settings.Add("limit_house_hotel_numbers", true);
     // Populate the AvailableBoards list
     AvailableBoards = GetAvailableBoards();
 }
Example #9
0
 /// <summary>
 /// Insert missing settings.
 /// </summary>
 /// <param name="list"></param>
 public void UpsertSettings(params Setting[] list)
 {
     foreach (var item in list)
     {
         var old = Settings.Items.FirstOrDefault(x => x.SettingId == item.SettingId);
         if (old == null)
         {
             Settings.Add(item);
         }
         // If item was updated then...
         else if (item.DateUpdated > old.DateUpdated)
         {
             JocysCom.ClassLibrary.Runtime.Helper.CopyDataMembers(item, old);
         }
     }
 }
Example #10
0
        public void Add(ServiceSetting serverSetting)
        {
            if (serverSetting == null)
            {
                throw new ArgumentNullException(nameof(serverSetting));
            }

            foreach (ServiceSetting setting in Settings)
            {
                if (setting.Name.Equals(serverSetting.Name, StringComparison.CurrentCultureIgnoreCase))
                {
                    throw new ArgumentException(nameof(serverSetting));
                }
            }

            Settings.Add(serverSetting);
        }
Example #11
0
        public ReportTemplate(ReportType reportType, string[] settings) : this()
        {
            ReportType = reportType;
            for (int i = 1; i < settings.Length; i++)
            {
                Settings.Add(settings[i].Trim());
            }

            From = ParseDateSetting("from ");
            To   = ParseDateSetting("to ");

            int index = Settings.FindIndex(s => s.StartsWith("Drop "));

            if (index > -1)
            {
                Drops = new Drops();
                string drops = Settings[index];
                index = drops.IndexOf(" worst ");
                if (index > -1)
                {
                    if (drops.Contains("%"))
                    {
                        Drops.PercentWorst = double.Parse(drops.Substring(index + " worst ".Length, drops.IndexOf('%', index) - index - " worst ".Length));
                    }
                    else
                    {
                        Drops.CountWorst = int.Parse(drops.Substring(index + " worst ".Length, drops.IndexOf(' ', index) - index - " worst ".Length));
                    }
                }

                index = drops.IndexOf(" best ");
                if (index > -1)
                {
                    if (drops.Contains("%"))
                    {
                        Drops.PercentBest = double.Parse(drops.Substring(index + " best ".Length, drops.IndexOf('%', index) - index - " best ".Length));
                    }
                    else
                    {
                        Drops.CountBest = int.Parse(drops.Substring(index + " best ".Length, drops.IndexOf(' ', index) - index - " best ".Length));
                    }
                }

                Settings.RemoveAll(s => s.StartsWith("Drop "));
            }
        }
Example #12
0
        public bool AddChild(object child)
        {
            var settings = child.As <XLEEnvSettings>();

            if (settings != null)
            {
                Settings.Add(settings);
                return(true);
            }
            var defEnv = DefaultEnvSettings;

            if (defEnv != null && defEnv.AddChild(child))
            {
                return(true);
            }
            return(false);
        }
Example #13
0
 public void Request(string requestId, NetworkConnectionMetadata network, RequestMetadata md, Document[] requestDocuments, out IDictionary <string, string> requestProperties, out Document[] desiredDocuments)
 {
     _requestMetadata   = md;
     this.requestTypeId = md.RequestTypeId;
     if (Settings.ContainsKey("MSRequestID"))
     {
         Settings["MSRequestID"] = md.MSRequestID;
     }
     else
     {
         Settings.Add("MSRequestID", md.MSRequestID);
     }
     requestProperties = null;
     desiredDocuments  = Array.Empty <Document>();
     status.Code       = RequestStatus.StatusCode.InProgress;
     status.Message    = "";
 }
Example #14
0
        void IPatientIdentifierProcessor.GenerateLists(Guid requestID, NetworkConnectionMetadata network, RequestMetadata md, IDictionary <Guid, string> outputPaths, string format)
        {
            using (QueryComposer.IModelAdapter adapter = GetModelAdapter(_request.Queries.First(), true))
            {
                if (Settings.ContainsKey("MSRequestID"))
                {
                    Settings["MSRequestID"] = md.MSRequestID;
                }
                else
                {
                    Settings.Add("MSRequestID", md.MSRequestID);
                }

                adapter.Initialize(Settings, requestID.ToString());
                adapter.GeneratePatientIdentifierLists(_request, outputPaths, format);
            }
        }
Example #15
0
        public RgbFadeRgbNode() : base("RGB", "Fade RGB")
        {
            AddInput("From RGB", DataType.Text);
            AddInput("To RGB", DataType.Text);
            AddInput("Interval", DataType.Number, true);
            AddInput("Start/Stop", DataType.Logical, true);

            AddOutput("RGB");
            AddOutput("Enabled", DataType.Logical);

            Outputs[1].Value = "0";

            interval = DEFAULT_INTERVAL;

            Settings.Add("UpdateInterval", new NodeSetting(NodeSettingType.Number, "Output update interval", "30"));
            Settings.Add("PreventDuplication", new NodeSetting(NodeSettingType.Checkbox, "Prevent duplication", "true"));
        }
Example #16
0
        public void FromXml(XmlNode node)
        {
            foreach (XmlNode x in node.ChildNodes)
            {
                switch (x.Name)
                {
                case "type":
                    ReportType = (ReportType)Enum.Parse(typeof(ReportType), x.InnerText);
                    break;

                case "title":
                    Title = x.InnerText;
                    break;

                case "drops":
                    Drops = new Drops
                    {
                        CountWorst   = XmlInt(x, "worst"),
                        PercentWorst = XmlInt(x, "percentworst"),
                        CountBest    = XmlInt(x, "best"),
                        PercentBest  = XmlInt(x, "percentbest")
                    };
                    break;

                case "from":
                    From = DateTime.Parse(x.InnerText);
                    break;

                case "to":
                    To = DateTime.Parse(x.InnerText);
                    break;

                default:
                    if (string.IsNullOrEmpty(x.InnerText))
                    {
                        Settings.Add(x.Name);
                    }
                    else
                    {
                        Settings.Add(x.Name + "=" + x.InnerText);
                    }
                    break;
                }
            }
        }
Example #17
0
        /// <summary>
        /// Called when [start].
        /// </summary>
        /// <remarks>...</remarks>
        protected override void OnStart() {
            customizedSettings = GetSettings().Customize<AppLinkPackageCustomizedSettings>();

            // Fix logo
            if (!Settings.OfType<NewgenPackageLogoSettings>().Any())
                Settings.Add(new NewgenPackageLogoSettings(this));
            Settings.OfType<NewgenPackageLogoSettings>().First().Value = Path.Combine(Location, customizedSettings.IconPath);

            // Load UI
            Application.Current.Dispatcher.Invoke(new Action(() => {
                tile = new AppLinkPackageTile();

                tile.MouseLeftButtonUp += (f, g) => {
                    try {
                        if (customizedSettings.IsUrl) {
                            Api.Messenger.Send(new EMessage() {
                                Key = EMessage.UrlKey,
                                Value = customizedSettings.LinkPath
                            });
                        }
                        else {
                            foreach (var process in Process.GetProcesses())
                                if (process.StartInfo.FileName.Equals(customizedSettings.LinkPath)) {
                                    WinAPI.SetForegroundWindow(process.MainWindowHandle);
                                    return;
                                }
                            var p = new Process();
                            p.StartInfo.Arguments = customizedSettings.Args;
                            p.StartInfo.FileName = customizedSettings.LinkPath;
                            p.StartInfo.UseShellExecute = true;
                            p.Start();
                        }
                    }
                    catch { }
                };

                tile.ContextMenu = new ContextMenu();
                var mi_options = new MenuItem();
                mi_options.Header = new AppLinkPackageSettingsEditor(this);
                tile.ContextMenu.Items.Add(mi_options);

                // Re load tile
                ReloadTile();
            }));
        }
Example #18
0
        public RgbSmoothRgbwNode() : base("RGB", "Smooth RGBW")
        {
            AddInput("RGBW", DataType.Text);
            AddInput("Interval", DataType.Number, true);

            AddOutput("RGBW");
            AddOutput("Enabled", DataType.Logical);

            Outputs[1].Value = "0";
            Outputs[0].Value = "00000000";

            interval = DEFAULT_INTERVAL;

            Settings.Add("UpdateInterval", new NodeSetting(NodeSettingType.Number, "Output update interval", "30"));
            Settings.Add("PreventDuplication", new NodeSetting(NodeSettingType.Checkbox, "Prevent duplication", "true"));
            Settings.Add("StopWhenDisconnected", new NodeSetting(NodeSettingType.Checkbox, "Stop when input color is null", "false"));
            Settings.Add("ResetWhenDisconnected", new NodeSetting(NodeSettingType.Checkbox, "Reset and send null when input color is null", "false"));
        }
Example #19
0
        public BaseTest()
        {
            if (!ms_inited)
            {
                NameValueCollection nv = ConfigurationManager.AppSettings;
                for (int i = 0; i < nv.Count; ++i)
                {
                    Settings.Add(nv.GetKey(i), nv.Get(i));
                }

                AssertTraceListener.Install();

                Log.Init();
                Log.AutoFlush = true;

                ms_inited = true;
            }
        }
Example #20
0
        private void AddManager(Vpn vpn)
        {
            var configuration = new VpnTraySettingsEntryConfiguration
            {
                Id              = vpn.Id,
                Name            = vpn.Name,
                IsSelected      = false,
                RefreshInterval = _configurationProvider.Configuration.DefaultMonitorRefreshInterval
            };

            _configurationProvider.Configuration.Entries[_vpnProvider.Name].Add(configuration);
            _configurationProvider.Save();

            var entry = new VpnTraySettingsEntryViewModel(_vpnProvider.VpnManagerFactory.Create(vpn), configuration);

            entry.PropertyChanged += Entry_PropertyChanged;
            Settings.Add(entry);
        }
        public void UpdateLastOrderExtractTime(int lastRun)
        {
            var settings = Settings.FirstOrDefault();

            if (settings == null)
            {
                settings = new Setting();
            }

            settings.LastErplyOrderExtractTime     = DateTimeOffset.FromUnixTimeSeconds(lastRun);
            settings.LastErplyOrderExtractTimeUnix = lastRun;

            if (settings.Id == 0)
            {
                Settings.Add(settings);
            }
            SaveChanges();
        }
        public TimeIteratorNode() : base("Time", "Iterator")
        {
            AddInput("Enents Count", DataType.Number);
            AddInput("Interval", DataType.Number, true);
            AddInput("Start", DataType.Logical, true);
            AddInput("Stop", DataType.Logical, true);

            AddOutput("Trigger", DataType.Logical);
            AddOutput("Enabled", DataType.Logical);

            interval = DEFAULT_INTERVAL;

            Settings.Add("zero", new NodeSetting(NodeSettingType.Checkbox, "Generate Zero", "true"));

            timer          = new Timer();
            timer.Interval = interval / 2;
            timer.Elapsed += TimerElapsed;
        }
Example #23
0
 public static void WriteToSetting(string Key, string Value)
 {
     lock (lockobject)
     {
         var Setting = Settings.Where(x => x.Key == Key).FirstOrDefault();
         if (Setting == null)
         {
             Settings.Add(new KeyValue()
             {
                 Key = Key, Value = Value
             });
         }
         else
         {
             Setting.Value = Value;
         }
     }
 }
Example #24
0
        private void _RegisterSettings(ISettingsModule sender)
        {
            _settingModules.Add(sender);

            var settings = ((ISettingsModule)sender).Settings;
            var keyList  = Settings.Select(x => x.Key).ToList();

            foreach (var setting in settings)
            {
                string key = setting.Key;
                if (keyList.Contains(key))
                {
                    this.Settings.Remove(this.Settings.First(x => x.Key == key));
                }

                Settings.Add(setting);
            }
        }
Example #25
0
        public static void Load()
        {
            Principal = MainMenu.AddMenu("基地大招", "BaseUlt");
            Principal.AddLabel("感谢 iRaxe");

            Settings = Principal.AddSubMenu("设置", "Settings");
            Settings.Add("UseBaseUlt", new CheckBox("使用基地大招 ?"));
            Settings.AddSeparator(2);
            Settings.Add("ShowEnemies", new CheckBox("显示敌人回城计时"));
            Settings.Add("ShowAllies", new CheckBox("显示友军回城计时"));
            Settings.AddSeparator(1);
            Settings.AddSeparator(2);
            Settings.AddLabel("对谁使用基地大招:");
            foreach (var x in EntityManager.Heroes.Enemies)
            {
                Settings.Add("对/" + x.ChampionName, new CheckBox(x.ChampionName));
            }
        }
        public bool Add(Setting setting)
        {
            if (setting == null || setting.Name == null)
            {
                return(false);
            }
            if (FindSetting(setting.Name) != null)
            {
                return(false);
            }
            Settings.Add(setting);

            if (settingsDictionary != null)
            {
                settingsDictionary.Add(setting.Name, setting);
            }
            return(true);
        }
        public void UpdateLastOrderCreationTime(DateTimeOffset lastRun)
        {
            var settings = Settings.FirstOrDefault();

            if (settings == null)
            {
                settings = new Setting();
            }

            settings.LastOrderCreationTime     = lastRun;
            settings.LastOrderCreationTimeUnix = (int)lastRun.ToUnixTimeSeconds();

            if (settings.Id == 0)
            {
                Settings.Add(settings);
            }
            SaveChanges();
        }
Example #28
0
        public void OnWorldLoadFinished()
        {
            if (GameUtils.IsInstalled(ProductVersion.EP8))
            {
                Settings.Add(new SeasonKey(Season.Spring), true);
                Settings.Add(new SeasonKey(Season.Summer), true);
                Settings.Add(new SeasonKey(Season.Fall), true);
                Settings.Add(new SeasonKey(Season.Winter), true);
            }

            ApplySettings();

            new Common.DelayedEventListener(EventTypeId.kSeasonTransition, OnSeasonChanged);

            StartAlarms();

            kDebugging = Settings.Debugging;
        }
Example #29
0
 protected virtual void ConfigureApplication(string[] args)
 {
     // command line overrides configuration file
     // -dev DeveloperMode - Login database combo box to allow selection or not
     // -use "key or connection string" UseConnection - Works one of three ways
     // 1.  If omitted, ConfigurationManager.ConnectionStrings[Default] or ConfigurationManager.ConnectionStrings[0] is used (in that order)
     // 2.  Specifies the connection string to use
     // 3.  Specifies the key as in ConfigurationManager.ConnectionStrings[key] to use
     log.Info("Process application configuration file.");
     settings.Add(ConfigurationManager.AppSettings, KeyValueOrigin.Source.AppConfig);
     connectionStrings = ConfigurationManager.ConnectionStrings;
     foreach (ConnectionStringSettings css in connectionStrings)
     {
         KeyValueOrigin.Source origin = KeyValueOrigin.Source.AppConfig;
         // Find a better way to determine if a setting was inherited from MACHINE.config
         if (0 == string.Compare(css.Name, "LocalSqlServer", StringComparison.Ordinal))
         {
             origin = KeyValueOrigin.Source.MachineConfig;
         }
         settings.Add(css.Name, css.ConnectionString, origin);
     }
     log.Info("Process command line.");
     for (int i = 0; i < args.Length; ++i)
     {
         string s = args[i];
         if (s.StartsWith("-dev", StringComparison.OrdinalIgnoreCase))
         {
             settings.Add("DeveloperMode", "true", KeyValueOrigin.Source.CommandLine);
         }
         if (s.StartsWith("-use", StringComparison.OrdinalIgnoreCase) && args.Length >= (i + 2))
         {
             settings.Add("UseConnection", args[i + 1], KeyValueOrigin.Source.CommandLine, true);
         }
     }
     foreach (DictionaryEntry de in Environment.GetEnvironmentVariables())
     {
         Settings.Add(de.Key.ToString(), de.Value.ToString(), KeyValueOrigin.Source.Environment);
     }
     log.Debug("Global application configuration settings:");
     foreach (KeyValueOrigin nvo in settings.Settings)
     {
         log.DebugFormat("  {0, -15}{1, -25}{2}", nvo.Origin.ToString(), nvo.Key, nvo.Value);
     }
 }
Example #30
0
        static void Postfix(SubtitleLogic __instance)
        {
            SubtitleState.subtitlesDefaultScale = __instance.label_.defaultFontSize;

            if (Configuration["Debug"] is true && new List <string>(from argument in Environment.GetCommandLineArgs() select argument.DOWN()).Contains("-extract-subtitles"))
            {
                Settings settings = new Settings("subtitles_extracted");
                settings.Clear();
                foreach (var subtitle_entry in __instance.subtitles_)
                {
                    settings.Add(subtitle_entry.Key, subtitle_entry.Value);
                }
                settings.Save();

                try
                {
                    settings = new Settings("subtitles_defaults");
                    settings.Clear();
                    foreach (string key in __instance.subtitles_.OrderBy(x => x.Key).ToDictionary(x => x.Key, y => y.Value).Keys)
                    {
                        foreach (uint marker in __instance.subtitles_[key].Keys)
                        {
                            string value  = __instance.subtitles_[key][marker];
                            string csv_id = $"{key}/{marker}";
                            T4.GeneratedDictionaries.SubtitleBindings.TryGetValue(csv_id, out string json_id);

                            if (!settings.ContainsKey(json_id ?? csv_id))
                            {
                                settings.Add(json_id ?? csv_id, value);
                            }
                            else
                            {
                                Console.WriteLine(json_id ?? csv_id);
                            }
                        }
                    }
                    settings.Save();
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }
        }
Example #31
0
        public Collection <ShippingRateDisplay> GetRates(Order o, Store currentStore)
        {
            var groups = o.GetShippingGroups(Bvin);
            var result = new Collection <ShippingRateDisplay>();
            var p      = AvailableServices.FindById(ShippingProviderId, currentStore);

            if (p != null)
            {
                Settings.Add("PayerName", (o.ShippingAddress.FirstName + " " + o.ShippingAddress.LastName));
                p.BaseSettings.Clear();
                p.BaseSettings.Merge(Settings);

                var shipment  = ConvertGroupsToShipments(groups);
                var tempRates = p.RateShipment(shipment);

                if (tempRates != null)
                {
                    for (var i = 0; i <= tempRates.Count - 1; i++)
                    {
                        var r = new ShippingRateDisplay(tempRates[i])
                        {
                            ShippingMethodId = Bvin
                        };

                        if (r.DisplayName == string.Empty)
                        {
                            r.DisplayName = Name;
                        }

                        AdjustRate(r);

                        // Free shipping if no included items
                        if (shipment.Items.Count < 1)
                        {
                            r.Rate = 0;
                        }

                        result.Add(r);
                    }
                }
            }

            return(result);
        }
Example #32
0
        public SettingsViewModel()
        {
            DesignTime(() => iss = DesignerSettingsService.Default);
            RunTime(() => Task.Run(async() =>
            {
                iss = XmlSettingsService.Default;
                ips = ManagedProcessService.Default;
                ies = EncryptionService.Default;

                PropertyChanged += async(s, e) =>
                {
                    if (e.PropertyName == "Password" && Password != null)
                    {
                        await VerifyPassword();
                    }
                };

                PasswordVerified += (s, e) =>
                {
                    Task.Run(() =>
                    {
                        Password = null;
                        RaisePropertyChanged("Password");

                        CurrentScreen = Screen.Main;
                    });
                };

                if (string.IsNullOrWhiteSpace(IvyLockSettings.Hash))
                {
                    CurrentScreen = Screen.SetupPassword;
                }
                else
                {
                    CurrentScreen = Screen.EnterPassword;
                }

                UI(() => Settings.Add(IvyLockSettings));

                await LoadSettings();
                await LoadProcesses();
            }));
            BindingOperations.EnableCollectionSynchronization(Settings, this);
        }
Example #33
0
        /// <inheritdoc />
        public virtual ISettingDto[] Initialize(ISettingDto[] systemSettings, string serviceVersion)
        {
            var cache = Settings.ToDictionary(s => s.Key);

            if (ApplicationIntentDeterminer.Repository == ApplicationIntent.ReadWrite)
            {
                var changed = false;

                // Handle missing settings
                var missingSettings = systemSettings.Where(s => !cache.ContainsKey(s.Key)).ToArray();
                if (missingSettings.Length > 0)
                {
                    foreach (var missingSetting in missingSettings)
                    {
                        var newSetting = new SettingDto
                        {
                            Key         = missingSetting.Key,
                            Value       = missingSetting.Value,
                            DataType    = missingSetting.DataType,
                            Description = missingSetting.Description,
                            IsSystem    = true
                        };
                        cache[missingSetting.Key] = newSetting;
                        Settings.Add(newSetting);
                    }

                    changed = true;
                }

                // Update service version
                if (cache.TryGetValue("ServiceVersion", out var versionSetting) && versionSetting.Value != serviceVersion)
                {
                    versionSetting.Value = serviceVersion;
                    changed = true;
                }

                if (changed)
                {
                    PersistChanges();
                }
            }

            return(cache.Values.ToArray <ISettingDto>());
        }
Example #34
0
 /// <summary>
 /// Saves a string to the settings section.
 /// </summary>
 /// <param name="name">The key of the setting.</param>
 /// <param name="data">The string data of the setting.</param>
 /// <param name="saveData">True if the data has to be written to the XML file, false otherwise.</param>
 public void SaveSetting(string name, string data, bool saveData)
 {
     if (name == null || data == null)
     {
         throw new ArgumentNullException();
     }
     if (Settings.ContainsKey(name))
     {
         Settings[name] = data;
     }
     else
     {
         Settings.Add(name, data);
     }
     if (saveData)
     {
         SaveData();
     }
 }
Example #35
0
        }         // Save

        // ----------------------------------------------------------------------
        private void FormLoad(object sender, EventArgs e)
        {
            if (UseLocation)
            {
                Settings.Add(topSetting);
                Settings.Add(leftSetting);
            }
            if (UseSize)
            {
                Settings.Add(widthSetting);
                Settings.Add(heightSetting);
            }
            if (UseWindowState)
            {
                Settings.Add(stateSetting);
            }

            Load();
        }         // FormLoad
Example #36
0
        private void SetRunToolSettingsDefaults()
        {
            // If RunQuiet is already defined in config.json, don't override it
            if (!Settings.ContainsKey(RunQuietReservedKeyword))
            {
                Setting runQuietSetting = new Setting()
                {
                    Values = new List <string>()
                    {
                        "True", "False"
                    },
                    ValueType    = RunToolSettingValueTypeReservedKeyword,
                    Description  = "Run tool specific setting.  Set to True to only display output from the executing command.",
                    DefaultValue = "false"
                };

                Settings.Add(RunQuietReservedKeyword, runQuietSetting);
            }
        }
Example #37
0
 private void SaveSettings()
 {
     List<Control> controls = GetTaggedControls(tabEmail);
     Settings settings = new Settings();
     foreach (Control c in controls)
     {
         settings.Add((String)c.Tag, c.Text);
     }
     Settings.Save(settings);
 }
        /// <summary>
        /// Creates the default configuration File
        /// </summary>
        public static void CreateDefaultConfigFile()
        {
            var config = new BuildStatusConfig();

            #region Add Default Core Data (Schedule and Controllers)
            config.Settings.Add(new Setting("PollFrequency","5"));
            config.Schedules.DefaultState = "OFF";
            config.Schedules.Add(new Schedule("6:00AM", "8:00PM", "ON", "Week"));
            config.Schedules.Add(new Schedule("12:00AM","11:59PM", "OFF", "Weekend"));
            config.Controllers.Add(new Controller("Controller1", "Monitor1","Visualiser1","Transition1"));
            config.Controllers.Add(new Controller("Controller2", "Monitor1","Visualiser2","Transition2"));
            #endregion

            #region Add the Sample Monitors
            var settings1 = new Settings();
            settings1.Add(new Setting("Host","yourhost:8080"));
            settings1.Add(new Setting("User", "guest"));
            settings1.Add(new Setting("Password", "guest"));
            settings1.Add(new Setting("UseGuest", "true"));
            settings1.Add(new Setting("ProjectID", "project2"));
            settings1.Add(new Setting("ProjectID", "project6"));
            settings1.Add(new Setting("ProjectID","project4"));
            config.Monitors.Add(new Monitor("Monitor1", "BuildStatusMonitor", "BuildStatusMonitor.Monitors.TeamCityMonitor",settings1));

            var settings2 = new Settings();
            settings2.Add(new Setting("Host","yourhost:8080"));
            settings2.Add(new Setting("User", "guest"));
            settings2.Add(new Setting("Password", "guest"));
            settings2.Add(new Setting("UseGuest", "true"));
            settings2.Add(new Setting("ProjectID", "projectID"));
            settings2.Add(new Setting("BuildID", "buildID"));
            settings2.Add(new Setting("ProjectName","projectName"));
            config.Monitors.Add(new Monitor("Monitor2", "BuildStatusMonitor", "BuildStatusMonitor.Monitors.TeamCityMonitor",settings2));
            #endregion

            #region Add Sample Visualisers
            var settings3 = new Settings();
            settings3.Add(new Setting("DeviceID",@"\\?\hid#vid_0fc5&amp;pid_b080#7&amp;141d6465&amp;0&amp;0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"));
            config.Visualisers.Add(new Visualiser("DelcomLight#1","BuildStatusMonitor","BuildStatusMonitor.Visualisers.DelcomVisualiser",settings3));

            var settings4 = new Settings();
            settings4.Add(new Setting("DeviceID",@"\\?\hid#vid_0fc5&amp;pid_b080#7&amp;26d7150a&amp;0&amp;0000#{4d1e55b2-f16f-11cf-88cb-001111000030}"));
            config.Visualisers.Add(new Visualiser("DelcomLight#2","BuildStatusMonitor","BuildStatusMonitor.Visualisers.DelcomVisualiser",settings4));

            var settings5 = new Settings();
            settings5.Add(new Setting("File",@"C:\Status.Log"));
            config.Visualisers.Add(new Visualiser("FileTrace","BuildStatusMonitor","BuildStatusMonitor.Visualisers.FileTraceVisualiser",settings5));
            #endregion

            #region Add Transitions

            var transition1 = config.Transitions.Add(new Transition("Transition1"));
            var t1s1 = transition1.Add(new State("Unknown","YELLOW:ON",null));
            var t1s2 = transition1.Add(new State("Success","GREEN:ON"));
            t1s2.SubState.Add(new SubState("Success1","TIME:0-15","GREEN:FLASH"));
            var t1s3 = transition1.Add(new State("SuccessInProgress","GREEN:ON;YELLOW:FLASH",null));
            var t1s4 = transition1.Add(new State("Failed","RED:ON"));
            t1s4.SubState.Add(new SubState("Failed1","TIME:0-15","RED:FLASH-SLOW"));
            t1s4.SubState.Add(new SubState("Failed2","TIME:15-30","RED:FLASH"));
            t1s4.SubState.Add(new SubState("Failed3","TIME:30-60","RED:FLASH-FAST"));
            var t1s5 = transition1.Add(new State("FailedInProgress","RED:ON;YELLOW:FLASH",null));
            var t1s6 = transition1.Add(new State("InProgress","YELLOW:FLASH",null));
            var t1s7 = transition1.Add(new State("Error","RED:FLASH",null));

            var transition2 = config.Transitions.Add(new Transition("Transition2"));
            var t2s1 = transition2.Add(new State("Unknown","Build State is UNKNOWN",null));
            var t2s2 = transition2.Add(new State("Success","Build was Sucessfull"));
            t2s2.SubState.Add(new SubState("Success1","TIME:0-15","Build Sucessfull - Ready For QA"));
            var t2s3 = transition2.Add(new State("SuccessInProgress","Last build was Sucessfull. New Build in Progress",null));
            var t2s4 = transition2.Add(new State("Failed","Build Failed."));
            t2s4.SubState.Add(new SubState("Failed1","TIME:0-15","Build Failed: First Warning"));
            t2s4.SubState.Add(new SubState("Failed2","TIME:15-30","Build Failed: Second Warning"));
            t2s4.SubState.Add(new SubState("Failed3","TIME:30-60","Build Failed: Third Warning"));
            var t2s5 = transition2.Add(new State("FailedInProgress","Build Failed - New Build in Progress",null));
            var t2s6 = transition2.Add(new State("InProgress","Build in Progress - Previus State is Unknown",null));
            var t2s7 = transition2.Add(new State("Error","WARNING: Unknown Error Has Occurred",null));
            #endregion

            config.Save("BuildStatusMonitor.settings.sample.xml");
        }