Esempio n. 1
0
        public static string DownloadMember(string Lib, string Obj, string Mbr, DDMStreamCallbackAdaptor adaptor, string Ext = "")
        {
            if (Lib == "*CURLIB")
            {
                Lib = IBMi.CurrentSystem.GetValue("curlib");
            }
            string filetemp = GetLocalFile(Lib, Obj, Mbr, Ext);

            if (IBMi.IsConnected())
            {
                if (IBMi.DownloadFile(filetemp, "/QSYS.lib/" + Lib + ".lib/" + Obj + ".file/" + Mbr + ".mbr",
                                      adaptor) == false)
                {
                    return(filetemp);
                }
                else
                {
                    return("");
                }
            }
            else
            {
                Editor.TheEditor.SetStatus("Fetching existing local member.");
                if (File.Exists(filetemp))
                {
                    return(filetemp);
                }
                else
                {
                    return("");
                }
            }
        }
Esempio n. 2
0
 //Returns false if successful
 public static bool DownloadFile(string Local, string Remote, DDMStreamCallbackAdaptor adaptor = null)
 {
     if (useDDM)
     {
         return(IBMDDMi.DownloadFile(Local, Remote, adaptor));
     }
     else
     {
         return(IBMFTPi.DownloadFile(Local, Remote));
     }
 }
Esempio n. 3
0
        public static bool DownloadFile(string Local, string Remote, DDMStreamCallbackAdaptor callback)
        {
            bool Result = false;

            try
            {
                if (ClientDDM != null && !ClientDDM.isClosed())
                {
                    string[] parts      = Remote.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);
                    string   remotelib  = parts[1].Replace(".lib", "");
                    string   remotefile = parts[2].Replace(".file", "");
                    string   remotembr  = parts[3].Replace(".mbr", "");

                    DDMRecordFormat remotefmt = ClientDDM.getRecordFormat(remotelib, remotefile);
                    if (remotefmt != null)
                    {
                        DDMFile remote = ClientDDM.open(remotelib, remotefile, remotembr, remotefmt.getName());
                        if (remote != null)
                        {
                            // Open local file and pass to Reader
                            StreamWriter sw = new StreamWriter(Local, false, Encoding.ASCII);
                            callback.Format = remotefmt;
                            callback.Writer = sw;
                            while (!callback.isDone())
                            {
                                ClientDDM.readNext(remote, callback);
                            }
                            ClientDDM.close(remote);
                            sw.Close();
                        }
                    }
                }
                else
                {
                    return(true); //error
                }
            }
            catch (Exception e)
            {
                Result = true;
            }

            return(Result);
        }