示例#1
0
        internal RemoteFile(RemoteDirectory parent, SharedFileListing listing)
        {
            m_Parent = parent;

            m_Name = listing.Name;
            UpdateFromInfo(listing);
        }
示例#2
0
        internal void UpdateFromInfo(SharedDirectoryInfo info)
        {
            var newDirectories = new RemoteDirectory[info.Directories.Length];

            for (var x = 0; x < info.Directories.Length; x++)
            {
                var dir = (RemoteDirectory)GetSubdirectory(info.Directories[x]);
                if (dir == null)
                {
                    dir = new RemoteDirectory(core, PathUtil.Join(m_FullPath, info.Directories[x]));
                }
                newDirectories[x] = dir;
            }

            var newFiles = new RemoteFile[info.Files.Length];

            for (var x = 0; x < info.Files.Length; x++)
            {
                var file = (RemoteFile)GetFile(info.Files[x].Name);
                if (file == null)
                {
                    file = new RemoteFile(this, info.Files[x]);
                }
                else
                {
                    file.UpdateFromInfo(info.Files[x]);
                }
                newFiles[x] = file;
            }

            m_SubDirectories = newDirectories;
            m_Files          = newFiles;

            m_State = RemoteDirectoryState.ContentsReceived;
        }
示例#3
0
        internal RemoteDirectory CreateSubdirectory(string name)
        {
            var dir = new RemoteDirectory(core, PathUtil.Join(m_FullPath, name));

            var newDirectories = new RemoteDirectory[m_SubDirectories.Length + 1];

            Array.Copy(m_SubDirectories, newDirectories, m_SubDirectories.Length);
            newDirectories[newDirectories.Length - 1] = dir;

            m_SubDirectories = newDirectories;

            return(dir);
        }