public override void UpdateFile(String original, String updated) { foreach (var s in FileContents.Where(itm => itm.Contains(original)).ToList()) { var pos = Array.IndexOf(FileContents, s); if (pos > -1) { FileContents[pos] = FileContents[pos].Replace(original, updated); } } }
private void Initialize() { Files = new List <String>(); foreach (var s in FileContents.Where(s => "FILE" == s.Substring(0, 4).ToUpper())) { var equalIndex = s.IndexOf("=", StringComparison.Ordinal) + 1; var fn = s.Substring(equalIndex, s.Length - equalIndex); if (!System.IO.Path.IsPathRooted(s)) { var uri = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(FFileName), fn); Files.Add(uri); } else { Files.Add(System.IO.Path.GetFullPath(fn)); } } }
private void Initialize() { Files = new List <String>(); foreach (var s in FileContents.Where(itm => itm[0] != '#').ToList()) { IsUri = s.StartsWith("file://"); var check = IsUri ? new Uri(s).LocalPath:s; if (!System.IO.Path.IsPathRooted(check)) { var u = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(FFileName), check); UpdateFile(s, IsUri ? new Uri(u).AbsoluteUri : u); Files.Add(u); } else { Files.Add(System.IO.Path.GetFullPath(s)); } } }