コード例 #1
0
        public MemFSFile(string path, MemFSDir parent)
        {
            if (parent != null && !parent.GetRoot())
            {
                _path = parent.GetPath() + "/" + path;
            }
            else if (parent != null && parent.GetRoot())
            {
                if (parent.GetPath().EndsWith("/"))
                {
                    _path = parent.GetPath() + path;
                }
                else
                {
                    _path = parent.GetPath() + "/" + path;
                }
            }
            else
            {
                _path = path;
            }

            _parent  = parent;
            _reading = new ConcurrentDictionary <ObservableMemoryStream, ObservableMemoryStream>();
            _writing = new ConcurrentDictionary <ObservableMemoryStream, ObservableMemoryStream>();
            _data    = new MemoryStream();
        }
コード例 #2
0
        public MemFSDir(string path, MemFSDir parent)
        {
            if (parent != null && !parent.GetRoot())
            {
                _path = parent.GetPath() + "/" + path;
            }
            else if (parent != null && parent.GetRoot())
            {
                if (parent.GetPath().EndsWith("/"))
                {
                    _path = parent.GetPath() + path;
                }
                else
                {
                    _path = parent.GetPath() + "/" + path;
                }
            }
            else
            {
                _path = path;
            }

            _parent      = parent;
            _directories = new List <Dir422>();
            _files       = new List <File422>();
        }
コード例 #3
0
        public override Dir422 CreateDir(string dirName)
        {
            if (!CheckValidName(dirName))
            {
                return(null);
            }

            Dir422 newDir = GetDir(dirName);

            if (newDir == null)
            {
                newDir = new MemFSDir(dirName, this);
                _directories.Add(newDir);
            }

            return(newDir);
        }
コード例 #4
0
 public MemoryFileSystem()
 {
     Root = new MemFSDir("/", null);
     Root.SetRoot(true);
 }