Exemple #1
0
        public override GQAPData ImportData(string path)
        {
            var parser = new CordeauGQAPParser();

            parser.Parse(path);
            var instance = Load(parser);

            instance.Name        = Path.GetFileName(path);
            instance.Description = "Loaded from file \"" + path + "\" on " + DateTime.Now.ToString();

            return(instance);
        }
Exemple #2
0
        public override GQAPData LoadData(IDataDescriptor id)
        {
            var descriptor          = (CordeauGQAPDataDescriptor)id;
            var instanceArchiveName = GetResourceName(FileName + @"\.zip");

            using (var instancesZipFile = new ZipArchive(GetType().Assembly.GetManifestResourceStream(instanceArchiveName), ZipArchiveMode.Read)) {
                var entry = instancesZipFile.GetEntry(descriptor.InstanceIdentifier);
                using (var stream = entry.Open()) {
                    var parser = new CordeauGQAPParser();
                    parser.Parse(stream);
                    var instance = Load(parser);

                    instance.Name        = id.Name;
                    instance.Description = id.Description;

                    return(instance);
                }
            }
        }