Пример #1
0
        public override GCPData ImportData(string path)
        {
            var parser = new GcolParser();

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

            instance.Name         = Path.GetFileName(path);
            instance.Description += Environment.NewLine + "Loaded from file \"" + path + "\" on " + DateTime.Now.ToString();
            return(instance);
        }
Пример #2
0
        public override GCPData LoadData(IDataDescriptor id)
        {
            var descriptor          = (GcolDataDescriptor)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 GcolParser();
                    parser.Parse(stream);
                    var instance = Load(parser);
                    instance.Name         = id.Name;
                    instance.Description += Environment.NewLine + id.Description;
                    int bestknown;
                    if (bkq.TryGetValue(instance.Name, out bestknown))
                    {
                        instance.BestKnownColors = bestknown;
                    }
                    return(instance);
                }
            }
        }