public void AddFile(ZippedFile zippedFile) { _files[zippedFile.Name.GetName()] = zippedFile; }
public void AddFile(ZippedFile zipfile) { _files.Add(zipfile.Name.GetName(), zipfile); }
void parseFile(ZipInputStream input,ZipEntry entry) { var name = entry.FileName.Split('/'); if (name.Length == 1) // a file { byte[] data = input.ReadToEnd(); Trace.WriteLine("Read: " + data.Length + " bytes"); var fn = FileName.GetFileName(Name, name[0]); AddFile(new ZippedFile(fn, data)); } else { var first = name.First(); var parent = new ZippedDirectory(DirectoryName.GetDirectoryName(Name, first), this); AddDirectory(parent); var rest = name.Skip(1).Take(name.Length - 2); var queue = new Queue<string>(rest); foreach (var item in queue) { var dir = new ZippedDirectory(DirectoryName.GetDirectoryName(parent.Name, item), parent); parent.AddDirectory(dir); parent = dir; } var file = name.Last(); byte[] data = input.ReadToEnd(); Trace.WriteLine("Read: " + data.Length + " bytes"); //neds to be added var zipfile = new ZippedFile(FileName.GetFileName(parent.Name, file), data); parent.AddFile(zipfile); } }