Esempio n. 1
0
        public static void HandleTrigger(SCNotification Notification)
        {
            string     path = GetCurrentFileName();
            OpenMember member;

            switch (Notification.nmhdr.code)
            {
            case (uint)NppMsg.NPPN_FILESAVED:
                member = OpenMembers.GetMember(path);
                if (member != null)
                {
                    Thread gothread = new Thread((ThreadStart) delegate {
                        if (member.GetSystemName() == IBMi.GetConfig("system"))
                        {
                            bool UploadResult = IBMiUtilities.UploadMember(member.GetLocalFile(), member.GetLibrary(), member.GetObject(), member.GetMember());
                            if (UploadResult == false)
                            {
                                System.Windows.Forms.MessageBox.Show("Failed to upload to " + member.GetMember() + " on " + member.GetSystemName() + ".");
                            }
                        }
                        else
                        {
                            System.Windows.Forms.MessageBox.Show("Unable to upload to " + member.GetMember() + ". You must be connected to " + member.GetSystemName() + " in order to save this file.");
                        }
                        if (Main.CommandWindow != null)
                        {
                            Main.CommandWindow.loadNewOutput();
                        }
                    });
                    gothread.Start();
                }
                break;

            case (uint)NppMsg.NPPN_FILEBEFORECLOSE:
                if (OpenMembers.Contains(path))
                {
                    OpenMembers.RemoveMember(path);
                    File.Delete(path);
                }
                break;
            }
        }
Esempio n. 2
0
        private void create_Click(object sender, EventArgs e)
        {
            bool isValid = true;

            lib.Text = lib.Text.Trim();
            spf.Text = spf.Text.Trim();

            if (!IBMiUtils.IsValueObjectName(lib.Text))
            {
                isValid = false;
            }
            if (!IBMiUtils.IsValueObjectName(spf.Text))
            {
                isValid = false;
            }

            if (isValid)
            {
                if (IBMi.IsConnected())
                {
                    string cmd = "CRTSRCPF FILE(" + lib.Text + "/" + spf.Text + ") RCDLEN(" + rcdLen.Value.ToString() + ") CCSID(" + ccsid.Text + ")";
                    if (IBMi.RemoteCommand(cmd))
                    {
                        Editor.TheEditor.AddTool(new MemberBrowse(lib.Text, spf.Text), WeifenLuo.WinFormsUI.Docking.DockState.DockRight);
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show(lib.Text.Trim() + "/" + spf.Text.Trim() + " not created.");
                    }
                }
                else
                {
                    Directory.CreateDirectory(IBMiUtils.GetLocalDir(lib.Text, spf.Text));
                    Editor.TheEditor.AddTool(new MemberBrowse(lib.Text, spf.Text), WeifenLuo.WinFormsUI.Docking.DockState.DockRight);
                }
            }
            else
            {
                MessageBox.Show("SPF information not valid.");
            }
        }
Esempio n. 3
0
        private void treeView1_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Delete)
            {
                if (treeView1.SelectedNode != null)
                {
                    var confirmResult = MessageBox.Show("Are you sure to delete this binding?",
                                                        "Delete binding",
                                                        MessageBoxButtons.YesNo);

                    if (confirmResult == DialogResult.Yes)
                    {
                        bindings.Remove(treeView1.SelectedNode.Text);
                        IBMi.SetConfig("binds", string.Join("|", bindings.ToArray()));
                        IBMi.RemConfig(treeView1.SelectedNode.Text);
                        treeView1.Nodes.Remove(treeView1.SelectedNode);
                    }
                }
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            List <string> bindings;

            if (validate())
            {
                IBMi.setConfig("CLBind", string.Join("|", generateCommands()));
                bindings = IBMi.getConfig("binds").Split('|').ToList();
                bindings.Add("CLBind");
                IBMi.setConfig("binds", string.Join("|", bindings.ToArray()));

                if (Main.bindsWindow != null)
                {
                    Main.bindsWindow.cmdBindings_Load();
                    Win32.SendMessage(PluginBase.nppData._nppHandle, NppMsg.NPPM_DMMSHOW, 0, Main.bindsWindow.Handle);
                }

                this.Close();
            }
        }
Esempio n. 5
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (RightClickedNode != null)
            {
                DialogResult result = MessageBox.Show("Are you sure you want to delete '" + RightClickedNode.Tag.ToString() + "'?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
                if (result == DialogResult.Yes)
                {
                    if (RightClickedNode.Nodes.Count == 0)
                    {
                        IBMi.DeleteFile(RightClickedNode.Tag.ToString());
                    }
                    else
                    {
                        IBMi.DeleteDir(RightClickedNode.Tag.ToString());
                    }

                    RightClickedNode.Remove();
                }
            }
        }
Esempio n. 6
0
        private void IFSBrowser_Load(object sender, EventArgs e)
        {
            Boolean  exists;
            TreeNode node;

            if (IBMi.IsConnected())
            {
                new Thread((ThreadStart) delegate
                {
                    foreach (string dir in DirList)
                    {
                        if (dir.Trim() == "")
                        {
                            continue;
                        }

                        exists = IBMi.DirExists(dir);
                        this.Invoke((MethodInvoker) delegate
                        {
                            if (exists)
                            {
                                node                    = new TreeNode(dir, new[] { new TreeNode("Loading..", 2, 2) });
                                node.Tag                = dir;
                                node.ImageIndex         = 0;
                                node.SelectedImageIndex = 0;
                                files.Nodes.Add(node);
                            }
                            else
                            {
                                files.Nodes.Add(new TreeNode("Directory '" + dir + "' was not located.", 3, 3));
                            }
                        });
                    }
                }).Start();
            }
            else
            {
                files.Nodes.Add(new TreeNode("IFS Browsing only works when connected to the remote system.", 3, 3));
            }
        }
Esempio n. 7
0
        private void files_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            string pathResult = "";
            bool   success    = false;

            if (e.Label == null)
            {
                return;
            }

            if (e.Label == e.Node.Text)
            {
                return;
            }

            if (e.Label == "")
            {
                e.CancelEdit = true;
                return;
            }

            if (e.Node.Nodes.Count > 0)
            {
                pathResult = IBMi.RenameDir(e.Node.Tag.ToString(), e.Label);
            }
            else
            {
                pathResult = IBMi.RenameFile(e.Node.Tag.ToString(), e.Label);
            }

            success = (e.Node.Tag.ToString() != pathResult);

            if (success)
            {
                e.Node.Tag = pathResult;
            }

            e.CancelEdit = !success;
        }
Esempio n. 8
0
        private void OpenMember(string Lib, string Obj, string Mbr, Boolean Editing)
        {
            Thread gothread = new Thread((ThreadStart) delegate {
                string resultFile = IBMiUtilities.DownloadMember(Lib, Obj, Mbr);
                if (Main.CommandWindow != null)
                {
                    Main.CommandWindow.loadNewOutput();
                }

                if (resultFile != "")
                {
                    NppFunctions.OpenFile(resultFile, !Editing);
                    OpenMembers.AddMember(IBMi.GetConfig("system"), resultFile, Lib, Obj, Mbr, Editing);
                }
                else
                {
                    MessageBox.Show("Unable to download member " + Lib + "/" + Obj + "." + Mbr + ". Please check it exists and that you have access to the remote system.");
                }
            });

            gothread.Start();
        }
Esempio n. 9
0
        private void generateSQLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FileSelect SelectFile = new FileSelect();

            SelectFile.ShowDialog();

            if (SelectFile.Success)
            {
                new Thread((ThreadStart) delegate {
                    IBMi.RemoteCommand(SelectFile.getCommand());
                    string resultFile = IBMiUtils.DownloadMember("QTEMP", "Q_GENSQL", "Q_GENSQL", "SQL");

                    if (resultFile != "")
                    {
                        this.Invoke((MethodInvoker) delegate
                        {
                            Editor.TheEditor.AddMemberEditor(new Member(resultFile, "QTEMP", "Q_GENSQL", "Q_GENSQL", "SQL", false), GetBoundLangType("SQL"));
                        });
                    }
                }).Start();
            }
        }
Esempio n. 10
0
        public Connection()
        {
            string password = "";

            InitializeComponent();

            systemInfo.Text = IBMi.GetSystem().Replace(". ", ".\n");

            host.Text = IBMi.CurrentSystem.GetValue("system");
            user.Text = IBMi.CurrentSystem.GetValue("username");

            password  = IBMi.CurrentSystem.GetValue("password");
            password  = Password.Decode(password);
            pass.Text = password;

            fetchJobLog.Checked = (IBMi.CurrentSystem.GetValue("fetchJobLog") == "true");

            dataConnectionType.SelectedItem = IBMi.CurrentSystem.GetValue("transferMode");
            ftpes.Checked = (Program.Config.GetValue("useFTPES") == "true");

            homeDir.Text  = IBMi.CurrentSystem.GetValue("homeDir");
            buildLib.Text = IBMi.CurrentSystem.GetValue("buildLib");

            selectedFont.SelectedItem = IBMi.CurrentSystem.GetValue("FONT");
            cur_size.Text             = IBMi.CurrentSystem.GetValue("ZOOM");
            indent_size.Value         = decimal.Parse(IBMi.CurrentSystem.GetValue("INDENT_SIZE"));
            show_spaces.Checked       = (IBMi.CurrentSystem.GetValue("SHOW_SPACES") == "true");
            highlight_line.Checked    = (IBMi.CurrentSystem.GetValue("HIGHLIGHT_CURRENT_LINE") == "true");
            conv_tabs.Checked         = (IBMi.CurrentSystem.GetValue("CONV_TABS") == "true");
            format_cl.Checked         = (IBMi.CurrentSystem.GetValue("CL_FORMAT_ON_SAVE") == "true");
            character_assist.Checked  = (IBMi.CurrentSystem.GetValue("CHARACTER_ASSIST") == "true");

            prntLib.Text = IBMi.CurrentSystem.GetValue("printerLib");
            prntObj.Text = IBMi.CurrentSystem.GetValue("printerObj");

            validACS.Checked = (Program.Config.GetValue("acspath") != "false");
            darkMode.Checked = (Program.Config.GetValue("darkmode") == "true");
        }
Esempio n. 11
0
        private void open_Click(object sender, EventArgs e)
        {
            stmfPath.Text = stmfPath.Text.Trim();

            if (stmfPath.Text == "")
            {
                MessageBox.Show("Path cannot be blank");
            }
            else
            {
                if (!IBMi.FileExists(stmfPath.Text))
                {
                    string filetemp = Path.Combine(IBMiUtils.GetLocalDir("IFS"), Path.GetFileName(stmfPath.Text));
                    File.Create(filetemp).Close();
                    result = new RemoteSource(filetemp, stmfPath.Text);
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Chosen path already exists.");
                }
            }
        }
Esempio n. 12
0
        public static void getErrors(string lib, string obj)
        {
            string filetemp = Path.GetTempFileName();

            List <string> commands = new List <string>();

            lib = lib.Trim().ToUpper();
            obj = obj.Trim().ToUpper();

            if (lib == "*CURLIB")
            {
                lib = IBMi.GetConfig("curlib");
            }

            commands.Add("ASCII");
            commands.Add("cd /QSYS.lib");
            commands.Add("recv \"" + lib + ".lib/EVFEVENT.file/" + obj + ".mbr\" \"" + filetemp + "\"");

            IBMi.RunCommands(commands.ToArray());

            ErrorHandle.doName(lib.ToUpper() + '/' + obj.ToUpper());
            ErrorHandle.setLines(File.ReadAllLines(filetemp));
        }
Esempio n. 13
0
        private void button2_Click(object sender, EventArgs e)
        {
            label2.Text = "";
            label2.Update();

            string s = "";

            foreach (string item in textBox1.Text.Trim().Split(','))
            {
                if (IBMiUtilities.IsValidQSYSObjectName(item.Trim()))
                {
                    s += item.Trim() + ',';
                }
                else
                {
                    label2.Text = "Invalid Library List Syntax. Valid syntax is < LIB,LIB,LIB >";
                    label2.Update();
                    return;
                }
            }

            if (IBMiUtilities.IsValidQSYSObjectName(textBox2.Text.Trim()))
            {
                IBMi.SetConfig("curlib", textBox2.Text.Trim()); //Remove last comma
            }
            else
            {
                label2.Text = "Invalid Current Library Syntax. Valid syntax is < LIB >";
                label2.Update();
                return;
            }

            IBMi.SetConfig("datalibl", s.Remove(s.Length - 1, 1)); //Remove last comma

            this.Close();
        }
Esempio n. 14
0
        public void wrkWithBind()
        {
            TreeNode curNode;

            editingCanceled = true;
            new wrkBind().ShowDialog();
            if (editingCanceled == false)
            {
                IBMi.SetConfig(editingBind, string.Join("|", editingBindCmds));

                if (bindings.Contains(editingBind))
                {
                    //Handled in wrkwithBind
                }
                else
                {
                    curNode     = treeView1.Nodes.Add(editingBind);
                    curNode.Tag = string.Join("|", editingBindCmds);

                    bindings.Add(editingBind);
                    IBMi.SetConfig("binds", string.Join("|", bindings.ToArray()));
                }
            }
        }
Esempio n. 15
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("Are you sure you want to delete all spool files of user " + IBMi.CurrentSystem.GetValue("username") + "? This process can take some time.", "Continue", MessageBoxButtons.YesNo, MessageBoxIcon.Hand);

            if (result == DialogResult.Yes)
            {
                Editor.TheEditor.SetStatus("Deleting all spool files..");
                new Thread((ThreadStart) delegate
                {
                    if (IBMi.RemoteCommand("DLTSPLF FILE(*SELECT)") == true)
                    {
                        this.Invoke((MethodInvoker) delegate
                        {
                            Editor.TheEditor.SetStatus("Spool files deleted.");
                            spoolList.Items.Clear();
                        });
                    }
                    else
                    {
                        MessageBox.Show("Failed to delete all spool files.");
                    }
                }).Start();
            }
        }
Esempio n. 16
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Trim() == "")
            {
                textBox1.Focus();
                return;
            }
            if (textBox2.Text.Trim() == "")
            {
                textBox2.Focus();
                return;
            }
            if (textBox3.Text.Trim() == "")
            {
                textBox3.Focus();
                return;
            }

            IBMi.SetConfig("system", textBox1.Text);
            IBMi.SetConfig("username", textBox2.Text);
            IBMi.SetConfig("password", textBox3.Text);

            this.Close();
        }
Esempio n. 17
0
        static void Main()
        {
            string promptedPassword = "";

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            HostSelect     Selector;
            PasswordPrompt Prompter;

            Directory.CreateDirectory(SYSTEMSDIR);
            Directory.CreateDirectory(SOURCEDIR);
            Directory.CreateDirectory(DUMPSDIR);

            Config = new Config(CONFIGFILE);
            Config.DoEditorDefaults();

            bool Connected = false;

            while (Connected == false)
            {
                Selector = new HostSelect();
                Application.Run(Selector);

                if (Selector.SystemSelected)
                {
                    if (IBMi.CurrentSystem.GetValue("password") == "")
                    {
                        Prompter = new PasswordPrompt(IBMi.CurrentSystem.GetValue("alias"), IBMi.CurrentSystem.GetValue("username"));
                        Prompter.ShowDialog();
                        if (Prompter.Success)
                        {
                            promptedPassword = Prompter.GetResult();
                        }
                    }

                    Connected = IBMi.Connect(Selector.OfflineModeSelected(), promptedPassword);

                    if (Connected)
                    {
                        if (Config.GetValue("srcdat_agreement") == "false")
                        {
                            MessageBox.Show("Thanks for using ILEditor. This is a notice to tell you that when editing source members, the SRCDAT value is not retained. This is due to a restriction in our connection method. By using ILEditor you agree to our LICENCE, found on the ILEditor GitHub repository. Please seek ILEditor GitHub issues for further information.", "ILEditor Notice", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Config.SetValue("srcdat_agreement", "true");
                            Config.SaveConfig();
                        }

                        try
                        {
                            Application.Run(new Editor());
                        }
                        catch (Exception e)
                        {
                            File.WriteAllText(Path.Combine(DUMPSDIR, DateTime.Now.ToFileTime() + ".txt"), e.ToString());
                            MessageBox.Show("There was an error. Crash dump created: " + DUMPSDIR);
                        }
                        IBMi.Disconnect();
                    }
                    else
                    {
                        //Basically, if it failed to connect when they're using FTPES - offer them a FTP connection
                        if (IBMi.CurrentSystem.GetValue("useFTPES") == "true")
                        {
                            MessageBox.Show("Failed to connect. Perhaps try disabling FTPES and then connecting again.", "Connection", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
                else
                {
                    Connected = true; //End loop and close
                }
            }
        }
Esempio n. 18
0
 public void UpdateSystemName()
 {
     toolStripLabel1.Text = IBMi.GetConfig("system");
     listView1.Clear();
 }
Esempio n. 19
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            HostSelect Selector;

            //Application.Run(new Splash());

            Directory.CreateDirectory(SYSTEMSDIR);
            Directory.CreateDirectory(SOURCEDIR);

            Config = new Config(CONFIGDIR);
            Config.DoEditorDefaults();

            bool Connected = false;

            while (Connected == false)
            {
                Selector = new HostSelect();
                Application.Run(Selector);

                if (Selector.SystemSelected)
                {
                    if (Password.Decode(IBMi.CurrentSystem.GetValue("password")) == "")
                    {
                        MessageBox.Show("ILEditor has been updated to encrypt local passwords. Please update your password in the Connection Settings.", "Password Update", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        new Connection().ShowDialog();
                    }

                    Connected = IBMi.Connect();

                    if (Connected)
                    {
                        Application.Run(new Editor());
                        IBMi.Disconnect();
                    }
                    else
                    {
                        //Basically, if it failed to connect when they're using FTPES - offer them a FTP connection
                        if (IBMi.CurrentSystem.GetValue("useFTPES") == "true")
                        {
                            DialogResult Result = MessageBox.Show("Would you like to try and connect again using a plain FTP connection? This will change the systems settings.", "Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (Result == DialogResult.Yes)
                            {
                                IBMi.CurrentSystem.SetValue("useFTPES", "false");
                                Connected = IBMi.Connect();
                                if (Connected)
                                {
                                    Application.Run(new Editor());
                                    IBMi.Disconnect();
                                }
                            }
                        }
                    }
                }
                else
                {
                    Connected = true; //End loop and close
                }
            }
        }
Esempio n. 20
0
 private void installRemote_Load(object sender, EventArgs e)
 {
     textBox1.Text = IBMi.GetConfig("installlib");
 }
Esempio n. 21
0
        public Editor()
        {
            InitializeComponent();
            TheEditor = this;

            MemberCache.Import();

            this.Text += ' ' + Program.getVersion() + " (" + IBMi.CurrentSystem.GetValue("alias") + ")";
            if (!IBMi.IsConnected())
            {
                this.Text += " - Offline Mode";
            }

            if (IBMi.IsConnected())
            {
                if (IBMi.CurrentSystem.GetValue("lastOffline") == "true")
                {
                    DialogResult result = MessageBox.Show("Looks like your last session was in Offline Mode. Would you like the launch the SPF Push tool?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

                    if (result == DialogResult.Yes)
                    {
                        new Forms.PushWindow().ShowDialog();
                    }
                }
            }

            IBMi.CurrentSystem.SetValue("lastOffline", (IBMi.IsConnected() == false).ToString().ToLower());

            DarkMode = (Program.Config.GetValue("darkmode") == "true");

            if (DarkMode)
            {
                dockingPanel.Theme = new VS2015DarkTheme();
            }
            else
            {
                dockingPanel.Theme = new VS2015BlueTheme();
            }

            ApplyControlTheme(toolStrip);
            ApplyControlTheme(menuStrip);
            ApplyControlTheme(statusStrip);

            if (File.Exists(Program.PanelsXML))
            {
                dockingPanel.LoadFromXml(Program.PanelsXML, new DeserializeDockContent(GetContentFromPersistString));
            }
            else
            {
                AddTool(new UserTools.UserToolList(), DockState.DockLeft, true);
            }

            AddTool(new UserTools.Welcome(), DockState.Document, true);

            OutlineView = new UserTools.OutlineView();
            Tasklist    = new UserTools.TaskList();

            AddTool(OutlineView, DockState.DockRightAutoHide, true);
            AddTool(Tasklist, DockState.DockBottomAutoHide, true);

            dockingPanel.ActiveContentChanged += DockingPanel_ActiveContentChanged;
        }
Esempio n. 22
0
        static void Main()
        {
            string promptedPassword = "";

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            HostSelect     Selector;
            PasswordPrompt Prompter;

            if (!Directory.Exists(APPDIR))
            {
                Directory.CreateDirectory(APPDIR);
                if (Directory.Exists(SYSTEMSDIR_Old))
                {
                    Directory.Move(SYSTEMSDIR_Old, SYSTEMSDIR);
                }

                if (File.Exists(CONFIGDIR_Old))
                {
                    File.Move(CONFIGDIR_Old, CONFIGFILE);
                }

                if (Directory.Exists(SOURCEDIR_Old))
                {
                    Directory.Move(SOURCEDIR_Old, SOURCEDIR);
                }
            }

            Directory.CreateDirectory(SYSTEMSDIR);
            Directory.CreateDirectory(SOURCEDIR);
            Directory.CreateDirectory(PROJDIR);

            Config = new Config(CONFIGFILE);
            Config.DoEditorDefaults();

            bool Connected = false;

            while (Connected == false)
            {
                Selector = new HostSelect();
                Application.Run(Selector);

                if (Selector.SystemSelected)
                {
                    if (IBMi.CurrentSystem.GetValue("password") == "")
                    {
                        Prompter = new PasswordPrompt(IBMi.CurrentSystem.GetValue("alias"), IBMi.CurrentSystem.GetValue("username"));
                        Prompter.ShowDialog();
                        if (Prompter.Success)
                        {
                            promptedPassword = Prompter.GetResult();
                        }
                    }

                    Connected = IBMi.Connect(Selector.OfflineModeSelected(), promptedPassword);

                    if (Connected)
                    {
                        Application.Run(new Editor());
                        IBMi.Disconnect();
                    }
                    else
                    {
                        //Basically, if it failed to connect when they're using FTPES - offer them a FTP connection
                        if (IBMi.CurrentSystem.GetValue("useFTPES") == "true")
                        {
                            DialogResult Result = MessageBox.Show("Would you like to try and connect again using a plain FTP connection? This will change the systems settings.", "Connection", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                            if (Result == DialogResult.Yes)
                            {
                                IBMi.CurrentSystem.SetValue("useFTPES", "false");
                                Connected = IBMi.Connect(false, promptedPassword);
                                if (Connected)
                                {
                                    Application.Run(new Editor());
                                    IBMi.Disconnect();
                                }
                            }
                        }
                    }
                }
                else
                {
                    Connected = true; //End loop and close
                }
            }
        }
Esempio n. 23
0
        public static void HandleTrigger(SCNotification Notification)
        {
            Thread     gothread;
            string     path = GetCurrentFileName();
            OpenMember member;

            switch (Notification.nmhdr.code)
            {
            case (uint)NppMsg.NPPN_READY:
                IntellisenseReady = true;
                break;

            case (uint)SciMsg.SCN_MODIFIED:
                if (IBMi.GetConfig("intellisense") == "true")
                {
                    if (IntellisenseReady)
                    {
                        gothread = new Thread((ThreadStart) delegate
                        {
                            Main.IntelliSenseWindow.LoadList(Intellisense.ParseLine());
                        });
                        gothread.Start();
                    }
                }
                break;

            case (uint)NppMsg.NPPN_FILEBEFOREOPEN:
                IntellisenseReady = false;
                break;

            case (uint)NppMsg.NPPN_FILEOPENED:
                gothread = new Thread((ThreadStart) delegate
                {
                    Intellisense.ScanFile();
                    IntellisenseReady = true;
                });
                gothread.Start();
                break;

            case (uint)NppMsg.NPPN_FILESAVED:
                member = OpenMembers.GetMember(path);
                if (member != null)
                {
                    gothread = new Thread((ThreadStart) delegate {
                        if (member.IsEditable())
                        {
                            if (member.GetSystemName() == IBMi.GetConfig("system"))
                            {
                                bool UploadResult = IBMiUtilities.UploadMember(member.GetLocalFile(), member.GetLibrary(), member.GetObject(), member.GetMember());
                                if (UploadResult == false)
                                {
                                    System.Windows.Forms.MessageBox.Show("Failed to upload to " + member.GetMember() + " on " + member.GetSystemName() + ".");
                                }
                            }
                            else
                            {
                                System.Windows.Forms.MessageBox.Show("Unable to upload to " + member.GetMember() + ". You must be connected to " + member.GetSystemName() + " in order to save this file.");
                            }
                            if (Main.CommandWindow != null)
                            {
                                Main.CommandWindow.loadNewOutput();
                            }
                        }
                    });
                    gothread.Start();
                }
                new Thread((ThreadStart) delegate
                {
                    Intellisense.ScanFile();
                }).Start();
                break;

            case (uint)NppMsg.NPPN_FILEBEFORECLOSE:
                if (OpenMembers.Contains(path))
                {
                    OpenMembers.RemoveMember(path);
                    File.Delete(path);
                }
                break;
            }
        }
Esempio n. 24
0
        private void update_Click(object sender, EventArgs e)
        {
            string        cmd = "", result = "";
            List <string> ModuleList         = new List <string>();
            List <string> BindingDirectories = new List <string>();

            foreach (ListViewItem item in modules.Items)
            {
                if (item.Checked)
                {
                    ModuleList.Add(item.Text);
                }
            }

            foreach (string item in customModules.Items)
            {
                ModuleList.Add(item);
            }

            foreach (string bnddir in bndDirs.Items)
            {
                BindingDirectories.Add(bnddir);
            }

            if (ModuleList.Count == 0)
            {
                ModuleList.Add("*NONE");
            }

            if (isSrvPgm)
            {
                cmd = "UPDSRVPGM SRVPGM(" + pgm.Text + ") MODULE(" + String.Join(" ", ModuleList) + ")";
                if (updSrvSrc.Checked)
                {
                    cmd += " EXPORT(*CURRENT)";
                }
                else
                {
                    cmd += " EXPORT(*SRCFILE)";
                    cmd += " SRCFILE(" + bndLib.Text + "/" + bndSpf.Text + ")";
                    cmd += " SRCMBR(" + bndMbr.Text + ")";
                }
            }
            else
            {
                cmd = "UPDPGM PGM(" + pgm.Text + ") MODULE(" + String.Join(" ", ModuleList) + ")";
            }

            if (BindingDirectories.Count > 0)
            {
                cmd += " BNDDIR(" + String.Join(" ", BindingDirectories) + ")";
            }

            actgrp.Text = actgrp.Text.Trim();
            if (actgrp.Text != "" && actgrp.Text != "*SAME")
            {
                cmd += " ACTGRP(" + actgrp.Text + ")";
            }

            result = IBMi.RemoteCommandResponse(cmd);

            if (result == "")
            {
                Editor.TheEditor.SetStatus(pgm.Text + " updated successfully.");
                this.Close();
            }
            else
            {
                MessageBox.Show(result, "Error");
            }
        }
Esempio n. 25
0
 private void userSettings_Load(object sender, EventArgs e)
 {
     textBox1.Text = IBMi.GetConfig("system");
     textBox2.Text = IBMi.GetConfig("username");
     textBox3.Text = IBMi.GetConfig("password");
 }
Esempio n. 26
0
        private void create_Click(object sender, EventArgs e)
        {
            Boolean isValid = true;
            string  Command = "", Local;

            if (!IBMiUtils.IsValueObjectName(lib.Text))
            {
                isValid = false;
            }
            if (!IBMiUtils.IsValueObjectName(spf.Text))
            {
                isValid = false;
            }
            if (!IBMiUtils.IsValueObjectName(mbr.Text))
            {
                isValid = false;
            }

            if (isValid)
            {
                _lib  = lib.Text.Trim();
                _spf  = spf.Text.Trim();
                _mbr  = mbr.Text.Trim();
                _type = (type.Text.Trim() == "" ? "*NONE" : type.Text.Trim());
                if (IBMi.IsConnected())
                {
                    _text = (text.Text.Trim() == "" ? "*BLANK" : "'" + text.Text.Trim() + "'");

                    Command = "ADDPFM FILE(" + _lib + "/" + _spf + ") MBR(" + _mbr + ") TEXT(" + _text + ") SRCTYPE(" + _type + ")";
                    if (IBMi.RemoteCommand(Command)) //No error
                    {
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Member not created.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
                else
                {
                    if (_type == "*NONE")
                    {
                        _type = "";
                    }
                    Local = IBMiUtils.GetLocalFile(_lib, _spf, _mbr, _type);

                    if (!File.Exists(Local))
                    {
                        File.Create(Local).Close();
                        created = true;
                        this.Close();
                    }
                    else
                    {
                        MessageBox.Show("Local member not created as already exists.", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    }
                }
            }
            else
            {
                MessageBox.Show("Provided member information not valid.", "Invalid member.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Esempio n. 27
0
 private void libraryList_Load(object sender, EventArgs e)
 {
     textBox1.Text = IBMi.GetConfig("datalibl");
     textBox2.Text = IBMi.GetConfig("curlib");
 }
Esempio n. 28
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            if (!IBMiUtils.IsValueObjectName(objectName.Text))
            {
                MessageBox.Show("Object name is not valid.");
                objectName.Focus();
                return;
            }
            if (objectType.Text == "")
            {
                MessageBox.Show("Object type is not valid.");
                objectType.Focus();
                return;
            }
            if (IBMiUtils.IsValueObjectName(objectLib.Text) == false && objectLib.Text != "*LIBL")
            {
                MessageBox.Show("Object library name is not valid.");
                objectLib.Focus();
                return;
            }
            if (objectActivation.Text == "")
            {
                MessageBox.Show("Object activation is not valid.");
                objectType.Focus();
                return;
            }

            BindingEntry Entry = new BindingEntry();

            Entry.BindingLib   = Library;
            Entry.BindingObj   = Object;
            Entry.Name         = objectName.Text.Trim();
            Entry.Library      = objectLib.Text.Trim();
            Entry.Type         = objectType.Text;
            Entry.Activation   = objectActivation.Text;
            Entry.CreationDate = "";
            Entry.CreationTime = "";

            string command  = "ADDBNDDIRE BNDDIR(" + Library + "/" + Object + ") OBJ((" + Entry.Library + "/" + Entry.Name + " " + Entry.Type + " " + Entry.Activation + "))";
            Thread gothread = new Thread((ThreadStart) delegate
            {
                if (IBMi.RunCommands(new string[1] {
                    command
                }) == false)
                {
                    ListViewItem Item = new ListViewItem(new string[6] {
                        Entry.Name, Entry.Type, Entry.Library, Entry.Activation, Entry.CreationDate, Entry.CreationTime
                    });
                    Item.Tag = Entry;
                    this.Invoke((MethodInvoker) delegate
                    {
                        entriesList.Items.Add(Item);
                    });
                }
                else
                {
                    MessageBox.Show("Unable to create binding entry.");
                }
            });

            gothread.Start();
        }
Esempio n. 29
0
        private void pushButton_Click(object sender, EventArgs e)
        {
            string        LocalFile;
            List <string> Commands = new List <string>();
            Dictionary <string, string> PushList = new Dictionary <string, string>();

            string[] Path;

            if (runCommands.Checked)
            {
                foreach (var Member in CreateSPFs)
                {
                    Commands.Add("CRTSRCPF FILE(" + lib.Text.Trim() + "/" + Member.Key + ") RCDLEN(" + Member.Value.ToString() + ")");
                }

                foreach (string Member in DeleteMembers)
                {
                    Path = Member.Split('/');
                    Commands.Add("RMVM FILE(" + lib.Text.Trim() + "/" + Path[0] + ") MBR(" + Path[1] + ")");
                }

                foreach (var Member in CreateMembers)
                {
                    Path = Member.Key.Trim().Split('/');
                    Commands.Add("ADDPFM FILE(" + lib.Text.Trim() + "/" + Path[0] + ") MBR(" + Path[1] + ") SRCTYPE(" + Member.Value.Trim() + ")");
                }
            }

            foreach (ListViewItem Member in memberLog.Items)
            {
                if (Member.Checked)
                {
                    Path      = Member.Text.Trim().Split('/');
                    LocalFile = IBMiUtils.GetLocalFile(lib.Text.Trim(), Path[0], Path[1], UploadMembers[Path[0] + '/' + Path[1]]);
                    PushList.Add(LocalFile, "/QSYS.lib/" + lib.Text.Trim() + ".lib/" + Path[0] + ".file/" + Path[1] + ".mbr");
                }
            }

            Boolean Success = IBMi.RunCommands(Commands.ToArray());

            if (Success)
            {
                foreach (var File in PushList)
                {
                    if (IBMi.UploadFile(File.Key, File.Value) == false)
                    {
                        Success = false;
                    }
                }

                if (Success)
                {
                    MessageBox.Show("Push to server was successful.");
                    MemberCache.EditsClear();
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Push to server was not successful (stage 2)");
                }
            }
            else
            {
                MessageBox.Show("Push to server was not successful (stage 1)");
            }
        }
Esempio n. 30
0
 public openMember()
 {
     InitializeComponent();
     textBox4.Text     = IBMi.GetConfig("system");
     checkBox1.Checked = true;
 }