public BaseFile(BaseFolder ParentFolder, FileMetaInfo MetaFile) { this.ParentFolder = ParentFolder; this.Name = MetaFile.Name; RelativePath = Path.Combine(ParentFolder.RelativePath, Name); MetaPath = Path.Combine(ParentFolder.MetaPath, Name); RealPath = Path.Combine(ParentFolder.RealPath, Name); _meta = MetaFile; _meta.ParenFile = this; MetaFile.Save(); }
public override void BeforeSend() { base.BeforeSend(); Meta = srcFile.meta; }
/// <summary> /// Add file by metafileinfo /// </summary> /// <param name="ParentFolder">Direactory to move new file</param> /// <param name="MetaFile">new file meta information</param> /// <returns></returns> public BaseFile AddFile(BaseFolder ParentFolder, FileMetaInfo MetaFile, FSObjectEvents FileEventType) { // if (ReadOnly) return null; lock (ParentFolder.FS) { var metapath = Path.Combine(ParentFolder.MetaPath, MetaFile.Name); if (File.Exists(metapath)) throw new Exception(string.Format("Файл \"{0}\" уже существует!", metapath));// return null; var f = new BaseFile(ParentFolder, MetaFile); ParentFolder.Files.Add(f); //add to files if (_OnFileEvent != null) _OnFileEvent(f, FileEventType); return f; } }
internal void UpdateMeta(FileMetaInfo Meta,bool remote) { _meta = Meta; _meta.ParenFile = this; _meta.Save(); if (OnFileEvent != null) OnFileEvent(this, remote?FSObjectEvents.remote_changed:FSObjectEvents.local_changed); }