Example #1
0
        public override void CopyFrom(EntityBase entity)
        {
            base.CopyFrom(entity);
            LogicFileInfoData sourceEntity = entity as LogicFileInfoData;

            if (sourceEntity != null)
            {
                this.LogicFileName        = sourceEntity.LogicFileName;
                this.LogicFileExt         = sourceEntity.LogicFileExt;
                this.LatestPhysicalFileID = sourceEntity.LatestPhysicalFileID;
                this.IsReadOnly           = sourceEntity.IsReadOnly;
                this.LogicFileStatus      = sourceEntity.LogicFileStatus;
            }
        }
Example #2
0
 protected internal void SetParent(LogicFileInfoData logicFileInfo)
 {
     _logicFileInfo = logicFileInfo;
 }
Example #3
0
        /// <summary>
        /// 判断是否存在对应的文件。
        /// </summary>
        /// <param name="logicFileID"></param>
        /// <param name="version"></param>
        /// <returns></returns>
        public static bool FileExists(Guid logicFileID, int version, IRemoteFileStorage proxy)
        {
            LogicFileInfoData logicFileInfo = GetFileInfo(logicFileID, version, proxy);

            return(logicFileInfo != null);
        }
Example #4
0
            internal void Initialize(RemoteStreamContext context)
            {
                __Error.CheckNullReference(context, "context");
                if (context.FileID == Guid.Empty)
                {
                    __Error.InvalidateFileID();
                }
                _context = context;
                _proxy   = CreateServiceProxy(context);
                //Stopwatch w = new Stopwatch();
                //w.Start();
                _itemResult = FileManager.OpenFile(context, _proxy);
                //w.Stop();
                //Console.WriteLine("Open File execute times:" + w.ElapsedMilliseconds);
                //_logicFileInfo = FileManager.GetFileInfo(context.FileID, context.Version);
                if (context.FileMode == FileMode.None)
                {
                    __Error.InvalidateFileMode();
                }

                FileAccess access = context.FileAccess;

                if (FileMode.Truncate == context.FileMode)
                {
                    access = FileAccess.Write;
                }

                LogicFileInfoData logicFileInfo = LogicFileInfo;

                if (logicFileInfo == null)
                {
                    if (context.FileMode == FileMode.Open ||
                        context.FileMode == FileMode.Append ||
                        context.FileMode == FileMode.Truncate)
                    {
                        __Error.NotExistsFileID(context.FileID);
                    }
                }

                if (logicFileInfo != null)
                {
                    if (logicFileInfo.ReadOnly && this._canWrite)
                    {
                        __Error.FileReadOnly(context.FileID);
                    }

                    if (context.FileMode == FileMode.CreateNew)
                    {
                        __Error.ExistsFileID(context.FileID);
                    }
                }

                this._canRead  = (access & FileAccess.Read) != 0;
                this._canWrite = (access & FileAccess.Write) != 0;

                PhysicalFileInfoData physicalFileInfo = this.PhysicalFileInfo;

                if (physicalFileInfo != null)
                {
                    this._fileLength = physicalFileInfo.FileLength;
                }

                if (context.FileMode == FileMode.Append)
                {
                    _origin = _fileLength;
                }
            }
Example #5
0
 public PhysicalFileInfoDataCollection(LogicFileInfoData owner)
 {
     _owner = owner;
 }