Пример #1
0
        internal KeyFamily Parse(DSDDocument dsd)
        {
            KeyFamily keyFamily = new KeyFamily("keyFamilyName","lsdkfj", "agnencyID");

            XElement kfElement = dsd.GetKeyFamilyElement();

            foreach (var keFamilyElement in kfElement.Elements())
            {
                if (keFamilyElement.Name.LocalName == "Components")
                {
                    foreach (var element in keFamilyElement.Elements())
                    {
                        if (element.Name.LocalName == "Dimension")
                        {
                            var parser = new DimensionParser();
                            var dimension = parser.Parse(element, dsd);
                            keyFamily.AddDimension(dimension);
                        }
                    }
                }
            }

            return keyFamily;

        }
Пример #2
0
        public ECKeyPair DeriveKey(KeyFamily keyFamily, uint index)
        {
            ExtKey  key        = new ExtKey(_walletService.Key.PrivateKeyData);
            KeyPath keyPath    = KeyPathHelper.Create(_networkParameters.CoinType, keyFamily, (int)index);
            ExtKey  derivedKey = key.Derive(keyPath);

            return(new ECKeyPair(derivedKey.PrivateKey.GetBytes(), true));
        }
Пример #3
0
        internal Group(Id id, KeyFamily keyFamily)
        {            
            Contract.AssertNotNull(id, "id");
            Contract.AssertNotNull(keyFamily, "keyFamily");

            Id = id;
            KeyFamily = keyFamily;
            Description = new InternationalText();
        }
Пример #4
0
        public ObsValueMap(KeyFamily keyFamily)
        {
            _keyFamily = keyFamily;

            Map(o => converter.Serialize(o, out startTime)).ToAttribute("value", true)
            .Set(v => s = v)
            .Converter(new StringConverter());

            Map(o => startTime).ToAttribute("startTime", false)
            .Set(v => startTime = v)
            .Converter(new StringConverter());
        }
Пример #5
0
        public DataMessageMap(KeyFamily keyFamily)
        {
            RegisterNamespace("common", Namespaces.Common);
            RegisterNamespace("generic", Namespaces.Generic);

            ElementsOrder("Header", "DataSet");

            Map(o => o.Header).ToElement("Header", true)
            .Set(v => _message.Header = v)
            .ClassMap(() => new HeaderMap());

            Map(o => o.DataSet).ToElement(Namespaces.Generic + "DataSet", true)
            .Set(v => _message.DataSet = v)
            .ClassMap(() => new DataSetMap(keyFamily));
        }
Пример #6
0
        public ValueMap(KeyFamily keyFamily)
        {
            _keyFamily = keyFamily;

            Map(o => o.Key).ToAttribute("concept", true)
            .Set(v => id = v)
            .Converter(new IDConverter());

            Map(o => converter.Serialize(o.Value, out startTime)).ToAttribute("value", true)
            .Set(v => s = v)
            .Converter(new StringConverter());

            Map(o => startTime).ToAttribute("startTime", false)
            .Set(v => startTime = v)
            .Converter(new StringConverter());
        }
Пример #7
0
        public DataSetMap(KeyFamily keyFamily)
        {
            _dataSet = new DataSet(keyFamily);

            Map(o => o.KeyFamily.ID).ToSimpleElement(Namespaces.Generic + "KeyFamilyRef", true)
            .Set(id => VerifyKeyFamilyRef(id))
            .Converter(new IDConverter());

            MapContainer(Namespaces.Generic + "Attributes", false)
            .MapCollection(o => GetKeyValues(o.Attributes)).ToElement("Value", false)
            .Set(v => _dataSet.Attributes.Add(v.Concept, v.Value))
            .ClassMap(() => new KeyValueMap());

            MapCollection(o => o.Series).ToElement(Namespaces.Generic + "Series", false)
            .ClassMap(() => new SeriesMap(_dataSet));
        }
Пример #8
0
        public GroupDescriptorMap(KeyFamily keyFamily)
        {
            ElementsOrder("DimensionRef", "AttachmentConstraintRef", "Description", "Annotations");

            Map(o => o.ID).ToAttribute("id", true)
            .Set(v => _group = keyFamily.CreateNewGroup(v))
            .Converter(new IDConverter());

            MapCollection(o => o.Dimensions.Select(d => d.Concept.ID)).ToSimpleElement("DimensionRef", true)
            .Set(v => _group.AddDimension(v))
            .Converter(new IDConverter());

            Map(o => o.AttachmentConstraintRef).ToSimpleElement("AttachmentConstraintRef", false)
            .Set(v => _group.AttachmentConstraintRef = v)
            .Converter(new IDConverter());

            MapCollection(o => o.Description).ToElement("Description", false)
            .Set(v => _group.Description.Add(v))
            .ClassMap(() => new InternationalStringMap());
        }
Пример #9
0
        internal KeyFamily Parse(DSDDocument dsd)
        {
            KeyFamily keyFamily = new KeyFamily("keyFamilyName", "lsdkfj", "agnencyID");

            XElement kfElement = dsd.GetKeyFamilyElement();

            foreach (var keFamilyElement in kfElement.Elements())
            {
                if (keFamilyElement.Name.LocalName == "Components")
                {
                    foreach (var element in keFamilyElement.Elements())
                    {
                        if (element.Name.LocalName == "Dimension")
                        {
                            var parser    = new DimensionParser();
                            var dimension = parser.Parse(element, dsd);
                            keyFamily.AddDimension(dimension);
                        }
                    }
                }
            }

            return(keyFamily);
        }
Пример #10
0
 public GenericDataWriter(TextWriter textWriter, KeyFamily keyFamily, XmlWriterSettings settings)
     : base(textWriter, keyFamily, settings)
 { }
Пример #11
0
 public GenericDataWriter(StringBuilder stringBuilder, KeyFamily keyFamily, XmlWriterSettings settings)
     : base(stringBuilder, keyFamily, settings)
 { }
Пример #12
0
 public DataValidator(KeyFamily keyFamily)
 {
     KeyFamily = keyFamily;
 }
Пример #13
0
 public MessageGroupReader(XmlReader xmlReader, KeyFamily keyFamily)
 {
     XmlReader = xmlReader;
     KeyFamily = keyFamily;
     ThrowExceptionIfNotValid = true;
 }
Пример #14
0
 public MessageGroupReader(string fileName, KeyFamily keyFamily)
     : this(XmlReader.Create(fileName), keyFamily)
 { }
Пример #15
0
 public DataWriter(XmlWriter writer, KeyFamily keyFamily)
 {
     KeyFamily = keyFamily;
     XmlWriter = writer;
     _validator = new DataValidator(keyFamily);
 }
Пример #16
0
 public CompactDataWriter(string path, KeyFamily keyFamily, string prefix, string targetNamespace)
     : base(path, keyFamily)
 {
     _prefix = prefix;
     _targetNamespace = targetNamespace;
 }
Пример #17
0
 public CompactDataWriter(StringBuilder stringBuilder, KeyFamily keyFamily, string prefix, string targetNamespace)
     : base(stringBuilder, keyFamily)
 {
     _prefix = prefix;
     _targetNamespace = targetNamespace;
 }
Пример #18
0
 public DataWriter(StringBuilder stringBuilder, KeyFamily keyFamily, XmlWriterSettings settings)
 {
     KeyFamily = keyFamily;
     XmlWriter = XmlWriter.Create(stringBuilder, settings);
     _validator = new DataValidator(keyFamily);
 }
Пример #19
0
 public DataWriter(TextWriter textWriter, KeyFamily keyFamily, XmlWriterSettings settings)
 {
     KeyFamily = keyFamily;
     XmlWriter = XmlWriter.Create(textWriter, settings);
     _validator = new DataValidator(keyFamily);
 }
Пример #20
0
 public DataWriter(string path, KeyFamily keyFamily, XmlWriterSettings settings)
 {
     KeyFamily = keyFamily;
     XmlWriter = XmlWriter.Create(path, settings);
     _validator = new DataValidator(keyFamily);
 }
Пример #21
0
 public DataWriter(TextWriter textWriter, KeyFamily keyFamily)
 {
     KeyFamily = keyFamily;
     XmlWriter = XmlWriter.Create(textWriter, new XmlWriterSettings() { Indent = true });
     _validator = new DataValidator(keyFamily);
 }
Пример #22
0
 public DataWriter(StringBuilder stringBuilder, KeyFamily keyFamily)
 {
     KeyFamily = keyFamily;
     XmlWriter = XmlWriter.Create(stringBuilder, new XmlWriterSettings() { Indent = true });
     _validator = new DataValidator(keyFamily);
 }
Пример #23
0
 internal DataReader(XmlReader reader, KeyFamily keyFamily)
 {
     XmlReader = reader;
     KeyFamily = keyFamily;
     ThrowExceptionIfNotValid = true;
 }
Пример #24
0
 public CompactDataWriter(TextWriter textWriter, KeyFamily keyFamily, XmlWriterSettings settings, string prefix, string targetNamespace)
     : base(textWriter, keyFamily, settings)
 {
     _prefix = prefix;
     _targetNamespace = targetNamespace;
 }
Пример #25
0
 public GenericDataWriter(string path, KeyFamily keyFamily)
     : base(path, keyFamily)
 { }
Пример #26
0
 public GenericDataReader(XmlReader xmlReader, KeyFamily keyFamily)
     : base(xmlReader, keyFamily)
 { }
Пример #27
0
 public CompactDataWriter(XmlWriter writer, KeyFamily keyFamily, string prefix, string targetNamespace)
     : base(writer, keyFamily)
 {
     _prefix = prefix;
     _targetNamespace = targetNamespace;
 }
Пример #28
0
 public GenericDataWriter(Stream stream, KeyFamily keyFamily)
     : base(stream, keyFamily)
 { }
Пример #29
0
 public CompactDataWriter(Stream stream, KeyFamily keyFamily, XmlWriterSettings settings, string prefix, string targetNamespace)
     : base(stream, keyFamily, settings)
 {
     _prefix = prefix;
     _targetNamespace = targetNamespace;
 }
Пример #30
0
 public GenericDataWriter(XmlWriter writer, KeyFamily keyFamily)
     : base(writer, keyFamily)
 { }
Пример #31
0
 public CompactDataReader(XmlReader xmlReader, KeyFamily keyFamily)
     : base(xmlReader, keyFamily)
 { }
Пример #32
0
 public GenericDataWriter(StringBuilder stringBuilder, KeyFamily keyFamily)
     : base(stringBuilder, keyFamily)
 { }
Пример #33
0
        /// <summary>
        /// Create a data reader based on an xml data reader. This mathod looks into the first element
        /// and creates the right reader (Generic, Compact, Utility, CrossSectional).
        /// </summary>
        /// <param name="reader">The reader.</param>
        /// <param name="keyFamily">The key family.</param>
        /// <returns>An instance of the DataReader.</returns>
        public static DataReader Create(XmlReader reader, KeyFamily keyFamily)
        {
            Contract.AssertNotNull(reader, "reader");

            if (reader.ReadState == ReadState.Initial)
            {
                reader.Read();
            }

            if (reader.NodeType != XmlNodeType.Element)
            {
                reader.ReadNextStartElement();
            }

            if (reader.LocalName == "CompactData")
                return new CompactDataReader(reader, keyFamily);
            else if (reader.LocalName == "GenericData")
                return new GenericDataReader(reader, keyFamily);
            else
                throw new SDMXException("Unsupported root element ({0}) for data file.", reader.LocalName);
        }
Пример #34
0
 public GenericDataWriter(string path, KeyFamily keyFamily, XmlWriterSettings settings)
     : base(path, keyFamily, settings)
 { }
Пример #35
0
 public MessageGroupReader(Stream stream, KeyFamily keyFamily)
     : this(XmlReader.Create(stream), keyFamily)
 { } 
Пример #36
0
 public GenericDataWriter(Stream stream, KeyFamily keyFamily, XmlWriterSettings settings)
     : base(stream, keyFamily, settings)
 { }
Пример #37
0
 public GenericDataWriter(TextWriter textWriter, KeyFamily keyFamily)
     : base(textWriter, keyFamily)
 { }
Пример #38
0
 public static KeyPath Create(int coinType, KeyFamily keyFamily, int index)
 {
     return(KeyPath.Parse($"m/{Bip043Purpose}'/{coinType}/{(int)keyFamily}/{KeyDerivationVersion}/{index}"));
 }