public void Main(SolutionFactory Factory) { var obj = GetObj(Factory); obj.CreateAdvertisement(); obj.CreateEnvelope(); }
/// <inheritdoc /> /// <summary> /// Generates project files. /// </summary> /// <param name="arguments">Command line arguments.</param> /// <returns></returns> public override int Execute(string[] arguments) { try { var projectGenerator = ProjectGeneratorFactory.Create(); var solution = SolutionFactory.Create(arguments.Length > 0 ? arguments[0] : Path.Combine(BuildSystem.GetSdkLocation(), "Source", "GoddamnEngine.gdsln.cs")); // Generating project files.. foreach (var solutionProject in solution.Projects) { if (solutionProject.IsBuildTool) { continue; } solutionProject.GeneratorOutputPath = projectGenerator.GenerateProjectFiles(solutionProject); } //Parallel.ForEach(solution.CachedProjects.Where(project => !project.IsBuildTool) // , project => project.GeneratorOutputPath = projectGenerator.GenerateProjectFiles(project)); // Generating the solution.. solution.GeneratedSolutionPath = projectGenerator.GenerateSolutionFiles(solution); return(0); } catch (ProjectGeneratorException exception) { Console.Error.WriteLine("Unhanded error was caught while running the Project Generator Module:"); Console.Error.WriteLine(exception.Message); return(1); } }
public void GlobalJsonRemover_RemovesJson_WhenExists() { UnitTestHelper.IsRunningUnitTests = true; var solution = IVsSolutionFactory.CreateWithSolutionDirectory(DirectoryInfoCallback); var projectItem = ProjectItemFactory.Create(); var dteSolution = SolutionFactory.ImplementFindProjectItem(path => { Assert.Equal(Path.Combine(Directory, "global.json"), path); return(projectItem); }); var dte = DteFactory.ImplementSolution(() => dteSolution); var serviceProvider = IServiceProviderFactory.ImplementGetService(t => { if (typeof(SVsSolution) == t) { return(solution); } if (typeof(DTE) == t) { return(dte); } Assert.False(true); throw new InvalidOperationException(); }); var remover = new GlobalJsonRemover(serviceProvider); Assert.Equal(VSConstants.S_OK, remover.OnAfterOpenSolution(null, 0)); Mock.Get(projectItem).Verify(p => p.Remove(), Times.Once); }
private static void Main(string[] args) { int day = int.Parse(args[0]); int part = int.Parse(args[1]); ISolution instance = SolutionFactory.GetSolution(day, part); // Load the data var locationUri = new UriBuilder(Assembly.GetExecutingAssembly().CodeBase); string location = Uri.UnescapeDataString(locationUri.Path); string locationDirectory = Path.GetDirectoryName(location); string inputFileName = Path.Combine(locationDirectory, "Input", $"day{day:D2}.txt"); string data = File.ReadAllText(inputFileName); var stopwatch = new Stopwatch(); stopwatch.Start(); string result = instance.Solve(data); stopwatch.Stop(); Console.WriteLine(result); Console.WriteLine($"Result obtained in {stopwatch.ElapsedMilliseconds}ms"); }
public void Tests(int day, int part, string input, string expectedResult) { ISolution solution = SolutionFactory.GetSolution(day, part); string result = solution.Solve(input); Assert.That(result, Is.EqualTo(expectedResult)); }
public void GlobalJsonRemover_NoJson_DoesntCrash() { UnitTestHelper.IsRunningUnitTests = true; var solution = IVsSolutionFactory.CreateWithSolutionDirectory(DirectoryInfoCallback); var dteSolution = SolutionFactory.ImplementFindProjectItem(path => { Assert.Equal(Path.Combine(Directory, "global.json"), path); return(null); }); var dte = DteFactory.ImplementSolution(() => dteSolution); var serviceProvider = IServiceProviderFactory.ImplementGetService(t => { if (typeof(SVsSolution) == t) { return(solution); } if (typeof(DTE) == t) { return(dte); } Assert.False(true); throw new InvalidOperationException(); }); var remover = new GlobalJsonRemover(serviceProvider, IFileSystemFactory.Create()); GlobalJsonRemover.Remover = remover; Assert.Equal(VSConstants.S_OK, remover.OnAfterOpenSolution(null, 0)); }
private IPlayingCard GetCard(SolutionFactory Factory) { CardValue Value = (CardValue)GetValueOrRankOfCard <CardValue>("card rank number"); CardSuit Suit = (CardSuit)GetValueOrRankOfCard <CardSuit>("card suit number"); return((IPlayingCard)Factory.FactoryMethod(Value, Suit)); }
public void Main(SolutionFactory Factory) { Console.WriteLine( @"Многочлены Введите через пробел коэффиценты cначала первого потом второго многочлена:"); var value1 = Console.ReadLine(); var value2 = Console.ReadLine(); var polinom1 = (IPolynomial)Factory.FactoryMethod(value1); var polinom2 = (IPolynomial)Factory.FactoryMethod(value2); DoOperations(polinom1, polinom2); TakeCoeff(polinom1); Console.Write("Получить коэффицент первого полинома на позиции "); var index = Console.ReadLine(); //if() Console.WriteLine(); if (int.Parse(index) >= polinom1.Count) { Console.WriteLine("Такой коэффицент отсутствует"); } else { Console.WriteLine(polinom1[int.Parse(index)]); } }
private ICounter GetCounterObj(SolutionFactory Factory) { Console.WriteLine("Enter the borders this counter:"); int border1 = GetBorder("Border 1 - "); var border2 = GetBorder("Border 2 - "); return((ICounter)Factory.FactoryMethod(border1, border2)); }
public void Main(SolutionFactory Factory) { var obj = (IChainList)Factory.FactoryMethod(); AddToList(obj); DeleteStringFromObjByValue(obj); DeleteListStartingFrom(obj); ClearAllList(obj); }
public void Main(SolutionFactory Factory) { var obj = GetObj(Factory); PrintPerimetetr(obj); PrintArea(obj); PrintTypeOfThriangle(obj); PrintViewOfThriangle(obj); Print(obj); }
private IRectangle GetRectangleObj(SolutionFactory Factory) { Console.WriteLine("Enter the rectangle data"); var x = GetValue("X - "); var y = GetValue("Y - "); var width = GetValue("Width - "); var heght = GetValue("Height - "); return((IRectangle)Factory.FactoryMethod(x, y, width, heght)); }
public void Main(SolutionFactory Factory) { var obj = CreateObj(Factory); FillArr(obj); obj.Print(); Console.WriteLine(); GetValue(obj); DoConcatenate(obj); DoMerge(obj); }
private static void Main(string[] args) { int day = int.Parse(args[0]); int part = int.Parse(args[1]); int executions = args.Length == 2 ? 1 : int.Parse(args[2]); // Load the data var locationUri = new UriBuilder(Assembly.GetExecutingAssembly().Location !); string location = Uri.UnescapeDataString(locationUri.Path); string locationDirectory = Path.GetDirectoryName(location) !; string inputFileName = Path.Combine(locationDirectory, "Input", $"day{day:D2}.txt"); string data = File.ReadAllText(inputFileName); string result = string.Empty; var times = new List <double>(executions); if (executions > 1) { // This is a timing run, so warm things up first. for (int warmup = 0; warmup < 5; warmup++) { ISolution instance = SolutionFactory.GetSolution(day, part); instance.Solve(data); } } for (int i = 0; i < executions; i++) { ISolution instance = SolutionFactory.GetSolution(day, part); var stopwatch = new Stopwatch(); stopwatch.Start(); result = instance.Solve(data); stopwatch.Stop(); times.Add(stopwatch.Elapsed.TotalMilliseconds); } Console.WriteLine(result); if (executions == 1) { Console.WriteLine($"Result obtained in {times[0]}ms"); } else { Console.WriteLine($"Processing executed {executions} times:"); Console.WriteLine($"\tAvg: {times.Average():0.00}ms"); Console.WriteLine($"\tMin: {times.Min():0.00}ms"); Console.WriteLine($"\tMax: {times.Max():0.00}ms"); } }
/// <summary> /// Initializes a new instance of the <see cref="SolutionTask" /> class. /// </summary> public SolutionTask() { _projects = new FileSet(); _referenceProjects = new FileSet(); _excludeProjects = new FileSet(); _assemblyFolders = new FileSet(); _webMaps = new WebMapCollection(); _projectFactory = ProjectFactory.Create(this); _solutionFactory = SolutionFactory.Create(); _configuration = new Configuration(); }
public void Main(SolutionFactory Factory) { var obj = (IMessageLog)Factory.FactoryMethod(); Console.WriteLine("Simple demonstration"); string message = EnterMessage(obj); string name = EnterName(obj); string comment = EnterComment(obj); AddSaveOpenFile(obj, message, name, comment); }
public void Solution_ReturnsServiceProviderGetService() { var solution = SolutionFactory.Create(); var dte = DteFactory.ImplementSolution(() => solution); var serviceProvider = IServiceProviderFactory.Create(typeof(SDTE), dte); var dteServices = CreateInstance(serviceProvider); var result = dteServices.Solution; Assert.Same(solution, result); }
public void Main(SolutionFactory Factory) { IPlayingCard obj = GetCard(Factory); GetCardColor(obj); Console.WriteLine(); ShowVisibility(obj); Console.WriteLine(); TurnOverCard(obj); Console.WriteLine(); ShowCardInfo(obj); }
public void Main(SolutionFactory Factory) { ICounter obj = GetCounterObj(Factory); Console.WriteLine(obj.ToString()); ToChangeCounter(obj); Console.WriteLine("Two time increase of counter"); obj.Inc(); obj.Inc(); Console.WriteLine("One time decrease of counter"); obj.Dec(); Console.WriteLine($"Current value of counter - {obj.Current}"); }
private IOneDStringArray CreateObj(SolutionFactory Factory) { Console.Write("Enter the length of the array to be created - "); var length = 0; if (int.TryParse(Console.ReadLine(), out length) && length >= 0) { Console.WriteLine(); return((IOneDStringArray)Factory.FactoryMethod(length)); } Console.WriteLine("Incorrect data entered. Try again"); return(CreateObj(Factory)); }
public void Main(SolutionFactory Factory) { var obj = GetRectangleObj(Factory); Console.WriteLine(); obj.Print(); var testObj = (IRectangle)Factory.FactoryMethod(0, 0, 5, 5); Console.WriteLine(); TestIntersect(obj, testObj); Console.WriteLine(); FindRectangleContains(obj, testObj); }
private IOneDArray CreateObj(SolutionFactory Factory) { var startIndex = 0; var length = 1; Console.WriteLine("Create an array"); Console.Write("Starting index - "); int.TryParse(Console.ReadLine(), out startIndex); Console.Write("Array length starting at given index - "); int.TryParse(Console.ReadLine(), out length); return((IOneDArray)Factory.FactoryMethod(startIndex, length)); }
public FluentLangCompiler( ILogger <FluentLangCompiler> logger, SolutionFactory solutionFactory, IScopeFactory <SolutionInfo, IProjectLoader> projectLoader, IFileSystem fileSystem, IDiagnosticFormatter diagnosticFormatter) { _logger = logger ?? throw new ArgumentNullException(nameof(logger)); _solutionFactory = solutionFactory ?? throw new ArgumentNullException(nameof(solutionFactory)); _projectLoader = projectLoader ?? throw new ArgumentNullException(nameof(projectLoader)); _fileSystem = fileSystem; _diagnosticFormatter = diagnosticFormatter; }
public void Main(SolutionFactory Factory) { var obj = CreateMatrix(Factory); FillMatrixRandomValue(obj); Console.WriteLine($"Addition with itself\n{obj.Add(obj).ToString()}"); Console.WriteLine(); Console.WriteLine($"Multiplication with itself\n{obj.Multiply(obj).ToString()}"); Console.WriteLine(); Console.WriteLine($"Substraction with itself\n{obj.Sub(obj).ToString()}"); Console.WriteLine(); Console.WriteLine($"Taking the reverse\n{obj.InverseToAdd().ToString()}"); }
public void Main(SolutionFactory Factory) { var obj1 = EnterVector(Factory); Console.WriteLine(); var obj2 = EnterVector(Factory); SomeOperations(obj1, obj2); ReverseVectors(obj1, obj2); CompareVectors(obj1, obj2); VectorLengths(obj1, obj2); ViewValueByIndex(obj1); }
public void AddParetoSolution(S pareto_solution) { ContinuousVector original_solution = (ContinuousVector)pareto_solution; ContinuousVector nash_solution = (ContinuousVector)SolutionFactory.Clone(); nash_solution.Population = mPopulation; nash_solution.Problem = this; nash_solution.Initialize(mDesignVariableGlobal2LocalMapping.Count); foreach (int global_design_variable_index in mDesignVariableGlobal2LocalMapping.Keys) { nash_solution[mDesignVariableGlobal2LocalMapping[global_design_variable_index]] = original_solution[global_design_variable_index]; } }
private ISquareMatrix CreateMatrix(SolutionFactory Factory) { Console.Write("Enter the rank of the matrix\r\n and a random matrix with this rank will be generated - "); try { return((ISquareMatrix)Factory.FactoryMethod(int.Parse(Console.ReadLine()))); } catch { Console.WriteLine("Please enter valid data!"); Console.WriteLine(); return(CreateMatrix(Factory)); } }
private IMailingAddress GetObj(SolutionFactory Factory) { var post = (IMailingAddress)Factory.FactoryMethod(); Console.Write("Enter company name "); post.Name = Console.ReadLine(); Console.Write("Enter city "); post.City = Console.ReadLine(); Console.Write("Enter street "); post.Street = Console.ReadLine(); Console.Write("Enter home address "); post.HomeAddress = Console.ReadLine(); Console.Write("Enter postal code "); post.PostalCode = Console.ReadLine(); return(post); }
public void Main(SolutionFactory Factory) { IOneDArray obj = CreateObj(Factory); Console.WriteLine(); FillArrayRandomValue(obj); Console.WriteLine(obj.ToString()); Console.WriteLine(); GetElem(obj); Console.WriteLine(); MakeAddition(obj); DivisionAndMultiplication(obj); Console.WriteLine(); Console.WriteLine($"Max - {obj.Max()}"); Console.WriteLine($"Min - {obj.Min()}"); Console.WriteLine(); obj.Print(); }
public void GlobalJsonRemover_AfterRemoval_UnadvisesEvents() { UnitTestHelper.IsRunningUnitTests = true; var globalJsonPath = Path.Combine(Directory, "global.json"); var solution = IVsSolutionFactory.CreateWithSolutionDirectory(DirectoryInfoCallback); var projectItem = ProjectItemFactory.Create(); var dteSolution = SolutionFactory.ImplementFindProjectItem(path => { Assert.Equal(globalJsonPath, path); return(projectItem); }); var dte = DteFactory.ImplementSolution(() => dteSolution); var serviceProvider = IServiceProviderFactory.ImplementGetService(t => { if (typeof(SVsSolution) == t) { return(solution); } if (typeof(DTE) == t) { return(dte); } Assert.False(true); throw new InvalidOperationException(); }); var fileSystem = IFileSystemFactory.Create(); fileSystem.Create(globalJsonPath); var remover = new GlobalJsonRemover(serviceProvider, fileSystem) { SolutionCookie = 1234 }; GlobalJsonRemover.Remover = remover; Assert.Equal(VSConstants.S_OK, remover.OnAfterOpenSolution(null, 0)); Mock.Get(solution).Verify(s => s.UnadviseSolutionEvents(1234), Times.Once); }
/// <summary> /// Initializes a new instance of the <see cref="SolutionTask" /> class. /// </summary> public SolutionTask() { _customproperties = new ArrayList(); _projects = new FileSet(); _referenceProjects = new FileSet(); _excludeProjects = new FileSet(); _assemblyFolders = new FileSet(); _webMaps = new WebMapCollection(); _projectFactory = ProjectFactory.Create(this); _solutionFactory = SolutionFactory.Create(); _configuration = new Configuration (); }