Beispiel #1
0
        /// <summary>
        /// Initializes the module item if needed.
        /// </summary>
        private void InitModuleItem(ModuleItem moduleItem)
        {
            if (!moduleItem.IsInitialized)
            {
                moduleItem.IsInitialized = true;

                try {
                    if (environment.ModuleViews.TryGetValue(moduleItem.FilePath, out ModView modView))
                    {
                        moduleItem.Descr   = CorrectItemDescr(modView.Descr);
                        moduleItem.ModView = modView;
                    }
                    else if (File.Exists(moduleItem.FilePath))
                    {
                        modView         = ModFactory.GetModView(moduleItem.FilePath);
                        modView.AppDirs = environment.AppDirs;

                        moduleItem.Descr   = CorrectItemDescr(modView.Descr);
                        moduleItem.ModView = modView;

                        environment.ModuleViews[moduleItem.FilePath] = modView;
                    }
                    else
                    {
                        moduleItem.Descr =
                            string.Format(ServerShellPhrases.ModuleNotFound, moduleItem.FileName);
                        moduleItem.ModView = null;
                    }
                } catch (Exception ex) {
                    moduleItem.Descr   = ex.Message;
                    moduleItem.ModView = null;
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets the user interface of the driver.
        /// </summary>
        public ModView GetModuleView(string dllPath)
        {
            if (!moduleViews.TryGetValue(dllPath, out ModView modView))
            {
                modView              = ModFactory.GetModView(dllPath);
                modView.AppDirs      = AppDirs;
                moduleViews[dllPath] = modView;
            }

            return(modView);
        }