Beispiel #1
0
        public virtual NT_STATUS ReadDirectory(UserContext userContext, MTPFileContext fileContext)
        {
            foreach (FSItem child in Children)
            {
                fileContext.Items.Add(child.GetDirectoryContext());
            }

            return(NT_STATUS.OK);
        }
Beispiel #2
0
        public virtual NT_STATUS Create(UserContext userContext, string name, SearchFlag searchFlag, FileMode fileMode, FileAccess fileAccess, FileShare fileShare, FileAttributes attributes, out MTPFileContext fileContext)
        {
            if (IsDirectory)
            {
                fileContext = new MTPFileContext(this);

                return(NT_STATUS.OK);
            }

            fileContext = null;
            return(NT_STATUS.NOT_IMPLEMENTED);
        }
Beispiel #3
0
        public override NT_STATUS Create(UserContext userContext, string name, SearchFlag searchFlag, FileMode fileMode, FileAccess fileAccess, FileShare fileShare, FileAttributes attributes, out MTPFileContext fileContext)
        {
            if (!IsDirectory)
            {
                if (fileMode == FileMode.Open)
                {
                    fileContext = new MTPFileContext(this);

                    using (BinaryReader reader = new BinaryReader(_content.OpenRead()))
                    {
                        _data = reader.ReadBytes((int)_content.Size);
                    }

                    return(NT_STATUS.OK);
                }
                else
                {
                    fileContext = null;
                    return(NT_STATUS.NOT_IMPLEMENTED);
                }
            }

            return(base.Create(userContext, name, searchFlag, fileMode, fileAccess, fileShare, attributes, out fileContext));
        }