예제 #1
0
        public string Import()
        {
            if (!fileAccess.Exists(fileInfo))
            {
                throw new FileNotFoundException();
            }

            string data = fileAccess.ReadAllText(fileInfo);

            return(data);
        }
예제 #2
0
        public string ReadFile(string path)
        {
            string fullPath = _hostEnv.ContentRootPath + "/Resources" + path;

            if (_fileAccess.Exists(fullPath))
            {
                return(_fileAccess.ReadAllText(fullPath));
            }
            else
            {
                throw new FileNotFoundException();
            }
        }
예제 #3
0
        public bool TryGetPreConsolidationInfo(out PreCompilationReport preCompilationReport)
        {
            if (!_fileAccess.Exists(_filePath))
            {
                preCompilationReport = null;
                return(false);
            }

            preCompilationReport = new PreCompilationReport();
            XDocument document;

            using (var reader = _fileAccess.OpenReader(_filePath))
            {
                document = XDocument.Load(reader);
            }

            preCompilationReport.Version      = (string)document.Root.Attribute("version");
            preCompilationReport.Scripts      = CollectResourceReport(document.Root.Element("scripts"));
            preCompilationReport.Stylesheets  = CollectResourceReport(document.Root.Element("stylesheets"));
            preCompilationReport.Dependencies = CollectDependencies(document.Root.Element("dependencies")).ToList();

            return(true);
        }
예제 #4
0
 public static bool Exists(string filename, bool includesExtension)
 {
     return(_storage.Exists(GetFilenameWithExtension(filename, includesExtension)));
 }