コード例 #1
0
ファイル: Program.cs プロジェクト: smellyriver/tankinspector
        public static void LogHardwareInfo()
        {
            try
            {
                foreach (var hardware in Hardwares)
                {
                    var searcher = new ManagementObjectSearcher(
                        "SELECT * FROM " + hardware);

                    var hardwareLog = SafeLog.GetLogger(hardware);

                    foreach (ManagementObject wmiHd in searcher.Get())
                    {
                        PropertyDataCollection
                                              searcherProperties = wmiHd.Properties;
                        foreach (PropertyData sp in searcherProperties)
                        {
                            hardwareLog.Info(sp.Name + ' ' + sp.Value);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.Error("logging hardware info", ex);
            }
        }
コード例 #2
0
ファイル: App.xaml.cs プロジェクト: smellyriver/tankinspector
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            if (App.LocalizationVersion < MinimumLocalizationVersion)
            {
                var message = App.GetLocalizedString("ObsoleteLocalization", "This language pack of US English is obsolete and incompatible. Please update it, or delete it to use a fallback language.");
                var title   = App.GetLocalizedString("ObsoleteLocalizationTitle", "Obsolete Language Pack");
                MessageBox.Show(message, title, MessageBoxButton.OK, MessageBoxImage.Error);
                Environment.Exit(0);
            }

            var argLog = SafeLog.GetLogger("Args");

            foreach (var arg in e.Args)
            {
                argLog.Info(arg);
            }

            // todo: remove e.Args[1] (login token)

            if (e.Args.Length >= 3 && Database.IsPathValid(e.Args[2]))
            {
                var pathes = new StringCollection();
                pathes.Add(e.Args[2]);
                ApplicationSettings.Default.GamePathes = pathes;
                ApplicationSettings.Default.Save();
            }

            var versionLog = SafeLog.GetLogger("Version");
            var x          = ApplicationSettings.Default.GamePathes; //dummy

            //ApplicationSettings.Default.GamePathes[0] = @"E:\Game Archives\World_of_Tanks_CT";

            Program.InitializeUnhandledExceptionHandler();

            versionLog.Info(Assembly.GetExecutingAssembly().GetName().Version.ToString());

            Program.LogHardwareInfo();
        }