Beispiel #1
0
        /// <summary>
        ///     Parses the program.
        /// </summary>
        private void ParseTheProgram()
        {
            var parser = new Tiny();

            this.Scenario["parser"] = parser;
            var tree = parser.Tree(this.Scenario.Get <string>("program"));
        }
Beispiel #2
0
        public void TinyBenchmarkReturnsCorrectResult(string name, MethodInfo method, object instance)
        {
            var expected = Tiny.Create(0).String;
            var actual   = (string)method.Invoke(instance, null);

            Assert.AreEqual(expected, actual, name);
        }
Beispiel #3
0
 static void Main(string[] args)
 {
     var tiny=new Tiny(args);
     var fileNames = new List<string>();
     var tempFile=Path.GetTempFileName();
     var hayStack=tiny.Arguments.haystack.Split(';');
     using(var tpc=TfsTeamProjectCollectionFactory.GetTeamProjectCollection(new Uri(tiny.Arguments.tfsUrl))) {
         tpc.Authenticate();
         var vcs = (VersionControlServer)tpc.GetService(typeof(VersionControlServer));
         var projects = vcs.GetAllTeamProjects(false);
         foreach(var teamProject in projects) {
             foreach(var hay in hayStack){
                 var strands=GetStrands(hay);
                 if(string.Compare(teamProject.Name, hay.IndexOf("/")>0?hay.Substring(0,hay.IndexOf("/")):hay, StringComparison.CurrentCultureIgnoreCase) == 0) {
                     var csFiles = vcs.GetItems("$\\" + teamProject.Name + "\\" + tiny.Arguments.files, VersionSpec.Latest, RecursionType.Full, DeletedState.NonDeleted, ItemType.File);
                     foreach(var csFile in csFiles.Items){
                         csFile.DownloadFile(tempFile);
                         var s=File.OpenText(tempFile);
                         Console.SetCursorPosition(0, Console.CursorTop);
                         Console.Write("Searching in file "+csFile.ServerItem+"...");
                         if(s.ReadToEnd().Contains(tiny.Arguments.needle)) {
                             fileNames.Add(csFile.ServerItem);
                         }
                         s.Close();
                     }
                 }
             }
         }
         foreach(var item in fileNames) {
             Console.WriteLine(item);
         }
     }
     File.Delete(tempFile);
     Console.ReadKey();
 }
Beispiel #4
0
 static void Main(string[] args)
 {
     Tiny.Menu("Main")
     ._("Foo", () => { Console.WriteLine("Foo"); Thread.Sleep(1000); })
     ._("Bar", () => { Console.WriteLine("Bar"); Thread.Sleep(1000); })
     ._(
         Tiny.Menu("Sub")
         ._("SubItem", () => { Console.WriteLine("SubItem"); Thread.Sleep(1000); })
         )
     .Show();
 }
Beispiel #5
0
        public static void OnAssemblyLoaded(string path)
        {
            Log.Write("Trying to find Discord Mod..");
            ModFolder = Path.GetDirectoryName(path);
            Log.Write("Found Discord Mod at {0}", ModFolder);

            try
            {
                _discord = Tiny.New(Environment.GetEnvironmentVariable("token"));
            }
            catch (Exception ex)
            {
                Log.WriteError($"Failed to initialize websocket client: {ex.Message}");
            }
        }
        public static Engine GetDefaultDeathmatchEngine(IEnumerable <IFighterStats> fighters)
        {
            var battlefield = new PlainBattlefield();
            var bounds      = new Tiny();

            var features = new List <IEngineFeature>()
            {
                new FeatureApplyCondition(),
                new FeatureReviveDeadFighters(),
            };

            var moveOrder         = new AllRandomMoveOrder();
            var positionGenerator = new AllRandomPositionGenerator();
            var winCondition      = new FiftyRoundsWinCondition();
            var staleCondition    = new NoneStaleCondition();

            return(GetEngine(fighters, battlefield, bounds, features, moveOrder, positionGenerator, winCondition, staleCondition, 2));
        }
        public static Engine GetDefaultEngine(IEnumerable <IFighterStats> fighters)
        {
            var battlefield = new PlainBattlefield();
            var bounds      = new Tiny();

            var features = new List <IEngineFeature>()
            {
                new FeatureApplyCondition(),
                new FeatureSacrificeToEntity(),
            };

            var moveOrder         = new AllRandomMoveOrder();
            var positionGenerator = new AllRandomPositionGenerator();
            var winCondition      = new LastManStandingWinCondition();
            var staleCondition    = new NoWinnerCanBeDeterminedStaleCondition();

            return(GetEngine(fighters, battlefield, bounds, features, moveOrder, positionGenerator, winCondition, staleCondition, 2));
        }
Beispiel #8
0
        /// <summary>
        /// Returns true if LabelIconUrls instances are equal
        /// </summary>
        /// <param name="input">Instance of LabelIconUrls to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(LabelIconUrls? input)
        {
            if (input == null)
                return false;

            return 
                (
                    Tiny == input.Tiny ||
                    (Tiny != null &&
                    Tiny.Equals(input.Tiny))
                ) && 
                (
                    Small == input.Small ||
                    (Small != null &&
                    Small.Equals(input.Small))
                ) && 
                (
                    Medium == input.Medium ||
                    (Medium != null &&
                    Medium.Equals(input.Medium))
                );
        }
 public void Setup()
 {
     _key = Tiny.GenerateKey();
     _tiny = new Tiny(_key);
 }
Beispiel #10
0
 public void Initialize()
 {
     this.tiny = new Tiny("5SX0TEjkR1mLOw8Gvq2VyJxIFhgCAYidrclDWaM3so9bfzZpuUenKtP74QNH6B");
 }
Beispiel #11
0
 public void Setup()
 {
     _key  = Tiny.GenerateKey();
     _tiny = new Tiny(_key);
 }