コード例 #1
0
        public static bool UploadMember(string Local, string Lib, string Obj, string Mbr)
        {
            List <string> commands = new List <string>();

            Lib = Lib.ToUpper();
            Obj = Obj.ToUpper();
            Mbr = Mbr.ToUpper();

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

            commands.Add("ASCII");
            commands.Add("cd /QSYS.lib");
            commands.Add("put \"" + Local + "\" \"" + Lib + ".lib/" + Obj + ".file/" + Mbr + ".mbr\"");

            //Returns true if successful
            return(!IBMi.RunCommands(commands.ToArray()));
        }
コード例 #2
0
        public static string[] GetMemberList(string Lib, string Obj)
        {
            List <string> commands = new List <string>();

            Lib = Lib.ToUpper();
            Obj = Obj.ToUpper();

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

            commands.Add("cd /QSYS.lib/" + Lib + ".lib/" + Obj + ".file");
            commands.Add("ls");

            if (IBMi.RunCommands(commands.ToArray()) == false)
            {
                return(IBMi.GetListing());
            }
            else
            {
                return(null);
            }
        }
コード例 #3
0
        public static Boolean RunCommands(string[] list)
        {
            Boolean result = true;

            try
            {
                FlushOutput();
                string tempfile = Path.GetTempFileName();
                File.Move(tempfile, tempfile + ".ftp");
                tempfile += ".ftp";
                List <string> lines = new List <string>();

                lines.Add("user " + _config["username"]);
                lines.Add(_config["password"]);
                lines.Add("bin");

                lines.Add($"QUOTE RCMD CHGLIBL LIBL({ IBMi.GetConfig("datalibl").Replace(',', ' ')})  CURLIB({ IBMi.GetConfig("curlib") })");
                foreach (string cmd in list)
                {
                    if (cmd == null)
                    {
                        continue;
                    }
                    if (cmd.Trim() != "")
                    {
                        AddOutput("> " + cmd);
                        IBMiUtilities.DebugLog("Collecting command for ftp file: " + cmd);
                        lines.Add(cmd);
                    }
                }
#if DEBUG
                lines.Add("QUOTE RCMD DSPJOBLOG");
#endif
                lines.Add("quit");

                File.WriteAllLines(tempfile, lines.ToArray());
                result = RunFTP(tempfile);
                File.Delete(tempfile);
            }
            catch (Exception e)
            {
                IBMiUtilities.Log(e.ToString());
                MessageBox.Show(e.ToString());
            }

            return(result);
        }
コード例 #4
0
ファイル: Config.cs プロジェクト: ymurata1967/IBMiCmd
 public static void SwitchToConfig(string Config)
 {
     IBMi.LoadConfig(Main.SystemsDirectory + Config + ".cfg", Config);
     File.WriteAllText(Main.ConfigDirectory + "dftcfg", Config);
 }
コード例 #5
0
        internal static string[] RenderFFDCollectionScript(List <SourceLine> src, string[] tmp)
        {
            IBMiUtilities.DebugLog("RenderFFDCollectionScript");
            string[] cmd = new string[(src.Count * 3) + 2];
            int      i = 0, t = 0;

            // Run commands on remote
            cmd[i++] = "ASCII";
            cmd[i++] = $"QUOTE RCMD CHGLIBL LIBL({ IBMi.GetConfig("datalibl").Replace(',', ' ')})  CURLIB({ IBMi.GetConfig("curlib") })";
            foreach (SourceLine sl in src)
            {
                cmd[i++] = $"QUOTE RCMD { IBMi.GetConfig("installlib") }/IICDSPFFD { sl.searchResult }";
                cmd[i++] = $"RECV /home/{ IBMi.GetConfig("username") }/{ sl.searchResult }.tmp \"{ tmp[t++] }\"";
                cmd[i++] = $"QUOTE RCMD RMVLNK OBJLNK('/home/{ IBMi.GetConfig("username") }/{ sl.searchResult }.tmp')";
            }

            IBMiUtilities.DebugLog("RenderFFDCollectionScript - DONE!");
            return(cmd);
        }
コード例 #6
0
        internal static string[] RenderCommandDescriptionCollection(string command)
        {
            IBMiUtilities.DebugLog("RenderCommandDescriptionCollection");
            string[] cmd = new string[5];
            // Run commands on remote
            int i = 0;

            cmd[i++] = "ASCII";
            cmd[i++] = $"QUOTE RCMD CHGLIBL LIBL({ IBMi.GetConfig("datalibl").Replace(',', ' ')}) CURLIB({ IBMi.GetConfig("curlib") })";
            cmd[i++] = $"QUOTE RCMD { IBMi.GetConfig("installlib") }/IICRTVCMD {command}";
            cmd[i++] = $"RECV /home/{ IBMi.GetConfig("username") }/{ command }.cdml \"{ Main.FileCacheDirectory }{ command }.cdml\"";
            cmd[i]   = $"QUOTE RCMD RMVLNK OBJLNK('/home/{ IBMi.GetConfig("username") }/{ command }.cdml')";

            IBMiUtilities.DebugLog("RenderCommandDescriptionCollection - DONE!");
            return(cmd);
        }