Ejemplo n.º 1
0
        private void m_ftpc_DataSocketConnectedSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
        {
            _Log("20", "...connected! (" + e.ClientCommand.ToString() + ")", false);

            //MUST NOT!!!
            //this.Dispatcher.BeginInvoke(() => { ReceiveData20( ); });
        }
Ejemplo n.º 2
0
        private void m_ftpc_ServerResponseSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
        {
            _Log("21", e.ServerResponse);

            m_ftpc.DispatchResponse(e.ClientCommand, e.ServerResponse);

            if (svrPanel.Visibility == Rsc.Collapsed)
            {
                svrPanel.Visibility = Rsc.Visible;
            }

            if (svrAddr.Text.ToString().Trim().Length == 0)
            {
                string sAddr = m_ftpc.UserName;
                if (sAddr.Length > 0)
                {
                    sAddr += "@";
                }
                sAddr       += m_ftpc.IPAddress + ":" + m_ftpc.Port.ToString();
                svrAddr.Text = sAddr;
            }
            if (svrTit.Text.ToString().Trim().Length == 0)
            {
                svrTit.Text = m_ftpc.ServerTitle;
            }
        }
Ejemplo n.º 3
0
        private void m_ftpc_ServerDataSentSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
        {
            _Log("20", "...sent!", false);

            prsBarData.Visibility = Rsc.Collapsed;

            /*
             * On Wm6.5 end of sent data has been lost!
             * Possible FIX!!!
             *
             * THIS IS!!!
             */
            m_ftpc.CloseDataSocket(e.ClientCommand);
        }
Ejemplo n.º 4
0
        private void m_ftpc_CommandDoneSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
        {
            m_txtRemotePath.Text = m_ftpc.WorkingDirectory;

            string sLog = "";

            if (e.ClientCommand != null)
            {
                sLog = "DONE! - " + e.ClientCommand.ToString() + " ("
                       + e.ClientCommand.ResponseCountArrived.ToString( ) + " / " + e.ClientCommand.ResponseCount.ToString( ) + ")";
            }

            //Last command executed (with error / success)...
            _Log("", sLog, false);
        }
Ejemplo n.º 5
0
        private void m_ftpc_ProgressSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
        {
            if (e.ProgressPos >= e.ProgressMax)
            {
                return;
            }

            prsBarData.Maximum = e.ProgressMax;
            prsBarData.Minimum = 0;
            prsBarData.Value   = e.ProgressPos;

            prsBarData.Visibility = Rsc.Visible;

            m_AppFrame.UpdateAppMemInfo();

            _RefreshStatusText();
        }
Ejemplo n.º 6
0
        private void m_ftpc_LogSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
        {
            //KNOWN BUG!!!
            if (e.Message == "unkLISTresLEN")
            {
                m_AppFrame.TRACE = "file\r\nLIST\r\nloss";
            }

            string sLog = "";

            if (e.ClientCommand != null)
            {
                sLog = e.Message + "\r\n" + e.ClientCommand.ToString() + " ("
                       + e.ClientCommand.ResponseCountArrived.ToString( ) + " / " + e.ClientCommand.ResponseCount.ToString( ) + ")";
            }

            //Last command executed (with error / success)...
            _Log("", "Log: " + sLog, false);
        }
Ejemplo n.º 7
0
 private void m_ftpc_ProgressAsync(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
 {
     this.Dispatcher.BeginInvoke(() => { m_ftpc_ProgressSYNC(sender, e); });
 }
Ejemplo n.º 8
0
 private void m_ftpc_DataSocketClosingSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
 {
     _Log("20", "Closing...", false);
 }
Ejemplo n.º 9
0
 private void m_ftpc_DataSocketClosingAsync(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
 {
     this.Dispatcher.BeginInvoke(() => { m_ftpc_DataSocketClosingSYNC(sender, e); });
 }
Ejemplo n.º 10
0
        private void m_ftpc_ServerDataReceivedSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
        {
            if (!e.ServerData.ParseOk)
            {
                _Log("20", "<DATA ERROR> " + e.ClientCommand.ToString( ), false);
            }
            else
            {
                switch (e.ClientCommand.Command)
                {
                case "LIST":
                {
                    prsBarData.Visibility = Rsc.Collapsed;

                    int iCount;
                    RscFtpServerDataItemFileInfo fi;

                    iCount = e.ServerData.Count;

                    if (iCount == 0)
                    {
                        _Log("20", e.ClientCommand.Command + " returned 0 item.", false, true);
                    }
                    else
                    {
                        for (int i = 0; i < iCount; i++)
                        {
                            fi = (RscFtpServerDataItemFileInfo)e.ServerData.GetItem(i);

                            _Log("20", fi.GetItemTitle( ), false, true, fi);
                        }
                    }

                    break;
                }

                case "RETR":
                {
                    prsBarData.Visibility = Rsc.Collapsed;

                    _Log("20", e.ClientCommand.Command + " returned " +
                         e.ClientCommand.DataSize.ToString() + " bytes.", false, true);

                    if (e.ClientCommand.HasMemStream)
                    {
                        string sPath = e.ClientCommand.Arg1;
                        int    iPos  = sPath.LastIndexOf(m_ftpc.BackSlashInPath);
                        string sFn   = sPath;
                        if (iPos >= 0)
                        {
                            sFn = sPath.Substring(iPos + m_ftpc.BackSlashInPath.Length);
                        }

                        _Log("20", e.ClientCommand.Command + " saving local file '" +
                             sFn + "'.", false, true);

                        RscStore store = new RscStore();

                        string sLocalPath = "A:\\FTP";
                        if (!store.FolderExists(sLocalPath))
                        {
                            store.CreateFolder(sLocalPath);
                        }
                        sLocalPath += "\\" + sFn;
                        if (store.FileExists(sLocalPath))
                        {
                            store.DeleteFile(sLocalPath);
                        }

                        System.IO.Stream stream = store.CreateFile(sLocalPath);
                        e.ServerData.MemStream.WriteTo(stream);
                        e.ServerData.MemStream.Close();
                        stream.Close();
                    }

                    break;
                }
                }
            }
        }
Ejemplo n.º 11
0
 private void m_ftpc_ServerDataReceivedAsync(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
 {
     this.Dispatcher.BeginInvoke(() => { m_ftpc_ServerDataReceivedSYNC(sender, e); });
 }
Ejemplo n.º 12
0
 private void m_ftpc_CommandSentSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
 {
     m_ftpc.ReadServerResponse(e.ClientCommand);
 }
Ejemplo n.º 13
0
 private void m_ftpc_CommandSocketConnectedSYNC(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
 {
     _Log("21", "...connected!", false);
     m_ftpc.ReadServerResponse(e.ClientCommand);
 }
Ejemplo n.º 14
0
 private void m_ftpc_CommandSocketConnectedAsync(object sender, Ressive.FTP.RscFtpCommandEventArgs e)
 {
     this.Dispatcher.BeginInvoke(() => { m_ftpc_CommandSocketConnectedSYNC(sender, e); });
 }