Esempio n. 1
0
 protected bool FileExists(string file)
 {
     if (!this.IsZippedTemplate)
     {
         return(Microsoft.Expression.Framework.Documents.PathHelper.FileExists(Microsoft.Expression.Framework.Documents.PathHelper.ResolveRelativePath(this.TemplateLocation.LocalPath, file)));
     }
     Microsoft.Expression.SubsetFontTask.Zip.ZipArchive zipArchive = this.ZipArchive;
     if (this.ZipArchive[file] != null)
     {
         return(true);
     }
     if (zipArchive[file.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar)] != null)
     {
         return(true);
     }
     return(false);
 }
Esempio n. 2
0
        protected StreamReader OpenText(string file, Uri root)
        {
            if (!TemplateBase.IsZipArchive(root))
            {
                return(new StreamReader(this.ResolveFileUri(file, root).LocalPath));
            }
            Microsoft.Expression.SubsetFontTask.Zip.ZipArchive zipArchive = this.ZipArchive;
            if (zipArchive[file] != null)
            {
                return(zipArchive.OpenText(file));
            }
            string str = file.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);

            if (zipArchive[str] == null)
            {
                CultureInfo currentCulture   = CultureInfo.CurrentCulture;
                string      couldNotFindFile = ExceptionStringTable.CouldNotFindFile;
                object[]    objArray         = new object[] { string.Concat(this.TemplateLocation.LocalPath, "[", file, "]") };
                throw new FileNotFoundException(string.Format(currentCulture, couldNotFindFile, objArray));
            }
            return(zipArchive.OpenText(str));
        }