Ejemplo n.º 1
0
 public bool WriteToFile(FileStructure structure, string outFilePath)
 {
     if (structure != null)
     {
         var loc = structure.Location;
         return(fManager.WriteToFile(loc, outFilePath, structure.Hash, LEN));
     }
     return(false);
 }
        public void ChangeFile(int id, FileStructure fileStructure)
        {
            if (GetFileStructure(id) == null)
            {
                return;
            }

            files[id] = fileStructure;
            IsChenged = true;
        }
        public void CreateFile(int id, int parent, string name, long location, string hash, Dictionary <string, string> additionals = null)
        {
            var fileStructure = new FileStructure
            {
                Id       = id,
                Parent   = parent,
                Name     = name,
                Location = location,
                Hash     = hash,
            };

            if (additionals != null)
            {
                fileStructure.Additional = new Dictionary <string, string>();
                var zip = additionals.Keys.Zip(additionals.Values, (_key, _value) => new { key = _key, value = _value });
                foreach (var val in zip)
                {
                    fileStructure.Additional.Add(val.key, val.value);
                }
            }

            CreateFile(fileStructure);
        }
 public void CreateFile(FileStructure fileStructure)
 {
     files.Add(fileStructure.Id, fileStructure);
     NextFileId++;
     IsChenged = true;
 }