From 6378f749d58301c36456a7c5400039a0542fb182 Mon Sep 17 00:00:00 2001 From: Daniel Grunwald <daniel@danielgrunwald.de> Date: Tue, 1 Jun 2010 15:44:58 +0000 Subject: [PATCH] UDC: Upload name of feature branch git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@5888 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../AnalyticsMonitor.cs | 10 ++++++++-- .../UsageDataCollector/UsageDataUploader.cs | 10 ++++++++-- src/Main/GlobalAssemblyInfo.template | 2 ++ .../StartUp/Project/Dialogs/SplashScreen.cs | 17 +++++++++-------- 4 files changed, 27 insertions(+), 12 deletions(-) diff --git a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/AnalyticsMonitor.cs b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/AnalyticsMonitor.cs index 629fcac2a3..0b59d89644 100644 --- a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/AnalyticsMonitor.cs +++ b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector.AddIn/AnalyticsMonitor.cs @@ -25,6 +25,7 @@ namespace ICSharpCode.UsageDataCollector public sealed class AnalyticsMonitor : IAnalyticsMonitor { const string UploadUrl = "http://usagedatacollector.sharpdevelop.net/upload/UploadUsageData.svc"; + const string ProductName = "sharpdevelop"; public static readonly Uri PrivacyStatementUrl = new Uri("http://www.icsharpcode.net/OpenSource/SD/UsageDataCollector/"); public static readonly AnalyticsMonitor Instance = new AnalyticsMonitor(); @@ -110,7 +111,7 @@ namespace ICSharpCode.UsageDataCollector } } if (sessionOpened) { - UsageDataUploader uploader = new UsageDataUploader(dbFileName); + UsageDataUploader uploader = new UsageDataUploader(dbFileName, ProductName); uploader.EnvironmentDataForDummySession = appEnvironmentProperties; ThreadPool.QueueUserWorkItem(delegate { uploader.StartUpload(UploadUrl); }); } @@ -131,6 +132,11 @@ namespace ICSharpCode.UsageDataCollector if (!string.IsNullOrEmpty(PROCESSOR_ARCHITECTURE)) { properties.Add(new UsageDataEnvironmentProperty { Name = "architecture", Value = PROCESSOR_ARCHITECTURE }); } + #pragma warning disable 0162 + if (RevisionClass.BranchName != null) { + properties.Add(new UsageDataEnvironmentProperty { Name = "branch", Value = RevisionClass.BranchName }); + } + #pragma warning restore 0162 #if DEBUG properties.Add(new UsageDataEnvironmentProperty { Name = "debug", Value = "true" }); #endif @@ -148,7 +154,7 @@ namespace ICSharpCode.UsageDataCollector if (session != null) session.Flush(); } - UsageDataUploader uploader = new UsageDataUploader(dbFileName); + UsageDataUploader uploader = new UsageDataUploader(dbFileName, ProductName); return uploader.GetTextForStoredData(); } diff --git a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataUploader.cs b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataUploader.cs index d907a174c4..42f1d3613a 100644 --- a/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataUploader.cs +++ b/src/AddIns/Misc/UsageDataCollector/UsageDataCollector/UsageDataUploader.cs @@ -28,13 +28,19 @@ namespace ICSharpCode.UsageDataCollector public class UsageDataUploader { string databaseFileName; + string productName; /// <summary> /// Creates a new UsageDataUploader. /// </summary> - public UsageDataUploader(string databaseFileName) + public UsageDataUploader(string databaseFileName, string productName) { + if (databaseFileName == null) + throw new ArgumentNullException("databaseFileName"); + if (productName == null) + throw new ArgumentNullException("productName"); this.databaseFileName = databaseFileName; + this.productName = productName; } /// <summary> @@ -140,7 +146,7 @@ namespace ICSharpCode.UsageDataCollector UdcProxy.UDCUploadServiceClient client = new UdcProxy.UDCUploadServiceClient(binding, endpoint); try { - client.BeginUploadUsageData("sharpdevelop", new MemoryStream(data), + client.BeginUploadUsageData(productName, new MemoryStream(data), ar => UsageDataUploaded(ar, client, commaSeparatedSessionIDList), null); } catch (CommunicationException) { // ignore error (maybe currently not connected to network) diff --git a/src/Main/GlobalAssemblyInfo.template b/src/Main/GlobalAssemblyInfo.template index d75b703800..5ddb81e4f9 100644 --- a/src/Main/GlobalAssemblyInfo.template +++ b/src/Main/GlobalAssemblyInfo.template @@ -33,4 +33,6 @@ internal static class RevisionClass public const string MainVersion = Major + "." + Minor; public const string FullVersion = Major + "." + Minor + "." + Build + "." + Revision; + + public const string BranchName = null; } diff --git a/src/Main/StartUp/Project/Dialogs/SplashScreen.cs b/src/Main/StartUp/Project/Dialogs/SplashScreen.cs index f947f26572..5963bddb1b 100644 --- a/src/Main/StartUp/Project/Dialogs/SplashScreen.cs +++ b/src/Main/StartUp/Project/Dialogs/SplashScreen.cs @@ -14,8 +14,6 @@ namespace ICSharpCode.SharpDevelop { public class SplashScreenForm : Form { - public const string VersionText = "Mirador (4.0) build " + RevisionClass.Revision; - static SplashScreenForm splashScreen; static List<string> requestedFileList = new List<string>(); static List<string> parameterList = new List<string>(); @@ -32,20 +30,23 @@ namespace ICSharpCode.SharpDevelop public SplashScreenForm() { + const string versionText = "SharpDevelop" + + (RevisionClass.BranchName != null ? "-" + RevisionClass.BranchName : "") + + " " + RevisionClass.FullVersion + #if DEBUG + + " (debug)" + #endif + ; + FormBorderStyle = FormBorderStyle.None; StartPosition = FormStartPosition.CenterScreen; ShowInTaskbar = false; - #if DEBUG - string versionText = VersionText + " (debug)"; - #else - string versionText = VersionText; - #endif // Stream must be kept open for the lifetime of the bitmap bitmap = new Bitmap(typeof(SplashScreenForm).Assembly.GetManifestResourceStream("Resources.SplashScreen.jpg")); this.ClientSize = bitmap.Size; using (Font font = new Font("Sans Serif", 4)) { using (Graphics g = Graphics.FromImage(bitmap)) { - g.DrawString(versionText, font, Brushes.Black, 100, 142); + g.DrawString(versionText, font, Brushes.Black, 166 - 3 * versionText.Length, 142); } } BackgroundImage = bitmap;