Ejemplo n.º 1
0
        List<Weather> IOpenWeatherService.GetWeathers(IOpenWeatherService openWeatherService, IXmlService xmlService, XDocument weatherDocument, WeatherForecast weatherForecast)
        {
            List<Weather> weathers =
                   (from w in weatherDocument.Descendants("time")

                    select new Weather
                    {
                        ForecastDaysPlus = (int)(Convert.ToDateTime(w.Attribute("day").Value) - DateTime.Now.Date).TotalDays,
                        Date = Convert.ToDateTime(w.Attribute("day").Value),
                        Symbol = w.Element("symbol").Attribute("name").Value,
                        WeatherForecast = weatherForecast,
                        Clouds = CreateClouds(xmlService, w),
                        Humidity = CreateHumidity(xmlService, w),
                        Precipitation = CreatePrecipitation(xmlService, w),
                        Pressure = CreatePressure(xmlService, w),
                        Temperature = new Temperature
                                        {
                                            Day = Convert.ToDecimal(w.Element("temperature").Attribute("day").Value, CultureInfo.InvariantCulture),
                                            Morn = Convert.ToDecimal(w.Element("temperature").Attribute("morn").Value, CultureInfo.InvariantCulture),
                                            Eve = Convert.ToDecimal(w.Element("temperature").Attribute("eve").Value, CultureInfo.InvariantCulture),
                                            Night = Convert.ToDecimal(w.Element("temperature").Attribute("night").Value, CultureInfo.InvariantCulture),
                                            Max = Convert.ToDecimal(w.Element("temperature").Attribute("max").Value, CultureInfo.InvariantCulture),
                                            Min = Convert.ToDecimal(w.Element("temperature").Attribute("min").Value, CultureInfo.InvariantCulture)
                                        },
                        Wind = CreateWind(xmlService, w),
                    }).ToList<Weather>();

            return weathers;
        }
Ejemplo n.º 2
0
 public FileSystemService(IXmlService xmlService, IFilenameGeneratorService filenameGeneratorService, IDirectoryService directoryService, IGuidGeneratorService guidGeneratorService)
 {
     XmlService = xmlService;
     FilenameGeneratorService = filenameGeneratorService;
     DirectoryService         = directoryService;
     GuidGeneratorService     = guidGeneratorService;
 }
Ejemplo n.º 3
0
 public void SetUp()
 {
     openWeatherService = new OpenWeatherService();
     xmlService = new XmlService();
     weatherString = File.ReadAllText(StaticPath.daily);
     weatherDocument = xmlService.GetXmlDoc(weatherString);
 }
Ejemplo n.º 4
0
 public BlogController(ILoggerFactory loggerFactory, ICategoryService categoryService, IPageService pageService, IPostService postService,
                       ITagService tagService, IXmlService xmlService, IService service)
     : base(loggerFactory, service, categoryService, pageService, postService, tagService)
 {
     _postService = postService;
     _xmlService  = xmlService;
 }
Ejemplo n.º 5
0
        private static ConfigFileSettings get_config_file_settings(IFileSystem fileSystem, IXmlService xmlService)
        {
            var globalConfigPath = ApplicationParameters.GlobalConfigFileLocation;
            AssemblyFileExtractor.extract_text_file_from_assembly(fileSystem, Assembly.GetExecutingAssembly(), ApplicationParameters.ChocolateyConfigFileResource, globalConfigPath);

            return xmlService.deserialize<ConfigFileSettings>(globalConfigPath);
        }
Ejemplo n.º 6
0
 public void SetUp()
 {
     worldWeatherOnlineService = new WorldWeatherOnlineService();
     xmlService = new XmlService();
     weatherString = File.ReadAllText(StaticPath.pastWeather);
     weatherDocument = xmlService.GetXmlDoc(weatherString);
 }
Ejemplo n.º 7
0
 public ContactService(IContactRequestMapper mapper, IXmlService xmlService, IDomainboxServiceClient domainboxServiceClient, IContactResponseMapper responseMapper)
 {
     _requestMapper          = mapper;
     _xmlService             = xmlService;
     _domainboxServiceClient = domainboxServiceClient;
     _responseMapper         = responseMapper;
 }
Ejemplo n.º 8
0
 /// <summary>
 ///   Sets up the configuration based on arguments passed in, config file, and environment
 /// </summary>
 /// <param name="args">The arguments.</param>
 /// <param name="config">The configuration.</param>
 /// <param name="fileSystem">The file system.</param>
 /// <param name="xmlService">The XML service.</param>
 /// <param name="notifyWarnLoggingAction">Notify warn logging action</param>
 public static void set_up_configuration(IList<string> args, ChocolateyConfiguration config, IFileSystem fileSystem, IXmlService xmlService, Action<string> notifyWarnLoggingAction)
 {
     set_file_configuration(config, fileSystem, xmlService, notifyWarnLoggingAction);
     ConfigurationOptions.reset_options();
     set_global_options(args, config);
     set_environment_options(config);
 }
 public ProductPlanningController(IProductPlanningService productPlanningService, IUserService userService, IPermissionService permissionService, IXmlService xmlService, IExcellService excellService)
 {
     _productPlanningService = productPlanningService;
     _userService            = userService;
     _permissionService      = permissionService;
     _xmlService             = xmlService;
     _excellService          = excellService;
 }
Ejemplo n.º 10
0
 public static void LoadFromXml(IXmlService xmlService, string path)
 {
     if (File.Exists(path))
     {
         settings = xmlService.LoadFromXml <SerializableDictionary>(path);
     }
     FillEmptyDefaults();
 }
Ejemplo n.º 11
0
        public MainViewModel(IInvoiceService invoiceService, IXmlService xmlService)
        {
            IsPriceListFileLoaded = false;
            IsPurchaseFileLoaded  = false;

            this.invoiceService = invoiceService;
            this.xmlService     = xmlService;
        }
Ejemplo n.º 12
0
 public TeamController(IAdminService adminService, IXmlService xmlService, ITeamService teamService,
                       ILogger <TeamController> logger)
 {
     this.adminService = adminService ?? throw new ArgumentNullException();
     this.xmlService   = xmlService ?? throw new ArgumentNullException();
     this.teamService  = teamService ?? throw new ArgumentNullException();
     this.logger       = logger ?? throw new ArgumentNullException();
 }
Ejemplo n.º 13
0
 public List<string> GetCities(string citiesXmlFileName, IXmlService xmlService)
 {
     string citiesXmlString = File.ReadAllText(citiesXmlFileName);
     XDocument citiesDocument = xmlService.GetXmlDoc(citiesXmlString);
     List<string> cities = (from w in citiesDocument.Descendants("city")
                            select w.Value).ToList<string>();
     return cities;
 }
Ejemplo n.º 14
0
 public MeteoService(IRepository<Location> locationRepository, IRepository<WeatherForecast> weatherForecastRepository)
 {
     _locationRepository = locationRepository;
     _weatherForecastRepository = weatherForecastRepository;
     _xmlService = new XmlService();
     _webClientService = new WebClientService();
     _openWeatherService = new OpenWeatherService();
     _worldWeatherOnlineService = new WorldWeatherOnlineService();
 }
Ejemplo n.º 15
0
        private static Mock <ExpenseService> GetMockedService(IXmlService xmlService)
        {
            var logger = new Mock <ILogger <ExpenseService> >();

            return(new Mock <ExpenseService>(new object[] { xmlService, logger.Object })
            {
                CallBase = true
            });
        }
Ejemplo n.º 16
0
        public MainWindow(IUtrosakRepository repo, IExcelService excelService, IXmlService xmlService)
        {
            _utrosakRepo  = repo;
            _excelService = excelService;
            _xmlService   = xmlService;
            lista         = new ObservableCollection <Lek>();

            DataContext = this;
            InitializeComponent();
        }
Ejemplo n.º 17
0
 public List<WeatherForecast> GetHistoricalWeatherList(string apiKey, List<string> cityNameList, string date, string endDate, IWebClientService webClientService, IXmlService xmlService, IOpenWeatherService openWeatherService)
 {
     List<WeatherForecast> weatherHistoricalForecast = new List<WeatherForecast>();
     foreach (string cityName in cityNameList)
     {
         List<WeatherForecast> weatherHistoricalForecastByCity = GetHistoricalWeatherList(apiKey, cityName, date, endDate, webClientService, xmlService, openWeatherService);
         weatherHistoricalForecast.AddRange(weatherHistoricalForecastByCity);
     }
     return weatherHistoricalForecast;
 }
Ejemplo n.º 18
0
 public HomeController(ILoggerFactory loggerFactory, IEmailSender emailSender, IPageService pageService, IXmlService xmlService,
                       ICategoryService categoryService, ITagService tagService, IService service, IPostService postService,
                       IEmailService emailService)
     : base(loggerFactory, service, categoryService, pageService, postService, tagService)
 {
     _emailSender  = emailSender;
     _pageService  = pageService;
     _xmlService   = xmlService;
     _emailService = emailService;
 }
Ejemplo n.º 19
0
 public ChocolateyPackageService(INugetService nugetService, IPowershellService powershellService, IShimGenerationService shimgenService, IFileSystem fileSystem, IRegistryService registryService, IChocolateyPackageInformationService packageInfoService, IAutomaticUninstallerService autoUninstallerService, IXmlService xmlService)
 {
     _nugetService           = nugetService;
     _powershellService      = powershellService;
     _shimgenService         = shimgenService;
     _fileSystem             = fileSystem;
     _registryService        = registryService;
     _packageInfoService     = packageInfoService;
     _autoUninstallerService = autoUninstallerService;
     _xmlService             = xmlService;
 }
 public UploadTransactionsCommandHandler(
     ITransactionService transactionService,
     IXmlService xmlService,
     ICsvService csvService,
     TransactionServiceFactory transactionServiceFactory)
 {
     this.transactionService        = transactionService;
     this.xmlService                = xmlService;
     this.csvService                = csvService;
     this.transactionServiceFactory = transactionServiceFactory;
 }
Ejemplo n.º 21
0
#pragma warning disable SA1401 // Fields must be private
#pragma warning restore SA1401 // Fields must be private

        public ChocolateyService(IMapper mapper, IProgressService progressService, IChocolateyConfigSettingsService configSettingsService, IXmlService xmlService, IFileSystem fileSystem, IConfigService configService)
        {
            _mapper                = mapper;
            _progressService       = progressService;
            _configSettingsService = configSettingsService;
            _xmlService            = xmlService;
            _fileSystem            = fileSystem;
            _configService         = configService;
            _choco = Lets.GetChocolatey().SetCustomLogging(new SerilogLogger(Logger, _progressService));

            _localAppDataPath = _fileSystem.combine_paths(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData, Environment.SpecialFolderOption.DoNotVerify), "Chocolatey GUI");
        }
        public IActionResult Index()
        {
            xmlService = new XmlService();
            string str  = xmlService.XmlToString();
            var    list = xmlService.ConvertXmlToList(str);

            ViewBag.XmlList = list;

            if (User.IsInRole("admin"))
            {
                return(RedirectToAction("Index", "Admin"));
            }

            if (User.Identity.IsAuthenticated)
            {
                UserIndexViewModel model = new UserIndexViewModel();

                string   UserIdFromUsers  = userService.FindUserByName(User.Identity.Name).Id;
                string   userName         = string.Empty;
                string   logoCompany      = string.Empty;
                int      userId           = 0;
                UserInfo userFromUserInfo = userService.FindUserByIdInUserInfo(UserIdFromUsers, ref userName, ref userId);
                if (userFromUserInfo == null)
                {
                    EmployeeInfo userFromEmployeeInfo = userService.FindUserByIdInCompany(UserIdFromUsers, ref userName, ref userId);
                    model.UserAccounts = accountService.GetCompanyAccounts(userId);
                    if (companyService.FindCompanyById(userId).Logo != null)
                    {
                        logoCompany = companyService.FindCompanyById(userId).Logo;
                    }
                }
                else
                {
                    model.UserAccounts = accountService.GetUserInfoAccounts(userId);
                }

                if (userId != 0)
                {
                    model.UserId   = userId;
                    model.UserName = userName;
                }
                HttpContext.Session.SetString("FullName", userName);
                HttpContext.Session.SetString("Logo", logoCompany);

                model.NBKRRates   = exchangeRateService.GetLastExchangeRatesByDate().Where(r => r.ExchangeRateTypeId == 1).ToList();
                model.MarketRates = exchangeRateService.GetLastExchangeRatesByDate().Where(r => r.ExchangeRateTypeId == 2).ToList();

                return(View(model));
            }

            return(RedirectToAction("Login"));
        }
Ejemplo n.º 23
0
        public AdminController(

            ISiteService siteService,
            IMemberEventService eventService,
            IXmlService xmlService,
            IShapeFactory shapeFactory
            )
        {
            _siteService  = siteService;
            _eventService = eventService;
            _xmlService   = xmlService;
            Shape         = shapeFactory;
        }
Ejemplo n.º 24
0
        public void InitTest()
        {
            xmlServiceMock = new Mock<IXmlService>();
            webClientServiceMock = new Mock<IWebClientService>();
            openWeatherServiceMock = new Mock<IOpenWeatherService>();
            xmlService = new XmlService();
            webClientService = new WebClientService();
            openWeatherService = new OpenWeatherService();

            IDbContext dbContext = new MeteoContext();
            IRepository<Location> locationRepository = new EfRepository<Location>(dbContext);
            IRepository<WeatherForecast> weatherForecastRepository = new EfRepository<WeatherForecast>(dbContext);
            meteoService = new MeteoService(locationRepository, weatherForecastRepository);
        }
Ejemplo n.º 25
0
 public BusinessService(ILogger <BusinessService> logger,
                        IDataAccessService dataAccessService,
                        ISendEmailService mailService,
                        IJsonService jsonService,
                        IDataService dataService,
                        IXmlService xmlService)
 {
     _logger            = logger;
     _xmlService        = xmlService;
     _jsonService       = jsonService;
     _dataService       = dataService;
     _mailService       = mailService;
     _dataAccessService = dataAccessService;
 }
Ejemplo n.º 26
0
        public XmlCreator(ICustomLogger logger, IXmlService service)
        {
            if (logger is null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            if (service is null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            this.logger  = logger;
            this.service = service;
        }
Ejemplo n.º 27
0
 public List<WeatherForecast> GetHistoricalWeatherList(string apiKey, string cityName, string date, string endDate, IWebClientService webClientService, IXmlService xmlService, IOpenWeatherService openWeatherService)
 {
     //string url = @"http://api.worldweatheronline.com/free/v2/past-weather.ashx?key={apiKey}&q={cityName}&format=xml&includeLocation=yes&date={date}&enddate={endDate}";
     string url = ConfigurationManager.AppSettings["historicalWeatherUrl"];
     url = url.Replace("{apiKey}", apiKey);
     url = url.Replace("{cityName}", cityName);
     url = url.Replace("{date}", date);
     url = url.Replace("{endDate}", endDate);
     LogHelper.WriteToLog("meteo.log", url);
     string weatherString = webClientService.Get(url);
     XDocument weatherDocument = xmlService.GetXmlDoc(weatherString);
     Location location = GetLocation(cityName);
     List<WeatherForecast> weatherHistoricalForecast = _worldWeatherOnlineService.GetWeatherHistoricalForecast(_worldWeatherOnlineService, xmlService, weatherDocument, location);
     return weatherHistoricalForecast;
 }
Ejemplo n.º 28
0
        public WeatherForecast GetWeatherForecast(IOpenWeatherService openWeatherService, IXmlService xmlService, XDocument weatherDocument, List<Location> currentLocations, int forecastDaysCount)
        {
            Location location = openWeatherService.GetLocation(weatherDocument, currentLocations);

            WeatherForecast weatherForecast = new WeatherForecast()
            {
                Location = location,
                Time = DateTime.Now,
                ForecastDaysQuantity = forecastDaysCount
            };

            List<Weather> weathers = openWeatherService.GetWeathers(openWeatherService, xmlService, weatherDocument, weatherForecast);
            weatherForecast.Weathers = weathers;
            return weatherForecast;
        }
Ejemplo n.º 29
0
 public SettingsPresenter(ISettingsView view)
 {
     this.view = view;
     try
     {
         xmlService = new XmlService();
         webClientService = new WebClientService();
         openWeatherService = new OpenWeatherService();
         dbContext = new MeteoContext();
         locationRepository = new EfRepository<Location>(dbContext);
         weatherForecastRepository = new EfRepository<WeatherForecast>(dbContext);
         meteoService = new MeteoService(locationRepository, weatherForecastRepository);
     }
     catch (Exception ex)
     {
         throw;
     }
 }
Ejemplo n.º 30
0
        private static void set_file_configuration(ChocolateyConfiguration config, IFileSystem fileSystem, IXmlService xmlService, Action<string> notifyWarnLoggingAction)
        {
            var globalConfigPath = ApplicationParameters.GlobalConfigFileLocation;
            AssemblyFileExtractor.extract_text_file_from_assembly(fileSystem, Assembly.GetExecutingAssembly(), ApplicationParameters.ChocolateyConfigFileResource, globalConfigPath);

            var configFileSettings = xmlService.deserialize<ConfigFileSettings>(globalConfigPath);
            var sources = new StringBuilder();
            foreach (var source in configFileSettings.Sources.Where(s => !s.Disabled).or_empty_list_if_null())
            {
                sources.AppendFormat("{0};", source.Value);
            }
            if (sources.Length != 0)
            {
                config.Sources = sources.Remove(sources.Length - 1, 1).ToString();
            }

            set_machine_sources(config, configFileSettings);

            config.CacheLocation = !string.IsNullOrWhiteSpace(configFileSettings.CacheLocation) ? configFileSettings.CacheLocation : System.Environment.GetEnvironmentVariable("TEMP");
            if (string.IsNullOrWhiteSpace(config.CacheLocation))
            {
                config.CacheLocation = fileSystem.combine_paths(ApplicationParameters.InstallLocation, "temp");
            }

            FaultTolerance.try_catch_with_logging_exception(
                () => fileSystem.create_directory_if_not_exists(config.CacheLocation),
                "Could not create temp directory at '{0}'".format_with(config.CacheLocation),
                logWarningInsteadOfError: true);

            config.ContainsLegacyPackageInstalls = configFileSettings.ContainsLegacyPackageInstalls;
            if (configFileSettings.CommandExecutionTimeoutSeconds <= 0)
            {
                configFileSettings.CommandExecutionTimeoutSeconds = ApplicationParameters.DefaultWaitForExitInSeconds;
            }
            config.CommandExecutionTimeoutSeconds = configFileSettings.CommandExecutionTimeoutSeconds;

            set_feature_flags(config, configFileSettings);

            // save so all updated configuration items get set to existing config
            FaultTolerance.try_catch_with_logging_exception(
                () => xmlService.serialize(configFileSettings, globalConfigPath),
                "Error updating '{0}'. Please ensure you have permissions to do so".format_with(globalConfigPath),
                logWarningInsteadOfError: true);
        }
Ejemplo n.º 31
0
 public AirShoppingService(
     ILogger <AirShoppingService> logger,
     IXmlService xmlService,
     ISoapService soapService,
     IDocumentFactory documentFactory,
     IPartyBuilder partyBuilder,
     ITravelerBuilder travelerBuilder,
     ICoreQueryBuilder coreQueryBuilder,
     IPreferenceBuilder preferenceBuilder)
 {
     _logger            = logger;
     _xmlService        = xmlService;
     _soapService       = soapService;
     _documentFactory   = documentFactory;
     _partyBuilder      = partyBuilder;
     _travelerBuilder   = travelerBuilder;
     _coreQueryBuilder  = coreQueryBuilder;
     _preferenceBuilder = preferenceBuilder;
 }
 public ChocolateyPackageService(INugetService nugetService, IPowershellService powershellService,
                                 IEnumerable <ISourceRunner> sourceRunners, IShimGenerationService shimgenService,
                                 IFileSystem fileSystem, IRegistryService registryService,
                                 IChocolateyPackageInformationService packageInfoService, IFilesService filesService,
                                 IAutomaticUninstallerService autoUninstallerService, IXmlService xmlService,
                                 IConfigTransformService configTransformService)
 {
     _nugetService           = nugetService;
     _powershellService      = powershellService;
     _sourceRunners          = sourceRunners;
     _shimgenService         = shimgenService;
     _fileSystem             = fileSystem;
     _registryService        = registryService;
     _packageInfoService     = packageInfoService;
     _filesService           = filesService;
     _autoUninstallerService = autoUninstallerService;
     _xmlService             = xmlService;
     _configTransformService = configTransformService;
 }
Ejemplo n.º 33
0
 private Clouds CreateClouds(IXmlService xmlService, XElement w)
 {
     Clouds clouds = new Clouds()
     {
         Value = xmlService.GetXmlAttributeText(w, "clouds", "value"),
         Unit = xmlService.GetXmlAttributeText(w, "clouds", "unit"),
         All = xmlService.GetXmlAttributeValue(w, "clouds", "all"),
     };
     if (
         string.IsNullOrEmpty(clouds.Value) &&
         string.IsNullOrEmpty(clouds.Unit) &&
         clouds.All == 0)
     {
         return null;
     }
     else
     {
         return clouds;
     }
 }
Ejemplo n.º 34
0
        private static void set_file_configuration(ChocolateyConfiguration config, IFileSystem fileSystem, IXmlService xmlService, Action<string> notifyWarnLoggingAction)
        {
            var globalConfigPath = ApplicationParameters.GlobalConfigFileLocation;
            AssemblyFileExtractor.extract_text_file_from_assembly(fileSystem, Assembly.GetExecutingAssembly(), ApplicationParameters.ChocolateyConfigFileResource, globalConfigPath);

            var configFileSettings = xmlService.deserialize<ConfigFileSettings>(globalConfigPath);
            var sources = new StringBuilder();

            var defaultSourcesInOrder = configFileSettings.Sources.Where(s => !s.Disabled).or_empty_list_if_null().ToList();
            if (configFileSettings.Sources.Any(s => s.Priority > 0))
            {
                defaultSourcesInOrder = configFileSettings.Sources.Where(s => !s.Disabled && s.Priority != 0).OrderBy(s => s.Priority).or_empty_list_if_null().ToList();
                defaultSourcesInOrder.AddRange(configFileSettings.Sources.Where(s => !s.Disabled && s.Priority == 0 ).or_empty_list_if_null().ToList());
            }

            foreach (var source in defaultSourcesInOrder)
            {
                sources.AppendFormat("{0};", source.Value);
            }
            if (sources.Length != 0)
            {
                config.Sources = sources.Remove(sources.Length - 1, 1).ToString();
            }

            set_machine_sources(config, configFileSettings);

            set_config_items(config, configFileSettings, fileSystem);

            FaultTolerance.try_catch_with_logging_exception(
                () => fileSystem.create_directory_if_not_exists(config.CacheLocation),
                "Could not create temp directory at '{0}'".format_with(config.CacheLocation),
                logWarningInsteadOfError: true);

            set_feature_flags(config, configFileSettings);

            // save so all updated configuration items get set to existing config
            FaultTolerance.try_catch_with_logging_exception(
                () => xmlService.serialize(configFileSettings, globalConfigPath),
                "Error updating '{0}'. Please ensure you have permissions to do so".format_with(globalConfigPath),
                logWarningInsteadOfError: true);
        }
        public UserController(UserManager <User> userManager, SignInManager <User> signInManager,
                              ApplicationContext context, IUserService userService, ISelectListService selectListService,
                              IAccountService accountService, IEmployeeService employeeService
                              , IExchangeRateService exchangeRateService, ICompanyService companyService, IValidationService validationService,
                              IXmlService xmlService)

        {
            _userManager             = userManager;
            _signInManager           = signInManager;
            this.context             = context;
            this.userService         = userService;
            this.selectListService   = selectListService;
            this.accountService      = accountService;
            generatePasswordService  = new GeneratePasswordService();
            emailService             = new EmailService();
            this.employeeService     = employeeService;
            this.exchangeRateService = exchangeRateService;
            this.companyService      = companyService;
            this.validationService   = validationService;
            this.xmlService          = xmlService;
        }
Ejemplo n.º 36
0
        public AdminController(
            IPollService pollService,
            ISongService songService,
            ISiteService siteService,
            IXmlService xmlService,
            IShapeFactory shapeFactory,
            IContentManager contentManager,
            IOrchardServices services,
            IArtistUserService artitsUserService)
        {
            _pollService       = pollService;
            _songService       = songService;
            _siteService       = siteService;
            Shape              = shapeFactory;
            _xmlService        = xmlService;
            _contentManager    = contentManager;
            Services           = services;
            _artistUserService = artitsUserService;

            T = NullLocalizer.Instance;
        }
Ejemplo n.º 37
0
        public FilamentService(ISerialService serialService, IXmlService xmlService, ICsvService csvService)
        {
            stopWatch = new Stopwatch();

            _serialService = serialService;
            _serialService.DiameterChanged += SerialService_DiameterChanged;

            _xmlService = xmlService;
            _csvService = csvService;

            FilamentServiceVariables = new Dictionary <string, string>();
            FilamentServiceVariables.Add("ActualDiameter", "");
            FilamentServiceVariables.Add("HighestValue", "");
            FilamentServiceVariables.Add("LowestValue", "");
            FilamentServiceVariables.Add("NominalValue", "");
            FilamentServiceVariables.Add("UpperLimit", "");
            FilamentServiceVariables.Add("LowerLimit", "");
            FilamentServiceVariables.Add("Duration", "");

            BuildXmlData();
            SetupPlots();
        }
 public ChocolateyConfigSettingsService(IXmlService xmlService)
 {
     _xmlService = xmlService;
     _configFileSettings = new Lazy<ConfigFileSettings>(() => _xmlService.deserialize<ConfigFileSettings>(ApplicationParameters.GlobalConfigFileLocation));
 }
Ejemplo n.º 39
0
        private static void set_config_file_settings(ConfigFileSettings configFileSettings, IXmlService xmlService)
        {
            var globalConfigPath = ApplicationParameters.GlobalConfigFileLocation;

            // save so all updated configuration items get set to existing config
            FaultTolerance.try_catch_with_logging_exception(
                () => xmlService.serialize(configFileSettings, globalConfigPath),
                "Error updating '{0}'. Please ensure you have permissions to do so".format_with(globalConfigPath),
                logWarningInsteadOfError: true);
        }
Ejemplo n.º 40
0
 private Wind CreateWind(IXmlService xmlService, XElement w)
 {
     Wind wind = new Wind()
     {
         Direction = xmlService.GetXmlAttributeText(w, "windDirection", "name"),
         DirectionCode = xmlService.GetXmlAttributeText(w, "windDirection", "code"),
         Deg = xmlService.GetXmlAttributeText(w, "windDirection", "deg"),
         SpeedName = xmlService.GetXmlAttributeText(w, "windSpeed", "name"),
         Mps = xmlService.GetXmlAttributeValue(w, "windSpeed", "mps")
     };
     if (string.IsNullOrEmpty(wind.Direction) &&
        string.IsNullOrEmpty(wind.DirectionCode) &&
        string.IsNullOrEmpty(wind.SpeedName) &&
        string.IsNullOrEmpty(wind.Deg) &&
        wind.Mps == 0)
     {
         return null;
     }
     else
     {
         return wind;
     }
 }
Ejemplo n.º 41
0
 public HomeController(IXmlService xmlService)
 {
     _xmlService = xmlService;
 }
Ejemplo n.º 42
0
 public RegistryService(IXmlService xmlService, IFileSystem fileSystem)
 {
     _xmlService = xmlService;
     _fileSystem = fileSystem;
 }
Ejemplo n.º 43
0
 public PanoService(IConfigurationService configurationService, IXmlService xmlService, IHostingEnvironment env)
 {
     _configurationService = configurationService;
     _xmlService = xmlService;
     _env = env;
 }
Ejemplo n.º 44
0
        private static void set_config_file_settings(ConfigFileSettings configFileSettings, IXmlService xmlService, ChocolateyConfiguration config)
        {
            var shouldLogSilently = (!config.Information.IsProcessElevated || !config.Information.IsUserAdministrator);

            var globalConfigPath = ApplicationParameters.GlobalConfigFileLocation;
            // save so all updated configuration items get set to existing config
            FaultTolerance.try_catch_with_logging_exception(
                () => xmlService.serialize(configFileSettings, globalConfigPath, isSilent: shouldLogSilently),
                "Error updating '{0}'. Please ensure you have permissions to do so".format_with(globalConfigPath),
                logDebugInsteadOfError: true);
        }
Ejemplo n.º 45
0
 private Humidity CreateHumidity(IXmlService xmlService, XElement w)
 {
     Humidity humidity = new Humidity()
     {
         Value = xmlService.GetXmlAttributeValue(w, "humidity", "value"),
         Unit = xmlService.GetXmlAttributeText(w, "humidity", "unit")
     };
     if (humidity.Value == 0 &&
         string.IsNullOrEmpty(humidity.Unit))
     {
         return null;
     }
     else
     {
         return humidity;
     }
 }
Ejemplo n.º 46
0
 public static void SaveToXml(IXmlService xmlService, string path)
 {
     xmlService.SaveToXml(path, settings);
 }
Ejemplo n.º 47
0
 public WeatherForecast GetWeather(string city, int forecastDaysCount, IWebClientService webClientService, IXmlService xmlService, IOpenWeatherService openWeatherService, List<Location> currentLocations)
 {
     string url = "http://api.openweathermap.org/data/2.5/forecast/daily?q=city&mode=xml&units=metric&cnt=forecastDaysCount";
     url = url.Replace("city", city);
     url = url.Replace("forecastDaysCount", forecastDaysCount.ToString());
     string weatherString = webClientService.Get(url);
     XDocument weatherDocument = xmlService.GetXmlDoc(weatherString);
     WeatherForecast weatherForecast = openWeatherService.GetWeatherForecast(openWeatherService, xmlService, weatherDocument, currentLocations, forecastDaysCount);
     return weatherForecast;
 }
Ejemplo n.º 48
0
 private Precipitation CreatePrecipitation(IXmlService xmlService, XElement w)
 {
     Precipitation precipitation = new Precipitation()
     {
         Value = xmlService.GetXmlAttributeValue(w, "precipitation", "value"),
         _Type = xmlService.GetXmlAttributeText(w, "precipitation", "type")
     };
     if (precipitation.Value == 0 &&
         string.IsNullOrEmpty(precipitation._Type))
     {
         return null;
     }
     else
     {
         return precipitation;
     }
 }
Ejemplo n.º 49
0
 private Pressure CreatePressure(IXmlService xmlService, XElement w)
 {
     Pressure pressure = new Pressure()
     {
         Value = xmlService.GetXmlAttributeValue(w, "pressure", "value"),
         Unit = xmlService.GetXmlAttributeText(w, "pressure", "unit")
     };
     if (pressure.Value == 0 &&
         string.IsNullOrEmpty(pressure.Unit))
     {
         return null;
     }
     else
     {
         return pressure;
     }
 }
Ejemplo n.º 50
0
 public FilesService(IXmlService xmlService, IFileSystem fileSystem, IHashProvider hashProvider)
 {
     _xmlService   = xmlService;
     _fileSystem   = fileSystem;
     _hashProvider = hashProvider;
 }
Ejemplo n.º 51
0
 private static void set_config_file_settings(ConfigFileSettings configFileSettings, IXmlService xmlService)
 {
     var globalConfigPath = ApplicationParameters.GlobalConfigFileLocation;
     // save so all updated configuration items get set to existing config
     FaultTolerance.try_catch_with_logging_exception(
         () => xmlService.serialize(configFileSettings, globalConfigPath),
         "Error updating '{0}'. Please ensure you have permissions to do so".format_with(globalConfigPath),
         logWarningInsteadOfError: true);
 }
Ejemplo n.º 52
0
 public FilesService(IXmlService xmlService, IFileSystem fileSystem, IHashProvider hashProvider)
 {
     _xmlService = xmlService;
     _fileSystem = fileSystem;
     _hashProvider = hashProvider;
 }
Ejemplo n.º 53
0
 public void InitTest()
 {
     xmlService = new XmlService();
 }
 public BackGroundService(IXmlService xmlService)
 {
     this.xmlService = xmlService;
 }
Ejemplo n.º 55
0
 public PersonRepository(IPathProvider pathProvider, IXmlService xmlService)
 {
     this.pathProvider = pathProvider;
     this.xmlService   = xmlService;
 }
Ejemplo n.º 56
0
 public ChocolateyConfigSettingsService(IXmlService xmlService)
 {
     _xmlService         = xmlService;
     _configFileSettings = new Lazy <ConfigFileSettings>(() => _xmlService.deserialize <ConfigFileSettings>(ApplicationParameters.GlobalConfigFileLocation));
 }
Ejemplo n.º 57
0
        private static ConfigFileSettings get_config_file_settings(IFileSystem fileSystem, IXmlService xmlService)
        {
            var globalConfigPath = ApplicationParameters.GlobalConfigFileLocation;

            AssemblyFileExtractor.extract_text_file_from_assembly(fileSystem, Assembly.GetExecutingAssembly(), ApplicationParameters.ChocolateyConfigFileResource, globalConfigPath);

            return(xmlService.deserialize <ConfigFileSettings>(globalConfigPath));
        }
Ejemplo n.º 58
0
 public RegistryService(IXmlService xmlService, IFileSystem fileSystem)
 {
     _xmlService = xmlService;
     _fileSystem = fileSystem;
 }
Ejemplo n.º 59
0
 public List<WeatherForecast> GetWeatherList(List<string> cityList, int forecastDaysCount, IWebClientService webClientService, IXmlService xmlService, IOpenWeatherService openWeatherService)
 {
     List<WeatherForecast> weatherForecasts = new List<WeatherForecast>();
     List<Location> currentLocations = GetLocations();
     foreach (string city in cityList)
     {
         WeatherForecast weatherForecast = GetWeather(city, forecastDaysCount, webClientService, xmlService, openWeatherService, currentLocations);
         weatherForecasts.Add(weatherForecast);
     }
     return weatherForecasts;
 }