public Model.Configuration GetConfiguration(bool reloadFromSource=true) { if(_configuration==null || reloadFromSource) _configuration = _configurationReader.GetConfiguration(); return _configuration; }
public CheckOutRefService(IEnumerable <IParseable> parseable, Model.CommandLineArgs commandLineArgs, Model.Configuration configuration, ILogger logger, GitAdapter.IGitAdapter gitAdapter) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _commandLineArgs = commandLineArgs ?? throw new ArgumentNullException(nameof(commandLineArgs)); _parseable = parseable ?? throw new ArgumentNullException(nameof(parseable)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _gitAdapter = gitAdapter ?? throw new ArgumentNullException(nameof(gitAdapter)); }
public void Override_Branches_Do_Not_Work_If_Asterisk_Used_In_Label() { // Create the configuration model var config = new Model.Configuration { Version = "1.0.0", Label = { "r*" }, Branches = { Release = { "^refs/heads/master$", "^refs/heads/release/.+$", "^refs/heads/feature/.+$" }, Overrides = { new Model.BranchConfiguration { Match = "^refs/heads/feature/.+$", Label = new List <string>{ "{shortbranchname}" } } } } }; // Arrange using (var fixture = new SimpleVersionRepositoryFixture(config)) using (EnvrionmentContext.NoBuildServer()) { // Make some extra commits on master fixture.MakeACommit(); fixture.MakeACommit(); fixture.MakeACommit(); // branch to a feature branch fixture.BranchTo("feature/PBI-319594-GitVersionDeprecation"); fixture.MakeACommit(); fixture.MakeACommit(); fixture.MakeACommit(); // Act var result = GetResult(fixture); var semver1 = result.Formats[Semver1FormatProcess.FormatKey]; var semver2 = result.Formats[Semver2FormatProcess.FormatKey]; // Assert semver1.Should().Be("1.0.0-featurePBI319594GitVersionDeprecation-0007"); semver2.Should().Be("1.0.0-featurePBI319594GitVersionDeprecation.7"); } }
public ServicesAlreadyDownloadedShouldNotDownloadAgain() { _registry.AddSingleton(Substitute.For <IUpdateServiceJson>()); _registry.AddSingleton(Substitute.For <IUpdateServiceStatus>()); _registry.AddSingleton(Substitute.For <IMergeOpenApiSchemas>()); var getConfiguration = Substitute.For <IGetConfigurationCached>(); var configuration = new Model.Configuration { UrlFilter = "/v1/", JsonEndpoint = "/swagger.json" }; getConfiguration.Execute().Returns(configuration); _registry.AddSingleton(getConfiguration); }
public ASingleServiceShouldNotBeMerged() { _registry.AddSingleton(Substitute.For <IInsertMergedSchema>()); _registry.AddSingleton(Substitute.For <IUpdateServiceStatus>()); _registry.AddSingleton(Substitute.For <IMergeOpenApiSchema>()); var getConfiguration = Substitute.For <IGetConfigurationCached>(); var configuration = new Model.Configuration { UrlFilter = "/v1/", JsonEndpoint = "/swagger.json" }; getConfiguration.Execute().Returns(configuration); _registry.AddSingleton(getConfiguration); }
public UnavailableServicesExceedingMaxRetriesShouldBeDisabled() { _registry.AddSingleton(Substitute.For <IUpdateServiceJson>()); _registry.AddSingleton(Substitute.For <IUpdateServiceStatus>()); _registry.AddSingleton(Substitute.For <IMergeOpenApiSchemas>()); var getConfiguration = Substitute.For <IGetConfigurationCached>(); var configuration = new Model.Configuration { UrlFilter = "/v1/", JsonEndpoint = "/swagger.json" }; getConfiguration.Execute().Returns(configuration); _registry.AddSingleton(getConfiguration); }
public async Task <bool> RefreshFeedsAsync() { try { string api_url = App.configVM.ConfigurationCollection.FirstOrDefault(c => c.Name == "Api Url").Value; string api_key = App.configVM.ConfigurationCollection.FirstOrDefault(c => c.Name == "Api Key").Value; ApiJsonClient client = new ApiJsonClient(); List <FeedItem> resp = await client.GetFeedsListAsync(api_url, api_key); var confFeeds = from o in App.configVM.ConfigurationCollection where o.Type == Model.ConfigType.FEED select o; foreach (var confFeed in confFeeds) { confFeed.Type = Model.ConfigType.FEED_TO_DELETE; } foreach (var feed in resp) { Model.Configuration existingFeedConf = App.configVM.ConfigurationCollection.FirstOrDefault((o) => o.Type == Model.ConfigType.FEED_TO_DELETE && o.Id == feed.Id); if (existingFeedConf != null) { existingFeedConf.Name = feed.Name; existingFeedConf.Type = Model.ConfigType.FEED; existingFeedConf.LastTimeStamp = Util.FromApiTime(feed.Time); existingFeedConf.Value = feed.Value; } else { App.configVM.ConfigurationCollection.Add( new Model.Configuration { Name = feed.Name, Id = feed.Id, Type = Model.ConfigType.FEED, LastTimeStamp = Util.FromApiTime(feed.Time), Value = feed.Value } ); } } return(true); } catch (Exception ex) { return(false); } }
private void WriteSystems(XmlWriter writer, Model.Configuration configuration) { writer.WriteStartElement("systems"); foreach (var configurationSystem in configuration.Systems) { writer.WriteStartElement("system"); writer.WriteAttributeString("name", configurationSystem.Name); writer.WriteAttributeString("keep_compressed", configurationSystem.KeepCompressed.ToString()); writer.WriteAttributeString("is_selected", configurationSystem.IsSelected.ToString()); writer.WriteEndElement(); //system } writer.WriteEndElement(); //systems }
public MergedServiceSchemasShouldHaveTheirTypesRenamed() { var insert = Substitute.For <IInsertMergedSchema>(); insert.Execute(Arg.Do <string>(x => _primaryJson = x), Arg.Any <int>()); _registry.AddSingleton(insert); _registry.AddSingleton(Substitute.For <IUpdateServiceStatus>()); var getConfiguration = Substitute.For <IGetConfigurationCached>(); var configuration = new Model.Configuration { UrlFilter = "/v1/", JsonEndpoint = "/swagger.json" }; getConfiguration.Execute().Returns(configuration); _registry.AddSingleton(getConfiguration); }
public void OnGet() { SecurityTypes = Enum.GetValues(typeof(SecurityType)).Cast <SecurityType>().Select(x => new SelectListItem(x.ToString(), ((int)x).ToString())).ToList(); var configuration = _getConfiguration.Execute(); if (configuration == null) { Configuration = new Model.Configuration { UrlFilter = "/", JsonEndpoint = "/swagger.json" }; return; } Configuration = configuration; }
public static Model.Configuration TranslateDTOConfigurationToModelConfiguration(DTO.Configuration c) { if (c == null) { return(null); } var mc = new Model.Configuration { ConfigurationEntries = new Dictionary <string, string>() }; foreach (var item in c.ConfigurationEntries) { mc.ConfigurationEntries.Add(item.Key, item.Value); } return(mc); }
private void WriteBestMatch(XmlWriter writer, Model.Configuration configuration) { writer.WriteStartElement("bestmatch"); writer.WriteStartElement("rom_source_directory"); writer.WriteAttributeString("value", configuration.BestMatch.RomSourceDirectory); writer.WriteEndElement(); //rom_source_directory writer.WriteStartElement("rom_destination_directory"); writer.WriteAttributeString("value", configuration.BestMatch.RomDestinationDirectory); writer.WriteEndElement(); //rom_destination_directory writer.WriteStartElement("preferences"); writer.WriteStartElement("ignore_musthaves_for_one_rom"); writer.WriteString(configuration.BestMatch.Preferences.IgnoreMustHaveForOneRom.ToString()); writer.WriteEndElement(); //ignore_musthaves_for_one_rom writer.WriteStartElement("ignore_neveruse_for_one_rom"); writer.WriteString(configuration.BestMatch.Preferences.IgnoreNeverUseForOneRom.ToString()); writer.WriteEndElement(); //ignore_neveruse_for_one_rom writer.WriteStartElement("nameparts"); foreach (var namePart in configuration.BestMatch.Preferences.NameParts.OrderBy(l => l.Position)) { writer.WriteStartElement("namepart"); writer.WriteAttributeString("name", namePart.Name); writer.WriteAttributeString("value", namePart.Value); writer.WriteAttributeString("system", namePart.System); writer.WriteAttributeString("type", namePart.Type.ToString()); writer.WriteAttributeString("behaviour", namePart.Behaviour.ToString()); writer.WriteAttributeString("position", namePart.Position.ToString()); writer.WriteAttributeString("description", namePart.Description); writer.WriteEndElement(); //namepart } writer.WriteEndElement(); //nameparts writer.WriteEndElement(); //preferences writer.WriteEndElement(); //BestMatch }
public void AndGivenApiServiceHasBeenConfigured() { var getConfiguration = Substitute.For <IGetConfigurationCached>(); _configuration = new Model.Configuration { UrlFilter = "/v1/", JsonEndpoint = "/swagger.json", Description = "This is a very important test Api", Title = "Test Api", ContactEmail = "*****@*****.**", LicenseName = "Test License 2.0", LicenseUrl = "www.test.com", TermsUrl = "reddit.com", SecurityType = SecurityType.ApiKey, SecurityKeyName = "X-TEST-KEY" }; getConfiguration.Execute().Returns(_configuration); _registry.AddSingleton(getConfiguration); }
public void Write(Model.Configuration configuration) { var configFile = Path.Combine(_configDir, "Configuration.xml"); //var configFile = Path.Combine(_configDir, "Configuration_update.xml"); var settings = new XmlWriterSettings { OmitXmlDeclaration = true, Indent = true, }; using (XmlWriter writer = XmlWriter.Create(configFile, settings)) { writer.WriteStartElement("configuration"); WriteBestMatch(writer, configuration); WriteSystems(writer, configuration); writer.WriteEndElement(); //configuration } }
public LogForm(string filename) { this.filename = filename; InitializeComponent(); this.Icon = Icon.FromHandle(Resources.ssw128.GetHicon()); config = Model.Configuration.Load(); if (config.logViewer == null) { config.logViewer = new Model.LogViewerConfig(); } else { topMostTrigger = config.logViewer.topMost; wrapTextTrigger = config.logViewer.wrapText; toolbarTrigger = config.logViewer.toolbarShown; LogMessageTextBox.Font = new Font(config.logViewer.fontName, config.logViewer.fontSize); LogMessageTextBox.BackColor = config.logViewer.GetBackgroundColor(); LogMessageTextBox.ForeColor = config.logViewer.GetTextColor(); } UpdateTexts(); }
private void OnLoaded(object sender, RoutedEventArgs e) { Configuration = Model.Configuration; }
public ServiceConfigurationController(Model.Configuration configuration, ILogger logger) { _configuration = configuration; _logger = logger; }
private void OnClosed(object sender, EventArgs e) { Configuration = null; }
/// <summary> /// /// </summary> /// <param name="locations"></param> /// <param name="vehicle"></param> /// <param name="pointsEncoded"></param> /// <param name="calcPoints"></param> /// <returns></returns> private Response CalculateRouteOptimize(List <Location> locations , Vehicle vehicle , bool pointsEncoded = true , bool calcPoints = true) { // comnpose the body for the request var clientServices = new List <Service>(); try { locations.ForEach(loc => { var address = new Address(loc.LocationId, $"servicing-{loc.LocationId}", loc.Lon, loc.Lat); var srvc = new Service(Id: address.LocationId, Name: address.Name, Type: loc.ServiceType, Address: address); clientServices.Add(srvc); }); var routingCfg = new Model.Configuration() { Routing = new Routing(calcPoints: calcPoints, considerTraffic: true, networkDataProvider: Routing.NetworkDataProviderEnum.Openstreetmap) }; var body = new Request(Vehicles: new List <Vehicle>() { vehicle }, VehicleTypes: new List <VehicleType>() { vehicle.VehicleType }, Configuration: routingCfg, Services: clientServices); // Request | Request object that contains the problem to be solved var jobId = _vrpApiInstance.PostVrp(_apiKey, body); // Return the solution associated to the jobId Exception ex = null; Response response = null; RetryCodeKit.LoopAction(() => { response = _slnApiInstance.GetSolution(_apiKey, jobId._JobId); return(response?.Status != null && response.Solution?.Routes != null && response.Solution.Routes.Any() && (response != null && response?.Status.Value != Response.StatusEnum.Finished)); }, ref ex, true, 10, 5000); if (ex != null) { throw ex; } return(response); } catch (Exception ex) { throw; } }
public static bool Update(Model.Configuration model) { if (model == null) { return(false); } string guid = Guid.NewGuid().ToString(); StringBuilder strSql = new StringBuilder(); strSql.Append("update Configuration set "); strSql.Append(" YLMoney = @YLMoney , "); strSql.Append(" InFloat = @InFloat , "); strSql.Append(" OutFloat = @OutFloat , "); strSql.Append(" MaxDPCount = @MaxDPCount , "); strSql.Append(" DPTopFloat = @DPTopFloat , "); strSql.Append(" BDCount = @BDCount , "); strSql.Append(" DefaultRole = @DefaultRole , "); strSql.Append(" DMHBPart = @DMHBPart , "); strSql.Append(" DMGPPart = @DMGPPart , "); strSql.Append(" JMHBPart = @JMHBPart , "); strSql.Append(" TXMinMoney = @TXMinMoney , "); strSql.Append(" JMGPPart = @JMGPPart , "); strSql.Append(" GPrice = @GPrice , "); strSql.Append(" DFHFloat = @DFHFloat , "); strSql.Append(" DFHTopMoney = @DFHTopMoney , "); strSql.Append(" MinBuyGCount = @MinBuyGCount , "); strSql.Append(" GLMoney = @GLMoney , "); strSql.Append(" AutoDFH = @AutoDFH , "); strSql.Append(" TXBaseMoney = @TXBaseMoney , "); strSql.Append(" ZZMinMoney = @ZZMinMoney , "); strSql.Append(" ZZBaseMoney = @ZZBaseMoney , "); strSql.Append(" DHMinMoney = @DHMinMoney , "); strSql.Append(" DHBaseMoney = @DHBaseMoney , "); strSql.Append(" MaxBuyGCount = @MaxBuyGCount, "); strSql.Append(" DFHXFCount = @DFHXFCount, "); strSql.Append(" DFHOutCount = @DFHOutCount, "); strSql.Append("CanRegedit=@CanRegedit,"); strSql.Append("DayRegeditNumber=@DayRegeditNumber,"); strSql.Append("ShowOfferTotalMoney=@ShowOfferTotalMoney,"); strSql.Append("ShowGetTotalMoney=@ShowGetTotalMoney,"); strSql.Append("ShowTotalNumber=@ShowTotalNumber"); strSql.AppendFormat(" ;select '{0}'", guid); SqlParameter[] parameters = { new SqlParameter("@YLMoney", SqlDbType.Int, 4), new SqlParameter("@InFloat", SqlDbType.Decimal, 9), new SqlParameter("@OutFloat", SqlDbType.Decimal, 9), new SqlParameter("@MaxDPCount", SqlDbType.Int, 4), new SqlParameter("@DPTopFloat", SqlDbType.Decimal, 9), new SqlParameter("@BDCount", SqlDbType.Int, 4), new SqlParameter("@DefaultRole", SqlDbType.VarChar, 10), new SqlParameter("@DMHBPart", SqlDbType.Decimal, 9), new SqlParameter("@DMGPPart", SqlDbType.Decimal, 9), new SqlParameter("@JMHBPart", SqlDbType.Decimal, 9), new SqlParameter("@TXMinMoney", SqlDbType.Int, 4), new SqlParameter("@JMGPPart", SqlDbType.Decimal, 9), new SqlParameter("@GPrice", SqlDbType.Decimal, 9), new SqlParameter("@DFHFloat", SqlDbType.Decimal, 9), new SqlParameter("@DFHTopMoney", SqlDbType.Decimal, 9), new SqlParameter("@MinBuyGCount", SqlDbType.Int, 4), new SqlParameter("@GLMoney", SqlDbType.Decimal, 9), new SqlParameter("@AutoDFH", SqlDbType.Bit, 1), new SqlParameter("@TXBaseMoney", SqlDbType.Int, 4), new SqlParameter("@ZZMinMoney", SqlDbType.Int, 4), new SqlParameter("@ZZBaseMoney", SqlDbType.Int, 4), new SqlParameter("@DHMinMoney", SqlDbType.Int, 4), new SqlParameter("@DHBaseMoney", SqlDbType.Int, 4), new SqlParameter("@MaxBuyGCount", SqlDbType.Int, 4), new SqlParameter("@DFHXFCount", SqlDbType.Int, 4), new SqlParameter("@DFHOutCount", SqlDbType.Int, 4), new SqlParameter("@CanRegedit", SqlDbType.Bit, 1), new SqlParameter("@DayRegeditNumber", SqlDbType.Int, 4), new SqlParameter("@ShowOfferTotalMoney", SqlDbType.Decimal, 9), new SqlParameter("@ShowGetTotalMoney", SqlDbType.Decimal, 9), new SqlParameter("@ShowTotalNumber", SqlDbType.Int, 4) }; parameters[0].Value = model.YLMoney; parameters[1].Value = model.InFloat; parameters[2].Value = model.OutFloat; parameters[3].Value = model.MaxDPCount; parameters[4].Value = model.DPTopFloat; parameters[5].Value = model.BDCount; parameters[6].Value = model.DefaultRole; parameters[7].Value = model.DMHBPart; parameters[8].Value = model.DMGPPart; parameters[9].Value = model.JMHBPart; parameters[10].Value = model.TXMinMoney; parameters[11].Value = model.JMGPPart; parameters[12].Value = model.GPrice; parameters[13].Value = model.DFHFloat; parameters[14].Value = model.DFHTopMoney; parameters[15].Value = model.MinBuyGCount; parameters[16].Value = model.GLMoney; parameters[17].Value = model.AutoDFH; parameters[18].Value = model.TXBaseMoney; parameters[19].Value = model.ZZMinMoney; parameters[20].Value = model.ZZBaseMoney; parameters[21].Value = model.DHMinMoney; parameters[22].Value = model.DHBaseMoney; parameters[23].Value = model.MaxBuyGCount; parameters[24].Value = model.DFHXFCount; parameters[25].Value = model.DFHOutCount; parameters[26].Value = model.CanRegedit; parameters[27].Value = model.DayRegeditNumber; parameters[28].Value = model.ShowOfferTotalMoney; parameters[29].Value = model.ShowGetTotalMoney; parameters[30].Value = model.ShowTotalNumber; Hashtable MyHs = new Hashtable(); MyHs.Add(strSql.ToString(), parameters); DAL.SHMoney.UpdateList(model.SHMoneyList, MyHs); List <Model.ConfigDictionary> list = new List <Model.ConfigDictionary>(); foreach (List <Model.ConfigDictionary> MyDe in DAL.Configuration.TModel.ConfigDictionaryList.Values) { list.AddRange(MyDe); } DAL.ConfigDictionary.UpdateList(list, MyHs); List <Model.NConfigDictionary> nlist = new List <Model.NConfigDictionary>(); foreach (List <Model.NConfigDictionary> MyDe in DAL.Configuration.TModel.NConfigDictionaryList.Values) { nlist.AddRange(MyDe); } DAL.NConfigDictionary.UpdateList(nlist, MyHs); DAL.Configuration.TModel = null; return(DAL.CommonBase.RunHashtable(MyHs)); }
public void UpdateConfiguration(Model.Configuration configuration) { _configuration = configuration; _configurationWriter.Write(configuration); }
public static DTO.Configuration TranslateModelConfigurationToDTOConfiguration(Model.Configuration c) { if (c == null) { return(null); } var dtoc = new DTO.Configuration { ConfigurationEntries = new Dictionary <string, string>() }; foreach (var item in c.ConfigurationEntries) { dtoc.ConfigurationEntries.Add(item.Key, item.Value); } return(dtoc); }
public Logger(Model.Configuration configuration, Model.ApplicationPath appPath) { _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration)); _appPath = appPath ?? throw new ArgumentNullException(nameof(appPath)); _logFilePath = new Lazy <string>(() => _appPath.Expand(_configuration.LogFilePath)); }