Example #1
0
        public bool Exists(string fpath)
        {
            this.Assert(!string.IsNullOrEmpty(fpath));
            if (fpath.StartsWith("/"))
            {
                fpath = fpath.TrimStart('/');
            }

            bool exists = false;

            try
            {
                exists = _webCache.Contains(fpath);
                if (!exists)
                {
                    //if (File.Exists(_pkgLocation))
                    if (Path.IsPathRooted(_pkgLocation))
                    {
                        using (FileStream fs = new FileStream(_pkgLocation, FileMode.Open, FileAccess.Read, FileShare.Read))
                            exists = ZipStream.IsExists(fs, fpath);
                    }
                    else
                    {
                        var assembly = System.Reflection.Assembly.GetEntryAssembly();
                        var rs       = assembly.GetManifestResourceStream(_pkgLocation);
                        exists = ZipStream.IsExists(rs, fpath);
                    }
                }
            }
            catch (Exception ex) { TraceLog.WriteException(ex); throw; }
            return(exists);
        }