public async Task EnumerateSolutionsInRepository(RepositoryInfo repository) { Dictionary <string, Stream?> SolutionStreamTable = await GitHubApi.GitHub.EnumerateFiles(repository.Source, "/", ".sln"); NotifyStatusUpdated(); bool IsMainProjectExe = false; foreach (KeyValuePair <string, Stream?> Entry in SolutionStreamTable) { if (Entry.Value != null) { string SolutionName = Path.GetFileNameWithoutExtension(Entry.Key); Stream SolutionStream = Entry.Value; using StreamReader Reader = new(SolutionStream, Encoding.UTF8); SlnExplorer.Solution Solution = new(SolutionName, Reader); List <ProjectInfo> LoadedProjectList = new(); foreach (SlnExplorer.Project ProjectItem in Solution.ProjectList) { bool IsIgnored = ProjectItem.ProjectType > SlnExplorer.ProjectType.KnownToBeMSBuildFormat; if (!IsIgnored) { byte[]? Content = await GitHubApi.GitHub.DownloadFile(repository.Source, ProjectItem.RelativePath); NotifyStatusUpdated(); if (Content != null) { using MemoryStream Stream = new MemoryStream(Content); ProjectItem.LoadDetails(Stream); } ProjectInfo NewProject = new(ProjectList, ProjectItem); ProjectList.Add(NewProject); LoadedProjectList.Add(NewProject); } } if (LoadedProjectList.Count > 0) { SolutionInfo NewSolution = new(SolutionList, repository, Solution, LoadedProjectList); SolutionList.Add(NewSolution); foreach (ProjectInfo Item in NewSolution.ProjectList) { Item.ParentSolution = NewSolution; } repository.SolutionList.Add(NewSolution); IsMainProjectExe |= CheckMainProjectExe(NewSolution); } } } repository.IsMainProjectExe = IsMainProjectExe; }
public Interpreter(Program tacnyProgram) { Contract.Requires(tacnyProgram != null); this.tacnyProgram = tacnyProgram; solution_list = new SolutionList(); //Console.SetOut(System.IO.TextWriter.Null); }
public Interpreter(Program tacnyProgram) { Contract.Requires(tacnyProgram != null); this.tacnyProgram = tacnyProgram; solution_list = new SolutionList(); //Console.SetOut(System.IO.TextWriter.Null); }
public SolutionListComponent(Guid solutionId, string key, string category) { if (!string.IsNullOrEmpty(key)) { mifnexsoEntities = new MIFNEXSOEntities(); try { solutionList = mifnexsoEntities.SolutionLists.FirstOrDefault(a => a.SolutionId == solutionId && a.Key == key && a.Category == category); if (solutionList == null) { solutionList = new SolutionList(); solutionList.ListId = Guid.NewGuid(); solutionList.Key = key; solutionList.SolutionId = solutionId; solutionList.Category = category; mifnexsoEntities.SolutionLists.AddObject(solutionList); } } catch (Exception) { throw; } } }
public async Task StorageService_SetSolutionList() { var fileUtils = new FileUtilities(); var solutionAnalyzer = new SolutionAnalyzer(new ProjectAnalyzer(fileUtils), fileUtils); var solution = await solutionAnalyzer.AnalyzeSolution(@"C:\VS2015\pp-git\LocationService\LocationService.sln", projectNamesToIgnore : new List <string> { "Test" }); var solutionList = new SolutionList { solution }; var storage = new StorageService(); storage.Initialize("1000.01", "UseDevelopmentStorage=true", "solutioncontainer"); for (var i = 0; i < 20; i++) { await storage.SetSolutionList(new SolutionConfiguration { StorageIdentifier = "LocationService", AreaTags = SolutionAreaTag.Location | SolutionAreaTag.TimeCapture | SolutionAreaTag.DigitalAssistant }, solutionList); } }
/// <summary> /// Create the Dlx grid: /// Create the column headers for the grid and chains them /// together with the linked list. /// </summary> private void CreateDlxGrid() { // reset _columnHeaders.Clear(); _solutionNodes.Clear(); SolutionList.Clear(); var primaryColCount = _puzzleSize.ToInt32() * _puzzleSize.ToInt32() * 4; // build DLX network _columnHeaders[0] = new DlxHeader(0); for (var column = 1; column <= primaryColCount; column++) { _columnHeaders[column] = new DlxHeader(column) { Right = null, Left = _columnHeaders[column - 1] }; // Connect the current column to the previous column. _columnHeaders[column - 1].Right = _columnHeaders[column]; } // Connect last primary column to the root node. _columnHeaders[primaryColCount].Right = _columnHeaders[0]; _columnHeaders[0].Left = _columnHeaders[primaryColCount]; }
/// <summary> /// Create a puzzle solution out of the Dlx result. /// </summary> /// <param name="rows">The remaining Dlx nodes containing the solution values.</param> private void SolutionFound(IEnumerable <DlxNode> rows) { var size = _puzzleSize.ToInt32(); var newSolution = new Dictionary <PuzzleCoordinate, int>(); foreach (var rowNode in rows) { if (rowNode != null) { var value = rowNode.Coordinate.Row - 1; var digit = value % size + 1; value /= size; var col = value % size; value /= size; var row = value % size; var coord = new PuzzleCoordinate(row, col); newSolution[coord] = digit; } } var solvedPuzzle = new Puzzle(_puzzleSize); foreach (var coord in newSolution.Keys.OrderBy(k => k)) { solvedPuzzle[coord] = Convert.ToByte(newSolution[coord]); } SolutionList.Add(solvedPuzzle); }
private async Task StoreResults(SolutionConfiguration solutionConfiguration, SolutionList solutionList) { try { await _storageService.SetSolutionList(solutionConfiguration, solutionList); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void ExecuteSolve(object p) { string word = Model.Solve(); if (word != null) { char[] conundrum = new char[Model.cLetterCount]; for (int index = 0; index < Model.cLetterCount; ++index) { conundrum[index] = Model.Conundrum[index][0]; } Solution = word; SolutionList.Add(new ConundrumItem(new string(conundrum), word)); } }
private async Task <SolutionList> AnalyzeSolutions(SolutionConfiguration solutionConfiguration) { var tasks = new List <Task <Solution> >(); foreach (var solutionInformation in solutionConfiguration.Solutions) { var solutionFile = Path.Combine(solutionConfiguration.RootFolder, solutionInformation.SolutionFile); tasks.Add(_solutionAnalyzer.AnalyzeSolution(solutionFile, solutionInformation.ProjectReferencesToIgnore, solutionInformation.ProjectsToIgnore)); } var results = await Task.WhenAll(tasks); var retVal = new SolutionList(); retVal.AddRange(results); return(retVal); }
/// <summary> /// This will return the list side menu from Solution to Configuration /// </summary> /// <returns></returns> public MDTTransactionInfo GetSideMenu(int UserID) { MDTTransactionInfo mdt = new MDTTransactionInfo(); IEnumerable <SolutionList> solutionLists = null; SolutionList solutionList = null; List <SqlParameter> prm = new List <SqlParameter>(); SqlParameter Status = new SqlParameter("@Status", 0); Status.Direction = ParameterDirection.Output; prm.Add(Status); int StatusValue = 0; DataTable dt = DatabaseSettings.GetDataSet("sp_GetSolutions", out StatusValue, prm).Tables[0]; if (StatusValue == 1) { if (dt.Rows.Count > 0) { solutionLists = from d in dt.AsEnumerable() select new SolutionList { SOLUTION_ID = d.Field <int>("SOLUTION_ID"), SOLUTION_NAME = d.Field <string>("SOLUTION_NAME"), Packages = GetPackageList(d.Field <int>("SOLUTION_ID"), UserID) }; //solutionLists = new List<SolutionList>(); //foreach (DataRow row in dt.Rows) //{ // solutionList = new SolutionList(); // solutionList.SOLUTION_ID = Convert.ToInt32(row["SOLUTION_ID"]); // solutionList.SOLUTION_NAME = row["SOLUTION_NAME"].ToString(); // if (Convert.ToInt32(row["SOLUTION_ID"]) > 0) // { // solutionList.Packages = GetPackageList(Convert.ToInt32(row["SOLUTION_ID"]), UserID); // } // solutionLists.Add(solutionList); //} } } mdt = DatabaseSettings.GetTransObject(solutionLists, StatusValue, "Record Found", dt); return(mdt); }
public async Task EnumerateSolutions() { foreach (RepositoryInfo Repository in RepositoryList) { if (Repository.IsChecked) { continue; } List <SolutionInfo> SolutionToRemoveList = new(); foreach (SolutionInfo Item in SolutionList) { if (Item.ParentRepository == Repository) { SolutionToRemoveList.Add(Item); } } List <ProjectInfo> ProjectToRemoveList = new(); foreach (ProjectInfo Item in ProjectList) { if (Item.ParentSolution.ParentRepository == Repository) { ProjectToRemoveList.Add(Item); } } foreach (SolutionInfo Item in SolutionToRemoveList) { SolutionList.Remove(Item); } foreach (ProjectInfo Item in ProjectToRemoveList) { ProjectList.Remove(Item); } await EnumerateSolutionsInRepository(Repository); } }
private void AddFunc() { SolutionList pl = new SolutionList(); pl.title = txt_title.Text; pl.img = txt_img.Text; pl.mainstyle = txt_mainstyle.Text; pl.memo = txt_memo.Text; pl.pagetype = ddl_pagetype.SelectedValue; pl.titlestyle = txt_titlestyle.Text; pl.city = ddl_city.SelectedValue; string jpath = @"\json\SolutionList.json"; List <SolutionList> pll = GetJsonToObject <List <SolutionList> >(jpath); pl.id = pll.Count + 1; pll.Add(pl); //保存修改 string s1 = JsonSerializer <List <SolutionList> >(pll); Write(CurrentPath + "\\" + jpath, s1); Product product = new Product(); product.id = pll.Count; string jpath2 = @"\json\Solutions\Solution" + product.id + ".json"; product.date = DateTime.Now.ToLongDateString(); product.content = txt_content.Text; string s2 = JsonSerializer <List <Product> >(new List <Product>() { product }); Write(CurrentPath + "\\" + jpath2, s2); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>successCallback('添加成功!');</script>"); //Alert("添加成功!"); }
private async void SolutionListTreeViewService_ActionPresentBlobs(object sender, ActionPresentBlobsEventArgs e) { var tasks = new List <Task <SolutionList> >(); foreach (var blobName in e.BlobNames) { tasks.Add(_applicationStorageService.GetSolutionList(blobName)); } var solutionLists = await Task.WhenAll(tasks); var combinedSolutionList = new SolutionList(); //Todo: log instances that are not of type Solution combinedSolutionList.AddRange(solutionLists.SelectMany(s => s).OfType <Solution>()); _html = await _htmlRenderer.RenderToString(_renderingOptionsTreeViewService.GetRenderProperties(), combinedSolutionList, "Third party dependencies", "Third party dependencies"); _synchronizationContext.Send(new SendOrPostCallback(o => { var htmlToRender = (string)o; _webBrowser.DocumentText = htmlToRender; }), _html); }
public async Task <string> Render(SolutionConfiguration solutionConfiguration, SolutionList solutionList) { var renderProperties = solutionConfiguration.RenderProperties; var outputPath = solutionConfiguration.OutputPath; var indexFileName = solutionConfiguration.IndexFileName; var titleText = !string.IsNullOrWhiteSpace(solutionConfiguration.PageTitle) ? solutionConfiguration.PageTitle : "Third party dependencies"; var headerText = !string.IsNullOrWhiteSpace(solutionConfiguration.HeaderText) ? solutionConfiguration.HeaderText : "Third party dependencies"; return(await Render(renderProperties, solutionList, titleText, headerText, outputPath, indexFileName)); }
private void AddFunc() { SolutionList pl = new SolutionList(); pl.title = txt_title.Text; pl.img = txt_img.Text; pl.mainstyle = txt_mainstyle.Text; pl.memo = txt_memo.Text; pl.pagetype = ddl_pagetype.SelectedValue; pl.titlestyle = txt_titlestyle.Text; pl.city = ddl_city.SelectedValue; string jpath = @"\json\SolutionList.json"; List<SolutionList> pll = GetJsonToObject<List<SolutionList>>(jpath); pl.id = pll.Count + 1; pll.Add(pl); //保存修改 string s1 = JsonSerializer<List<SolutionList>>(pll); Write(CurrentPath + "\\" + jpath, s1); Product product = new Product(); product.id = pll.Count; string jpath2 = @"\json\Solutions\Solution" + product.id + ".json"; product.date = DateTime.Now.ToLongDateString(); product.content = txt_content.Text; string s2 = JsonSerializer<List<Product>>(new List<Product>() { product }); Write(CurrentPath + "\\" + jpath2, s2); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>successCallback('添加成功!');</script>"); //Alert("添加成功!"); }
private async Task Render(SolutionConfiguration solutionConfiguration, SolutionList solutionList) { await _htmlRenderer.Render(solutionConfiguration, solutionList); }
public void Stop() { RepositoryList.Clear(); SolutionList.Clear(); ProjectList.Clear(); }
private bool CanSelectAll(object p) { return((SolutionList != null) && SolutionList.Any(e => !e.IsSelected)); }
public async Task <bool> SetSolutionList(SolutionConfiguration solutionConfiguration, SolutionList solutionList) { var identifier = CreateIdentifier(solutionConfiguration); if (!string.IsNullOrWhiteSpace(identifier)) { var blockBlob = await GetBlockBlob(identifier); if (blockBlob != null && !(await blockBlob.ExistsAsync())) { var serializedSolutionList = JsonConvert.SerializeObject(solutionList, Formatting.None); using (var ms = new MemoryStream()) { using (var writer = new StreamWriter(ms)) { writer.Write(serializedSolutionList); writer.Flush(); ms.Seek(0, SeekOrigin.Begin); await blockBlob.UploadFromStreamAsync(ms); Console.WriteLine($"Stored solution results with identifier {identifier}."); return(true); } } } { var reason = blockBlob != null ? "Block blob already exits." : "Could not get a block blob reference."; Console.WriteLine($"Could not store solution information in backing storage. Reason: {reason}"); } } else { Console.WriteLine("Could not create a valid storage identifier. Results will not be stored in the backing storage."); } return(false); }
private string ScanMemberBody(MemberDecl md) { Contract.Requires(md != null); solution_list.plist.Clear(); Method m = md as Method; if (m == null) return null; if (m.Body == null) return null; List<IVariable> variables = new List<IVariable>(); variables.AddRange(m.Ins); variables.AddRange(m.Outs); SolutionList sol_list = new SolutionList(); sol_list.AddRange(solution_list.plist); if (TacnyOptions.O.ParallelExecution) { Parallel.ForEach(m.Body.Body, st => { // register local variables VarDeclStmt vds = st as VarDeclStmt; if (vds != null) variables.AddRange(vds.Locals); UpdateStmt us = st as UpdateStmt; if (us != null) { if (tacnyProgram.IsTacticCall(us)) { try { tacnyProgram.SetCurrent(tacnyProgram.GetTactic(us), md); // get the resolved variables List<IVariable> resolved = tacnyProgram.GetResolvedVariables(md); resolved.AddRange(m.Ins); // add input arguments as resolved variables Atomic.ResolveTactic(tacnyProgram.GetTactic(us), us, md, tacnyProgram, variables, resolved, ref sol_list); tacnyProgram.CurrentDebug.Fin(); } catch (AggregateException e) { foreach (var err in e.Data) { Printer.Error(err.ToString()); } } } } }); } else { foreach (var st in m.Body.Body) { // register local variables VarDeclStmt vds = st as VarDeclStmt; if (vds != null) variables.AddRange(vds.Locals); UpdateStmt us = st as UpdateStmt; if (us != null) { if (tacnyProgram.IsTacticCall(us)) { try { tacnyProgram.SetCurrent(tacnyProgram.GetTactic(us), md); // get the resolved variables List<IVariable> resolved = tacnyProgram.GetResolvedVariables(md); resolved.AddRange(m.Ins); // add input arguments as resolved variables Atomic.ResolveTactic(tacnyProgram.GetTactic(us), us, md, tacnyProgram, variables, resolved, ref sol_list); tacnyProgram.CurrentDebug.Fin(); } catch (Exception e) { return e.Message; } } } } } solution_list.AddRange(sol_list.plist); return null; }
private string ScanMemberBody(MemberDecl md) { Contract.Requires(md != null); solution_list.plist.Clear(); Method m = md as Method; if (m == null) { return(null); } if (m.Body == null) { return(null); } List <IVariable> variables = new List <IVariable>(); variables.AddRange(m.Ins); variables.AddRange(m.Outs); SolutionList sol_list = new SolutionList(); sol_list.AddRange(solution_list.plist); if (TacnyOptions.O.ParallelExecution) { Parallel.ForEach(m.Body.Body, st => { // register local variables VarDeclStmt vds = st as VarDeclStmt; if (vds != null) { variables.AddRange(vds.Locals); } UpdateStmt us = st as UpdateStmt; if (us != null) { if (tacnyProgram.IsTacticCall(us)) { try { tacnyProgram.SetCurrent(tacnyProgram.GetTactic(us), md); // get the resolved variables List <IVariable> resolved = tacnyProgram.GetResolvedVariables(md); resolved.AddRange(m.Ins); // add input arguments as resolved variables Atomic.ResolveTactic(tacnyProgram.GetTactic(us), us, md, tacnyProgram, variables, resolved, ref sol_list); tacnyProgram.CurrentDebug.Fin(); } catch (AggregateException e) { foreach (var err in e.Data) { Printer.Error(err.ToString()); } } } } }); } else { foreach (var st in m.Body.Body) { // register local variables VarDeclStmt vds = st as VarDeclStmt; if (vds != null) { variables.AddRange(vds.Locals); } UpdateStmt us = st as UpdateStmt; if (us != null) { if (tacnyProgram.IsTacticCall(us)) { try { tacnyProgram.SetCurrent(tacnyProgram.GetTactic(us), md); // get the resolved variables List <IVariable> resolved = tacnyProgram.GetResolvedVariables(md); resolved.AddRange(m.Ins); // add input arguments as resolved variables Atomic.ResolveTactic(tacnyProgram.GetTactic(us), us, md, tacnyProgram, variables, resolved, ref sol_list); tacnyProgram.CurrentDebug.Fin(); } catch (Exception e) { return(e.Message); } } } } } solution_list.AddRange(sol_list.plist); return(null); }
public async Task <string> RenderToString(RenderProperties renderProperties, SolutionList solutionList, string titleText, string headerText) { return(await Render(renderProperties, solutionList, titleText, headerText)); }
private async Task <string> Render(RenderProperties renderProperties, SolutionList solutionList, string titleText, string headerText, string outputPath = null, string indexFileName = null) { var createFile = !string.IsNullOrWhiteSpace(outputPath) && !string.IsNullOrWhiteSpace(indexFileName); var packageReferences = solutionList.GetPackageReferences(!renderProperties.IncludeDuplicates, !renderProperties.IncludePackageDependencies, "<br>"); if (packageReferences.Any()) { if (createFile && !Directory.Exists(outputPath)) { Directory.CreateDirectory(outputPath); } var tabPos = 0; string txt = string.Empty; RenderLine(ref txt, tabPos, "<html>"); RenderLine(ref txt, ++tabPos, "<head>"); RenderLine(ref txt, ++tabPos, $"<title>{titleText}</title>"); if (renderProperties.PageAutomaticRefresh) { RenderLine(ref txt, tabPos, "<meta http-equiv=\"refresh\" content=\"5\">"); } RenderLine(ref txt, --tabPos, "</head>"); RenderLine(ref txt, tabPos, "<body style=\"font-family: Verdana, Helvetica, sans-serif;font-size:8pt;\">"); RenderLine(ref txt, ++tabPos, $"<h1>{headerText}</h1>"); if (renderProperties.IncludeSolutionInformation) { solutionList.ForEach(s => { RenderLine(ref txt, tabPos, $"<b>{s.Name}</b><br>"); RenderLine(ref txt, tabPos, $"<ul>"); s.Projects.ForEach(p => { RenderLine(ref txt, ++tabPos, $"<li>{p.Name}<br></li>"); }); RenderLine(ref txt, --tabPos, $"</ul>"); RenderLine(ref txt, tabPos, $"<br>"); }); RenderLine(ref txt, tabPos, $"<br>"); } if (createFile) { RenderLine(ref txt, tabPos, "<button onclick=\"createMarkdown();\">Markdown to clipboard</button>"); } RenderLine(ref txt, tabPos, $"<table id=\"mainTable\" cellspacing=\"1\" cellpadding=\"3\" style=\"font-size:8pt;\">"); txt += RenderTableHeaderRow(tabPos, renderProperties); txt += await RenderTableRows(tabPos, renderProperties, packageReferences, outputPath, createFile); RenderLine(ref txt, tabPos--, "</table>"); if (createFile) { txt += AddMarkdownScript(tabPos); txt += "<textarea type=\"text\" id=\"hiddenInput\" style=\"position:absolute;left:-100px;top:-100px;width:10px;height:10px;\"></textarea>"; } RenderLine(ref txt, tabPos--, "</body>"); RenderLine(ref txt, tabPos, "</html>"); if (createFile) { var file = Path.Combine(outputPath, indexFileName); await _fileUtilities.CreateFile(file, txt); } return(txt); } return(null); }