Example #1
0
        protected void OnFileChanged(string url)
        {
            log.Debug("File changed detected: [{0}]", url);

            if (FileChanged != null)
            {
                FileChanged(this, url);
            }
        }
Example #2
0
        public System.IO.Stream Open(string url, bool write)
        {
            log.Debug("Trying to open file [{0}] write: {1}", url, write);

            // Find matching archive.
            if (!write)
            {
                if (!Exists(url))
                {
                    log.Warning("Trying to open [{0}] for reading, file does not exist.", url);
                    return(null);
                }
            }

            if (Url.IsFilename(url))
            {
                string  relativeUrl  = url;
                Archive foundArchive = FindArchive(url, ref relativeUrl);

                if (foundArchive != null)
                {
                    System.IO.Stream stream = foundArchive.Open(relativeUrl, write);

                    if (stream != null)
                    {
                        log.Debug("File [{0}] successfully opened for write: {1}", url, write);
                    }
                    return(stream);
                }
                else
                {
                    log.Info("No archive found for url: [{0}][{1}]", url, relativeUrl);
                }
            }
            else
            {
                log.Info("[{0}] is not a file url.", url);
            }

            return(null);
        }