Example #1
0
        private bool CreateFile()
        {
            if (!this.ftpLoggedIn_flag)
            {
                return(false);
            }

            DTC_request_file df = new DTC_request_file();

            df.up_down_ReqTP = FTPrequestType.Input;
            df.DTCfunc       = DTCfunction.OSOLPR;
            string upFile_name = "'" + df.Get_FTP_fileName() + "'";

            df.up_down_ReqTP   = FTPrequestType.Output;
            this.downFile_name = "'" + df.Get_FTP_fileName() + "'";

            Stream sm  = df.Get_FTP_fileContent_inStream();
            long   len = this.remoteSource.UploadFile(upFile_name, sm);

            if (len >= 0)
            {
                this.errLog.Add("Upload success", "(size: " + len + ")");
                return(true);
            }
            else
            {
                this.errLog.Add("Upload fail", len.ToString());
                return(false);
            }
        }
Example #2
0
        private void createFile_button_Click(object sender, RoutedEventArgs e)
        {
            this.df = new DTC_request_file();
            this.df.up_down_ReqTP    = FTPrequestType.Input;
            this.df.DTCfunc          = DTCfunction.OSOLPR;
            this.upFile_textBox.Text = "'" + this.df.Get_FTP_fileName() + "'";

            this.df.up_down_ReqTP      = FTPrequestType.Output;
            this.downFile_textBox.Text = "'" + this.df.Get_FTP_fileName() + "'";

            if (this.out_textBox.IsChecked == true)
            {
                FileStream fs     = new FileStream(@"C:\Users\SHuang\Desktop\uploaded.txt", FileMode.Create);
                byte[]     buffer = df.Get_FTP_fileContent_inBytes();
                fs.Write(buffer, 0, buffer.Length);
                fs.Close();
            }
        }