Ejemplo n.º 1
0
 public SearchController(IContentProvider contentProvider, IRenderer renderer, ISearchProvider searchProvider)
 {
     ContentProvider = contentProvider;
     SearchProvider = searchProvider;
     SearchProvider.ContentResolver = contentProvider.ContentResolver;
     Renderer = renderer;
 }
Ejemplo n.º 2
0
 public void Add(IContentProvider provider)
 {
     var separator = new[]{'\\', '/'};
     foreach (AssetEntry current in provider.GetAssets())
     {
         string[] array = current.FullName.Split(separator, StringSplitOptions.RemoveEmptyEntries);
         DirectoryNode directory = root;
         for (int i = 0; i < array.Length - 1; i++)
         {
             if (!directory.HasDirectory(array[i]))
             {
                 directory.Add(array[i]);
             }
             directory = directory.GetDirectory(array[i]);
         }
         if (directory.Files.ContainsKey(current.Name))
         {
             directory.Files[current.Name] = current;
         }
         else
         {
             directory.Files.Add(current.Name, current);
         }
     }
 }
        /// <summary>
        /// Runs the content parsing part of the summarizing algorithm
        /// </summary>
        /// <param name="contentProvider"></param>
        /// <param name="contentParser"></param>
        /// <returns></returns>
        public ParsedDocument ParseContent(IContentProvider contentProvider, IContentParser contentParser)
        {
            if (contentProvider == null)
            {
                throw new ArgumentNullException(nameof(contentProvider));
            }
            if (contentParser == null)
            {
                throw new ArgumentNullException(nameof(contentParser));
            }

            var resultingParsedDocument = new ParsedDocument
            {
                Sentences = contentParser.SplitContentIntoSentences(contentProvider.Content)
            };
            if (resultingParsedDocument.Sentences == null)
            {
                throw new InvalidOperationException(
                    $"{contentProvider.GetType().FullName}.SplitContentIntoSentences must not return null");
            }
            foreach (var workingSentence in resultingParsedDocument.Sentences)
            {
                workingSentence.TextUnits = contentParser.SplitSentenceIntoTextUnits(workingSentence.OriginalSentence);
                if (workingSentence.TextUnits == null)
                {
                    throw new InvalidOperationException(
                        $"{contentProvider.GetType().FullName}.SplitSentenceIntoTextUnits must not return null");
                }
            }
            return resultingParsedDocument;
        }
 public static TDocument CloneOrCreateDocument <TDocument>(
     this IDocumentFactory documentFactory,
     TDocument document,
     IEnumerable <KeyValuePair <string, object> > items,
     IContentProvider contentProvider = null)
     where TDocument : FactoryDocument, IDocument, new() =>
 (TDocument)document?.Clone(items, contentProvider)
 ?? documentFactory.CreateDocument <TDocument>(items, contentProvider);
Ejemplo n.º 5
0
 public RockTower(ICamera camera, IContentProvider contentProvider, IWorld world, PathProvider pathProvider, Player player)
     : base(camera, contentProvider, world, pathProvider, player)
 {
     textureKeys  = new string[] { "RockTower" };
     Walkable     = false;
     FireRange    = 100;
     FireInterval = TimeSpan.FromSeconds(3.5);
 }
Ejemplo n.º 6
0
 public static void LoadSchemeFunctions(IContentProvider contentProvider)
 {
     var stream = contentProvider.GetStream("/graphmath.rkt");
     using (var sr = new StreamReader(stream))
     {
         sr.ReadToEnd().Eval();
     }
 }
Ejemplo n.º 7
0
 public Snake(ICamera camera, IContentProvider contentProvider, GameStateManager gameStateManager) : base(camera, contentProvider, gameStateManager)
 {
     AnimationInterval = TimeSpan.FromMilliseconds(90);
     MaxHealth         = 8;
     Health            = MaxHealth;
     Worth             = 15;
     MovementSpeed     = 1.65f;
 }
Ejemplo n.º 8
0
 public IceEnergy(ICamera camera, IContentProvider content, IWorld world)
     : base(camera, content, world)
 {
     textureKeys           = new string[] { "IceEnergy" };
     Velocity              = new Vector2(0.2f);
     BaseDamage            = 1;
     MaximumTravelDistance = 200;
 }
 public ObjectDocument(
     T obj,
     NormalizedPath source,
     NormalizedPath destination,
     IContentProvider contentProvider = null)
     : this(obj, source, destination, null, contentProvider)
 {
 }
 public ObjectDocument(
     T obj,
     NormalizedPath destination,
     IEnumerable <KeyValuePair <string, object> > items,
     IContentProvider contentProvider = null)
     : this(obj, null, destination, items, contentProvider)
 {
 }
 public static IDocument CloneOrCreateDocument(
     this IDocumentFactory documentFactory,
     IDocument document,
     NormalizedPath source,
     NormalizedPath destination,
     IContentProvider contentProvider = null) =>
 document?.Clone(source, destination, contentProvider)
 ?? documentFactory.CreateDocument(source, destination, contentProvider);
 public static IDocument CloneOrCreateDocument(
     this IDocumentFactory documentFactory,
     IDocument document,
     NormalizedPath destination,
     IEnumerable <KeyValuePair <string, object> > items,
     IContentProvider contentProvider = null) =>
 document?.Clone(destination, items, contentProvider)
 ?? documentFactory.CreateDocument(destination, items, contentProvider);
 public static TDocument CloneOrCreateDocument <TDocument>(
     this IDocumentFactory documentFactory,
     TDocument document,
     NormalizedPath destination,
     IContentProvider contentProvider = null)
     where TDocument : FactoryDocument, IDocument, new() =>
 (TDocument)document?.Clone(destination, contentProvider)
 ?? documentFactory.CreateDocument <TDocument>(destination, contentProvider);
Ejemplo n.º 14
0
 public Turtle(ICamera camera, IContentProvider contentProvider, GameStateManager gameStateManager)
     : base(camera, contentProvider, gameStateManager)
 {
     AnimationInterval = TimeSpan.FromMilliseconds(200);
     MaxHealth         = 200;
     Health            = MaxHealth;
     Worth             = 50;
     MovementSpeed     = 0.5f;
 }
Ejemplo n.º 15
0
 public Bear(ICamera camera, IContentProvider contentProvider, GameStateManager gameStateManager)
     : base(camera, contentProvider, gameStateManager)
 {
     AnimationInterval = TimeSpan.FromMilliseconds(170);
     MaxHealth         = 250;
     Health            = MaxHealth;
     Worth             = 70;
     MovementSpeed     = 1.3f;
 }
Ejemplo n.º 16
0
        public TextureLoader(IContentProvider contentLocator)
        {
            if (contentLocator == null)
            {
                throw new ArgumentNullException(nameof(contentLocator));
            }

            this.contentLocator = contentLocator;
        }
 protected Document(
     IMetadata baseMetadata,
     NormalizedPath source,
     NormalizedPath destination,
     IEnumerable <KeyValuePair <string, object> > items,
     IContentProvider contentProvider = null)
     : this(baseMetadata, source, destination, items == null ? null : new Metadata(items), contentProvider)
 {
 }
 public HdfsNameNodeExporter(
     IContentProvider contentProvider,
     IPrometheusUtils prometheusUtils,
     IOptions <HdfsNameNodeExporterConfiguration> exporterConfiguration,
     ILogger <HdfsNameNodeExporter> logger)
     : base(contentProvider, prometheusUtils, exporterConfiguration.Value, typeof(HdfsNameNodeComponent), logger)
 {
     _exporterConfiguration = exporterConfiguration.Value;
 }
 protected Document(
     IMetadata baseMetadata,
     NormalizedPath source,
     NormalizedPath destination,
     IMetadata metadata,
     IContentProvider contentProvider = null)
 {
     Initialize(baseMetadata, source, destination, metadata, contentProvider);
 }
Ejemplo n.º 20
0
        static Option <string> GetDirectoryReadme(IContentProvider provider, ContentPath path)
        {
            var candidates = new[] { "Readme.md", "Index.md" };
            var markdown   = candidates
                             .Select(_ => GetText(provider, path.CatDir(_)))
                             .FirstOrNone();

            return(markdown);
        }
Ejemplo n.º 21
0
 static string GetDirectoryMarkdown(IContentProvider provider, IHistory history, ContentPath path, IEnumerable <ContentPath> children)
 {
     return(String.Join(hr, new[]
     {
         GetChildList(path, children),
         GetDirectoryReadme(provider, path),
         history.GetRecentChanges(path).Result
     }.WhereValue()));
 }
Ejemplo n.º 22
0
 public ContentService(ILoggerFactory loggerFactory, IContentProvider contentProvider, TypeRegistry typeRegistry, EventBus eventBus, IKasbahQueryProviderFactory queryProviderFactory, IMemoryCache cache)
 {
     _log                  = loggerFactory.CreateLogger <ContentService>();
     _contentProvider      = contentProvider;
     _typeRegistry         = typeRegistry;
     _eventBus             = eventBus;
     _cache                = cache;
     _queryProviderFactory = queryProviderFactory;
 }
 public ObjectDocument(
     T obj,
     FilePath source,
     FilePath destination,
     IEnumerable <KeyValuePair <string, object> > items,
     IContentProvider contentProvider = null)
     : this(Guid.NewGuid(), obj, source, destination, new Metadata(items), contentProvider)
 {
 }
Ejemplo n.º 24
0
        public void RegisterContentProvider <T>(IContentProvider <T> provider)
        {
            _contentProviders.Add(typeof(T), provider);

            if (provider is IXmlContentParser <T> )
            {
                RegisterContentParser <T>(provider as IXmlContentParser <T>);
            }
        }
Ejemplo n.º 25
0
 public FrontPanels(IClassificationValueProvider classificationValueProvider, IContentProvider contentProvider, IProcessProvider processProvider, IOrganizationProvider organizationProvider, IPersonProvider personProvider, IProjectProvider projectProvider)
 {
     _classificationValueProvider = classificationValueProvider;
     _contentProvider             = contentProvider;
     _processProvider             = processProvider;
     _organizationProvider        = organizationProvider;
     _personProvider  = personProvider;
     _projectProvider = projectProvider;
 }
 public YarnResourceManagerExporter(
     IContentProvider contentProvider,
     IPrometheusUtils prometheusUtils,
     IOptions <YarnResourceManagerExporterConfiguration> exporterConfiguration,
     ILogger <YarnResourceManagerExporter> logger)
     : base(contentProvider, prometheusUtils, exporterConfiguration.Value, typeof(ResourceManagerComponent), logger)
 {
     _exporterConfiguration = exporterConfiguration.Value;
 }
Ejemplo n.º 27
0
        public void load(IContentProvider content)
        {
            leftborder  = content.Load <Texture2D>("imgs/leftborder");
            rightborder = content.Load <Texture2D>("imgs/rightborder");
            topborder   = content.Load <Texture2D>("imgs/topborder");
            newpaddle   = content.Load <Texture2D>("imgs/paddle");

            var deserializer = new DeserializerBuilder()
                               .WithNamingConvention(new HyphenatedNamingConvention())
                               .WithTypeConvertersForBasicStructures()
                               .Build();

            var imageData = deserializer.Deserialize <SpritesFile>(
                content.ReadAllText("sprites.yaml"));

            foreach (var field in GetType().GetTypeInfo().DeclaredFields)
            {
                string yamlKey = field.Name.ToLowerInvariant();

                if (field.FieldType == typeof(Texture2D))
                {
                    if (imageData.Images.TryGetValue(yamlKey, out var data))
                    {
                        field.SetValue(this, content.Load <Texture2D>($"imgs/{data.Image}"));
                    }
                    else
                    {
                        Log($"No image specified for {field.Name}");
                    }
                }
                else if (field.FieldType == typeof(Sprite))
                {
                    if (imageData.Sprites.TryGetValue(yamlKey, out var data))
                    {
                        var sprite = new Sprite();

                        sprite.AnimationType = data.Animation?.Type ?? sprite.AnimationType;
                        sprite.FrameTime     = TimeSpan.FromMilliseconds(data.Animation?.FrameTime ?? sprite.FrameTime.TotalMilliseconds);

                        foreach (var frameData in data.Frames)
                        {
                            var frame = new SpriteFrame(
                                content.Load <Texture2D>($"imgs/{frameData.Image}"),
                                frameData.SourceRect);

                            sprite.AddFrame(frame);
                        }

                        field.SetValue(this, sprite);
                    }
                    else
                    {
                        Log($"No sprite specified for {field.Name}");
                    }
                }
            }
        }
Ejemplo n.º 28
0
 public Butterfly(ICamera camera, IContentProvider contentProvider, GameStateManager gameStateManager)
     : base(camera, contentProvider, gameStateManager)
 {
     AnimationInterval = TimeSpan.FromMilliseconds(50);
     MaxHealth         = 35;
     Health            = MaxHealth;
     Worth             = 50;
     MovementSpeed     = 1.8f;
 }
Ejemplo n.º 29
0
 public Document(
     IMetadata baseMetadata,
     NormalizedPath source,
     NormalizedPath destination,
     IEnumerable <KeyValuePair <string, object> > items,
     IContentProvider contentProvider = null)
     : base(baseMetadata, source, destination, items, contentProvider)
 {
 }
 public HostExporter(
     IContentProvider contentProvider,
     IPrometheusUtils prometheusUtils,
     IOptions <HostExporterConfiguration> configuration,
     ILogger logger)
     : base(contentProvider, prometheusUtils, configuration.Value, typeof(ClusterHostComponent), logger)
 {
     _hostConfiguration = configuration.Value;
 }
Ejemplo n.º 31
0
        public LobFactory(
            IContentProvider content,
            XleData data)
        {
            this.content = content;
            this.data    = data;

            LoadSurfaces();
        }
Ejemplo n.º 32
0
 public Document(
     IMetadata baseMetadata,
     NormalizedPath source,
     NormalizedPath destination,
     IMetadata metadata,
     IContentProvider contentProvider = null)
     : base(baseMetadata, source, destination, metadata, contentProvider)
 {
 }
 public ObjectDocument(
     T obj,
     FilePath source,
     FilePath destination,
     IMetadata metadata,
     IContentProvider contentProvider = null)
     : this(Guid.NewGuid(), obj, source, destination, metadata, contentProvider)
 {
 }
 public ContentFinderJob(string contentPattern, IContentProvider contentProvider, IMessagePublisher messagePublisher)
 {
     _contentPattern = contentPattern;
     _contentProvider = contentProvider;
     _messagePublisher = messagePublisher;
     if (string.IsNullOrWhiteSpace(contentPattern)) throw new ArgumentNullException(nameof(contentPattern));
     if (contentProvider == null) throw new ArgumentNullException(nameof(contentProvider));
     if (messagePublisher == null) throw new ArgumentNullException(nameof(messagePublisher));
 }
Ejemplo n.º 35
0
 public ContentManager AddContentProvider(IContentProvider contentProvider, int order = 0)
 {
     if (contentProvider == null)
     {
         throw new ArgumentNullException("contentProvider");
     }
     ContentProvider.CastTo <CompositeContentProvider>().AddContentProvider(contentProvider, order);
     return(this);
 }
		public MarkdownService(IContentProvider contentProvider)
        {
            ContentProvider = contentProvider;

            _markdown = new MarkdownSharp.Markdown(CreateMarkdownOptions());

            _invariantTextInfo = CultureInfo.InvariantCulture.TextInfo;

			Tranformers = new Tranformers();
        }
Ejemplo n.º 37
0
        private static void SummarizeThis(IContentProvider contentProvider)
        {
            var summarizedDocument = OpenTextSummarizer.Summarizer.Summarize(
                contentProvider,
                new SummarizerArguments() { Language = "en", MaxSummarySentences = 5 });

            Console.WriteLine("Summarizing content from " + contentProvider.GetType().FullName);
            Console.WriteLine(" ===== Concepts =============================== ");
            summarizedDocument.Concepts.ForEach(c => Console.WriteLine(string.Format("\t{0}", c)));
            Console.WriteLine(" ===== Summary =============================== ");
            summarizedDocument.Sentences.ForEach(s => Console.WriteLine(string.Format("{0}", s)));
            Console.ReadKey();
        }
 public CompositeContentProvider AddContentProvider(IContentProvider contentProvider, int order = 0)
 {
     if (contentProvider == null) throw new ArgumentNullException("contentProvider");
     lock (_contentProviders)
     {
         contentProvider.ContentModified += OnContentModified;
         if (order < _contentProviders.Count && order >= 0)
             _contentProviders.Insert(order, contentProvider);
         else
             _contentProviders.Add(contentProvider);
         return this;
     }
 }
        public static IMvcApplication UseMvc(this HttpServerSimulator server, ControllerContainer controllerContainer, IContentProvider contentProvider)
        {
            if (controllerContainer == null) 
                throw new ArgumentNullException("controllerContainer");
            if (contentProvider == null) 
                throw new ArgumentNullException("contentProvider");

            var mvcApplication = new MvcApplication(controllerContainer, contentProvider);
            
            UseMvc(server, mvcApplication);

            return mvcApplication;
        }
Ejemplo n.º 40
0
        public static SummarizedDocument Summarize(IContentProvider contentProvider, ISummarizerArguments args)
        {
            if (contentProvider == null || args == null)
            {
                return new SummarizedDocument();
            }

            var engine = new SummarizingEngine();

            var parsedDocument = engine.ParseContent(contentProvider, args.ContentParser());
            var analyzedDocument = engine.AnalyzeParsedContent(parsedDocument, args.ContentAnalyzer());
            var summaryAnalysisDocument = engine.SummarizeAnalysedContent(analyzedDocument, args.ContentSummarizer(), args);

            return summaryAnalysisDocument;
        }
        public static void UseStatic(this HttpServerSimulator server, IContentProvider contentProvider)
        {
            if (contentProvider == null) 
                throw new ArgumentNullException("contentProvider");

            server.Use(context =>
            {
                var filePath = context.Request.FilePath.Substring(1);
                if (contentProvider.FileExists(filePath))
                {
                    contentProvider.Open(filePath).CopyTo(context.Response.OutputStream);
                    return true;
                }

                return false;
            });
        }
Ejemplo n.º 42
0
        // Constructors
        internal NamespaceManager(Federation federation, IContentProvider contentProvider,
            string ns, NamespaceProviderParameterCollection parameters)
        {
            _federation = federation;
            _contentProviderChain = contentProvider;
            _namespace = ns;

            if (parameters != null)
            {
                foreach (NamespaceProviderParameter parameter in parameters)
                {
                    _parameters.Add(parameter);
                }
            }

            _contentProviderChain.Initialize(this);
        }
Ejemplo n.º 43
0
        public ContentManager(IContentProvider provider, ContentEditMode editMode)
        {
            EditMode = editMode;

            if (EditMode == ContentEditMode.Editable)
            {
                // Register page javascript thingies

                // Register CSS information for the "cloudixEditable" tag

                // onmouseover="this.style.border='1px solid white'; this.style.padding='0px 0px 0px 0px';"
                // onmouseout="this.style.border='0px'; this.style.padding='1px 1px 1px 1px';"

                // TODO: Create a ContentProviderConfiguration, or something, to allow custom Javascript+CSS initialisations
                // or overloads.
            }
        }
Ejemplo n.º 44
0
        /// <summary>
        /// Initializes a new instance of the MainViewModel class.
        /// </summary>
        public MainViewModel(IContentProvider contentProvider)
        {
            ApplyFunctionCommand = new RelayCommand(ApplyFunctionExecute, ApplyFunctionCanExecute);
            AddFunctionCommand = new RelayCommand(AddFunction, () => Functions.Count < 12);
            DeleteFunctionCommand = new RelayCommand<IList>(deleteFunctionExecute, deleteFunctionCanExecute);

            InitPlotModel();

            LogarithmicBases = new List<double> { TEN, TWO, EULER };
            XLogarithmicBase = YLogarithmicBase = TEN;

            LoadSyntaxHighlighting(contentProvider);
            IronSchemeBridge.ResetEnvironment();
            SchemeMathWrapper.LoadSchemeFunctions(contentProvider);

            IronSchemeBridge.StdOutOutput += IronSchemeBridge_StdOutOutput;
            IronSchemeBridge.StdErrOutput += IronSchemeBridge_StdErrOutput;

            Functions = new ObservableCollection<GraphFunction>();

            AddFunction();
        }
Ejemplo n.º 45
0
 public CustomContentService(IContentProvider contentProvider)
 {
     _contentProvider = contentProvider;
 }
Ejemplo n.º 46
0
		public virtual void AddContentProvider(IContentProvider provider)
		{
			contentProviders.Add( provider );
		}
Ejemplo n.º 47
0
 public ListController(IContentProvider contentProvider, IRenderer renderer)
 {
     ContentProvider = contentProvider;
     Renderer = renderer;
 }
 public void throws_if_null_arguments_are_passed(IContentProvider contentProvider,
     IContentParser contentParser)
 {
     Assert.Throws<ArgumentNullException>(() => Target.ParseContent(contentProvider, contentParser));
 }
 public void before_each_test_setup()
 {
     TargetContentProvider = Substitute.For<IContentProvider>();
     TargetContentProvider.Content.Returns(Content);
     TargetContentParser = Substitute.For<IContentParser>();
     TargetContentParser.SplitContentIntoSentences(Arg.Any<string>()).Returns(
         new List<Sentence>
         {
             new Sentence {OriginalSentence = Sentence1},
             new Sentence {OriginalSentence = Sentence2}
         }
         );
     TargetContentParser.SplitSentenceIntoTextUnits(Arg.Any<string>()).Returns(
         new List<TextUnit>
         {
             new TextUnit {RawValue = Content}
         }
         );
 }
 public FileVirtualContent(IContentProvider contentProvider, string virtualPath)
 {
     _contentProvider = contentProvider;
     _virtualPath = virtualPath;
     _filePath = ToFilePath(virtualPath);
 }
Ejemplo n.º 51
0
 public ContentController(IWebSiteProvider siteProvider, IContentProvider provider)
 {
     this.siteProvider = siteProvider;
     this.provider = provider;
 }
Ejemplo n.º 52
0
 public DependencyRecorder(IContentProvider next)
     : base(next)
 {
 }
Ejemplo n.º 53
0
 public ItemChildrenComponent(IContentProvider contentProvider)
 {
     _contentProvider = contentProvider;
 }
Ejemplo n.º 54
0
        public TextureLoader(IContentProvider contentLocator)
        {
            if (contentLocator == null) throw new ArgumentNullException(nameof(contentLocator));

            this.contentLocator = contentLocator;
        }
 public CustomContentMenuItemProvider(string configFile)
 {
     _configFile = configFile;
     _contentProvider = new LocalStorageContentProvider();
 }
 public CkanGroupRepository(ICkanApi ckanApi, IContentProvider contentProvider)
 {
     _ckanApi = ckanApi;
     _contentProvider = contentProvider;
 }
Ejemplo n.º 57
0
 public NavigationController(IContentProvider contentProvider, IRenderer renderer)
 {
     ContentProvider = contentProvider;
     Renderer = renderer;
 }
Ejemplo n.º 58
0
 public ContentProviderBase(IContentProvider next)
 {
     _next = next;
 }
 public CompositeContentProvider RemoveContentProvider(IContentProvider contentProvider)
 {
     if (contentProvider == null) return this;
     lock (_contentProviders){
         if (_contentProviders.Remove(contentProvider)){
             contentProvider.ContentModified -= OnContentModified;
             contentProvider.TryDispose();
         }
     }
     return this;
 }
Ejemplo n.º 60
0
 public DbStoryRunner(IContentProvider contentProvider, IContentStorage contentStorage, ISourceControl versioning)
 {
     this.contentProvider = contentProvider;
     this.contentStorage = contentStorage;
     this.versioning = versioning;
 }