Ejemplo n.º 1
0
        /// <summary>
        /// 获取指定标志的数据
        /// </summary>
        /// <param name="identityName">数据标志号</param>
        /// <returns>如果存在该数据则返回,否则为null。</returns>
        public IDataItem GetData(string identityName)
        {
            string tarPath = Path.Combine(BaseDirectory, identityName.Replace('/', '\\').Trim('\\'));

            if (!File.Exists(tarPath))
            {
                tarPath += "\\" + FS_DIRDAT;
                if (!File.Exists(tarPath))
                {
                    throw new NullReferenceException("指定标识数据[" + identityName + "]在存储系统中不存在!");
                }
            }
            return(FileWrapHelper.UnWrapObject(File.ReadAllBytes(tarPath)) as IDataItem);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 相关属性数据绑定
        /// </summary>
        public override void DataBind()
        {
            string tarFile = (IsContainer) ? IdentityName + "\\" + FileSystemStorage.FS_DIRDAT : IdentityName;

            tarFile = tarFile.Replace('/', '\\');
            if (!File.Exists(tarFile))
            {
                return;
            }

            byte[]        diskDat = File.ReadAllBytes(tarFile);
            LocalFileData fDat    = FileWrapHelper.UnWrapObject(diskDat) as LocalFileData;

            if (fDat != null)
            {
                this.Alias               = fDat.Alias;
                this.IsContainer         = fDat.IsContainer;
                this.CreateDateTimeUTC   = fDat.CreateDateTimeUTC;
                this.ModifiedDateTimeUTC = fDat.ModifiedDateTimeUTC;
                this.Name    = fDat.Name;
                this.RawData = fDat.RawData;
            }
        }