当前位置: 首页>>代码示例>>C#>>正文


C# FtpClient.ChangeDir方法代码示例

本文整理汇总了C#中FtpClient.ChangeDir方法的典型用法代码示例。如果您正苦于以下问题:C# FtpClient.ChangeDir方法的具体用法?C# FtpClient.ChangeDir怎么用?C# FtpClient.ChangeDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FtpClient的用法示例。


在下文中一共展示了FtpClient.ChangeDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Process

        public override ProcessResult Process()
        {
            ProcessResult res = new ProcessResult();
            res.ErrorCode = 0;
            Bitmap bmp = null;
            Graphics graph = null;
            FtpClient ftpClient = null;
            try
            {
                bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
                graph = Graphics.FromImage(bmp);
                graph.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
                FileName = string.Format("zrzut_{0}-{1}-{2}_{3}.jpg", DateTime.Now.Year.ToString(), DateTime.Now.Month.ToString(), DateTime.Now.Day.ToString(), DateTime.Now.Ticks.ToString());
                bmp.Save(FileName, ImageFormat.Jpeg);
                     ftpClient = new FtpClient(FTPSettings.ServerAddress, FTPSettings.User, FTPSettings.Password);
                     ftpClient.ChangeDir(FTPSettings.Directory);
                ftpClient.Upload(FileName);
                System.IO.File.Delete(FileName);

            }
            catch (Exception exc)
            {
                res.ErrorCode = 5;
                res.ErrorDetails = exc.ToString();
            }
            finally
            {
                if (ftpClient != null)
                ftpClient.Close();
                if (graph != null)
                graph.Dispose();
                if (bmp != null)
                bmp.Dispose();
            }
            return res;
        }
开发者ID:macper,项目名称:MWRWebRemoter,代码行数:36,代码来源:MakeScreenshootTask.cs

示例2: CopyFileToFTP

 private ProcessResult CopyFileToFTP()
 {
     ProcessResult pr = new ProcessResult();
     FtpClient ftpClient = null;
     pr.ErrorCode = 3;
     try
     {
         if (!File.Exists(RequestedObjectPath))
         {
             pr.ErrorDetails = "Plik " + RequestedObjectPath + " nie istnieje";
             return pr;
         }
         ftpClient = new FtpClient(FTPSettings.ServerAddress, FTPSettings.User, FTPSettings.Password);
         ftpClient.ChangeDir(FTPSettings.Directory);
         ftpClient.Upload(RequestedObjectPath);
         pr.ErrorCode = 0;
     }
     catch (Exception exc)
     {
         pr.ErrorDetails = exc.ToString();
     }
     finally
     {
         try
         {
             if (ftpClient != null)
             {
                 ftpClient.Close();
             }
         }
         catch { }
     }
     return pr;
 }
开发者ID:macper,项目名称:MWRWebRemoter,代码行数:34,代码来源:FileManageTask.cs

示例3: CopyFileFromFTP

 private ProcessResult CopyFileFromFTP()
 {
     ProcessResult pr = new ProcessResult();
     FtpClient ftpClient = null;
     pr.ErrorCode = 3;
     try
     {
         ftpClient = new FtpClient(FTPSettings.ServerAddress, FTPSettings.User, FTPSettings.Password);
         ftpClient.ChangeDir(FTPSettings.Directory);
         ftpClient.Download(RequestedObjectPath, DestinationObjectPath);
         pr.ErrorCode = 0;
     }
     catch (Exception exc)
     {
         pr.ErrorDetails = exc.ToString();
     }
     finally
     {
         try
         {
             if (ftpClient != null)
             {
                 ftpClient.Close();
             }
         }
         catch { }
     }
     return pr;
 }
开发者ID:macper,项目名称:MWRWebRemoter,代码行数:29,代码来源:FileManageTask.cs


注:本文中的FtpClient.ChangeDir方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。