当前位置: 首页>>代码示例>>C#>>正文


C# Engine.Sandbox类代码示例

本文整理汇总了C#中Rant.Engine.Sandbox的典型用法代码示例。如果您正苦于以下问题:C# Sandbox类的具体用法?C# Sandbox怎么用?C# Sandbox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Sandbox类属于Rant.Engine命名空间,在下文中一共展示了Sandbox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ClearTarget

 private static void ClearTarget(Sandbox sb,
     [RantDescription("The name of the target to be cleared.")]
     string targetName)
 {
     sb.Output.Do(chain => chain.ClearTarget(targetName));
 }
开发者ID:strogonoff,项目名称:Rant,代码行数:6,代码来源:RantFunctions.cs

示例2: PrintEmoji

 private static void PrintEmoji(Sandbox sb, 
     [RantDescription("The emoji shortcode to use, without colons.")]
     string shortcode)
 {
     shortcode = shortcode.ToLower();
     if(!Emoji.Shortcodes.ContainsKey(shortcode))
     {
         sb.Print("[missing emoji]");
         return;
     }
     sb.Print(Char.ConvertFromUtf32(Emoji.Shortcodes[shortcode]));
 }
开发者ID:strogonoff,项目名称:Rant,代码行数:12,代码来源:RantFunctions.cs

示例3: Plural

	    private static void Plural(Sandbox sb, string word)
	    {
		    sb.Print(sb.Format.Pluralizer.Pluralize(word));
	    }
开发者ID:strogonoff,项目名称:Rant,代码行数:4,代码来源:RantFunctions.cs

示例4: Emdash

 private static void Emdash(Sandbox sb) => sb.Print("\x2014");
开发者ID:strogonoff,项目名称:Rant,代码行数:1,代码来源:RantFunctions.cs

示例5: Bullet

 private static void Bullet(Sandbox sb) => sb.Print("\x2022");
开发者ID:strogonoff,项目名称:Rant,代码行数:1,代码来源:RantFunctions.cs

示例6: PatternArg

	    private static void PatternArg(Sandbox sb, 
			[RantDescription("The name of the argument to access.")]
			string argName)
		{
			if (sb.PatternArgs == null) return;
			sb.Output.Print(sb.PatternArgs[argName]);
		}
开发者ID:strogonoff,项目名称:Rant,代码行数:7,代码来源:RantFunctions.cs

示例7: RegisteredTrademark

 private static void RegisteredTrademark(Sandbox sb) => sb.Print("\x00ae");
开发者ID:strogonoff,项目名称:Rant,代码行数:1,代码来源:RantFunctions.cs

示例8: Import

        private static IEnumerator<RantAction> Import(Sandbox sb,
            [RantDescription("The name or path of the pattern to load.")]
            string name)
        {
            RantAction action;

            try
            {
                action = sb.Engine.GetPattern(name).Action;
            }
            catch (RantCompilerException e)
            {
                throw new RantRuntimeException(sb.Pattern, sb.CurrentAction.Range,
                    $"Failed to compile imported pattern '{name}':\n{e.Message}");
            }
            catch (Exception e)
            {
                throw new RantRuntimeException(sb.Pattern, sb.CurrentAction.Range,
                    $"Failed to import '{name}':\n{e.Message}");
            }

            yield return action;
        }
开发者ID:strogonoff,项目名称:Rant,代码行数:23,代码来源:RantFunctions.cs

示例9: Define

 private static void Define(Sandbox sb,
     [RantDescription("The list of flags to define.")]
     params string[] flags)
 {
     foreach (var flag in flags.Where(f => !Util.IsNullOrWhiteSpace(f) && Util.ValidateName(f)))
     {
         sb.Engine.Flags.Add(flag);
     }
 }
开发者ID:strogonoff,项目名称:Rant,代码行数:9,代码来源:RantFunctions.cs

示例10: End

 private static void End(Sandbox sb,
     [RantDescription("The pattern to run after the next block.")]
     RantAction endPattern)
 {
     sb.CurrentBlockAttribs.End = endPattern;
 }
开发者ID:strogonoff,项目名称:Rant,代码行数:6,代码来源:RantFunctions.cs

示例11: Persist

 private static void Persist(Sandbox sb, AttribPersistence persistence)
 {
     sb.CurrentBlockAttribs.Persistence = persistence;
 }
开发者ID:strogonoff,项目名称:Rant,代码行数:4,代码来源:RantFunctions.cs

示例12: Start

 private static void Start(Sandbox sb,
     [RantDescription("The pattern to run before the next block.")]
     RantAction beforePattern)
 {
     sb.CurrentBlockAttribs.Start = beforePattern;
 }
开发者ID:strogonoff,项目名称:Rant,代码行数:6,代码来源:RantFunctions.cs

示例13: NotNthO

 private static IEnumerator<RantAction> NotNthO(Sandbox sb,
     [RantDescription("The interval at which the pattern should not be run.")]
     int interval,
     [RantDescription("The number of iterations to offset the interval by.")]
     int offset,
     [RantDescription("The pattern to run when the condition is satisfied.")]
     RantAction pattern)
 {
     if (!sb.Blocks.Any()) yield break;
     if (Util.Mod(sb.Blocks.Peek().Iteration - offset, interval) == 0) yield break;
     yield return pattern;
 }
开发者ID:strogonoff,项目名称:Rant,代码行数:12,代码来源:RantFunctions.cs

示例14: NotNth

 private static IEnumerator<RantAction> NotNth(Sandbox sb,
     [RantDescription("The interval at which the pattern should not be run.")]
     int interval,
     [RantDescription("The pattern to run when the condition is satisfied.")]
     RantAction pattern)
 {
     if (!sb.Blocks.Any()) yield break;
     if (sb.Blocks.Peek().Iteration % interval == 0) yield break;
     yield return pattern;
 }
开发者ID:strogonoff,项目名称:Rant,代码行数:10,代码来源:RantFunctions.cs

示例15: Branch

	    private static IEnumerator<RantAction> Branch(Sandbox sb, string id, RantAction branchAction)
	    {
		    sb.RNG.Branch(id.Hash());
		    yield return branchAction;
		    sb.RNG.Merge();
	    }
开发者ID:strogonoff,项目名称:Rant,代码行数:6,代码来源:RantFunctions.cs


注:本文中的Rant.Engine.Sandbox类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。