Example #1
0
        internal SharedFileSummary(_SharedFile data)
            : base(data.id)
        {
            TypeName = data.type;
            switch (TypeName)
            {
                case "file": Type = SharedFileType.File; break;
                case "directory": Type = SharedFileType.Directory; break;
                default:
                    throw new ArgumentException($"unsupported file type: {Type}");
            }

            Dir = data.dir;
            Name = data.name;
            Size = data.size;
            Creator = (data.createdUser != null) ? new UserSummary(data.createdUser) : null;
            Created = data.created;
            LastUpdated = data.updated;
            LastUpdater = (data.updatedUser != null) ? new UserSummary(data.updatedUser) : null;
        }
Example #2
0
        internal SharedFile(_SharedFile data, Project project)
            : base(data.id)
        {
            Project = project;

            TypeName = data.type;
            switch (TypeName)
            {
                case "file": Type = SharedFileType.File; break;
                case "directory": Type = SharedFileType.Directory; break;
                default:
                    throw new ArgumentException($"unsupported file type: {Type}");
            }

            Dir = data.dir;
            Name = data.name;
            Size = data.size;
            Creator = project.Client.ItemsCache.Update(data.createdUser?.id, () => new User(data.createdUser, project.Client));
            Created = data.created;
            LastUpdated = data.updated;
            LastUpdater = project.Client.ItemsCache.Update(data.updatedUser?.id, () => new User(data.updatedUser, project.Client));
        }
Example #3
0
 internal SharedFile(_SharedFile data, Wikipage wikipage)
     : this(data, wikipage.Project)
 {
     _wikipage = wikipage;
 }