Ejemplo n.º 1
0
        public DropBoxItemModel(DropBoxProfile profile, DropNet.Models.MetaData metadata,
                                string parentFullPath = null)
            : base(profile)
        {
            //A list of GetPropertyValue - https://www.dropbox.com/developers/core/docs#metadata-details
            Metadata = metadata;
            if (parentFullPath == null)
            {
                base.FullPath = base.Label = base.Name = profile.Alias;
            }
            else
            {
                base.FullPath = profile.Path.Combine(parentFullPath, metadata.Name);
                base.Label    = base.Name = metadata.Name;
            }
            this.RemotePath  = profile.ConvertRemotePath(base.FullPath);
            this.IsDirectory = metadata.Is_Dir;

            this._isRenamable = true;
            if (!this.IsDirectory)
            {
                long size = 0;
                if (long.TryParse(metadata.Size, out size))
                {
                    this.Size = size;
                }
            }

            //this.CreationTimeUtc = DateTime.MinValue;
            this.LastUpdateTimeUtc = metadata.UTCDateModified;

            this.Description = IsDirectory ? "Directory" :
                               System.IO.Tools.FileTypeInfoProvider
                               .GetFileTypeInfo(profile.Path.GetExtension(Name)).FileType;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// For temporary file.
 /// </summary>
 /// <param name="profile"></param>
 /// <param name="name"></param>
 /// <param name="parentFullPath"></param>
 internal DropBoxItemModel(DropBoxProfile profile, string name,
                           string parentFullPath)
     : base(profile)
 {
     base.FullPath   = profile.Path.Combine(parentFullPath, name);
     base.Label      = base.Name = name;
     this.RemotePath = profile.ConvertRemotePath(this.FullPath);
 }