ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/RomCheater/trunk/RomCheater.Logging/LoggingConstants.cs
(Generate patch)

Comparing trunk/RomCheater.Logging/LoggingConstants.cs (file contents):
Revision 874 by william, Tue Apr 15 18:07:36 2014 UTC vs.
Revision 875 by william, Wed Sep 17 00:27:13 2014 UTC

--- trunk/RomCheater.Logging/LoggingConstants.cs	2014/09/17 00:21:21	874
+++ trunk/RomCheater.Logging/LoggingConstants.cs	2014/09/17 00:27:13	875
@@ -17,9 +17,14 @@ namespace RomCheater.Logging
             //SettingsSubscriber = new SettingSubscriber();
             //SettingsSubscriber.AddSubscriber(Settings.Default);
             //Logging.Properties.Settings.Default;
+            try { AppName = Assembly.GetEntryAssembly().GetName().Name; }
+            catch (Exception) { try { AppName = Assembly.GetCallingAssembly().GetName().Name; } 
+            catch (Exception) { try { AppName = Assembly.GetCallingAssembly().GetName().Name; } 
+            catch (Exception) { AppName = DEFAULT_APP_NAME; } } }
         }
         #region Application Constants
-        public const string AppName = "RomCheater";
+        private const string DEFAULT_APP_NAME = "RomCheater";
+        public static string AppName = DEFAULT_APP_NAME;
         public static string AppLogFile = string.Format("{0}.log", AppName);
         public static string AppFullLogPath = string.Format(@"{0}\{1}", Application.StartupPath, AppLogFile);
         public static string AppVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();