bool UpdateVersionFile(string LocalPath, Dictionary <string, string> VersionStrings, int ChangeNumber) { PerforceWhereRecord WhereRecord; if (!Perforce.Where(LocalPath, out WhereRecord, Log)) { Log.WriteLine("P4 where failed for {0}", LocalPath); return(false); } List <string> Lines; if (!Perforce.Print(String.Format("{0}@{1}", WhereRecord.DepotPath, ChangeNumber), out Lines, Log)) { Log.WriteLine("Couldn't get default contents of {0}", WhereRecord.DepotPath); return(false); } StringWriter Writer = new StringWriter(); foreach (string Line in Lines) { string NewLine = Line; foreach (KeyValuePair <string, string> VersionString in VersionStrings) { if (UpdateVersionLine(ref NewLine, VersionString.Key, VersionString.Value)) { break; } } Writer.WriteLine(NewLine); } return(WriteVersionFile(WhereRecord, Writer.ToString())); }