/// <summary> /// Get a list of Log Lines that correspond to the given Queue Index and ProjectInfo. /// </summary> /// <param name="queueIndex">The Queue Index</param> /// <param name="projectInfo">Project (R/C/G) to Match</param> public IList<LogLine> GetLogLinesForQueueIndex(int queueIndex, IProjectInfo projectInfo) { // walk backwards through the ClientRunList and then backward // through the UnitIndexes list. Find the first (really last // because we're itterating in reverse) UnitIndex that matches // the given queueIndex. for (int i = ClientRunList.Count - 1; i >= 0; i--) { for (int j = ClientRunList[i].UnitIndexes.Count - 1; j >= 0; j--) { // if a match is found if (ClientRunList[i].UnitIndexes[j].QueueIndex == queueIndex) { int start = ClientRunList[i].UnitIndexes[j].StartIndex; int end = ClientRunList[i].UnitIndexes[j].EndIndex; var logLines = LogLineList.WhereLineIndex(start, end); var logLinesIndexOnly = logLines.Filter(LogFilterType.UnitIndex, queueIndex); var info = logLinesIndexOnly.FirstProjectInfoOrDefault(); if (info != null && info.EqualsProject(projectInfo)) { return logLinesIndexOnly.ToList().AsReadOnly(); } continue; } } } return null; }
private string FindSolutionFolder(IProjectInfo projectInfo) { string value = Environment.GetEnvironmentVariable("SolutionDir"); if (value != null || _variables.TryGetValue("SolutionDir", out value)) { try { return Path.GetFullPath(Path.Combine(Path.GetDirectoryName(projectInfo.FullFileName), value)) .TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) + Path.DirectorySeparatorChar; } catch { } } try { var dir = new DirectoryInfo(Path.GetDirectoryName(projectInfo.FullFileName)); while (dir != null && dir.GetDirectories("packages").Length == 0 && dir.GetFiles("*.sln").Length == 0) dir = dir.Parent; if (dir != null) return Path.GetFullPath(dir.FullName).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) + Path.DirectorySeparatorChar; } catch { } return "*Undefined*"; }
/// <summary> /// Equals Project (R/C/G) /// </summary> /// <returns>true if Project (R/C/G) are equal.</returns> public static bool EqualsProject(this IProjectInfo projectInfo1, IProjectInfo projectInfo2) { if (projectInfo1 == null || projectInfo2 == null) return false; return (projectInfo1.ProjectID == projectInfo2.ProjectID && projectInfo1.ProjectRun == projectInfo2.ProjectRun && projectInfo1.ProjectClone == projectInfo2.ProjectClone && projectInfo1.ProjectGen == projectInfo2.ProjectGen); }
public GeneratorArguments(bool domainsAllowed, string inputFile, IProjectItem item, IProjectInfo projectInfo) { _domainsAllowed = domainsAllowed; _help = new StringWriter(); _files = new List<OutputFile>(); Check.NotNull(item); _variables = new Dictionary<string, string>(Check.NotNull(projectInfo).GetProjectVariables(), StringComparer.OrdinalIgnoreCase); inputFile = Path.GetFullPath(inputFile); _variables["CmdToolDir"] = Path.GetDirectoryName(GetType().Assembly.Location).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) + Path.DirectorySeparatorChar; _variables["DefaultNamespace"] = item.DefaultNamespace; _variables["Namespace"] = item.Namespace; _variables["ClassName"] = StronglyTypedResourceBuilder.VerifyResourceName(Path.GetFileNameWithoutExtension(inputFile), new CSharpCodeProvider()); _variables["PseudoPath"] = item.FullPseudoPath; _variables["InputPath"] = inputFile; _variables["InputName"] = Path.GetFileName(inputFile); _variables["InputDir"] = Path.GetDirectoryName(inputFile).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) + Path.DirectorySeparatorChar; }
protected virtual bool IsInactive(IProjectInfo project) { return(false); }
private static bool ProjectsMatch(UnitInfo unit, IProjectInfo projectInfo) { Debug.Assert(unit != null); if (unit.ProjectIsUnknown() || projectInfo == null) return false; return (unit.ProjectID == projectInfo.ProjectID && unit.ProjectRun == projectInfo.ProjectRun && unit.ProjectClone == projectInfo.ProjectClone && unit.ProjectGen == projectInfo.ProjectGen); }
public void AddProject(IProjectInfo project) { projects.Add(project); }
public void IProjectInfo_ToShortProjectString_Test3() { IProjectInfo projectInfo = null; Assert.AreEqual(String.Empty, projectInfo.ToShortProjectString()); }
public void IProjectInfo_ProjectIsUnknown_Test3() { IProjectInfo projectInfo = null; Assert.IsTrue(projectInfo.ProjectIsUnknown()); }
public void IProjectInfo_HasProject_Test3() { IProjectInfo projectInfo = null; Assert.IsFalse(projectInfo.HasProject()); }
protected virtual IEnumerable <object> GetAdditionalRowData(IProjectInfo projectInfo) { return(new object[0]); }
/// <summary> /// Returns information about the test project. /// </summary> /// <returns></returns> private TestProjectInfo GetTestProjectInfo(TestProjectDuplication duplication, IProjectInfo testProjectInfo) { var testFramework = GetTestFramework(testProjectInfo); // Read the test project into memory. var projectInfo = new TestProjectInfo { TestFramework = testFramework, TestModule = ModuleDefinition.ReadModule(duplication.TestProjectFile.FullFilePath()) }; // Foreach project reference load it in memory as an 'assembly mutator'. foreach (var projectReferencePath in duplication.TestProjectReferences) { var loadProjectReferenceModel = new AssemblyMutator(projectReferencePath.FullFilePath()); if (loadProjectReferenceModel.Types.Count > 0) { projectInfo.DependencyAssemblies.Add(loadProjectReferenceModel); } } return(projectInfo); }
private static UnitRun GetUnitRun(SlotRun slotRun, int queueIndex, IProjectInfo projectInfo) { if (slotRun != null) { var unitRun = slotRun.UnitRuns.FirstOrDefault(x => x.QueueIndex == queueIndex && projectInfo.EqualsProject(x.Data)); if (unitRun != null) { return unitRun; } } return null; }
private static UnitRun GetUnitRun(SlotRun slotRun, int queueIndex, IProjectInfo projectInfo) { return(slotRun?.UnitRuns.LastOrDefault(x => x.QueueIndex == queueIndex && projectInfo.EqualsProject(x.Data.ToProjectInfo()))); }
public GeneratorArguments(bool domainsAllowed, string inputFile, IProjectItem item, IProjectInfo projectInfo) { _domainsAllowed = domainsAllowed; _help = new StringWriter(); _files = new List <OutputFile>(); Check.NotNull(item); _variables = new Dictionary <string, string>(Check.NotNull(projectInfo).GetProjectVariables(), StringComparer.OrdinalIgnoreCase); inputFile = Path.GetFullPath(inputFile); _variables["CmdToolDir"] = Path.GetDirectoryName(GetType().Assembly.Location).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) + Path.DirectorySeparatorChar; _variables["DefaultNamespace"] = item.DefaultNamespace; _variables["Namespace"] = item.Namespace; _variables["ClassName"] = StronglyTypedResourceBuilder.VerifyResourceName(Path.GetFileNameWithoutExtension(inputFile), new CSharpCodeProvider()); _variables["PseudoPath"] = item.FullPseudoPath; _variables["InputPath"] = inputFile; _variables["InputName"] = Path.GetFileName(inputFile); _variables["InputDir"] = Path.GetDirectoryName(inputFile).TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar) + Path.DirectorySeparatorChar; }
public GeneratorArguments(bool domainsAllowed, string inputFile, string nameSpace, IProjectInfo projectInfo) : this(domainsAllowed, inputFile, Check.NotNull(projectInfo).FindProjectItem(inputFile, nameSpace), projectInfo) { }
protected override bool IsInactive(IProjectInfo project) { return(((GlyssenDblTextMetadata)project).Inactive); }
static void VisitProjectItem(IProjectInfo project, IProjectItem item) { if (item.BuildAction != "Compile") return; string fileName = item.FullFileName; if (!File.Exists(fileName)) return; fileName = Path.GetFullPath(fileName); string ext = Path.GetExtension(fileName); if (!StringComparer.OrdinalIgnoreCase.Equals(".cs", ext)) return; Encoding encoding; string content = ReadFileText(fileName, out encoding); string original = content; int ixGenerated = content.IndexOf("Generated", StringComparison.OrdinalIgnoreCase); if (ixGenerated >= 0) return; InsertFileHeader(fileName, ref content, _copyText); if (content != original) { lock (typeof(Program)) { if(Confirm("Update {0}", fileName)) { _changes++; using (StreamWriter wtr = new StreamWriter(fileName, false, encoding)) { wtr.Write(content); wtr.Flush(); } } } } }
public ProjectEntity(int userId, IProjectInfo info) { Name = info.Name; Description = info.Description; CreatorId = userId; }
public Task AddAsync(int userId, IProjectInfo info) { return(_projectsDataAccessor.AddAsync(userId, info)); }