• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Nfs3FileHandle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Nfs3FileHandle的典型用法代码示例。如果您正苦于以下问题:C# Nfs3FileHandle类的具体用法?C# Nfs3FileHandle怎么用?C# Nfs3FileHandle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Nfs3FileHandle类属于命名空间,在下文中一共展示了Nfs3FileHandle类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Nfs3FileStream

        public Nfs3FileStream(Nfs3Client client, Nfs3FileHandle handle, FileAccess access)
        {
            _client = client;
            _handle = handle;
            _access = access;

            _length = _client.GetAttributes(_handle).Size;
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:8,代码来源:Nfs3FileStream.cs


示例2: Nfs3MountResult

 internal Nfs3MountResult(XdrDataReader reader)
 {
     FileHandle = new Nfs3FileHandle(reader);
     int numAuthFlavours = reader.ReadInt32();
     AuthFlavours = new List<int>(numAuthFlavours);
     for (int i = 0; i < numAuthFlavours; ++i)
     {
         AuthFlavours.Add(reader.ReadInt32());
     }
 }
开发者ID:marinehero,项目名称:ThinkAway.net,代码行数:10,代码来源:Nfs3MountResult.cs


示例3: Nfs3Client

        public Nfs3Client(string address, RpcCredentials credentials, string mountPoint)
        {
            _rpcClient = new RpcClient(address, credentials);
            _mountClient = new Nfs3Mount(_rpcClient);
            _rootHandle = _mountClient.Mount(mountPoint).FileHandle;

            _nfsClient = new Nfs3(_rpcClient);

            Nfs3FileSystemInfoResult fsiResult = _nfsClient.FileSystemInfo(_rootHandle);
            _fsInfo = fsiResult.FileSystemInfo;
            _cachedAttributes = new Dictionary<Nfs3FileHandle, Nfs3FileAttributes>();
            _cachedAttributes[_rootHandle] = fsiResult.PostOpAttributes;
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:13,代码来源:Nfs3Client.cs


示例4: Nfs3DirectoryEntry

 public Nfs3DirectoryEntry(XdrDataReader reader)
 {
     FileId = reader.ReadUInt64();
     Name = reader.ReadString();
     Cookie = reader.ReadUInt64();
     if (reader.ReadBool())
     {
         FileAttributes = new Nfs3FileAttributes(reader);
     }
     if (reader.ReadBool())
     {
         FileHandle = new Nfs3FileHandle(reader);
     }
 }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:14,代码来源:Nfs3DirectoryEntry.cs


示例5: Nfs3LookupResult

        public Nfs3LookupResult(XdrDataReader reader)
        {
            Status = (Nfs3Status)reader.ReadInt32();
            if (Status == Nfs3Status.Ok)
            {
                ObjectHandle = new Nfs3FileHandle(reader);
                if (reader.ReadBool())
                {
                    ObjectAttributes = new Nfs3FileAttributes(reader);
                }
            }

            if (reader.ReadBool())
            {
                DirAttributes = new Nfs3FileAttributes(reader);
            }
        }
开发者ID:JGTM2016,项目名称:discutils,代码行数:17,代码来源:Nfs3LookupResult.cs


示例6: Nfs3CreateResult

        public Nfs3CreateResult(XdrDataReader reader)
        {
            Status = (Nfs3Status)reader.ReadInt32();
            if (Status == Nfs3Status.Ok)
            {
                if (reader.ReadBool())
                {
                    FileHandle = new Nfs3FileHandle(reader);
                }
                if (reader.ReadBool())
                {
                    FileAttributes = new Nfs3FileAttributes(reader);
                }
            }

            CacheConsistency = new Nfs3WeakCacheConsistency(reader);
        }
开发者ID:joconno4,项目名称:MediaPortal-2,代码行数:17,代码来源:Nfs3CreateResult.cs


示例7: Access

        public Nfs3AccessPermissions Access(Nfs3FileHandle handle, Nfs3AccessPermissions requested)
        {
            Nfs3AccessResult result = _nfsClient.Access(handle, requested);

            if (result.ObjectAttributes != null)
            {
                _cachedAttributes[handle] = result.ObjectAttributes;
            }

            if (result.Status == Nfs3Status.Ok)
            {
                return result.Access;
            }
            else
            {
                throw new Nfs3Exception(result.Status);
            }
        }
开发者ID:JGTM2016,项目名称:discutils,代码行数:18,代码来源:Nfs3Client.cs


示例8: GetAttributes

        public Nfs3FileAttributes GetAttributes(Nfs3FileHandle handle)
        {
            Nfs3FileAttributes result;
            if (_cachedAttributes.TryGetValue(handle, out result))
            {
                return result;
            }

            Nfs3GetAttributesResult getResult = _nfsClient.GetAttributes(handle);

            if (getResult.Status == Nfs3Status.Ok)
            {
                _cachedAttributes[handle] = getResult.Attributes;
                return getResult.Attributes;
            }
            else
            {
                throw new Nfs3Exception(getResult.Status);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:20,代码来源:Nfs3Client.cs


示例9: Rename

        public void Rename(Nfs3FileHandle fromDirHandle, string fromName, Nfs3FileHandle toDirHandle, string toName)
        {
            Nfs3RenameResult result = _nfsClient.Rename(fromDirHandle, fromName, toDirHandle, toName);

            _cachedAttributes[fromDirHandle] = result.FromDirCacheConsistency.After;
            _cachedAttributes[toDirHandle] = result.ToDirCacheConsistency.After;
            if (result.Status != Nfs3Status.Ok)
            {
                throw new Nfs3Exception(result.Status);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:11,代码来源:Nfs3Client.cs


示例10: RemoveDirectory

        public void RemoveDirectory(Nfs3FileHandle dirHandle, string name)
        {
            Nfs3ModifyResult result = _nfsClient.RemoveDirectory(dirHandle, name);

            _cachedAttributes[dirHandle] = result.CacheConsistency.After;
            if (result.Status != Nfs3Status.Ok)
            {
                throw new Nfs3Exception(result.Status);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:10,代码来源:Nfs3Client.cs


示例11: MakeDirectory

        public Nfs3FileHandle MakeDirectory(Nfs3FileHandle dirHandle, string name, Nfs3SetAttributes attributes)
        {
            Nfs3CreateResult result = _nfsClient.MakeDirectory(dirHandle, name, attributes);

            if (result.Status == Nfs3Status.Ok)
            {
                _cachedAttributes[result.FileHandle] = result.FileAttributes;
                return result.FileHandle;
            }
            else
            {
                throw new Nfs3Exception(result.Status);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:14,代码来源:Nfs3Client.cs


示例12: Write

        public int Write(Nfs3FileHandle fileHandle, long position, byte[] buffer, int offset, int count)
        {
            Nfs3WriteResult result = _nfsClient.Write(fileHandle, position, buffer, offset, count);

            _cachedAttributes[fileHandle] = result.CacheConsistency.After;

            if (result.Status == Nfs3Status.Ok)
            {
                return result.Count;
            }
            else
            {
                throw new Nfs3Exception(result.Status);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:15,代码来源:Nfs3Client.cs


示例13: Read

        public Nfs3ReadResult Read(Nfs3FileHandle fileHandle, long position, int count)
        {
            Nfs3ReadResult result = _nfsClient.Read(fileHandle, position, count);

            if (result.FileAttributes != null)
            {
                _cachedAttributes[fileHandle] = result.FileAttributes;
            }

            if (result.Status == Nfs3Status.Ok)
            {
                return result;
            }
            else
            {
                throw new Nfs3Exception(result.Status);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:18,代码来源:Nfs3Client.cs


示例14: Lookup

        public Nfs3FileHandle Lookup(Nfs3FileHandle dirHandle, string name)
        {
            Nfs3LookupResult result = _nfsClient.Lookup(dirHandle, name);

            if (result.ObjectAttributes != null && result.ObjectHandle != null)
            {
                _cachedAttributes[result.ObjectHandle] = result.ObjectAttributes;
            }

            if (result.DirAttributes != null)
            {
                _cachedAttributes[dirHandle] = result.DirAttributes;
            }

            if (result.Status == Nfs3Status.Ok)
            {
                return result.ObjectHandle;
            }
            else if (result.Status == Nfs3Status.NoSuchEntity)
            {
                return null;
            }
            else
            {
                throw new Nfs3Exception(result.Status);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:27,代码来源:Nfs3Client.cs


示例15: Write

        public Nfs3WriteResult Write(Nfs3FileHandle handle, long position, byte[] buffer, int bufferOffset, int count)
        {
            MemoryStream ms = new MemoryStream();
            XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, 7);
            handle.Write(writer);
            writer.Write(position);
            writer.Write(count);
            writer.Write((int)0); // UNSTABLE
            writer.WriteBuffer(buffer, bufferOffset, count);

            RpcReply reply = DoSend(ms);
            if (reply.Header.IsSuccess)
            {
                return new Nfs3WriteResult(reply.BodyReader);
            }
            else
            {
                throw new RpcException(reply.Header.ReplyHeader);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:20,代码来源:Nfs3.cs


示例16: GetDirectory

        private Nfs3FileHandle GetDirectory(Nfs3FileHandle parent, string[] dirs)
        {
            if (dirs == null)
            {
                return parent;
            }

            Nfs3FileHandle handle = parent;
            for (int i = 0; i < dirs.Length; ++i)
            {
                handle = _client.Lookup(handle, dirs[i]);

                if (handle == null || _client.GetAttributes(handle).Type != Nfs3FileType.Directory)
                {
                    throw new DirectoryNotFoundException();
                }
            }

            return handle;
        }
开发者ID:JGTM2016,项目名称:discutils,代码行数:20,代码来源:NfsFileSystem.cs


示例17: DoSearch

        private void DoSearch(List<string> results, Nfs3FileHandle dir, string path, Regex regex, bool subFolders, bool dirs, bool files)
        {
            foreach (Nfs3DirectoryEntry de in _client.ReadDirectory(dir, true))
            {
                if (de.Name == "." || de.Name == "..")
                {
                    continue;
                }

                bool isDir = de.FileAttributes.Type == Nfs3FileType.Directory;

                if ((isDir && dirs) || (!isDir && files))
                {
                    string searchName = (de.Name.IndexOf('.') == -1) ? de.Name + "." : de.Name;

                    if (regex.IsMatch(searchName))
                    {
                        results.Add(Utilities.CombinePaths(path, de.Name));
                    }
                }

                if (subFolders && isDir)
                {
                    DoSearch(results, de.FileHandle, Utilities.CombinePaths(path, de.Name), regex, subFolders, dirs, files);
                }
            }
        }
开发者ID:JGTM2016,项目名称:discutils,代码行数:27,代码来源:NfsFileSystem.cs


示例18: Access

        public Nfs3AccessResult Access(Nfs3FileHandle handle, Nfs3AccessPermissions requested)
        {
            MemoryStream ms = new MemoryStream();
            XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, 4);
            handle.Write(writer);
            writer.Write((int)requested);

            RpcReply reply = DoSend(ms);
            if (reply.Header.IsSuccess)
            {
                return new Nfs3AccessResult(reply.BodyReader);
            }
            else
            {
                throw new RpcException(reply.Header.ReplyHeader);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:17,代码来源:Nfs3.cs


示例19: Rename

        public Nfs3RenameResult Rename(Nfs3FileHandle fromDirHandle, string fromName, Nfs3FileHandle toDirHandle, string toName)
        {
            MemoryStream ms = new MemoryStream();
            XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, 14);
            fromDirHandle.Write(writer);
            writer.Write(fromName);
            toDirHandle.Write(writer);
            writer.Write(toName);

            RpcReply reply = DoSend(ms);
            if (reply.Header.IsSuccess)
            {
                return new Nfs3RenameResult(reply.BodyReader);
            }
            else
            {
                throw new RpcException(reply.Header.ReplyHeader);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:19,代码来源:Nfs3.cs


示例20: RemoveDirectory

        public Nfs3ModifyResult RemoveDirectory(Nfs3FileHandle dirHandle, string name)
        {
            MemoryStream ms = new MemoryStream();
            XdrDataWriter writer = StartCallMessage(ms, _client.Credentials, 13);
            dirHandle.Write(writer);
            writer.Write(name);

            RpcReply reply = DoSend(ms);
            if (reply.Header.IsSuccess)
            {
                return new Nfs3ModifyResult(reply.BodyReader);
            }
            else
            {
                throw new RpcException(reply.Header.ReplyHeader);
            }
        }
开发者ID:AnotherAltr,项目名称:Rc.Core,代码行数:17,代码来源:Nfs3.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Nikse类代码示例发布时间:2022-05-24
下一篇:
C# NextAction类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap