예제 #1
0
        private void btnMkD_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            DateTime dNow = DateTime.Now;

            m_bLastFileIsFolder = true;
            string sFile = dNow.Year.ToString() +
                           "_" + RscUtils.pad60(dNow.Month) + "_" +
                           RscUtils.pad60(dNow.Day) + "_" + RscUtils.pad60(dNow.Hour) +
                           "_" + RscUtils.pad60(dNow.Minute) + "_" +
                           RscUtils.pad60(dNow.Second) + NationalChrsToTestFileNames;

            SetLastFile(sFile, true);

            RscFtpClientCommand cmd = RscFtpClientCommand.CreateFolder(sFile);

            _Log("21", cmd.ToString());

            m_ftpc.SendCommandToServer(cmd);
        }
예제 #2
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            if (m_AppArgs.Waiting)
            {
                RscPageArgsRet appOutput = m_AppArgs.GetOutput();
                if (appOutput != null)
                {
                    switch (appOutput.ID)
                    {
                    case "FtpHost":
                        txSvrIP.Text = appOutput.GetData(0);
                        LoadFromReg();
                        break;

                    case "txNewFolder":
                    {
                        if (appOutput.GetFlag(0) == "Ok")
                        {
                            m_bLastFileIsFolder = true;
                            string sFile = appOutput.GetData(0);
                            SetLastFile(sFile, true);

                            RscFtpClientCommand cmd = RscFtpClientCommand.CreateFolder(sFile);

                            _Log("21", cmd.ToString());

                            m_ftpc.SendCommandToServer(cmd);
                        }
                        break;
                    }

                    case "BrowseForFile_MEM":
                    {
                        if (appOutput.GetFlag(0) == "Ok")
                        {
                            string sFilePath = appOutput.GetData(0);

                            string sFile = RscStore.FileOfPath(sFilePath);

                            RscStore store = new RscStore();

                            System.IO.Stream stream = store.GetReaderStream(sFilePath);

                            SetLastFile(sFile, false, stream.Length);
                            System.IO.MemoryStream ms = new System.IO.MemoryStream((int)stream.Length);
                            stream.CopyTo(ms);
                            stream.Close();
                            ms.Seek(0, System.IO.SeekOrigin.Begin);

                            RscFtpClientCommand cmd = RscFtpClientCommand.UploadBin(sFile, ms);

                            _SendAutoPASV(cmd);
                        }
                        else
                        {
                            //NOP...
                        }

                        m_AppArgs.Vipe();

                        break;
                    }

                    case "BrowseForFile_FLE":
                    {
                        if (appOutput.GetFlag(0) == "Ok")
                        {
                            string sFilePath = appOutput.GetData(0);

                            string sFile = RscStore.FileOfPath(sFilePath);

                            RscStore store = new RscStore();

                            System.IO.Stream stream = store.GetReaderStream(sFilePath);

                            SetLastFile(sFile, false, stream.Length);

                            /*
                             * MemoryStream ms = new MemoryStream((int) stream.Length);
                             * stream.CopyTo(ms);
                             * stream.Close();
                             * ms.Seek(0, SeekOrigin.Begin);
                             */

                            RscFtpClientCommand cmd = RscFtpClientCommand.UploadBin(sFile, null, stream);

                            _SendAutoPASV(cmd);
                        }
                        else
                        {
                            //NOP...
                        }

                        m_AppArgs.Vipe();

                        break;
                    }
                    }
                }

                m_AppArgs.Clear();
            }
        }