private void PrefillBenchmarkInfo() { m_benchmarkInfo = new BenchmarkInfo(); m_benchmarkInfo.Name = m_baseExperiment.ExperimentInfo.Name; m_benchmarkInfo.Author = m_baseExperiment.ExperimentInfo.Author; m_benchmarkInfo.Contributors = m_baseExperiment.ExperimentInfo.Contributors; m_benchmarkInfo.Description = m_baseExperiment.ExperimentInfo.Description; m_benchmarkInfo.FilePath = null; //assure that original path is null }
public Benchmark(Contest contest, string linkToContest, string benchmarksDirectory) { //determine the full benchmark file path... although file might not have been downloaded yet string benchmarkPath = System.IO.Path.Combine(benchmarksDirectory, contest.PackageFileName); BenchmarkInfo = new BenchmarkInfo(contest.ContestGUID, contest.Name, contest.Author, contest.Contributors, contest.Description, contest.ShortDescription, benchmarkPath, contest.Deadline, linkToContest); ComponentTemplate = null; IsOnlineContest = true; }
public Benchmark(ExperimentInfo experimentInfo, ComponentTemplateMetadata componentTemplate) { if (experimentInfo == null) throw new ArgumentNullException("benchmarkInfo"); if (String.IsNullOrEmpty(experimentInfo.FilePath)) throw new ArgumentException("Benchmark file path cannot be null or empty."); if (componentTemplate == null) throw new ArgumentNullException("componentTemplate"); BenchmarkInfo = new BenchmarkInfo(experimentInfo); ComponentTemplate = componentTemplate; IsOnlineContest = false; }
public Benchmark(ExperimentInfo experimentInfo, ComponentTemplateMetadata componentTemplate) { if (experimentInfo == null) { throw new ArgumentNullException("benchmarkInfo"); } if (String.IsNullOrEmpty(experimentInfo.FilePath)) { throw new ArgumentException("Benchmark file path cannot be null or empty."); } if (componentTemplate == null) { throw new ArgumentNullException("componentTemplate"); } BenchmarkInfo = new BenchmarkInfo(experimentInfo); ComponentTemplate = componentTemplate; IsOnlineContest = false; }
private static Benchmark ReadBenchmark(string benchmarkFile) { XmlReader reader = XmlReader.Create(benchmarkFile); XPathDocument doc = new XPathDocument(reader); XPathNavigator nav = doc.CreateNavigator(); //new version XPathNavigator benchmarkInfoXmlNode = nav.SelectSingleNode("/graph/BenchmarkInfo"); BenchmarkInfo benchmarkInfo = null; ComponentTemplateMetadata template = null; //read the benchmark info if (benchmarkInfoXmlNode != null) { XmlSerializer m_experimentInfoSerializer = TraceLab.Core.Serialization.XmlSerializerFactory.GetSerializer(typeof(BenchmarkInfo), null); benchmarkInfo = (BenchmarkInfo)m_experimentInfoSerializer.Deserialize(benchmarkInfoXmlNode.ReadSubtree()); } //find the template if (benchmarkInfo != null) { template = FindTemplateComponentMetadata(nav); } Benchmark benchmark = null; if (benchmarkInfo != null && template != null) { //update benchmark filepath benchmarkInfo.FilePath = benchmarkFile; benchmark = new Benchmark(benchmarkInfo, template); } return(benchmark); }