Exemple #1
0
        internal GeneralInfo(SerializableException serializableException)
        {
            // this.HostApplication = Settings.EntryAssembly.GetName().Name; // Does not get the extensions of the file!
            this.HostApplication = Settings.EntryAssembly.GetLoadedModules()[0].Name;

            // this.HostApplicationVersion = Settings.EntryAssembly.GetName().Version.ToString(); // Gets AssemblyVersion not AssemblyFileVersion
            this.HostApplicationVersion = this.NBugVersion = FileVersionInfo.GetVersionInfo(Settings.EntryAssembly.Location).ProductVersion;

            // this.NBugVersion = System.Reflection.Assembly.GetCallingAssembly().GetName().Version.ToString(); // Gets AssemblyVersion not AssemblyFileVersion
            this.NBugVersion = FileVersionInfo.GetVersionInfo(Assembly.GetCallingAssembly().Location).ProductVersion;

            this.CLRVersion = Environment.Version.ToString();

            this.DateTime = System.DateTime.UtcNow.ToString();

            SystemOS              = WMIHelper.FillOSInformation(Environment.MachineName, null, null, nameof(QueryAreaDescription.Win32_OperatingSystem));
            SystemHotFixes        = WMIHelper.FillHotFixes(Environment.MachineName, null, null, nameof(QueryAreaDescription.Win32_QuickFixEngineering));
            SystemProcessor       = WMIHelper.FillProcessorInformation(Environment.MachineName, null, null, nameof(QueryAreaDescription.Win32_Processor));
            SystemVideoController = WMIHelper.FillVideoController(Environment.MachineName, null, null, nameof(QueryAreaDescription.Win32_VideoController));

            if (serializableException != null)
            {
                this.ExceptionType = serializableException.Type;

                if (!string.IsNullOrEmpty(serializableException.TargetSite))
                {
                    this.TargetSite = serializableException.TargetSite;
                }
                else if (serializableException.InnerException != null && !string.IsNullOrEmpty(serializableException.InnerException.TargetSite))
                {
                    this.TargetSite = serializableException.InnerException.TargetSite;
                }

                this.ExceptionMessage = serializableException.Message;
            }
        }
Exemple #2
0
        private object GetWmiObject()
        {
            ComboObject item = cbxQuery.SelectedItem as ComboObject;

            if (item == null)
            {
                return(null);
            }
            switch (item.DisplayText)
            {
            case "WMI_COMPUTER_INFORMATION":
                return
                    (WMIHelper.FillComputerInformation(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                                       txtPass.Text.Trim(), item.ValueText));

            case "WMI_PROCESSOR_INFORMATION":
                return(WMIHelper.FillProcessorInformation(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                                          txtPass.Text.Trim(), item.ValueText));

            //case "WMI_PROCESSOR_INFORMATION":
            //          return WMIHelper.FillProcessorInformation(txtMachine.Text.Trim(), txtUser.Text.Trim(),
            //                                                    txtPass.Text.Trim(), "Win32_Processor");



            case "WMI_BIOS_INFORMATION":
                return(WMIHelper.FillBiosInformation(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                                     txtPass.Text.Trim(), item.ValueText));

            case "WMI_OS_INFORMATION":
                return(WMIHelper.FillOSInformation(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                                   txtPass.Text.Trim(), item.ValueText));

            case "WMI_HOTFIX_INFORMATION":
                return(WMIHelper.FillHotFixes(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                              txtPass.Text.Trim(), item.ValueText));

            case "WMI_NETWORK_ADAPTER_INFORMATION":
                return(WMIHelper.FillNetworkAdapter(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                                    txtPass.Text.Trim(), item.ValueText));

            case "WMI_PRINTER_INFORMATION":
                return(WMIHelper.FillPrinters(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                              txtPass.Text.Trim(), item.ValueText));

            case "WMI_DISK_DRIVE_INFORMATION":
                return(WMIHelper.FillDisks(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                           txtPass.Text.Trim(), item.ValueText));

            case "WMI_LOGICAL_DISK_INFORMATION":
                return(WMIHelper.FillLogicalDisks(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                                  txtPass.Text.Trim(), item.ValueText));

            case "WMI_VIDEO_CONTROLLER_INFORMATION":
                return(WMIHelper.FillVideoController(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                                     txtPass.Text.Trim(), item.ValueText));

            case "WMI_SOUND_CARD_INFORMATION":
                return(WMIHelper.FillSoundCard(txtMachine.Text.Trim(), txtUser.Text.Trim(),
                                               txtPass.Text.Trim(), item.ValueText));
            }
            return(null);
        }