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


C# IActivityIOOperationsEndPoint.Put方法代码示例

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


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

示例1: CreateFile

        bool CreateFile(IActivityIOOperationsEndPoint dst, Dev2CRUDOperationTO args)
        {

            var result = true;

            var tmp = CreateTmpFile();
            using(Stream s = new MemoryStream(File.ReadAllBytes(tmp)))
            {

                if(dst.Put(s, dst.IOPath, args, null, _filesToDelete) < 0)
                {
                    result = false;
                }

                s.Close();
            }

            return result;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:19,代码来源:Dev2ActivityIOBroker.cs

示例2: MoveTmpFileToDestination

        string MoveTmpFileToDestination(IActivityIOOperationsEndPoint dst, string tmp, string result)
        {
            using(Stream s = new MemoryStream(File.ReadAllBytes(tmp)))
            {
                Dev2CRUDOperationTO newArgs = new Dev2CRUDOperationTO(true);

                //MO : 22-05-2012 : If the file doesnt exist then create the file
                if(!dst.PathExist(dst.IOPath))
                {
                    CreateEndPoint(dst, newArgs, true);
                }
                if(dst.Put(s, dst.IOPath, newArgs, null, _filesToDelete) < 0)
                {
                    result = ResultBad;
                }
            }
            return result;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:18,代码来源:Dev2ActivityIOBroker.cs

示例3: Copy

        public string Copy(IActivityIOOperationsEndPoint src, IActivityIOOperationsEndPoint dst,
                           Dev2CRUDOperationTO args)
        {
            string status;
            try
            {
                status = ValidateCopySourceDestinationFileOperation(src, dst, args, () =>
                    {
                        if(src.RequiresLocalTmpStorage())
                        {
                            if(dst.PathIs(dst.IOPath) == enPathType.Directory)
                            {
                                dst.IOPath.Path = dst.Combine(GetFileNameFromEndPoint(src));
                            }

                            using(var s = src.Get(src.IOPath, _filesToDelete))
                            {

                                // for flips sake quite putting short-hand notation in-line it causes bugs!!! ;)
                                dst.Put(s, dst.IOPath, args, Path.IsPathRooted(src.IOPath.Path) ? Path.GetDirectoryName(src.IOPath.Path) : null, _filesToDelete);
                                s.Close();
                                s.Dispose();
                            }
                        }
                        else
                        {
                            var sourceFile = new FileInfo(src.IOPath.Path);
                            if(dst.PathIs(dst.IOPath) == enPathType.Directory)
                            {
                                dst.IOPath.Path = dst.Combine(sourceFile.Name);
                            }

                            using(var s = src.Get(src.IOPath, _filesToDelete))
                            {
                                if(sourceFile.Directory != null)
                                {
                                    dst.Put(s, dst.IOPath, args, sourceFile.Directory.ToString(), _filesToDelete);
                                }
                            }
                        }
                        return ResultOk;
                    });
            }
            finally
            {
                _filesToDelete.ForEach(RemoveTmpFile);
            }
            return status;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:49,代码来源:Dev2ActivityIOBroker.cs

示例4: TransferTempZipFileToDestination

        string TransferTempZipFileToDestination(IActivityIOOperationsEndPoint src,
                                                        IActivityIOOperationsEndPoint dst, Dev2ZipOperationTO args,
                                                        string tmpZip)
        {
            // now transfer the zip file to the correct location
            string result;
            using(Stream s2 = new MemoryStream(File.ReadAllBytes(tmpZip)))
            {
                // add archive name to path
                dst =
                    ActivityIOFactory.CreateOperationEndPointFromIOPath(
                        ActivityIOFactory.CreatePathFromString(dst.IOPath.Path, dst.IOPath.Username,
                                                               dst.IOPath.Password, true, dst.IOPath.PrivateKeyFile));

                var zipTransferArgs = new Dev2CRUDOperationTO(args.Overwrite);

                result = ResultOk;

                if(src.RequiresLocalTmpStorage())
                {
                    if(dst.Put(s2, dst.IOPath, zipTransferArgs, null, _filesToDelete) < 0)
                    {
                        result = ResultBad;
                    }
                }
                else
                {
                    var fileInfo = new FileInfo(src.IOPath.Path);
                    if(fileInfo.Directory != null && Path.IsPathRooted(fileInfo.Directory.ToString()))
                    {
                        if(dst.Put(s2, dst.IOPath, zipTransferArgs, fileInfo.Directory.ToString(), _filesToDelete) < 0)
                        {
                            result = ResultBad;
                        }
                    }
                    else
                    {
                        if(dst.Put(s2, dst.IOPath, zipTransferArgs, null, _filesToDelete) < 0)
                        {
                            result = ResultBad;
                        }
                    }
                }
            }
            return result;
        }
开发者ID:Robin--,项目名称:Warewolf,代码行数:46,代码来源:Dev2ActivityIOBroker.cs


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