public void GenerateFromTemplate_CreatesFiles() { //var reader = new DbContextReader(@"pathToDll", "dll"); //var entities = reader.ReadEntities(); var generator = new FileGeneratorService(); var config = new ConfigFileService().ReadConfigurationJson(configuration); generator.GenerateFiles("Templates/ApiController.mhbs", config); }
public void ExportTo(string filename) { using (var fileGenerator = FileGeneratorService.CreateGenerator(filename)) { foreach (var prefixDefinition in PrefixDefinitionRepository.GetPrefixDefinitions()) { fileGenerator.AddLine("{0}~{1}{2} [{3}]".FormatWith(prefixDefinition.Symbol, prefixDefinition.Inverted ? "1/" : "", prefixDefinition.Factor, prefixDefinition.Name)); } foreach (var unitDefinition in UnitDefinitionRepository.GetUnitDefinitions()) { fileGenerator.AddLine("{0}={1} [{2}]".FormatWith(unitDefinition.Symbol, unitDefinition.Definition, unitDefinition.Name)); } } }
public override IWoxResultFinder PrepareContext() { var constantProvider = new ConstantProvider <ScalarFloat, float>(); IUnitService <ScalarFloat, float> unitService = new UnitService <ScalarFloat, float>(constantProvider); ISystemService systemService = new SystemService("Wox.UnitConverter"); IDataAccessConfigurationService dataAccessConfigurationService = new DataAccessConfigurationService(systemService); IDataAccessService dataAccessService = new DataAccessService(dataAccessConfigurationService); IPrefixDefinitionRepository prefixDefinitionRepository = new PrefixDefinitionRepository(dataAccessService); IUnitDefinitionRepository unitDefinitionRepository = new UnitDefinitionRepository(dataAccessService); IFileGeneratorService fileGeneratorService = new FileGeneratorService(); IFileReaderService fileReaderService = new FileReaderService(); IUnitConversionService unitConversionService = new UnitConversionService(unitService, dataAccessService, prefixDefinitionRepository, unitDefinitionRepository, fileGeneratorService, fileReaderService); return(new WoxUnitResultFinder(WoxContextService, unitConversionService, systemService)); }
public override IWoxResultFinder PrepareContext() { IQueryService queryService = new QueryService(); IResultService resultService = new ResultService(WoxContextService); ISystemWebAppService systemWebAppService = new SystemWebAppService("Wox.WebApp"); IDataAccessService dataAccessService = new DataAccessService(systemWebAppService); IWebAppItemRepository webAppItemRepository = new WebAppItemRepository(dataAccessService); IWebAppConfigurationRepository webAppConfigurationRepository = new WebAppConfigurationRepository(dataAccessService); IFileGeneratorService fileGeneratorService = new FileGeneratorService(); IFileReaderService fileReaderService = new FileReaderService(); IHelperService helperService = new HelperService(); IWebAppService webAppService = new WebAppService(dataAccessService, webAppItemRepository, webAppConfigurationRepository, systemWebAppService, fileGeneratorService, fileReaderService, helperService); IApplicationInformationService applicationInformationService = new ApplicationInformationService(systemWebAppService); IWoxResultFinder woxWebAppResultFinder = new WebAppResultFinder(WoxContextService, webAppService, helperService, applicationInformationService, systemWebAppService); return(woxWebAppResultFinder); }
public void Export() { var exportDirectory = SystemService.GetExportPath(); var exportFilename = string.Format("Wox.WebApp-Save-{0}.wap.txt", SystemService.GetUID()); var exportFullFilename = Path.Combine(exportDirectory, exportFilename); using (var fileGenerator = FileGeneratorService.CreateGenerator(exportFullFilename)) { var configurations = GetConfigurations(); if (configurations.ContainsKey("default")) { var configuration = configurations["default"]; fileGenerator.AddLine(string.Format("# launcher: {0}", configuration.WebAppLauncher)); fileGenerator.AddLine(string.Format("# argumentsPattern: {0}", configuration.WebAppArgumentPattern)); } foreach (var configuration in configurations.Values) { if (configuration.Profile != "default") { fileGenerator.AddLine(string.Format("# launcher[{1}]: {0}", configuration.WebAppLauncher, configuration.Profile)); fileGenerator.AddLine(string.Format("# argumentsPattern[{1}]: {0}", configuration.WebAppArgumentPattern, configuration.Profile)); } } foreach (var webAppItem in WebAppItemRepository.SearchItems(new List <string>())) { if (webAppItem.Profile == "default") { fileGenerator.AddLine(string.Format("{0} ({1})", webAppItem.Url, webAppItem.Keywords)); } else { fileGenerator.AddLine(string.Format("{0} ({1}) [{2}]", webAppItem.Url, webAppItem.Keywords, webAppItem.Profile)); } } fileGenerator.Generate(); } SystemService.StartCommandLine(exportDirectory, ""); }