コード例 #1
0
        static void TestEngineThroughService(string Program, Languages Lang)
        {
            OutputData odata;
            bool       bytes = true;

            using (var s = new n226589_s_dedikuoti_lt.Service())
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();
                Test.n226589_s_dedikuoti_lt.Result res = s.DoWork(Program, (Test.n226589_s_dedikuoti_lt.Languages)Lang, "test", "test", bytes);

                watch.Stop();
                if (res != null)
                {
                    if (string.IsNullOrEmpty(res.Stats))
                    {
                        res.Stats = "";
                    }
                    else
                    {
                        res.Stats += ", ";
                    }
                    res.Stats += string.Format("absolute service time: {0} sec", Math.Round((double)watch.ElapsedMilliseconds / (double)1000, 2));
                }

                odata = new OutputData()
                {
                    Errors       = res.Errors,
                    Warnings     = res.Warnings,
                    Stats        = res.Stats,
                    Output       = res.Output,
                    Exit_Status  = res.Exit_Status,
                    System_Error = res.System_Error
                };
                if (bytes)
                {
                    if (res.Errors_Bytes != null)
                    {
                        odata.Errors = System.Text.Encoding.Unicode.GetString(res.Errors_Bytes);
                    }
                    if (res.Warnings_Bytes != null)
                    {
                        odata.Warnings = System.Text.Encoding.Unicode.GetString(res.Warnings_Bytes);
                    }
                    if (res.Output_Bytes != null)
                    {
                        odata.Output = System.Text.Encoding.Unicode.GetString(res.Output_Bytes);
                    }
                }
            }
            ShowData(odata);
        }
コード例 #2
0
ファイル: Main.cs プロジェクト: mulamrkreddy/rextester
        static void TestEngineThroughService(string Program, Languages Lang)
        {
            OutputData odata;
            bool bytes = true;
            using(var s = new n226589_s_dedikuoti_lt.Service())
            {
                Stopwatch watch = new Stopwatch();
                watch.Start();
                Test.n226589_s_dedikuoti_lt.Result res = s.DoWork(Program, (Test.n226589_s_dedikuoti_lt.Languages)Lang, "test", "test", bytes);

                watch.Stop();
                if(res != null)
                {
                    if(string.IsNullOrEmpty(res.Stats))
                        res.Stats = "";
                    else
                        res.Stats += ", ";
                    res.Stats += string.Format("absolute service time: {0} sec", Math.Round((double)watch.ElapsedMilliseconds/(double)1000, 2));
                }

                odata = new OutputData()
                    {
                        Errors = res.Errors,
                        Warnings = res.Warnings,
                        Stats = res.Stats,
                        Output = res.Output,
                        Exit_Status = res.Exit_Status,
                        System_Error = res.System_Error
                    };
                if(bytes)
                {
                    if(res.Errors_Bytes != null)
                        odata.Errors = System.Text.Encoding.Unicode.GetString(res.Errors_Bytes);
                    if(res.Warnings_Bytes != null)
                        odata.Warnings = System.Text.Encoding.Unicode.GetString(res.Warnings_Bytes);
                    if(res.Output_Bytes != null)
                        odata.Output = System.Text.Encoding.Unicode.GetString(res.Output_Bytes);
                }
            }
            ShowData(odata);
        }