GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — scriptcs/src/ScriptCs.Core/ScriptPackManager.cs at dev · scriptcs/scriptcs

Expand file tree

/

ScriptPackManager.cs

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
33 lines (28 loc) · 1.01 KB
/

ScriptPackManager.cs

Copy path

File metadata and controls

33 lines (28 loc) · 1.01 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System;
using System.Collections.Generic;
using ScriptCs.Contracts;
using ScriptCs.Exceptions;
namespace ScriptCs
{
public class ScriptPackManager : IScriptPackManager
{
private readonly IDictionary<Type, IScriptPackContext> _contexts = new Dictionary<Type, IScriptPackContext>();
public ScriptPackManager(IEnumerable<IScriptPackContext> contexts)
{
Guard.AgainstNullArgument("contexts", contexts);
foreach (var context in contexts)
{
_contexts[context.GetType()] = context;
}
}
public TContext Get<TContext>() where TContext : IScriptPackContext
{
var key = typeof(TContext);
if (!_contexts.ContainsKey(key))
{
throw new ScriptPackException(string.Format("Tried to resolve a script pack '{0}', but such script pack is not available in the current execution context.", key));
}
return (TContext)_contexts[key];
}
}
}
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.