Exemplo n.º 1
0
        public void showStatus()
        {
            //    Console.Clear();
            string[,] arrValues = new string[4, 1];

            arrValues[0, 0] = "Hero " + name;
            arrValues[1, 0] = "Life " + actualLife.ToString() + "/" + lifeSize.ToString();
            arrValues[2, 0] = "ATK " + ATK.ToString();
            arrValues[3, 0] = "DEF " + DEF.ToString();

            ArrayPrinter.PrintToConsole(arrValues);
        }
Exemplo n.º 2
0
        static void A1()
        {
            var data = new[, ] {
                { "ปรับตัวรับมือกับเทคโนโลยีดิจิทัลกันอย่างคึกคัก", "เชื้อชาติ", "3803" },
                { "ซอฟต์แวร์ออกแบบเชิงวิศวกรรมชื่อดัง", "ภาษาไทยมีปัญหาสระลอย", "3803" },
                { "ซอฟต์แวร์ออกแบบเชิงวิศวกรรมชื่อดัง", "ภาษาไทยมีปัญหาสระลอย", "0" },
                { "ขี่ช้าง", "ภาษาไทยมีปัญหาสระลอย", "3" },
                { "ซอฟต์แวร์ออกแบบเชิงวิศวกรรมชื่อดัง", "ชี้ชี้ชี้", "3974" },
                { "อู่อู้", "ก็อ๋อชี้ชี้ชี้", "s803" },
                { "อู่อู้", "อี้อี้อี้อี่อี่", "x3" }
            };

            ArrayPrinter.PrintToConsole(data);
        }
Exemplo n.º 3
0
    static void Main(string[] args)
    {
        int value = 997;

        string[,] arrValues = new string[5, 5];
        for (int i = 0; i < arrValues.GetLength(0); i++)
        {
            for (int j = 0; j < arrValues.GetLength(1); j++)
            {
                value++;
                arrValues[i, j] = value.ToString();
            }
        }
        ArrayPrinter.PrintToConsole(arrValues);
        Console.ReadLine();
    }
Exemplo n.º 4
0
        private void PrintGame()
        {
            string[,] mdArr = new string[4, 4];
            for (int i = 0; i < 4; i++)
            {
                for (int j = 0; j < 4; j++)
                {
                    mdArr[i, j] = string.Empty;
                }
            }
            int rowLength = mdArr.GetLength(0);
            int colLength = mdArr.GetLength(1);

            foreach (Tile item in currentGameState)
            {
                mdArr[item.Row, item.Column] = item.Number.ToString();
            }
            ArrayPrinter.PrintToConsole(mdArr);
        }
Exemplo n.º 5
0
        public void RunTests(string[] tests)
        {
            Utils.DebugMessage("************* CONFIGURATION ***************");
            Utils.DebugMessage("TEST PLATFORM: " + Config.platform.ToString());
            Utils.DebugMessage("");
            Utils.DebugMessage("VERBOSE: " + Config.Verbose.ToString());
            Utils.DebugMessage("OUTPUT UNLIMITED: " + Config.Unlimited.ToString());
            Utils.DebugMessage("FAST MODE: " + Config.fast.ToString());
            Utils.DebugMessage("OVERWRITE TARGET CODE: " + Config.overwriteTarget.ToString());
            Utils.DebugMessage("PERFORMANCE TESTS: " + Config.performanceTests.ToString());
            Utils.DebugMessage("COMPILATION MODE: " + Config.compileMode.ToString());
            Utils.DebugMessage("*******************************************");
            Console.WriteLine();
            Console.WriteLine();
            foreach (string _s in tests)
            {
                //Removed final '/' if exists
                string s = _s.TrimEnd('/');
                Environment.CurrentDirectory = Utils.testPath;
                KeyValuePair <DirectoryInfo, TestResult> kvp = Tests.First(x => x.Key.Name == s);

                DirectoryInfo di  = kvp.Key;
                TestResult    res = kvp.Value;

                if (s.StartsWith("PT") && !Config.performanceTests)
                {
                    res.cmakeCode   = -10;
                    res.alternative = -10;
                    res.diffCode    = -10;
                    res.msbuildCode = -10;
                    res.output      = -10;
                    continue;
                }

                Console.ForegroundColor = ConsoleColor.Green;
                Console.WriteLine("Running test " + di.Name);
                Console.ResetColor();

                try
                {
                    Environment.CurrentDirectory = Utils.alternativeDirectory;
                    //Run alternative
                    test.Alternative(di, res);
                    Environment.CurrentDirectory = Utils.testPath;
                }
                catch (Exception e)
                {
                    Console.WriteLine("ERROR IN ALTERNATIVE: " + e.Message);
                    res.alternative = 1;
                }

                try
                {
                    //Diff files
                    Utils.diff(di, res);
                }
                catch (Exception e)
                {
                    Console.WriteLine("ERROR IN DIFF: " + e.Message);
                    res.diffCode = 1;
                }
                if (Config.fast)
                {
                    res.output = res.msbuildCode = res.cmakeCode = -10;
                    continue;
                }

                if (res.alternative == 0)
                {
                    try
                    {
                        test.Make(di, res);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("ERROR IN MAKE: " + e.Message);
                        res.cmakeCode = -2;
                        res.cmakeCode = -2;
                    }
                }
                else
                {
                    res.output = res.msbuildCode = res.cmakeCode = -10;
                }


                if (kvp.Value.msbuildCode == 0)
                {
                    try
                    {
                        test.CompareOutputs(di, res);
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("ERROR COMPARING OUTPUTS: " + e.Message);
                        res.output = 1;
                    }
                }
                else
                {
                    res.output = -10;
                }

                try
                {
                    if (res.msbuildCode == 0 && Config.overwriteTarget)
                    {
                        Utils.OverwriteTarget(di);
                    }

                    //if (res.alternative == 0)
                    //  Utils.CountLines(di, res);
                }
                catch (Exception e)
                {
                    Console.WriteLine("ERROR OVERWRITING FILES OR COUNTING LINES: " + e.Message);
                }
            }

            string[,] arr = new string[tests.Length + 1, 7];
            arr[0, 0]     = "NAME";
            arr[0, 1]     = "X-LATE";
            arr[0, 2]     = "DIFF";
            arr[0, 3]     = "CMAKE";
            arr[0, 4]     = "COMPILE"; // (" + Config.platform.ToString() + "|" + Config.compileMode.ToString() + ")";
            arr[0, 5]     = "OUTPUT";
            arr[0, 6]     = "TIME";
            int i = 1;

            foreach (string _s in tests)
            {
                string s = _s.TrimEnd('/');
                KeyValuePair <DirectoryInfo, TestResult> kvp = Tests.First(x => x.Key.Name == s);
                //KeyValuePair<DirectoryInfo, TestResult> kvp = SearchFirstWithName(s);
                arr[i, 0] = kvp.Value.name;
                arr[i, 1] = kvp.Value.alternative == 0 ? "#gSUCCESS" : (kvp.Value.alternative == -10 ? "#ySKIPPED" : "#rFAIL. Code: " + kvp.Value.alternative);
                arr[i, 2] = kvp.Value.diffCode == 0 ? "#gNo Differ" : (kvp.Value.diffCode == 1 ? "#rDiffer" : (kvp.Value.diffCode == -10 ? "#ySKIPPED" : "#rError. Code: " + kvp.Value.diffCode));
                arr[i, 3] = kvp.Value.cmakeCode == 0 ? "#gSUCCESS" : (kvp.Value.cmakeCode == -10 ? "#ySKIPPED" : "#rFAIL. Code: " + kvp.Value.cmakeCode);
                arr[i, 4] = kvp.Value.msbuildCode == 0 ? "#gSUCCEESS" : (kvp.Value.msbuildCode == -10 ? "#ySKIPPED" : "#rFAIL. Code: " + kvp.Value.msbuildCode);
                arr[i, 5] = kvp.Value.output == 0 ? "#gOK" : (kvp.Value.output == -10 ? "#ySKIPPED" : "#rFAIL");
                arr[i, 6] = (kvp.Value.msTimeSpan >= 0 ? (kvp.Value.msTimeSpan == 0 ? "#y" : "#r") : "#g") + kvp.Value.msTimeSpan.ToString() + " ms " + "(" + kvp.Value.relativeTime.ToString("N2") + "%)";

                i++;
            }
            ArrayPrinter.PrintToConsole(arr);
        }