using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Perforce.P4 { /// <summary> /// Specifies whether this line match is an exact match, /// or a context (before or after) match. /// </summary> public enum MatchType { Match, Before, After } /// <summary> /// Specifies matching lines in Perforce managed files. /// </summary> public class FileLineMatch { public MatchType Type; public string Line; public int LineNumber; public FileSpec FileSpec; public FileLineMatch() { } public FileLineMatch (MatchType type, string line, int linenumber, FileSpec filespec) { Type = type; Line = line; LineNumber = linenumber; FileSpec = filespec; } public void ParseGrepCmdTaggedData(TaggedObject obj) { if (obj.ContainsKey("depotFile")) { int rev = -1; if (obj.ContainsKey("rev")) { int.TryParse(obj["rev"], out rev); FileSpec = new FileSpec(new DepotPath(obj["depotFile"]), new Revision(rev)); } } Type = MatchType.Match; if (obj.ContainsKey("type")) { StringEnum<MatchType> matchtype = obj["type"]; Type = matchtype; } if (obj.ContainsKey("matchedLine")) { Line = obj["matchedLine"]; } if (obj.ContainsKey("line")) { int v = -1; int.TryParse(obj["line"], out v); LineNumber = v; } } public static FileLineMatch FromGrepCmdTaggedData(TaggedObject obj) { FileLineMatch val = new FileLineMatch(); val.ParseGrepCmdTaggedData(obj); return val; } } }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#1 | 19640 | Liz Lam | "Forking branch Main of perforce-software-p4connect to liz_lam-p4connect." | ||
//guest/perforce_software/p4connect/main/src/P4Bridge/p4api.net/FileLineMatch.cs | |||||
#1 | 16209 | Norman Morse | Move entire source tree into "main" branch so workshop code will act correctly. | ||
//guest/perforce_software/p4connect/src/P4Bridge/p4api.net/FileLineMatch.cs | |||||
#2 | 12135 | Norman Morse |
Integrate dev branch changes into main. This code is the basiis of the 2.7 BETA release which provides Unity 5 compatibility |
||
#1 | 10940 | Norman Morse |
Inital Workshop release of P4Connect. Released under BSD-2 license |