/// <summary> /// Compare() is to be used to help with implementation of IComparer for sorting operations. /// </summary> public static int Compare(ParsingParams xPrams, ParsingParams yPrams) { if (xPrams == null && yPrams == null) return 0; int retval = xPrams == null ? -1 : (yPrams == null ? 1 : 0); if (retval == 0) { string[][] xNames = xPrams.RenameNamespaceMap; string[][] yNames = yPrams.RenameNamespaceMap; retval = Comparer.Default.Compare(xNames.Length, yNames.Length); if (retval == 0) { for (int i = 0; i < xNames.Length && retval == 0; i++) { retval = Comparer.Default.Compare(xNames[i].Length, yNames[i].Length); if (retval == 0) { for (int j = 0; j < xNames[i].Length; j++) { retval = Comparer.Default.Compare(xNames[i][j], yNames[i][j]); } } } } } return retval; }
/// <summary> /// Compare() is to be used to help with implementation of IComparer for sorting operations. /// </summary> public static int Compare(ParsingParams xPrams, ParsingParams yPrams) { if (xPrams == null && yPrams == null) { return(0); } int retval = xPrams == null ? -1 : (yPrams == null ? 1 : 0); if (retval == 0) { string[][] xNames = xPrams.RenameNamespaceMap; string[][] yNames = yPrams.RenameNamespaceMap; retval = System.Collections.Comparer.Default.Compare(xNames.Length, yNames.Length); if (retval == 0) { for (int i = 0; i < xNames.Length && retval == 0; i++) { retval = System.Collections.Comparer.Default.Compare(xNames[i].Length, yNames[i].Length); if (retval == 0) { for (int j = 0; j < xNames[i].Length; j++) { retval = System.Collections.Comparer.Default.Compare(xNames[i][j], yNames[i][j]); } } } } } return(retval); }
public FileParser(string fileName, ParsingParams prams, bool process, bool imported, string[] searchDirs) { this.imported = imported; this.prams = prams; this.searchDirs = searchDirs; this.fileName = ResolveFile(fileName, searchDirs); if (process) { ProcessFile(); } }
public FileParser(string fileName, ParsingParams prams, bool process, bool imported, string[] searchDirs, bool throwOnError) { if (searchDirs == null) { searchDirs = new string[0]; } FileParser._throwOnError = throwOnError; this.imported = imported; this.prams = prams; this.fileName = ResolveFile(fileName, searchDirs); this.searchDirs = Utils.RemovePathDuplicates(Utils.Concat(searchDirs, Path.GetDirectoryName(this.fileName))); if (process) { ProcessFile(); } }
public int Compare(FileParser x, FileParser y) { if (x == null && y == null) { return(0); } int retval = x == null ? -1 : (y == null ? 1 : 0); if (retval == 0) { retval = string.Compare(x.fileName, y.fileName, true); if (retval == 0) { retval = ParsingParams.Compare(x.prams, y.prams); } } return(retval); }
int IComparer.Compare(object x, object y) { if (x == null && y == null) { return(0); } int retval = x == null ? -1 : (y == null ? 1 : 0); if (retval == 0) { FileParser xParser = (FileParser)x; FileParser yParser = (FileParser)y; retval = string.Compare(xParser.fileName, yParser.fileName, true); if (retval == 0) { retval = ParsingParams.Compare(xParser.prams, yParser.prams); } } return(retval); }
public FileParser(string fileName, ParsingParams prams, bool process, bool imported, string[] searchDirs) { this.imported = imported; this.prams = prams; this.searchDirs = searchDirs; this.fileName = ResolveFile(fileName, searchDirs); if (process) ProcessFile(); }