Пример #1
0
        public DotLessCssCssLoader(
            ITextFileLoader contentLoader,
            InsertedMarkerRetriever markerIdRetriever,
            string optionalTagNameToRemove,
            ErrorBehaviourOptions reportedErrorBehaviour,
            ILogEvents logger)
        {
            if (contentLoader == null)
            {
                throw new ArgumentNullException("contentLoader");
            }
            if (markerIdRetriever == null)
            {
                throw new ArgumentNullException("markerIdRetriever");
            }
            if (!Enum.IsDefined(typeof(ErrorBehaviourOptions), reportedErrorBehaviour))
            {
                throw new ArgumentOutOfRangeException("reportedErrorBehaviour");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            _contentLoader           = contentLoader;
            _markerIdRetriever       = markerIdRetriever;
            _optionalTagNameToRemove = optionalTagNameToRemove;
            _reportedErrorBehaviour  = reportedErrorBehaviour;
            _logger = logger;
        }
        public SameFolderImportFlatteningCssLoader(
            ITextFileLoader contentLoader,
            ContentLoaderCommentRemovalBehaviourOptions contentLoaderCommentRemovalBehaviour,
            ErrorBehaviourOptions circularReferenceImportBehaviour,
            ErrorBehaviourOptions unsupportedImportBehaviour,
            ILogEvents logger)
        {
            if (contentLoader == null)
            {
                throw new ArgumentNullException("contentLoader");
            }
            if (!Enum.IsDefined(typeof(ContentLoaderCommentRemovalBehaviourOptions), contentLoaderCommentRemovalBehaviour))
            {
                throw new ArgumentOutOfRangeException("contentLoaderCommentRemovalBehaviour");
            }
            if (!Enum.IsDefined(typeof(ErrorBehaviourOptions), circularReferenceImportBehaviour))
            {
                throw new ArgumentOutOfRangeException("circularReferenceImportBehaviour");
            }
            if (!Enum.IsDefined(typeof(ErrorBehaviourOptions), unsupportedImportBehaviour))
            {
                throw new ArgumentOutOfRangeException("unsupportedImportBehaviour");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            _contentLoader = contentLoader;
            _contentLoaderCommentRemovalBehaviour = contentLoaderCommentRemovalBehaviour;
            _circularReferenceImportBehaviour     = circularReferenceImportBehaviour;
            _unsupportedImportBehaviour           = unsupportedImportBehaviour;
            _logger = logger;
        }
        public DefaultNonCachedLessCssLoaderFactory(
            ITextFileLoader contentLoader,
            SourceMappingMarkerInjectionOptions sourceMappingMarkerInjection,
            ErrorBehaviourOptions errorBehaviour,
            ILogEvents logger)
        {
            if (contentLoader == null)
            {
                throw new ArgumentNullException("contentLoader");
            }
            if (!Enum.IsDefined(typeof(SourceMappingMarkerInjectionOptions), sourceMappingMarkerInjection))
            {
                throw new ArgumentOutOfRangeException("sourceMappingMarkerInjection");
            }
            if (!Enum.IsDefined(typeof(ErrorBehaviourOptions), errorBehaviour))
            {
                throw new ArgumentOutOfRangeException("lineNumberInjectionBehaviour");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            _contentLoader = contentLoader;
            _sourceMappingMarkerInjection = sourceMappingMarkerInjection;
            _errorBehaviour = errorBehaviour;
            _logger         = logger;
        }
        public RuleEnforcingCssFileLoader(
            IEnumerable <IEnforceRules> rules,
            StyleSheetTypeDeterminer styleSheetTypeDeterminer,
            ITextFileLoader baseContentLoader,
            CompilerGenerator compilerGenerator,
            Action <BrokenRuleEncounteredInFileException> optionalBrokenFileCallback = null)
        {
            if (rules == null)
            {
                throw new ArgumentNullException("rules");
            }
            if (styleSheetTypeDeterminer == null)
            {
                throw new ArgumentNullException("styleSheetTypeDeterminer");
            }
            if (baseContentLoader == null)
            {
                throw new ArgumentNullException("baseContentLoader");
            }
            if (compilerGenerator == null)
            {
                throw new ArgumentNullException("compilerGenerator");
            }

            _rules = rules.ToArray();
            if (_rules.Any(r => r == null))
            {
                throw new ArgumentException("Null encountered in rules set");
            }

            _styleSheetTypeDeterminer   = styleSheetTypeDeterminer;
            _baseContentLoader          = baseContentLoader;
            _compilerGenerator          = compilerGenerator;
            _optionalBrokenFileCallback = optionalBrokenFileCallback;
        }
Пример #5
0
        public LessCssCommentRemovingTextFileLoader(ITextFileLoader fileLoader)
        {
            if (fileLoader == null)
            {
                throw new ArgumentNullException("fileLoader");
            }

            _fileLoader = fileLoader;
        }
Пример #6
0
        public LessCssKeyFrameScoper(ITextFileLoader fileLoader)
        {
            if (fileLoader == null)
            {
                throw new ArgumentNullException("fileLoader");
            }

            _fileLoader = fileLoader;
        }
        public MinifyingCssLoader(ITextFileLoader contentLoader)
        {
            if (contentLoader == null)
            {
                throw new ArgumentNullException("contentLoader");
            }

            _contentLoader = contentLoader;
        }
Пример #8
0
 public AssetsLoader(
     ContentManager contentManager,
     ITextFileLoader fileLoader)
 {
     _contentManager  = contentManager ?? throw new ArgumentNullException(nameof(contentManager));
     _fileLoader      = fileLoader ?? throw new ArgumentNullException(nameof(fileLoader));
     _textureImporter = new CustomSpriteImporter(fileLoader);
     LoadResources();
 }
Пример #9
0
 public TextInput(
     IConsole console,
     ITextFileLoader textFileLoader,
     ITextUrlFileLoader textUrlFileLoader,
     IDisplayOutput displayOutput)
 {
     Console           = console;
     TextFileLoader    = textFileLoader;
     TextUrlFileLoader = textUrlFileLoader;
     DisplayOutput     = displayOutput;
 }
            public CallbackMakingTextFileLoader(ITextFileLoader contentLoader, Action <TextFileContents> callback)
            {
                if (contentLoader == null)
                {
                    throw new ArgumentNullException("contentLoader");
                }
                if (callback == null)
                {
                    throw new ArgumentNullException("callback");
                }

                _contentLoader = contentLoader;
                _callback      = callback;
            }
        public LessCssOpeningHtmlTagRenamer(ITextFileLoader fileLoader, string replaceOpeningHtmlTagWith)
        {
            if (fileLoader == null)
            {
                throw new ArgumentNullException("fileLoader");
            }
            if (string.IsNullOrWhiteSpace(replaceOpeningHtmlTagWith))
            {
                throw new ArgumentException("Null/blank replaceOpeningHtmlTagWith specified");
            }

            _fileLoader = fileLoader;
            _replaceOpeningHtmlTagWith = replaceOpeningHtmlTagWith;
        }
Пример #12
0
        public LessCssLineNumberingTextFileLoader(ITextFileLoader fileLoader, MarkerGenerator markerGenerator, Predicate <string> optionalSelectorMarkerInsertionCondition)
        {
            if (fileLoader == null)
            {
                throw new ArgumentNullException("fileLoader");
            }
            if (markerGenerator == null)
            {
                throw new ArgumentNullException("markerGenerator");
            }

            _fileLoader      = fileLoader;
            _markerGenerator = markerGenerator;
            _optionalSelectorMarkerInsertionCondition = optionalSelectorMarkerInsertionCondition;
        }
        public DiskCachingTextFileLoader(
            ITextFileLoader contentLoader,
            CacheFileLocationRetriever cacheFileLocationRetriever,
            ILastModifiedDateRetriever lastModifiedDateRetriever,
            InvalidContentBehaviourOptions invalidContentBehaviour,
            ErrorBehaviourOptions errorBehaviour,
            ILogEvents logger)
        {
            if (contentLoader == null)
            {
                throw new ArgumentNullException("contentLoader");
            }
            if (cacheFileLocationRetriever == null)
            {
                throw new ArgumentNullException("cacheFileLocationRetriever");
            }
            if (lastModifiedDateRetriever == null)
            {
                throw new ArgumentNullException("lastModifiedDateRetriever");
            }
            if (!Enum.IsDefined(typeof(InvalidContentBehaviourOptions), invalidContentBehaviour))
            {
                throw new ArgumentOutOfRangeException("invalidContentBehaviour");
            }
            if (!Enum.IsDefined(typeof(ErrorBehaviourOptions), errorBehaviour))
            {
                throw new ArgumentOutOfRangeException("errorBehaviour");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }

            _contentLoader = contentLoader;
            _cacheFileLocationRetriever = cacheFileLocationRetriever;
            _lastModifiedDateRetriever  = lastModifiedDateRetriever;
            _invalidContentBehaviour    = invalidContentBehaviour;
            _errorBehaviour             = errorBehaviour;
            _logger = logger;
        }
Пример #14
0
        public InfartBootstrap(
            ITextFileLoader textFileAssetsLoader,
            ISettingsRepository settingsRepository,
            IWebPageOpener webPageOpener,
            CultureInfo gameCulture,
            bool isPc,
            bool isFullScreen,
            Uri rateMeUri,
            int?deviceWidth  = null,
            int?deviceHeight = null)
        {
            _isPc = isPc;

            Window.Title = GameName;

            _rateMeUri    = rateMeUri;
            _currentState = RunningStates.Splashscreen;

            _textFileAssetsLoader = textFileAssetsLoader;
            _settingsRepository   = settingsRepository;
            _webPageOpener        = webPageOpener;
            _gameCulture          = gameCulture;

            GraphicsDeviceManager = new GraphicsDeviceManager(this)
            {
                SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeLeft,
                IsFullScreen          = isFullScreen
            };

            if (deviceWidth != null && deviceHeight != null)
            {
                GraphicsDeviceManager.PreferredBackBufferWidth  = deviceWidth.Value;
                GraphicsDeviceManager.PreferredBackBufferHeight = deviceHeight.Value;
            }

            _localizedStringsRepository = new InMemoryLocalizedStringsRepository(new Dictionary <string, string>());
        }
Пример #15
0
        ///// <summary>
        ///// Constructor to initialise a new loader with a specified dtd path
        ///// </summary>
        ///// <param name="dtdPath">The dtd path</param>
        //public DtdLoader(string dtdPath) : this(new TextFileLoader(), dtdPath)
        //{
        //}

        /// <summary>
        /// Constructor to initialise a new loader with a specific text file 
        /// loader and a dtd path
        /// </summary>
        /// <param name="textFileLoader">The text file loader</param>
        /// <param name="dtdPath">The dtd path</param>
        public DtdLoader(ITextFileLoader textFileLoader, string dtdPath)
        {
            this._textFileLoader = textFileLoader;
            _dtdPath = dtdPath;
        }
Пример #16
0
 /// <summary>
 /// This constructor is used if you just want a straight LESS compilation-and-minification without any handling of source mapping marker ids or scope-restricting
 /// selector removals
 /// </summary>
 public DotLessCssCssLoader(ITextFileLoader contentLoader, ErrorBehaviourOptions reportedErrorBehaviour, ILogEvents logger)
     : this(contentLoader, () => new string[0], null, reportedErrorBehaviour, logger)
 {
 }
Пример #17
0
        ///// <summary>
        ///// Constructor to initialise a new loader with a specified dtd path
        ///// </summary>
        ///// <param name="dtdPath">The dtd path</param>
        //public DtdLoader(string dtdPath) : this(new TextFileLoader(), dtdPath)
        //{
        //}

        /// <summary>
        /// Constructor to initialise a new loader with a specific text file
        /// loader and a dtd path
        /// </summary>
        /// <param name="textFileLoader">The text file loader</param>
        /// <param name="dtdPath">The dtd path</param>
        public DtdLoader(ITextFileLoader textFileLoader, string dtdPath)
        {
            this._textFileLoader = textFileLoader;
            _dtdPath             = dtdPath;
        }
Пример #18
0
 /// <summary>
 /// An implementation of a simple sprite importer given a file
 /// </summary>
 /// <param name="txtFileImporter">A text file loader</param>
 public CustomSpriteImporter(ITextFileLoader txtFileImporter)
 {
     _txtFileImporter = txtFileImporter ?? throw new ArgumentNullException(nameof(txtFileImporter));
 }