Esempio n. 1
0
        private void BenchmarkOpen()
        {
            BenchmarkFileText = string.Empty;
            if (File.Exists(BenchmarkFilePath))
            {
                try
                {
                    BenchmarkFileText = File.ReadAllText(BenchmarkFilePath);
                }
                catch (Exception e)
                {
                    Result = e.Message;
                    return;
                }

                try
                {
                    _docBenchmark = CodeDocument.Load(BenchmarkFileParser, BenchmarkFileText);
                }
                catch (Exception e)
                {
                    Result = "Can't read benchmark file: " + e.Message;
                    return;
                }
            }

            if (_docBenchmark != null && _docBenchmark.AnyNested(c => c.Name == "result1"))
            {
                BenchmarkCompare = new BenchmarkResult(_docBenchmark.Codes().First(c => c.Name == "result1"));
            }
        }