예제 #1
0
        public Entry CreateEntry(string dir, string name)
        {
            ExceptionContext.Check(!Disposed);

            Flush();

            string pathEnt;
            string pathTemp;

            GetPath(out pathEnt, out pathTemp, dir, name, true);
            if (PathMap.ContainsKey(pathEnt))
            {
                throw ExceptionContext.ExceptParam(nameof(name), "Duplicate entry: '{0}'", pathEnt);
            }
            else
            {
                PathMap.Add(pathEnt, pathTemp);
            }

            Stream stream;

            if (pathTemp != null)
            {
                stream = new FileStream(pathTemp, FileMode.CreateNew);
            }
            else
            {
                stream = new MemoryStream();
            }

            return(AddEntry(pathEnt, stream));
        }