public void SetUp()
        {
            firstTemplateFinder = A.Fake<ITemplateFinder>();
            secondTemplateFinder = A.Fake<ITemplateFinder>();

            templateFinderCollection = new TemplateFinderCollection(new List<ITemplateFinder> { firstTemplateFinder, secondTemplateFinder });
        }
        public SparkEngine()
        {
            _logger   = getLogger();
            _finder   = new TemplateFinder();
            _composer = new TemplateComposer(_types.Value);

            setupFinderDefaults();
            setupComposerDefaults();
        }
Esempio n. 3
0
        public Book(BookInfo info, IBookStorage storage, ITemplateFinder templateFinder,
		   CollectionSettings collectionSettings, HtmlThumbNailer thumbnailProvider,
			PageSelection pageSelection,
			PageListChangedEvent pageListChangedEvent,
			BookRefreshEvent bookRefreshEvent)
        {
            BookInfo = info;

            Guard.AgainstNull(storage,"storage");

            // This allows the _storage to
            storage.MetaData = info;

            _storage = storage;

            //this is a hack to keep these two in sync (in one direction)
            _storage.FolderPathChanged +=(x,y)=>BookInfo.FolderPath = _storage.FolderPath;

            _templateFinder = templateFinder;

            _collectionSettings = collectionSettings;

            _thumbnailProvider = thumbnailProvider;
            _pageSelection = pageSelection;
            _pageListChangedEvent = pageListChangedEvent;
            _bookRefreshEvent = bookRefreshEvent;
            _bookData = new BookData(OurHtmlDom,
                    _collectionSettings, UpdateImageMetadataAttributes);

            if (IsEditable && !HasFatalError)
            {
                _bookData.SynchronizeDataItemsThroughoutDOM();

                WriteLanguageDisplayStyleSheet(); //NB: if you try to do this on a file that's in program files, access will be denied
                OurHtmlDom.AddStyleSheet(@"languageDisplay.css");
            }

            FixBookIdAndLineageIfNeeded();
            _storage.Dom.RemoveExtraContentTypesMetas();
            Guard.Against(OurHtmlDom.RawDom.InnerXml=="","Bloom could not parse the xhtml of this document");
        }
Esempio n. 4
0
 public ImageHandler(ITemplateFinder templateFinder, GameStatus gameStatus) : base(templateFinder, gameStatus)
 {
 }
Esempio n. 5
0
 public ClickImageHandler(IGameWindowClicker gameWindowClicker, ITemplateFinder templateFinder, GameStatus gameStatus) : base(templateFinder, gameStatus)
 {
     _gameWindowClicker = gameWindowClicker;
 }
Esempio n. 6
0
 public ChampionPickImageHandler(IGameWindowTyper gameWindowTyper, ITemplateFinder searchFinder, ITemplateFinder chatFinder, ITemplateFinder templateFinder, GameStatus gameStatus) : base(templateFinder, gameStatus)
 {
     _gameWindowTyper = gameWindowTyper;
     _chatFinder      = chatFinder;
     _searchFinder    = searchFinder;
 }
Esempio n. 7
0
        public Book(BookInfo info, IBookStorage storage, ITemplateFinder templateFinder,
		   CollectionSettings collectionSettings,
			PageSelection pageSelection,
			PageListChangedEvent pageListChangedEvent,
			BookRefreshEvent bookRefreshEvent)
        {
            BookInfo = info;
            UserPrefs = UserPrefs.LoadOrMakeNew(Path.Combine(info.FolderPath, "book.userPrefs"));

            Guard.AgainstNull(storage,"storage");

            // This allows the _storage to
            storage.MetaData = info;

            _storage = storage;

            //this is a hack to keep these two in sync (in one direction)
            _storage.FolderPathChanged += _storage_FolderPathChanged;

            _templateFinder = templateFinder;

            _collectionSettings = collectionSettings;

            _pageSelection = pageSelection;
            _pageListChangedEvent = pageListChangedEvent;
            _bookRefreshEvent = bookRefreshEvent;
            _bookData = new BookData(OurHtmlDom,
                    _collectionSettings, UpdateImageMetadataAttributes);

            InjectStringListingActiveLanguagesOfBook();

            if (!HasFatalError && IsEditable)
            {
                _bookData.SynchronizeDataItemsThroughoutDOM();
            }

            //if we're showing the user a shell/template book, pick a color for it
            //If it is editable, then we don't want to change to the next color, we
            //want to use the color that we used for the sample shell/template we
            //showed them previously.
            if (!info.IsEditable)
            {
                Book.SelectNextCoverColor(); // we only increment when showing a template or shell
                InitCoverColor();
            }

            // If it doesn't already have a cover color give it one.
            if (OurHtmlDom.SafeSelectNodes("//head/style/text()[contains(., 'coverColor')]").Count == 0)
            {
                InitCoverColor(); // should use the same color as what they saw in the preview of the template/shell
            }
            FixBookIdAndLineageIfNeeded();
            _storage.Dom.RemoveExtraBookTitles();
            _storage.Dom.RemoveExtraContentTypesMetas();
            Guard.Against(OurHtmlDom.RawDom.InnerXml=="","Bloom could not parse the xhtml of this document");
        }
 public SparkEngine FindWith(ITemplateFinder finder)
 {
     _finder = finder;
     return(this);
 }
Esempio n. 9
0
 public ImageHandlerBase(ITemplateFinder templateFinder, GameStatus gameStatus)
 {
     _templateFinder = templateFinder;
     _gameStatus     = gameStatus;
 }