/// <summary> /// To be called at application startup time for the determination of the data that /// <see cref="AppVCSData"/> should contain. It will only contain data if a VCS-data- /// containing file was found! /// </summary> public static void DetermineApplicationVCSInfo() { const string VCS_REVISION_FILE_NAME = "vcs-revision.txt"; string VCSInfoFilePath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\" + VCS_REVISION_FILE_NAME; String TextLine; int LineCounter = 0; if (File.Exists(VCSInfoFilePath)) { using (StreamReader sr = File.OpenText(VCSInfoFilePath)) { while ((TextLine = sr.ReadLine()) != null) { switch (LineCounter) { case 0: // Check this is a file that holds output that the "bzr version-info" command generates // This file is put into the 'bin' folder ONLY when an Installer is built! if (!TextLine.StartsWith("revision-id:")) { return; } else { TApplicationVCSInfo.AppVCSData = new TApplicationVCSInfo.ApplicationVCSData(); TApplicationVCSInfo.AppVCSData.VCSName = "Bazaar"; TApplicationVCSInfo.AppVCSData.RevisionID = TextLine.Substring(TextLine.IndexOf(':') + 2); } break; case 1: TApplicationVCSInfo.AppVCSData.RevisionDate = TextLine.Substring(TextLine.IndexOf(':') + 2); break; case 2: TApplicationVCSInfo.AppVCSData.RevisionCheckoutDate = TextLine.Substring(TextLine.IndexOf(':') + 2); break; case 3: TApplicationVCSInfo.AppVCSData.RevisionNumber = TextLine.Substring(TextLine.IndexOf(':') + 2); break; } LineCounter++; } } } }
/// <summary> /// To be called at application startup time for the determination of the data that /// <see cref="AppVCSData"/> should contain. It will only contain data if a VCS-data- /// containing file was found! /// </summary> public static void DetermineApplicationVCSInfo() { const string VCS_REVISION_FILE_NAME = "vcs-revision.txt"; string VCSInfoFilePath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + "\\" + VCS_REVISION_FILE_NAME; String TextLine; int LineCounter = 0; if (File.Exists(VCSInfoFilePath)) { using (StreamReader sr = File.OpenText(VCSInfoFilePath)) { while ((TextLine = sr.ReadLine()) != null) { switch (LineCounter) { case 0: // Check this is a file that holds output that the "bzr version-info" command generates // This file is put into the 'bin' folder ONLY when an Installer is built! if (!TextLine.StartsWith("revision-id:")) { return; } else { TApplicationVCSInfo.AppVCSData = new TApplicationVCSInfo.ApplicationVCSData(); TApplicationVCSInfo.AppVCSData.VCSName = "Bazaar"; TApplicationVCSInfo.AppVCSData.RevisionID = TextLine.Substring(TextLine.IndexOf(':') + 2); } break; case 1: TApplicationVCSInfo.AppVCSData.RevisionDate = TextLine.Substring(TextLine.IndexOf(':') + 2); break; case 2: TApplicationVCSInfo.AppVCSData.RevisionCheckoutDate = TextLine.Substring(TextLine.IndexOf(':') + 2); break; case 3: TApplicationVCSInfo.AppVCSData.RevisionNumber = TextLine.Substring(TextLine.IndexOf(':') + 2); break; } LineCounter++; } } } }