コード例 #1
0
 public void Add(eContentDomain domain, string name, Func <string> content)
 {
     if (DomainCheck.IsAllowed(_contentDomain, domain))
     {
         _content.AddOrUpdate(name, (key) => content(), (key, oldValue) => content());
     }
 }
コード例 #2
0
        public QuokkaContainer WithContentDomain(eContentDomain contentDomain)
        {
            EnsureNotInitialized();

            _builder
            .RegisterInstance(new ContentDomainProvider(contentDomain))
            .AsImplementedInterfaces()
            .SingleInstance();

            return(this);
        }
コード例 #3
0
 public static void WriteLine(this ILogStream stream, eContentDomain domain, ConsoleColor foreground, string format = null, params object[] args)
 {
     stream.Log(new LogRecord()
     {
         Items = new List <LogRecordItem>()
         {
             new LogRecordItem()
             {
                 Domain     = domain,
                 Foreground = foreground,
                 Message    = format != null ? string.Format(format, args) : null,
                 NewLine    = true
             }
         }
     });
 }
コード例 #4
0
ファイル: DomainCheck.cs プロジェクト: EvgenyMuryshkin/quokka
        public static bool IsAllowed(eContentDomain allowed, eContentDomain requested)
        {
            switch (allowed)
            {
            case eContentDomain.Public:
                if (requested == eContentDomain.Public)
                {
                    return(true);
                }
                break;

            case eContentDomain.Trusted:
                if (requested == eContentDomain.Public || requested == eContentDomain.Trusted)
                {
                    return(true);
                }
                break;

            case eContentDomain.Private:
                return(true);
            }

            return(false);
        }
コード例 #5
0
 public static void WriteLine(this ILogStream stream, eContentDomain domain, string format = null, params object[] args)
 {
     stream.WriteLine(domain, ConsoleColor.White, format, args);
 }
コード例 #6
0
 public BaseLogStream(IContentDomainProvider contentDomainProvider)
 {
     _contentDomain = contentDomainProvider.ContentDomain;
 }
コード例 #7
0
 public ContentDomainProvider(eContentDomain contentDomain)
 {
     ContentDomain = contentDomain;
 }
コード例 #8
0
 public VirtualFS(IContentDomainProvider contentDomainProvider)
 {
     _contentDomain = contentDomainProvider.ContentDomain;
 }