public static void AddIbusVersionAsErrorReportProperty()
        {
            var settingsGeneral = IntPtr.Zero;

            try
            {
                const string ibusSchema = "org.freedesktop.ibus.general";
                if (!SchemaIsInstalled(ibusSchema))
                {
                    return;
                }
                settingsGeneral = Unmanaged.g_settings_new(ibusSchema);
                if (settingsGeneral == IntPtr.Zero)
                {
                    return;
                }
                var version = Unmanaged.g_settings_get_string(settingsGeneral, "version");
                ErrorReport.AddProperty("IbusVersion", version);
            }
            catch
            {
                // Ignore any error we might get
            }
            finally
            {
                if (settingsGeneral != IntPtr.Zero)
                {
                    Unmanaged.g_object_unref(settingsGeneral);
                }
            }
        }
 private void InitializeErrorHandling()
 {
     ErrorReport.SetErrorReporter(new WinFormsErrorReporter());
     ErrorReport.EmailAddress = "*****@*****.**";
     ErrorReport.AddStandardProperties();
     ErrorReport.AddProperty("Host Application", host.ApplicationName + " " + host.ApplicationVersion);
     ExceptionHandler.Init(new WinFormsExceptionHandler());
 }
Esempio n. 3
0
        public static void Main(string[] rgArgs)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ErrorReport.AddProperty("EmailAddress", "*****@*****.**");
            ErrorReport.AddStandardProperties();
            ExceptionHandler.Init();

            s_loadingWnd = new SmallFadingWnd(Properties.Resources.kstidLoadingProgramMsg);

            PortableSettingsProvider.SettingsFileFolder = App.ProjectFolder;
            PortableSettingsProvider.SettingsFileName   = "PCIEditor.settings";

            string inventoryFilePath =
                FileLocator.GetDirectoryDistributedWithApplication(App.ConfigFolderName);

            // This is the poor man's way of determining whether or not the user has
            // write access to the folder in which the phonetic inventory
            // is stored. I'm sure there is a great class in .Net to use for such a
            // thing, but I couldn't find it in the little bit of digging I did. Sigh!
            string tmpFile = Path.Combine(inventoryFilePath, "!~tmpaccesstest~!");

            try
            {
                File.WriteAllText(tmpFile, string.Empty);
            }
            catch
            {
                string msg = string.Format(Properties.Resources.kstidWriteAccessErrorMsg, inventoryFilePath);
                Utils.MsgBox(msg);
                return;
            }

            File.Delete(tmpFile);

            string inventoryPath = null;

            try
            {
                // Make sure the phonetic inventory file exists.
                inventoryPath = FileLocator.GetFileDistributedWithApplication(App.ConfigFolderName,
                                                                              App.kDefaultInventoryFileName);
            }
            catch
            {
                string filePath = Utils.PrepFilePathForMsgBox(inventoryPath);
                string msg      = string.Format(Properties.Resources.kstidInventoryFileMissing, filePath);
                Utils.MsgBox(msg);
                return;
            }

            var editor = new PCIEditor();

            editor.OpenFile(inventoryPath);
            Application.Run(editor);
        }
Esempio n. 4
0
 private static void SetupErrorHandling()
 {
     ErrorReport.EmailAddress = "*****@*****.**";
     if (BasilProject.IsInitialized)
     {
         ErrorReport.AddProperty("ProjectPath", BasilProject.Project.ProjectDirectoryPath);
     }
     ErrorReport.AddStandardProperties();
     ExceptionHandler.Init();
 }
Esempio n. 5
0
 private static void SetupErrorHandling()
 {
     ErrorReport.EmailAddress = "*****@*****.**";
     ErrorReport.AddProperty("Application", "ChorusHub");
     ErrorReport.AddProperty("Directory", ChorusHubOptions.RootDirectory);
     ErrorReport.AddProperty("AdvertisingPort", ChorusHubOptions.AdvertisingPort.ToString());
     ErrorReport.AddProperty("MercurialPort", ChorusHubOptions.MercurialPort.ToString());
     ErrorReport.AddStandardProperties();
     ExceptionHandler.Init();
 }
Esempio n. 6
0
        private void SetKeyboardAdaptors(IKeyboardRetrievingAdaptor[] adaptors)
        {
            _keyboards.Clear();
            foreach (IKeyboardRetrievingAdaptor adaptor in _adaptors.Values)
            {
                adaptor.Dispose();
            }
            _adaptors.Clear();

            foreach (IKeyboardRetrievingAdaptor adaptor in adaptors)
            {
                if (adaptor.IsApplicable)
                {
                    if ((adaptor.Type & KeyboardAdaptorType.System) == KeyboardAdaptorType.System)
                    {
                        _adaptors[KeyboardAdaptorType.System] = adaptor;
                    }
                    if ((adaptor.Type & KeyboardAdaptorType.OtherIm) == KeyboardAdaptorType.OtherIm)
                    {
                        _adaptors[KeyboardAdaptorType.OtherIm] = adaptor;
                    }
                }
            }

            foreach (IKeyboardRetrievingAdaptor adaptor in adaptors)
            {
                if (!_adaptors.ContainsValue(adaptor))
                {
                    adaptor.Dispose();
                }
            }

            // Now that we know who can deal with the keyboards we can retrieve all available
            // keyboards, as well as add the used keyboard adaptors as error report property.
            var bldr = new StringBuilder();

            foreach (IKeyboardRetrievingAdaptor adaptor in _adaptors.Values)
            {
                adaptor.Initialize();

                if (bldr.Length > 0)
                {
                    bldr.Append(", ");
                }
                bldr.Append(adaptor.GetType().Name);
            }
            ErrorReport.AddProperty("KeyboardAdaptors", bldr.ToString());
            Logger.WriteEvent("Keyboard adaptors in use: {0}", bldr.ToString());
        }
Esempio n. 7
0
        private void InitializeErrorHandling(string projectName)
        {
            ErrorReport.SetErrorReporter(new WinFormsErrorReporter());
            ErrorReport.EmailAddress = "*****@*****.**";
            ErrorReport.AddStandardProperties();
            // The version that gets added to the report by default is for the entry assembly, which is
            // AddInProcess32.exe. Even if if reported a version (which it doesn't), it wouldn't be very
            // useful.
            ErrorReport.AddProperty("Plugin Name", pluginName);
            Assembly assembly = Assembly.GetExecutingAssembly();

            ErrorReport.AddProperty("Version", string.Format("{0} (apparent build date: {1})",
                                                             assembly.GetName().Version,
                                                             File.GetLastWriteTime(assembly.Location).ToShortDateString()));
            ErrorReport.AddProperty("Host Application", host.ApplicationName + " " + host.ApplicationVersion);
            ErrorReport.AddProperty("Project Name", projectName);
            ExceptionHandler.Init(new WinFormsExceptionHandler());
        }