Ejemplo n.º 1
0
        internal static void CommandMenuInit()
        {
            StringBuilder pluginsConfigDir = new StringBuilder(Win32.MAX_PATH);

            Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_GETPLUGINSCONFIGDIR, Win32.MAX_PATH, pluginsConfigDir);
            ConfigDirectory    = $"{ pluginsConfigDir.ToString() }\\{ PluginName }\\";
            SystemsDirectory   = $"{ConfigDirectory}systems\\";
            FileCacheDirectory = $"{ConfigDirectory}cache\\";

            if (!Directory.Exists(ConfigDirectory))
            {
                Directory.CreateDirectory(ConfigDirectory);
            }
            if (!Directory.Exists(SystemsDirectory))
            {
                Directory.CreateDirectory(SystemsDirectory);
            }
            if (!Directory.Exists(FileCacheDirectory))
            {
                Directory.CreateDirectory(FileCacheDirectory);
            }

            IBMiUtilities.CreateLog(ConfigDirectory + PluginName);
            RPGParser.LoadFileCache();
            CLParser.LoadFileCache();

            if (File.Exists(ConfigDirectory + "dftcfg"))
            {
                Config.SwitchToConfig(File.ReadAllText(ConfigDirectory + "dftcfg"));
            }
            else
            {
                LoadConfigSelect();
                if (Config.GetConfigs().Length == 0)
                {
                    return;
                }
                if (IBMi._ConfigFile == "" || IBMi._ConfigFile == null)
                {
                    string UseConfig = Config.GetConfigs()[0];
                    MessageBox.Show("No config selected. Defaulted to " + UseConfig + ".");
                    Config.SwitchToConfig(UseConfig);
                }
            }
            //if (IBMi.GetConfig("localDefintionsInstalled") == "false")
            //{
            //    IBMiNPPInstaller.InstallLocalDefinitions();
            //}

            bool ExperimentalFeatures = (IBMi.GetConfig("experimental") == "true");
            int  ItemOrder            = 0;

            PluginBase.SetCommand(ItemOrder++, "About IBMiCmd", About, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Select Remote System", LoadConfigSelect);
            PluginBase.SetCommand(ItemOrder++, "Remote System Setup", RemoteSetup);
            PluginBase.SetCommand(ItemOrder++, "Library List", LiblDialog, new ShortcutKey(true, false, false, Keys.F7));
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Remote Install Plugin Server", RemoteInstall);
            }
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Command Entry", CommandDialog);
            PluginBase.SetCommand(ItemOrder++, "Error Listing", ErrorDialog);
            PluginBase.SetCommand(ItemOrder++, "Command Bindings", BindsDialog);
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Member Listing", MemberListing);
            PluginBase.SetCommand(ItemOrder++, "Open Source Member", OpenMember, new ShortcutKey(true, false, true, Keys.A));
            //PluginBase.SetCommand(ItemOrder++, "Upload Source Member", UploadMember, new ShortcutKey(true, false, true, Keys.X));
            PluginBase.SetCommand(ItemOrder++, "Open Include/Copy", OpenInclude, new ShortcutKey(true, false, false, Keys.F12));
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Format CL file", ManageCL, new ShortcutKey(true, false, false, Keys.F4));
            PluginBase.SetCommand(ItemOrder++, "RPG Line Conversion", LaunchConversion, new ShortcutKey(true, false, false, Keys.F5));
            PluginBase.SetCommand(ItemOrder++, "RPG File Conversion", LaunchFileConversion, new ShortcutKey(true, false, false, Keys.F6));
            PluginBase.SetCommand(ItemOrder++, "-SEPARATOR-", null);
            PluginBase.SetCommand(ItemOrder++, "Open Log File", OpenLogFile);
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Refresh Extname Definitions", BuildSourceContext);
            }
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Prompt CL Command", PromptCommand, new ShortcutKey(true, false, false, Keys.F4));
            }

            idMyDlg = 1;

            IntelliSenseWindow = new IntelliSenseWindow();
            IntelliSenseWindow.Show();
        }
Ejemplo n.º 2
0
 internal static void PluginCleanUp()
 {
     IntelliSenseWindow.Dispose();
 }