コード例 #1
0
ファイル: Main.cs プロジェクト: mlanglet/IBMiCmd
        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 }\\";
            FileCacheDirectory = $"{ConfigDirectory}cache\\";

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

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

            IBMi.LoadConfig(ConfigDirectory + PluginName);
            //if (IBMi.GetConfig("localDefintionsInstalled") == "false")
            //{
            //    IBMiNPPInstaller.InstallLocalDefinitions();
            //}

            PluginBase.SetCommand(0, "About IBMiCmd", About, new ShortcutKey(false, false, false, Keys.None));
            PluginBase.SetCommand(1, "IBM i Remote System Setup", RemoteSetup);
            PluginBase.SetCommand(2, "IBM i Command Entry", CommandDialog);
            PluginBase.SetCommand(3, "IBM i Error Listing", ErrorDialog);
            PluginBase.SetCommand(4, "IBM i Command Bindings", BindsDialog);
            PluginBase.SetCommand(5, "IBM i RPG Conversion", LaunchConversion, new ShortcutKey(true, false, false, Keys.F4));
            PluginBase.SetCommand(6, "IBM i Relic Build", LaunchRBLD, new ShortcutKey(true, false, false, Keys.F5));
            PluginBase.SetCommand(7, "IBM i Refresh Definitions", BuildSourceContext, new ShortcutKey(true, false, false, Keys.F6));
            PluginBase.SetCommand(8, "IBM i Auto Complete", AutoComplete, new ShortcutKey(false, true, false, Keys.Space));
            PluginBase.SetCommand(9, "IBM i Library List", LiblDialog, new ShortcutKey(true, false, false, Keys.F7));
            PluginBase.SetCommand(10, "IBM i Remote Install Plugin Server", RemoteInstall);
        }
コード例 #2
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++, "Display File Editor", DisplayEdit);
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Refresh Extname Definitions", BuildSourceContext);
            }
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Extname Content Assist", AutoComplete, new ShortcutKey(false, true, false, Keys.Space));
            }
            if (ExperimentalFeatures)
            {
                PluginBase.SetCommand(ItemOrder++, "Prompt CL Command", PromptCommand, new ShortcutKey(true, false, false, Keys.F4));
            }
        }