コード例 #1
0
        public TestOutcome GetFile(string path)
        {
            TestOutcome outcome = new TestOutcome();

            outcome.moduleName = "Folders";
            outcome.methodName = "FolderDownload";
            try
            {
                FoldersApi foldersApi    = new FoldersApi(_url);
                string     fileName      = path + @"/" + "file";
                string     localfilename = "World-" + System.DateTime.Now.ToString("G", CultureInfo.CreateSpecificCulture("en-US")).Replace('/', '-').Replace(':', '_').Replace(' ', '_') + ".png";
                localfilename = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), localfilename);
                Stream downloadedFile = foldersApi.FolderDownload(_session.SessionId, fileName);
                using (FileStream localFile = File.Create(localfilename))

                {
                    downloadedFile.CopyTo(localFile);
                }
                outcome.outcome = "Success";
                return(outcome);
            }
            catch (Exception ex)
            {
                outcome.outcome = ex.Message;
                return(outcome);
            }
        }