/// <summary> /// List (enumerate) entries of a given path. /// </summary> /// <param name="path">Path of a directory.</param> /// <returns>Enumerated entries.</returns> public static TEnumerator ListDirEntries(String path) { var entries = new TArrayList(); entries.AddAll(Directory.GetDirectories(path)); entries.AddAll(Directory.GetFiles(path)); return(new TEnumerator(entries.ToArray())); }
/// <summary> /// Initialize translation table. /// </summary> /// @param String @fileName Filename to load translation table from. /// <returns>Number of actual pairs in translation table.</returns> public static int Initialize(String fileName) { String[] lines = Helper.ReadAllLines(fileName); if (lines == null) { return(0); } pairs = new TArrayList(lines); return(pairs.Size()); }
/// <summary> /// Split a string using divider/separator. /// </summary> /// <param name="divider">Divider/separator.</param> /// <param name="input">Input string.</param> /// <returns>Array of resulting strings.</returns> public static String[] Split(String divider, String input) { String[] chunks = Regex.Split(input, divider); var result = new TArrayList(); for (int n = 0; n < SIZE(chunks); n++) { result.Add(chunks[n]); } return((String[])result.ToArray(typeof(String))); }
/// <summary> /// Merge array lists. /// </summary> /// <param name="input">Original array list.</param> /// <param name="extra">Array list to merge with original one.</param> /// <returns>Resulting array list.</returns> public TArrayList Merge(TArrayList extra) { var output = Create(); for (int n1 = 0; n1 < this.Size(); n1++) { output.Add(this[n1]); } if (extra == null) { return(output); } for (int n2 = 0; n2 < extra.Size(); n2++) { output.Add(extra[n2]); } return(output); }