public bool AddCode(string code) { #if WINDOWS if (string.IsNullOrWhiteSpace(code)) { return false; } SourceControl<object> controlFull = new SourceControl<object>(code); if (!RemoveComments(ref controlFull)) { return false; } if (!CleanAndExpand(ref controlFull)) { return false; } if (controlFull.Lines.Count == 0) { //All comments, so code was "compiled", return true return true; } List<SourceControl<string>> names = new List<SourceControl<string>>(); if (!GetPackages(controlFull, ref names)) { return false; } //TODO return true; #else return false; #endif }
private void SetSourceControl(string url, string sourceControlType, string path) { var scmType = sourceControlType.ToLower(); if (scmType != "svn") throw new ArgumentOutOfRangeException(string.Format("Unkown SourceControlType {0}", sourceControlType)); SourceControl = new SVNSourceControl(url, path); }
public BuildMetaDataStub(Core.BuildEngines.BuildEngine buildEngine, SourceControl sourceControl) { BuildEngine = buildEngine; SourceControl = sourceControl; PrebuildCommandList = new List<string>(); RepositoryElementList = new List<IRepositoryElement>(); ExportList = new List<SourceControl>(); ProjectInfo = new Dictionary<string, object>(); }
public static void DumpObjectTree(SourceControl.ObjectTree ot) { //System.Console.WriteLine("== Folder: " + ot.Name); _logger.Debug("== Folder: " + ot.Name); foreach (string key in ot.Objects) { //System.Console.WriteLine(key); _logger.Debug(key); } foreach (SourceControl.ObjectTree childOT in ot.ObjectTrees) { DumpObjectTree(childOT); } }
public MetaDataSynchroniser(SourceControl sourceControl) { this.sourceControl = sourceControl; }
public SourceControlAdapter(SourceControl sourceControl) { _sourceControl = sourceControl; }
protected override void Before_each_spec() { sourceControl = new SourceControlDouble("http://somesvnuri.com/Svn"); packageTree = TreeHelper.GetTempPackageTree().RetrievePackage(PackageTreeHelper.PackageWithoutRevision); }
public virtual IGet From(SourceControl sourceControlToGetFrom) { sourceControl = sourceControlToGetFrom; return this; }
/// <summary> /// Check out file from source control. /// </summary> /// <param name="sourceControl">Source control object</param> /// <param name="file">The name of the file to check out</param> private static void CheckOutFile(SourceControl sourceControl, string file) { if (sourceControl != null && sourceControl.IsItemUnderSCC(file) && !sourceControl.IsItemCheckedOut(file)) { sourceControl.CheckOutItem(file); } }
public AssemblyStatus(SourceControl.BuildServers.SourceController prj) { State = prj.BuildServer.GetState().ToString(); IRevision scmBS = prj.BuildServerRevision; IRevision scmPck = prj.PackageRevision; BuildServerRev = scmBS; PackageRev = scmPck; packagedDate = prj.Versions.LastPackagedDate; Loaded = prj.RuntimeLoaded; LoadedRevision = prj.RuntimeLoadedRevision; LoadedRemarks = prj.RuntimeLoadedRemark; }
private bool RemoveComments(ref SourceControl<object> sc) { bool comment = false; int index; //Remove comments for (int i = 0; i < sc.Lines.Count; i++) { string line = sc.Lines[i].Line; if (comment) { index = line.IndexOf("*/"); if (index >= 0) { index += 2; sc.Lines[i].ColNumber = index; sc.Lines[i].Line = line.Substring(index); comment = false; i--; //Just in case } else { sc.Lines[i].ColNumber = 0; sc.Lines[i].Line = string.Empty; } } else { index = line.IndexOf("//"); if (index >= 0 && ParaCount(line, index) % 2 == 0) { sc.Lines[i].ColNumber = 0; sc.Lines[i].Line = line.Substring(0, index).TrimEnd(); } else { index = line.IndexOf("/*"); if (index >= 0 && ParaCount(line, index) % 2 == 0) { int start = index; index = line.IndexOf("*/", index); if (index >= 0) { //Single line comment index += 2; sc.Lines[i].ColNumber = 0; sc.Lines[i].Line = line.Substring(0, start) + new string(' ', index - start) + line.Substring(index); i--; //So the comment checks repeat on single line comments } else { //Multiline comment sc.Lines[i].ColNumber = 0; sc.Lines[i].Line = line.Substring(0, start).TrimEnd(); this.line = i; this.col = start + sc.Lines[i].ColNumber; comment = true; } } } } } //If we are still in comment mode then we are missing a end of comment marker. This means the code has been corrupted by the cleaner if (comment) { this.message = Messages.Compiler_Error_NoEndComment; return false; } ResetError(); return true; }
private bool GetPackages(SourceControl<object> sc, ref List<SourceControl<string>> names) { bool onPackage = false; string package = null; int depth = 0; List<SourceLine> lines = new List<SourceLine>(); for (int i = 0; i < sc.Lines.Count; i++) { SourceLine line = sc.Lines[i]; if (onPackage) { if (line.Line.StartsWith("{")) { depth++; } else if (line.Line.StartsWith("}")) { depth--; } if (depth == 0) { if (package == null) { package = string.Empty; } if (lines.Count > 0) { names.Add(new SourceControl<string>(lines, package)); lines = new List<SourceLine>(); } package = null; onPackage = false; } else { lines.Add(line); } } else { if (package == null) { if (line.Line.StartsWith("package")) { package = line.Line.Substring(8).Trim(); } //What do we do if package is not the first line? What do we do if it has a modifier (documentation seems to mention it, not sure how it works) } else { if (line.Line.StartsWith("{")) { onPackage = true; depth = 1; } } } } ResetError(); return true; }
//TODO //TODO //TODO //TODO //TODO //Goes through all the lines and "expands" them so braces have their own lines and empty-lines are removed private bool CleanAndExpand(ref SourceControl<object> sc) { //TODO //Remove all blank lines to speed up processing, line numbers are kept intact List<SourceLine> lines = new List<SourceLine>(); for (int i = 0; i < sc.Lines.Count; i++) { SourceLine line = sc.Lines[i]; if (!string.IsNullOrWhiteSpace(line.Line)) { lines.Add(line); } } sc.Lines = lines; return true; }