Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="FwLexiconPlugin"/> class.
        /// </summary>
        public FwLexiconPlugin()
        {
            RegistryHelper.CompanyName = DirectoryFinder.CompanyName;
            RegistryHelper.ProductName = "FieldWorks";

            // setup necessary environment variables on Linux
            if (MiscUtils.IsUnix)
            {
                // update ICU_DATA to location of ICU data files
                if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("ICU_DATA")))
                {
                    string codeIcuDataPath = Path.Combine(ParatextLexiconPluginDirectoryFinder.CodeDirectory, "Icu" + Icu.Version);
#if DEBUG
                    string icuDataPath = codeIcuDataPath;
#else
                    string icuDataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ".config/fieldworks/Icu" + Icu.Version);
                    if (!Directory.Exists(icuDataPath))
                    {
                        icuDataPath = codeIcuDataPath;
                    }
#endif
                    Environment.SetEnvironmentVariable("ICU_DATA", icuDataPath);
                }
                // update COMPONENTS_MAP_PATH to point to code directory so that COM objects can be loaded properly
                if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("COMPONENTS_MAP_PATH")))
                {
                    string compMapPath = Path.GetDirectoryName(FileUtils.StripFilePrefix(Assembly.GetExecutingAssembly().CodeBase));
                    Environment.SetEnvironmentVariable("COMPONENTS_MAP_PATH", compMapPath);
                }
                // update FW_ROOTCODE so that strings-en.txt file can be found
                if (string.IsNullOrEmpty(Environment.GetEnvironmentVariable("FW_ROOTCODE")))
                {
                    Environment.SetEnvironmentVariable("FW_ROOTCODE", ParatextLexiconPluginDirectoryFinder.CodeDirectory);
                }
            }
            Icu.InitIcuDataDir();

            m_syncRoot          = new object();
            m_lexiconCache      = new FdoLexiconCollection();
            m_fdoCacheCache     = new FdoCacheCollection();
            m_activationContext = new ActivationContextHelper("FwParatextLexiconPlugin.dll.manifest");

            // initialize client-server services to use Db4O backend for FDO
            m_ui = new ParatextLexiconPluginFdoUI(m_activationContext);
            var dirs = ParatextLexiconPluginDirectoryFinder.FdoDirectories;
            ClientServerServices.SetCurrentToDb4OBackend(m_ui, dirs);
        }
Beispiel #2
0
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        static void Main()
        {
            // We need FieldWorks here to get the correct registry key HKLM\Software\SIL\FieldWorks.
            // The default without this would be HKLM\Software\SIL\SIL FieldWorks,
            // which breaks FwRemoteDatabaseConnectorService.exe.
            RegistryHelper.ProductName = "FieldWorks";

            ClientServerServices.SetCurrentToDb4OBackend(new SilentFdoUI(new SingleThreadedSynchronizeInvoke()),
                                                         FwDirectoryFinder.FdoDirectories);

            ServiceBase[] ServicesToRun;
            ServicesToRun = new ServiceBase[]
            {
                new FwRemoteDatabaseConnectorService()
            };
            ServiceBase.Run(ServicesToRun);
        }
Beispiel #3
0
 /// <summary>
 /// Setup static FDO properties
 /// </summary>
 public static void SetupStaticFdoProperties()
 {
     ClientServerServices.SetCurrentToDb4OBackend(new DummyFdoUI(), FwDirectoryFinder.FdoDirectories);
     ScrMappingList.TeStylesPath = FwDirectoryFinder.TeStylesPath;
 }
Beispiel #4
0
 /// <summary>
 /// Contstructor is required to initialize ClientServerServices
 /// </summary>
 public PaLexicalInfo()
 {
     // need to call this iniitialization routine to allow the ChooseLangProjectDialog can be used
     ClientServerServices.SetCurrentToDb4OBackend(null, FwDirectoryFinder.FdoDirectories);
 }