Exemplo n.º 1
0
        internal void OpenUrl(string url, string divSelector, string titleContains)
        {
            _driver.Navigate().GoToUrl(url);

            // Wait for the page to load, timeout after 10 seconds
            //TODO selenium: find a better way to wait ...
            WebDriverWait wait = new WebDriverWait(_driver, TimeSpan.FromSeconds(10));

            Outputter.Output("Searching for title text: " + titleContains);
            wait.Until(d => d.Title.ToLower().Contains(titleContains.ToLower()));

            Outputter.Output("Page title is: " + _driver.Title);

            IWebElement query;

            try
            {
                query = _driver.FindElement(By.CssSelector(divSelector));
            }
            catch (Exception ex)
            {
                throw new InvalidOperationException("Could not find the div with CSS selector: " + divSelector, ex);
            }
            if (!query.Displayed)
            {
                throw new InvalidOperationException("The div is not displayed: css selector: " + divSelector);
            }
        }
Exemplo n.º 2
0
 public void SetLoggerOutput(Outputter output)
 {
     if (CheckOutput(output) == false)
     {
         instanceMap.Add(output.GetOutputType(), output.GetInstance());
     }
 }
Exemplo n.º 3
0
        /// <summary>
        /// The main.
        /// </summary>
        public static void Main(string[] args)
        {
            InitializeUI();
            Outputter outputter = Outputter.GetOutputter(Contents.ChapterName);
            // To get results exactly like in the book set it to FullRun.
            ExperimentRunType runType = ExperimentRunType.FastRun;

            try
            {
                RunExperiments(outputter, runType);
            }
            catch (Exception e)
            {
                Console.WriteLine($"\nAn unhandled exception was thrown:\n{e}");
            }
            finally
            {
                if (args.Length == 1)
                {
                    Console.WriteLine("\n\nSaving outputs...");
                    outputter.SaveOutputAsProducedFlattening(args[0]);
                    Console.WriteLine("Done saving.");
                }
            }
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Inputter  inputter  = new Inputter(args);
            Rotator   rotator   = new Rotator();
            Indexor   indexor   = new Indexor();
            Outputter outputter = new Outputter();

            Bus.Register("start", delegate(object data) {
                Bus.Fire("input-completed", inputter.Input());
            });

            Bus.Register("input-completed", delegate(object data) {
                Bus.Fire("rotate-completed", rotator.Rotate((LinkedList <string>)data));
            });

            Bus.Register("rotate-completed", delegate(object data) {
                Bus.Fire("index-completed", indexor.Index((LinkedList <string>)data));
            });

            Bus.Register("index-completed", delegate(object data) {
                outputter.Output((List <string>)data);

                Bus.Fire("output-completed");
            });

            Bus.Fire("start");
        }
Exemplo n.º 5
0
        /// <summary>
        /// Defines the entry point of the application.
        /// </summary>
        public static void Main(string[] args)
        {
            Outputter outputter = Outputter.GetOutputter(Contents.ChapterName);

            InitializeUI();

            try
            {
                RunExperiments(outputter);
            }
            catch (Exception e)
            {
                Console.WriteLine($"\nAn unhandled exception was thrown:\n{e}");
            }
            finally
            {
                if (args.Length == 1)
                {
                    Console.WriteLine("\n\nSaving outputs...");
                    // Serialization of the complete output takes multiple hours
                    // and produces ~3.5 GB of .objml files.
                    // So we remove really large and not that interesting objects
                    // from the output before serialization by default.
                    // Feel free to comment out the next line if you're interested
                    // in complete .objml's and willing to wait.
                    TrimLargeObjects(outputter.Output);
                    outputter.SaveOutputAsProducedFlattening(args[0]);
                    Console.WriteLine("Done saving.");
                }
            }
        }
Exemplo n.º 6
0
        public static void RunExperiments(Outputter outputter)
        {
            ModelRunner runner = new ModelRunner(outputter);

            Console.WriteLine($"\n{Contents.S2TestingOutTheModel.NumberedName}.\n");
            runner.ToyWith3QuestionsAnd2Skills();
            Console.WriteLine($"\n{Contents.S3Loopiness.NumberedName}.\n");
            runner.LoopyExample();

            // Inference on the real data. Sections 4-6.
            runner.RealDataInference();

            // PDF demo
            Console.WriteLine("PDF demonstration");
            runner.ProbabilityDensityFunctionDemo();

            // Demo of Beta distribution
            Console.WriteLine("Beta function demonstration");
            runner.BetaDemo();

            // For Beta self assessment
            runner.BetaSelfAssessment();

            Console.WriteLine("\nCompleted all experiments.");
        }
Exemplo n.º 7
0
        public void TestCase1UsingQuantityGreaterThan1()
        {
            Item.Item book1     = new Item.NonTaxableItem("Book", 12.49, 2, false);
            Item.Item music     = new Item.TaxableItem("Music CD", 14.99, 1, false);
            Item.Item chocolate = new Item.NonTaxableItem("Chocolate bar", 0.85, 1, false);

            Outputter        outputter = new Outputter();
            List <Item.Item> bookList  = new List <Item.Item>();

            bookList.Add(book1);
            List <Item.Item> musicList = new List <Item.Item>();

            musicList.Add(music);

            List <Item.Item> chocolateList = new List <Item.Item>();

            chocolateList.Add(chocolate);

            outputter.Add(book1.GetItemName(), bookList);
            outputter.Add(music.GetItemName(), musicList);
            outputter.Add(chocolate.GetItemName(), chocolateList);

            string expected = "Book: $24.98 (2 @ $12.49)\n" +
                              "Music CD: $16.49\n" +
                              "Chocolate bar: $0.85\n" +
                              "Sales Taxes: $1.50\n" +
                              "Total: $42.32\n";
            Tuple <String, String> result = normalizeExpectedActual(expected, outputter.ToString());

            Assert.IsTrue(String.Equals(result.Item1, result.Item2, StringComparison.OrdinalIgnoreCase));
        }
Exemplo n.º 8
0
        /// <summary>
        /// Prepares the command system, registering all base commands.
        /// </summary>
        public void Init(Outputter _output, Server tserver)
        {
            // General Init
            TheServer            = tserver;
            CommandSystem        = new Commands();
            Output               = _output;
            CommandSystem.Output = Output;
            CommandSystem.Init();

            // Common Commands
            CommandSystem.RegisterCommand(new MeminfoCommand(TheServer));
            CommandSystem.RegisterCommand(new QuitCommand(TheServer));
            CommandSystem.RegisterCommand(new SayCommand(TheServer));

            // File Commands
            CommandSystem.RegisterCommand(new AddpathCommand(TheServer));

            // World Commands
            // ...

            // Player Management Commands
            CommandSystem.RegisterCommand(new KickCommand(TheServer));

            // Wrap up
            CommandSystem.PostInit();
        }
Exemplo n.º 9
0
        public void PrintInventory(int storeID, Dictionary <Product, int> cart)
        {
            Store store = StoreRepo.GetStoreByID(storeID);

            if (store.Inventory.Count == 0)
            {
                Outputter.WriteLine("Inventory is empty.");
            }
            else
            {
                Outputter.WriteLine("ID\t\tName\t\tPrice\t\tQuantity");
                foreach (var item in store.Inventory)
                {
                    int inOrder = 0;
                    foreach (var cartItem in cart)
                    {
                        if (cartItem.Key.ID == item.Key.ID)
                        {
                            inOrder = cartItem.Value;
                        }
                    }
                    Outputter.WriteLine($"{item.Key.ID}\t\t{item.Key.Name}\t\t${item.Key.Price}\t\t{item.Value-inOrder} Available");
                }
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Prepares the command system, registering all base commands.
        /// </summary>
        public static void Init(Outputter _output)
        {
            // General Init
            CommandSystem        = new Commands();
            Output               = _output;
            CommandSystem.Output = Output;
            CommandSystem.Init();

            // UI Commands
            CommandSystem.RegisterCommand(new AttackCommand());
            CommandSystem.RegisterCommand(new BackwardCommand());
            CommandSystem.RegisterCommand(new CaptureCommand());
            CommandSystem.RegisterCommand(new DownwardCommand());
            CommandSystem.RegisterCommand(new ForwardCommand());
            CommandSystem.RegisterCommand(new ItemNextCommand());
            CommandSystem.RegisterCommand(new ItemPrevCommand());
            CommandSystem.RegisterCommand(new LeftwardCommand());
            CommandSystem.RegisterCommand(new RightwardCommand());
            CommandSystem.RegisterCommand(new SecondaryCommand());
            CommandSystem.RegisterCommand(new UpwardCommand());
            CommandSystem.RegisterCommand(new UseCommand());
            CommandSystem.RegisterCommand(new WalkCommand());

            // Common Commands
            CommandSystem.RegisterCommand(new QuitCommand());

            // Network Commands
            CommandSystem.RegisterCommand(new ConnectCommand());
        }
Exemplo n.º 11
0
        public IActionResult Get([FromQuery] string logged, string username)
        {
            User user = Database.getInstance().getUserByUsername(username);

            if (user == null)
            {
                return(NotFound("User with" + username + " does not exist"));
            }
            List <Post> posts      = Database.getInstance().getPostsFromUser(user.Id);
            int         numOfPosts = posts.Count;
            dynamic     usercek    = user.getDynamic();

            usercek.posts      = Outputter.getDynamicList(posts);
            usercek.postNumber = numOfPosts;
            usercek.samePerson = false;
            usercek.follows    = false;
            if (logged != "")
            {
                User user2 = Database.getInstance().getUserByUsername(logged);
                if (user2 != null && Database.getInstance().isUserFollowingUser(user2, user))
                {
                    usercek.follows = true;
                }
                if (user2 != null && user2.Id == user.Id)
                {
                    usercek.samePerson = true;
                }
            }
            return(Ok(usercek));
        }
Exemplo n.º 12
0
 public void DeleteLoggerOutput(Outputter output)
 {
     if (CheckOutput(output) == true)
     {
         instanceMap.Remove(output.GetOutputType());
     }
 }
Exemplo n.º 13
0
        private BuildConfiguration TryGetBuildConfigurationOrTerminate(string repositoryPathStr)
        {
            var appVeyorYml = Path.Combine(repositoryPathStr, "appveyor.yml");

            if (!File.Exists(appVeyorYml))
            {
                Outputter.Write("appveyor.yml file not found on repository path. Trying '.appveyor.yml'...");

                appVeyorYml = Path.Combine(repositoryPathStr, ".appveyor.yml");

                if (!File.Exists(appVeyorYml))
                {
                    Outputter.WriteError(".appveyor.yml file not found on repository path.");
                    Environment.Exit(1);
                }
            }

            BuildConfiguration configuration = null;

            try
            {
                configuration = new BuildConfigurationYamlFileReader(appVeyorYml)
                                .GetBuildConfiguration();
            }
            catch (LocalAppVeyorException)
            {
                Outputter.WriteError($"Error while parsing '{appVeyorYml}' file.");
                Environment.Exit(1);
            }

            return(configuration);
        }
Exemplo n.º 14
0
        /// <summary>
        /// Prepares the command system, registering all base commands.
        /// </summary>
        public void Init(Outputter _output, Client tclient)
        {
            // General Init
            TheClient            = tclient;
            CommandSystem        = new Commands();
            Output               = _output;
            CommandSystem.Output = Output;
            CommandSystem.Init();

            // UI Commands
            CommandSystem.RegisterCommand(new AttackCommand(TheClient));
            CommandSystem.RegisterCommand(new BackwardCommand(TheClient));
            CommandSystem.RegisterCommand(new BindblockCommand(TheClient));
            CommandSystem.RegisterCommand(new BindCommand(TheClient));
            CommandSystem.RegisterCommand(new ForwardCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemdownCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemleftCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemrightCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemupCommand(TheClient));
            CommandSystem.RegisterCommand(new LeftwardCommand(TheClient));
            CommandSystem.RegisterCommand(new MovedownCommand(TheClient));
            CommandSystem.RegisterCommand(new RightwardCommand(TheClient));
            CommandSystem.RegisterCommand(new SecondaryCommand(TheClient));
            CommandSystem.RegisterCommand(new SprintCommand(TheClient));
            CommandSystem.RegisterCommand(new TalkCommand(TheClient));
            CommandSystem.RegisterCommand(new UnbindCommand(TheClient));
            CommandSystem.RegisterCommand(new UpwardCommand(TheClient));
            CommandSystem.RegisterCommand(new UseCommand(TheClient));
            CommandSystem.RegisterCommand(new WalkCommand(TheClient));

            // Common Commands
            CommandSystem.RegisterCommand(new CdevelCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemnextCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemprevCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemselCommand(TheClient));
            CommandSystem.RegisterCommand(new PlayCommand(TheClient));
            CommandSystem.RegisterCommand(new QuickItemCommand(TheClient));
            CommandSystem.RegisterCommand(new QuitCommand(TheClient));
            CommandSystem.RegisterCommand(new ReloadGameCommand(TheClient));

            // Network Commands
            CommandSystem.RegisterCommand(new ConnectCommand(TheClient));
            CommandSystem.RegisterCommand(new DisconnectCommand(TheClient));
            CommandSystem.RegisterCommand(new NetusageCommand(TheClient));
            CommandSystem.RegisterCommand(new PingCommand(TheClient));
            CommandSystem.RegisterCommand(new StartlocalserverCommand(TheClient));

            // Game Commands
            CommandSystem.RegisterCommand(new InventoryCommand(TheClient));
            CommandSystem.RegisterCommand(new TesteffectCommand(TheClient));

            // General Tags
            CommandSystem.TagSystem.Register(new AudioTagBase(TheClient));

            // Entity Tags
            CommandSystem.TagSystem.Register(new PlayerTagBase(TheClient));

            CommandSystem.PostInit();
        }
Exemplo n.º 15
0
        /// <summary>
        /// Prepares the command system, registering all base commands.
        /// </summary>
        public void Init(Outputter _output, Client tclient)
        {
            // General Init
            TheClient = tclient;
            CommandSystem = new Commands();
            Output = _output;
            CommandSystem.Output = Output;
            CommandSystem.Init();

            // UI Commands
            CommandSystem.RegisterCommand(new AttackCommand(TheClient));
            CommandSystem.RegisterCommand(new BackwardCommand(TheClient));
            CommandSystem.RegisterCommand(new BindblockCommand(TheClient));
            CommandSystem.RegisterCommand(new BindCommand(TheClient));
            CommandSystem.RegisterCommand(new ForwardCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemdownCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemleftCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemrightCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemupCommand(TheClient));
            CommandSystem.RegisterCommand(new LeftwardCommand(TheClient));
            CommandSystem.RegisterCommand(new MovedownCommand(TheClient));
            CommandSystem.RegisterCommand(new RightwardCommand(TheClient));
            CommandSystem.RegisterCommand(new SecondaryCommand(TheClient));
            CommandSystem.RegisterCommand(new SprintCommand(TheClient));
            CommandSystem.RegisterCommand(new TalkCommand(TheClient));
            CommandSystem.RegisterCommand(new UnbindCommand(TheClient));
            CommandSystem.RegisterCommand(new UpwardCommand(TheClient));
            CommandSystem.RegisterCommand(new UseCommand(TheClient));
            CommandSystem.RegisterCommand(new WalkCommand(TheClient));

            // Common Commands
            CommandSystem.RegisterCommand(new CdevelCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemnextCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemprevCommand(TheClient));
            CommandSystem.RegisterCommand(new ItemselCommand(TheClient));
            CommandSystem.RegisterCommand(new PlayCommand(TheClient));
            CommandSystem.RegisterCommand(new QuickItemCommand(TheClient));
            CommandSystem.RegisterCommand(new QuitCommand(TheClient));
            CommandSystem.RegisterCommand(new ReloadGameCommand(TheClient));

            // Network Commands
            CommandSystem.RegisterCommand(new ConnectCommand(TheClient));
            CommandSystem.RegisterCommand(new DisconnectCommand(TheClient));
            CommandSystem.RegisterCommand(new NetusageCommand(TheClient));
            CommandSystem.RegisterCommand(new PingCommand(TheClient));
            CommandSystem.RegisterCommand(new StartlocalserverCommand(TheClient));

            // Game Commands
            CommandSystem.RegisterCommand(new InventoryCommand(TheClient));
            CommandSystem.RegisterCommand(new TesteffectCommand(TheClient));

            // General Tags
            CommandSystem.TagSystem.Register(new AudioTagBase(TheClient));

            // Entity Tags
            CommandSystem.TagSystem.Register(new PlayerTagBase(TheClient));

            CommandSystem.PostInit();
        }
Exemplo n.º 16
0
 /// <summary>
 /// Prepares the command system, registering all base commands.
 /// </summary>
 public static void Init(Outputter _output)
 {
     // General Init
     CommandSystem        = new Commands();
     Output               = _output;
     CommandSystem.Output = Output;
     CommandSystem.Init();
 }
Exemplo n.º 17
0
 private void SleepBeforeScreenshot(TimeSpan sleepTimeSpan)
 {
     if (sleepTimeSpan.TotalMilliseconds > 0)
     {
         Outputter.Output("Sleeping before screenshot ...");
         Thread.Sleep(sleepTimeSpan);
     }
 }
Exemplo n.º 18
0
 public void PrintCart(Dictionary <Product, int> cart)
 {
     foreach (var item in cart)
     {
         Outputter.WriteLine($"{item.Key.ID} - ({item.Value}) {item.Key.Name} ${item.Key.Price * item.Value}");
     }
     Outputter.WriteLine("________");
 }
Exemplo n.º 19
0
        public override Task Save()
        {
            var tasks = new Task[_numberOfConsumers];

            for (int i = 0; i < _numberOfConsumers; i++)
            {
                tasks[i] = Task.Run(async() =>
                {
                    var sqlConnection = _createConnection();
                    sqlConnection.Open();
                    var thisSet = new List <Tuple <PersonPreg, AddressPreg[]> >();

                    try
                    {
                        while (!_queue.IsCompleted)
                        {
                            Person item;
                            if (!_queue.TryTake(out item, TimeSpan.FromMilliseconds(10)))
                            {
                                await Task.Delay(TimeSpan.FromMilliseconds(20));
                            }
                            else
                            {
                                Consumed();

                                thisSet.Add(new Tuple <PersonPreg, AddressPreg[]>(new PersonPreg(item), item.Addresses.Select(x => new AddressPreg(x)).ToArray()));
                                if (thisSet.Count > TempSetBatchSize)
                                {
                                    var stopwatch = new System.Diagnostics.Stopwatch();
                                    stopwatch.Start();

                                    await TryPush(thisSet, sqlConnection, SqlBatchSize);

                                    stopwatch.Stop();
                                    Outputter.WriteLine("Pushing took " + stopwatch.Elapsed.TotalSeconds + " seconds");

                                    thisSet.Clear();
                                }
                            }
                        }

                        if (thisSet.Any())
                        {
                            await TryPush(thisSet, sqlConnection, SqlBatchSize);
                        }
                    }
                    finally
                    {
                        sqlConnection.Close();
                        UnexceptedQuit = true;
                    }
                });
            }

            var completeTask = Task.WhenAll(tasks);

            return(completeTask);
        }
Exemplo n.º 20
0
        /// <summary>
        /// Prepares the CVar system, generating default CVars.
        /// </summary>
        public static void Init(Outputter output)
        {
            system = new CVarSystem(output);

            // System CVars
            s_filepath = Register("s_filepath", FileHandler.BaseDirectory, CVarFlag.Textual | CVarFlag.ReadOnly); // The current system environment filepath (The directory of /data).
            // Game CVars
            g_fps = Register("g_fps", "40", CVarFlag.Numeric);                                                    // What tickrate to use for the general game tick.
        }
Exemplo n.º 21
0
        private void ShowReportHeader(ReportSet reports)
        {
            Outputter.OutputEmphasised("Test Results Summary:", ConsoleColor.Cyan);
            Outputter.Output("Test Suite: " + reports.SuiteName);
            Outputter.Output("Duration: " + DateSupport.ToString(reports.Duration));

            Outputter.Output("Suite Result: " + reports.OverallResult, Compare.CompareResultHelper.GetResultAsConsoleColor(reports.OverallResult));
            Outputter.Output(reports.CountTestsPassed + " of " + reports.CountTests + " tests passed.");
        }
Exemplo n.º 22
0
        public void TestCaseEmpty()
        {
            Outputter outputter = new Outputter();
            string    expected  = "Sales Taxes: $0.00\n" +
                                  "Total: $0.00\n";
            Tuple <String, String> result = normalizeExpectedActual(expected, outputter.ToString());

            Assert.IsTrue(String.Equals(result.Item1, result.Item2, StringComparison.OrdinalIgnoreCase));
        }
Exemplo n.º 23
0
        public void Document()
        {
            string lText        = "BUILD FAILED";
            string lExpectedRtf =
                @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0 Arial;}}{\colortbl ;\red255\green0\blue0;\red0\green0\blue255;\red0\green255\blue0;}\viewkind4\uc1\pard\cf0\fs17 BUILD FAILED\par}";

            Outputter.AppendRtfText(lText);
            Assert.AreEqual(lExpectedRtf, Outputter.RtfDocument);
        }
Exemplo n.º 24
0
        private (string YamlFilePath, string YmlFileContent) TryGetAppVeyorFileContentOrTerminate(string repositoryPath)
        {
            var appVeyorYml = Path.Combine(repositoryPath, "appveyor.yml");

            if (!File.Exists(appVeyorYml))
            {
                Outputter.Write("appveyor.yml file not found on repository path. Trying '.appveyor.yml'...");

                appVeyorYml = Path.Combine(repositoryPath, ".appveyor.yml");

                if (!File.Exists(appVeyorYml))
                {
                    Outputter.WriteError(".appveyor.yml file not found on repository path. Validation stopped.");
                    Environment.Exit(1);
                }
            }

            string exceptionReason;

            try
            {
                return(appVeyorYml, File.ReadAllText(appVeyorYml));
            }
            catch (PathTooLongException)
            {
                exceptionReason = "Path too long";
            }
            catch (DirectoryNotFoundException)
            {
                exceptionReason = "Directory not found";
            }
            catch (FileNotFoundException)
            {
                exceptionReason = "File not found";
            }
            catch (NotSupportedException)
            {
                exceptionReason = "Path is in an invalid format";
            }
            catch (IOException e)
            {
                exceptionReason = e.Message;
            }
            catch (UnauthorizedAccessException)
            {
                exceptionReason = "No permissions to read configuration file";
            }
            catch (SecurityException)
            {
                exceptionReason = "The caller does not have the required permission";
            }

            Outputter.WriteError($"Error while trying to read '{appVeyorYml}' file. {exceptionReason}. Validation aborted.");
            Environment.Exit(1);
            return(null, null);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Prepares the command system, registering all base commands.
        /// </summary>
        public void Init(Outputter _output, Server tserver)
        {
            // General Init
            TheServer            = tserver;
            CommandSystem        = new Commands();
            Output               = _output;
            CommandSystem.Output = Output;
            CommandSystem.Init();

            // Common Commands
            CommandSystem.RegisterCommand(new MeminfoCommand(TheServer));
            CommandSystem.RegisterCommand(new QuitCommand(TheServer));
            CommandSystem.RegisterCommand(new SayCommand(TheServer));

            // File Commands
            CommandSystem.RegisterCommand(new AddpathCommand(TheServer));

            // World Commands
            // ...

            // Item Commands
            CommandSystem.RegisterCommand(new AddrecipeCommand(TheServer));
            CommandSystem.RegisterCommand(new GiveCommand(TheServer));

            // Player Management Commands
            CommandSystem.RegisterCommand(new KickCommand(TheServer));

            // Tag Bases
            CommandSystem.TagSystem.Register(new ArrowEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new BlockGroupEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new BlockItemEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new BulletEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new ColorTagBase());
            CommandSystem.TagSystem.Register(new EntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new GlowstickEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new GrenadeEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new ItemEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new ItemTagBase(TheServer));
            CommandSystem.TagSystem.Register(new LivingEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new LocationTagBase(TheServer));
            CommandSystem.TagSystem.Register(new MaterialTagBase());
            CommandSystem.TagSystem.Register(new ModelEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new PhysicsEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new PlayerTagBase(TheServer));
            CommandSystem.TagSystem.Register(new PrimitiveEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new RecipeResultTagBase(TheServer));
            CommandSystem.TagSystem.Register(new RecipeTagBase(TheServer));
            CommandSystem.TagSystem.Register(new WorldTagBase(TheServer));
            CommandSystem.TagSystem.Register(new ServerTagBase(TheServer));
            CommandSystem.TagSystem.Register(new SmokeGrenadeEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new VehicleEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new VehiclePartEntityTagBase(TheServer));

            // Wrap up
            CommandSystem.PostInit();
        }
Exemplo n.º 26
0
        /// <summary>
        /// Prepares the command system, registering all base commands.
        /// </summary>
        public void Init(Outputter _output, Server tserver)
        {
            // General Init
            TheServer = tserver;
            CommandSystem = new Commands();
            Output = _output;
            CommandSystem.Output = Output;
            CommandSystem.Init();

            // Common Commands
            CommandSystem.RegisterCommand(new MeminfoCommand(TheServer));
            CommandSystem.RegisterCommand(new QuitCommand(TheServer));
            CommandSystem.RegisterCommand(new SayCommand(TheServer));

            // File Commands
            CommandSystem.RegisterCommand(new AddpathCommand(TheServer));

            // World Commands
            // ...

            // Item Commands
            CommandSystem.RegisterCommand(new AddrecipeCommand(TheServer));
            CommandSystem.RegisterCommand(new GiveCommand(TheServer));

            // Player Management Commands
            CommandSystem.RegisterCommand(new KickCommand(TheServer));

            // Tag Bases
            CommandSystem.TagSystem.Register(new ArrowEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new BlockGroupEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new BlockItemEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new BulletEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new ColorTagBase());
            CommandSystem.TagSystem.Register(new EntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new GlowstickEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new GrenadeEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new ItemEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new ItemTagBase(TheServer));
            CommandSystem.TagSystem.Register(new LivingEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new LocationTagBase(TheServer));
            CommandSystem.TagSystem.Register(new MaterialTagBase());
            CommandSystem.TagSystem.Register(new ModelEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new PhysicsEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new PlayerTagBase(TheServer));
            CommandSystem.TagSystem.Register(new PrimitiveEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new RecipeResultTagBase(TheServer));
            CommandSystem.TagSystem.Register(new RecipeTagBase(TheServer));
            CommandSystem.TagSystem.Register(new WorldTagBase(TheServer));
            CommandSystem.TagSystem.Register(new ServerTagBase(TheServer));
            CommandSystem.TagSystem.Register(new SmokeGrenadeEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new VehicleEntityTagBase(TheServer));
            CommandSystem.TagSystem.Register(new VehiclePartEntityTagBase(TheServer));

            // Wrap up
            CommandSystem.PostInit();
        }
Exemplo n.º 27
0
        static void Main(string[] args)
        {
            Inputter  input  = new Inputter(args);
            Rotator   rot    = new Rotator();
            Indexor   idx    = new Indexor();
            Outputter output = new Outputter(args);

            output.Output(idx.Index(rot.Rotate(input.Input())));
            //disadvantage have to know the signatures to all methods otherwise cant do this^.
        }
Exemplo n.º 28
0
        private void ShowReport(Report report)
        {
            Outputter.OutputEmphasised("Test Result:");

            Outputter.Output("Test: " + report.Test.Name);
            Outputter.Output("Result: " + report.Result.Result, Compare.CompareResultHelper.GetResultAsConsoleColor(report.Result.Result));
            Outputter.Output("Tolerance: " + report.Result.Tolerance);
            Outputter.Output("Distortion: " + report.Result.Distortion);
            Outputter.Output("");
        }
Exemplo n.º 29
0
        public void ShowReport(ReportSet reports, bool isQuietNotShowResults)
        {
            if (isQuietNotShowResults)
            {
                Outputter.Output("quiet mode - so NOT opening the reports file");
                return;
            }

            Reports.WindowsSupport.OpenFileInExplorer(reports.FilePath);
        }
Exemplo n.º 30
0
 private bool CheckOutput(Outputter check)
 {
     foreach (Outputter output in instanceMap.Values)
     {
         if (check.GetOutputType() == output.GetOutputType())
         {
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 31
0
        public IActionResult GetPostsOfUser(int id)
        {
            List <Post> posts = Database.getInstance().getPostsFromUser(id);

            if (posts != null && posts.Count != 0)
            {
                return(Ok(Outputter.getDynamicList(posts)));
            }

            return(NotFound("Element ne obstaja"));
        }
Exemplo n.º 32
0
        public StoreApp()
        {
            string _connectionString = File.ReadAllText("C:/revature/project0-connection-string.txt");

            CustomerRepo = new CustomerRepository(_connectionString);
            StoreRepo    = new StoreRepository(_connectionString);
            ProductRepo  = new ProductRepository(_connectionString);
            OrderRepo    = new OrderRepository(_connectionString);
            Inputter     = new Inputter();
            Outputter    = new Outputter();
        }
Exemplo n.º 33
0
        /// <summary>
        /// Prepares the CVar system, generating default CVars.
        /// </summary>
        public void Init(Server tserver, Outputter output)
        {
            system = new CVarSystem(output);

            // System CVars
            s_filepath = Register("s_filepath", tserver.Files.BaseDirectory, CVarFlag.Textual | CVarFlag.ReadOnly, "The current system environment filepath (The directory of /data)."); // TODO: Scrap this! Tags!
            s_debug = Register("s_debug", "true", CVarFlag.Boolean, "Whether to output debug information.");
            // Game CVars
            //g_timescale = Register("g_timescale", "1", CVarFlag.Numeric, "The current game time scaling value.");
            g_fps = Register("g_fps", "30", CVarFlag.Numeric, "What framerate to use.");
            g_maxheight = Register("g_maxheight", "5000", CVarFlag.Numeric, "What the highest possible Z coordinate should be (for building)."); // TODO: Also per-world?
            g_minheight = Register("g_minheight", "-5000", CVarFlag.Numeric, "What the lowest possible Z coordinate should be (for building)."); // TODO: Also per-world?
            g_maxdist = Register("g_maxdist", "50000", CVarFlag.Numeric, "How far on the X or Y axis a player may travel from the origin."); // TODO: Also per-world?
            g_renderblocks = Register("g_renderblocks", "false", CVarFlag.Boolean, "Whether to render blocks for mapping purposes."); // TODO: Also per-world?
            // Network CVars
            n_verifyip = Register("n_verifyip", "true", CVarFlag.Boolean, "Whether to verify connecting users' IP addresses with the global server. Disabling this may help allow LAN connections.");
            n_rendersides = Register("n_rendersides", "false", CVarFlag.Boolean, "Whether to render the side-on map view for the linked webpage."); // TODO: Also per-world?
            n_chunkspertick = Register("n_chunkspertick", "15", CVarFlag.Numeric, "How many chunks can be sent in a single server tick, per player.");
            n_online = Register("n_online", "true", CVarFlag.Boolean, "Whether the server with authorize connections against the global server. Disable this if you want to play singleplayer without a live internet connection.");
            // Text CVars
            t_translateurls = Register("t_translateurls", "true", CVarFlag.Boolean, "Whether to automatically translate URLs posted in chat.");
            t_blockurls = Register("t_blockurls", "false", CVarFlag.Boolean, "Whether to block URLs as input to chat.");
            t_blockcolors = Register("t_blockcolors", "false", CVarFlag.Boolean, "Whether to block colors as input to chat.");
        }
Exemplo n.º 34
0
        /// <summary>
        /// Prepares the CVar system, generating default CVars.
        /// </summary>
        public void Init(Client tclient, Outputter output)
        {
            system = new CVarSystem(output);

            // System CVars
            s_filepath = Register("s_filepath", tclient.Files.BaseDirectory, CVarFlag.Textual | CVarFlag.ReadOnly, "The current system environment filepath (The directory of /data)."); // TODO: Tag!
            s_glversion = Register("s_glversion", "UNKNOWN", CVarFlag.Textual | CVarFlag.ReadOnly, "What version of OpenGL is in use.");
            s_glrenderer = Register("s_glrenderer", "UNKNOWN", CVarFlag.Textual | CVarFlag.ReadOnly, "What renderer for OpenGL is in use.");
            s_glvendor = Register("s_glvendor", "UNKNOWN", CVarFlag.Textual | CVarFlag.ReadOnly, "What graphics card vendor made the device being used for rendering.");
            // Game CVars
            g_timescale = Register("g_timescale", "1", CVarFlag.Numeric | CVarFlag.ServerControl, "The current game time scale value.");
            g_firstperson = Register("g_firstperson", "true", CVarFlag.Boolean, "Whether to be in FirstPerson view mode.");
            g_weathermode = Register("g_weathermode", "0", CVarFlag.Numeric | CVarFlag.ServerControl, "What weather mode is currently shown. 0 = none, 1 = rain, 2 = snow.");
            // Network CVars
            n_first = Register("n_first", "ipv4", CVarFlag.Textual, "Whether to prefer IPv4 or IPv6.");
            n_debugmovement = Register("n_debugmovement", "false", CVarFlag.Boolean, "Whether to debug movement networking.");
            n_movement_maxdistance = Register("n_movement_maxdistance", "20", CVarFlag.Numeric, "How far apart the client can move from the serverside player before snapping to the correct location.");
            n_movement_adjustment = Register("n_movement_adjustment", "0.1", CVarFlag.Numeric, "How rapidly to adjust the player's position to better match the server. Smaller numbers yield quicker results.");
            n_movemode = Register("n_movemode", "2", CVarFlag.Numeric, "Which movement mode to use. 1 = run-and-adjust, 2 = back-trace.");
            n_ourvehiclelerp = Register("n_ourvehiclelerp", "0.1", CVarFlag.Numeric, "How strongly to lerp our own vehicle's movement.");
            n_online = Register("n_online", "true", CVarFlag.Boolean, "Whether to only connect to servers with a valid login key. Disable this to play singleplayer without internet.");
            // Renderer CVars
            r_fullscreen = Register("r_fullscreen", "false", CVarFlag.Boolean | CVarFlag.Delayed, "Whether to use fullscreen mode.");
            r_width = Register("r_width", "1280", CVarFlag.Numeric | CVarFlag.Delayed, "What width the window should be.");
            r_height = Register("r_height", "720", CVarFlag.Numeric | CVarFlag.Delayed, "What height the window should be.");
            r_vsync = Register("r_vsync", "true", CVarFlag.Boolean, "Whether to use vertical synchronization mode.");
            r_lighting = Register("r_lighting", "true", CVarFlag.Boolean, "Whether to enable 3D lighting (Otherwise, use FullBright).");
            r_renderwireframe = Register("r_renderwireframe", "false", CVarFlag.Boolean, "Whether to render a wireframe.");
            r_fov = Register("r_fov", "70", CVarFlag.Numeric, "What Field of Vision range value to use.");
            r_znear = Register("r_znear", "0.1", CVarFlag.Numeric, "How close the near plane should be to the camera.");
            r_zfar = Register("r_zfar", "3500", CVarFlag.Numeric, "How far the far plane should be from the camera.");
            r_dof_strength = Register("r_dof_strength", "4", CVarFlag.Numeric, "How strong the Depth Of Field effect should be.");
            r_maxfps = Register("r_maxfps", "60", CVarFlag.Numeric | CVarFlag.Delayed, "What the FPS cap should be.");
            r_lightmaxdistance = Register("r_lightmaxdistance", "35", CVarFlag.Numeric, "How far away a light can be from the camera before it is disabled.");
            r_fallbacklighting = Register("r_fallbacklighting", "true", CVarFlag.Boolean, "Whether to calculate fallback block lighting (Requires chunk reload).");
            r_shadowquality = Register("r_shadowquality", "1024", CVarFlag.Numeric, "What texture size to use for shadow maps.");
            r_shadowblur = Register("r_shadowblur", "0.25", CVarFlag.Numeric, "What factor to use for shadow blurring. Smaller = blurrier.");
            r_shadowpace = Register("r_shadowpace", "1", CVarFlag.Numeric, "How rapidly to rerender shadows, in frames.");
            r_shadows = Register("r_shadows", "false", CVarFlag.Boolean, "Whether to render shadows at all.");
            r_cloudshadows = Register("r_cloudshadows", "false", CVarFlag.Boolean, "Whether to display shadows from clouds.");
            r_good_graphics = Register("r_good_graphics", "true", CVarFlag.Boolean | CVarFlag.Delayed, "Whether to use 'good' graphics."); // TODO: Callback to auto-set
            r_skybox = Register("r_skybox", "default", CVarFlag.ServerControl | CVarFlag.Textual, "What skybox to use.");
            r_blocktexturelinear = Register("r_blocktexturelinear", "true", CVarFlag.Boolean | CVarFlag.Delayed, "Whether block textures are to use a linear blur or nearest-pixel mode.");
            r_blocktexturewidth = Register("r_blocktexturewidth", "256", CVarFlag.Numeric | CVarFlag.Delayed, "What texture width (pixels) block textures should use.");
            r_toonify = Register("r_toonify", "false", CVarFlag.Boolean, "Whether to use a 'toonify' post-processing effect.");
            r_transplighting = Register("r_transplighting", "true", CVarFlag.Boolean, "Whether transparent objects should be lit properly (otherwise, fullbright).");
            r_transpshadows = Register("r_transpshadows", "false", CVarFlag.Boolean, "Whether transparent objects should be lit using HD shadows (Requires r_shadows true).");
            r_3d_enable = Register("r_3d_enable", "false", CVarFlag.Boolean, "Whether to use 3D side-by-side rendering mode.");
            r_fast = Register("r_fast", "false", CVarFlag.Boolean, "Whether to use 'fast' rendering mode.");
            r_chunksatonce = Register("r_chunksatonce", "100", CVarFlag.Numeric, "How many chunks can render at once.");
            r_chunkoverrender = Register("r_chunkoverrender", "true", CVarFlag.Boolean, "Whether to render chunks more often for quality's sake, at risk of performance.");
            r_transpll = Register("r_transpll", "false", CVarFlag.Boolean, "Whether to use GPU linked lists when rendering transparent objects.");
            r_noblockshapes = Register("r_noblockshapes", "false", CVarFlag.Boolean, "Whether block shapes are disabled or not.");
            r_treeshadows = Register("r_treeshadows", "true", CVarFlag.Boolean, "Whether trees cast shadows.");
            r_godrays = Register("r_godrays", "true", CVarFlag.Boolean, "Whether to render GodRays (rays of light from the sun."); // TODO: Validate?
            r_hdr = Register("r_hdr", "true", CVarFlag.Boolean, "Whether to render with high dynamic range adjustments enabled.");
            r_chunkmarch = Register("r_chunkmarch", "false", CVarFlag.Boolean, "Whether to use 'chunk marching' method to render chunks (if false, uses a generic loop).");
            r_clouds = Register("r_clouds", "true", CVarFlag.Boolean, "Whether to render clouds."); // TODO: Inform the server of this to reduce bandwidth.
            r_motionblur = Register("r_motionblur", "false", CVarFlag.Boolean, "Whether to blur the screen to better represent motion.");
            r_plants = Register("r_plants", "true", CVarFlag.Boolean, "Whether to render small plants around the view.");
            // Audio CVars
            a_musicvolume = Register("a_musicvolume", "0.5", CVarFlag.Numeric, "What volume the music should be.");
            a_musicpitch = Register("a_musicpitch", "1", CVarFlag.Numeric, "What pitch the music should be.");
            a_globalvolume = Register("a_globalvolume", "1", CVarFlag.Numeric, "What volume all sounds should be.");
            a_globalpitch = Register("a_globalpitch", "1", CVarFlag.Numeric, "What pitch all sounds should be.");
            a_music = Register("a_music", "music/epic/bcvoxalia_adventure", CVarFlag.Textual | CVarFlag.ServerControl, "What music should be played.");
            a_quietondeselect = Register("a_quietondeselect", "true", CVarFlag.Boolean, "Whether to quiet music when the window is deselected.");
            a_echovolume = Register("a_echovolume", "0", CVarFlag.Numeric, "What volume to echo microphone pickup at, for audio testing purposes. Specify 0 to not listen to the microphone at all.");
            // UI CVars
            u_mouse_sensitivity = Register("u_mouse_sensitivity", "1", CVarFlag.Numeric, "How sensitive the mouse is.");
            u_reticle = Register("u_reticle", "1", CVarFlag.Textual, "What reticle to use.");
            u_reticlescale = Register("u_reticlescale", "32", CVarFlag.Numeric, "How big the reticle should be.");
            u_showhud = Register("u_showhud", "true", CVarFlag.Boolean, "Whether to render the HUD.");
            u_highlight_targetblock = Register("u_highlight_targetblock", "true", CVarFlag.Boolean, "Whether to highlight the targeted block.");
            u_highlight_placeblock = Register("u_highlight_placeblock", "true", CVarFlag.Boolean, "Whether to highlight the targeted placement block.");
            u_debug = Register("u_debug", "false", CVarFlag.Boolean, "Whether to display debug information on the HUD.");
            u_showmap = Register("u_showmap", "false", CVarFlag.Boolean | CVarFlag.ServerControl, "Whether to display a map on the HUD.");
            u_showrangefinder = Register("u_showrangefinder", "false", CVarFlag.Boolean | CVarFlag.ServerControl, "Whether to display a range finder on the HUD.");
            u_showping = Register("u_showping", "true", CVarFlag.Boolean, "Whether to display the current ping on the UI.");
            u_showcompass = Register("u_showcompass", "false", CVarFlag.Boolean | CVarFlag.ServerControl, "Whether to display a compass on the HUD.");
            u_colortyping = Register("u_colortyping", "false", CVarFlag.Boolean, "Whether to color the text currently being typed typed (chat, console, ...).");
        }