public void AddDirectory(ZippedDirectory dir)
        {
            if(!_directories.ContainsKey(dir.Name.GetName()))
                _directories.Add(dir.Name.GetName(), dir);

            //possible dir merge?
        }
 public void AddDirectory(ZippedDirectory dir)
 {
     _directories.Add(dir.Name.GetName(), dir);
 }
        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);
            }
        }