Esempio n. 1
0
        internal static CommandProxy GetCommandProxy(int id, MappingType mappingType)
        {
            switch (mappingType)
            {
            case MappingType.In:
                if (KnownInCommands.ContainsKey(id))
                {
                    return(KnownInCommands[id]);
                }
                break;

            case MappingType.Out:
                if (KnownOutCommands.ContainsKey(id))
                {
                    return(KnownOutCommands[id]);
                }
                break;

            default:
                break;
            }

            var description = ((KnownCommands)id).GetCommandDescription();

            return(new CommandProxy(description, mappingType));
        }
 /// <summary>
 /// Creates a ValueMapping object.
 /// </summary>
 /// <param name="mapFromValue"></param>
 /// <param name="mapToValue"></param>
 /// <param name="canSensitive"></param>
 /// <param name="mappingType"></param>
 public ValueMapping(string mapFromValue, string mapToValue, bool canSensitive, MappingType mappingType)
 {
     MapFromValue = mapFromValue;
     MapToValue = mapToValue;
     IsCanSensitive = canSensitive;
     MappingType = mappingType;
 }
        private void MapProperites(
            MappingType type,
            Func <string, bool> filter,
            IDictionary <string, string> args,
            Action <string, string> a)
        {
            var parameters = m_config.GetProperties().Where(p => p.UrlMapType == type);

            foreach (var p in parameters)
            {
                string valueStr = String.Empty;

                if (args.ContainsKey(p.Name))
                {
                    valueStr = args[p.Name];
                }

                if ((filter != null) && filter(valueStr))
                {
                    continue;
                }

                a(p.MappingName, valueStr);
            }
        }
Esempio n. 4
0
 public void AssertDataColumn(string label, DataColumn col,
                              string colName, bool allowDBNull,
                              bool autoIncr, int autoIncrSeed, int autoIncrStep,
                              string caption, MappingType colMap,
                              Type type, object defaultValue, string expression,
                              int maxLength, string ns, int ordinal, string prefix,
                              bool readOnly, bool unique)
 {
     Assert.AreEqual(colName, col.ColumnName, label + "ColumnName: ");
     Assert.AreEqual(allowDBNull, col.AllowDBNull, label + "AllowDBNull? ");
     Assert.AreEqual(autoIncr, col.AutoIncrement, label + "AutoIncrement? ");
     Assert.AreEqual(autoIncrSeed, col.AutoIncrementSeed, label + "  Seed: ");
     Assert.AreEqual(autoIncrStep, col.AutoIncrementStep, label + "  Step: ");
     Assert.AreEqual(caption, col.Caption, label + "Caption ");
     Assert.AreEqual(colMap, col.ColumnMapping, label + "Mapping: ");
     Assert.AreEqual(type, col.DataType, label + "Type: ");
     Assert.AreEqual(defaultValue, col.DefaultValue, label + "DefaultValue: ");
     Assert.AreEqual(expression, col.Expression, label + "Expression: ");
     Assert.AreEqual(maxLength, col.MaxLength, label + "MaxLength: ");
     Assert.AreEqual(ns, col.Namespace, label + "Namespace: ");
     if (ordinal >= 0)
     {
         Assert.AreEqual(ordinal, col.Ordinal, label + "Ordinal: ");
     }
     Assert.AreEqual(prefix, col.Prefix, label + "Prefix: ");
     Assert.AreEqual(readOnly, col.ReadOnly, label + "ReadOnly: ");
     Assert.AreEqual(unique, col.Unique, label + "Unique: ");
 }
Esempio n. 5
0
                public virtual Expression CreateConvertExpression(
                    Context context,
                    Expression source,
                    Type destinationType,
                    MappingType mappingType)
                {
                    if (mappingType == MappingType.QueryableProjection)
                    {
                        if (destinationType != null)
                        {
                            if (destinationType != source.Type.GetEnumerableBaseType())
                            {
                                throw new MapperCompileException();
                            }
                        }
                    }

                    if (!typeof(IEnumerable).IsAssignableFrom(source.Type))
                    {
                        throw new MapperCompileException();
                    }

                    //source.ToArray()
                    var toArray = Expression.Call(
                        typeof(Enumerable).GetMethod(nameof(Enumerable.ToArray)),
                        source
                        );

                    return(toArray);
                }
Esempio n. 6
0
 /// <summary>
 /// Creates a ValueMapping object.
 /// </summary>
 /// <param name="mapFromValue"></param>
 /// <param name="mapToValue"></param>
 /// <param name="canSensitive"></param>
 /// <param name="mappingType"></param>
 public ValueMapping(string mapFromValue, string mapToValue, bool canSensitive, MappingType mappingType)
 {
     MapFromValue   = mapFromValue;
     MapToValue     = mapToValue;
     IsCanSensitive = canSensitive;
     MappingType    = mappingType;
 }
Esempio n. 7
0
        public ReplaceWindow(MappingType mapType, string paramName)
        {
            mappingType   = mapType;
            parameterName = paramName;

            InitializeComponent();
        }
Esempio n. 8
0
 /// <summary>
 /// Constructs a new <see cref="T:Dataweb.NShape.Advanced.NumericModelMapping" /> instance.
 /// </summary>
 /// <param name="shapePropertyId">PropertyId of the shape's property.</param>
 /// <param name="modelPropertyId">PropertyId of the model's property.</param>
 /// <param name="mappingType">
 /// Type of the mapping:
 /// IntegerFloat e.g. means model's integer property to shapes float property.
 /// </param>
 /// <param name="intercept">Defines an offset for the mapped value.</param>
 /// <param name="slope">Defines a factor for the mapped value.</param>
 public NumericModelMapping(int shapePropertyId, int modelPropertyId, MappingType mappingType, float intercept, float slope)
     : base(modelPropertyId, shapePropertyId)
 {
     this.mappingType = mappingType;
     this.intercept   = intercept;
     this.slope       = slope;
 }
Esempio n. 9
0
        internal ACommand(int id, string name, TargetType target, MappingType mappingType, MappingSettings rawSettings)
        {
            RawSettings = rawSettings;

            Id          = id;
            Name        = name;
            Target      = target;
            MappingType = mappingType;

            updateAssignmentOptions();
            if (!AssignmentOptions.ContainsKey(Assignment))
            {
                RawSettings.Target = AssignmentOptions.First().Key;
            }

            updateControlTypeOptions();
            if (!ControlTypeOptions.ContainsKey(ControlType))
            {
                RawSettings.ControlType = ControlTypeOptions.First().Key;
            }

            updateControlInteractionOptions();
            if (!ControlInteractionOptions.ContainsKey(InteractionMode))
            {
                RawSettings.InteractionMode = ControlInteractionOptions.First().Key;
            }

            updateControl();
        }
Esempio n. 10
0
        private void SetTexgen(LLPrimitive obj, MappingType texgen, int side)
        {
            int sides = GetNumberOfSides(obj);

            if (side >= 0 && side < sides)
            {
                // Get or create the requested face and update
                Primitive.TextureEntryFace face = obj.Prim.Textures.CreateFace((uint)side);
                face.TexMapType = texgen;

                obj.Scene.EntityAddOrUpdate(this, obj, 0, (uint)LLUpdateFlags.Textures);
            }
            else if (side == LSLConstants.ALL_SIDES)
            {
                // Change all of the faces
                for (uint i = 0; i < sides; i++)
                {
                    Primitive.TextureEntryFace face = obj.Prim.Textures.GetFace(i);
                    if (face != null)
                    {
                        face.TexMapType = texgen;
                    }
                }

                obj.Scene.EntityAddOrUpdate(this, obj, 0, (uint)LLUpdateFlags.Textures);
            }
        }
Esempio n. 11
0
        private void reduceDefinitions2(MappingType what)
        {
            var deviceData = RawDevice.Data;
            //var used_bindings = this.Mappings.Where(d => d.Type == what).Select(d => d.MidiBinding).Where(e => e != null).Select(d => d.Note).ToList();  //
            var used_bindings = this.Mappings.Select(d => d.MidiBinding).Where(e => e != null).Where(d => d.Type == what).Select(d => d.Note).ToList();  //
            List <MidiDefinition> cur_definitions = (what == MappingType.In) ? deviceData.MidiDefinitions.In.Definitions : deviceData.MidiDefinitions.Out.Definitions;

            List <MidiDefinition> new_definitions = new List <MidiDefinition>(); // = definitions.Where(d => false);   // just to get the structure

            foreach (var binding in used_bindings)
            {
                var used_definitions = cur_definitions.Where(d => d.MidiNote == binding);

                foreach (var used_definition in used_definitions)
                {
                    new_definitions.Add(used_definition);   // TODO: check collisions
                }
            }

            // todo: remove colisions
            if (what == MappingType.In)
            {
                RawDevice.Data.MidiDefinitions.In.Definitions = new_definitions;
            }
            else
            {
                RawDevice.Data.MidiDefinitions.Out.Definitions = new_definitions;
            }
        }
Esempio n. 12
0
                public Expression CreateInstantiationExpression(
                    Context context,
                    Expression source,
                    Type destinationType,
                    MappingType mappingType)
                {
                    var mapperContext = context.MapperContext;

                    if (mappingType == MappingType.ObjectMap)
                    {
                        if (mapperContext.UseDependencyResolverForObjectMapping)
                        {
                            var getMethod =
                                typeof(IDependencyResolver).GetMethod(nameof(IDependencyResolver.Get), Type.EmptyTypes);

                            //context.resolver.Get(destinationType)
                            return(Expression.Call(
                                       Expression.Property(Expression.Constant(mapperContext),
                                                           typeof(MapperContext).GetProperty(nameof(MapperContext.DependencyResolver))),
                                       getMethod,
                                       Expression.Constant(destinationType)
                                       ));
                        }
                    }

                    if (!destinationType.TryGetDefaultConstructor(out var constructorInfo))
                    {
                        throw new MapperCompileException();
                    }

                    return(Expression.New(constructorInfo));
                }
Esempio n. 13
0
        // note: the unused default entries are PER DEVICE
        private void reduceDefinitions2(MappingType what)
        {
            var deviceData    = RawDevice.Data;
            var used_bindings = this.Mappings.Select(d => d.MidiBinding).Where(e => e != null).Where(d => d.Type == what).Select(d => d.Note).Distinct().ToList();
            List <MidiDefinition> cur_definitions = (what == MappingType.In) ? deviceData.MidiDefinitions.In.Definitions : deviceData.MidiDefinitions.Out.Definitions;

            List <MidiDefinition> new_definitions = new List <MidiDefinition>(); // = definitions.Where(d => false);   // just to get the structure

            foreach (var binding in used_bindings)
            {
                var used_definitions = cur_definitions.Where(d => d.MidiNote == binding);
                if (used_definitions.Any())
                {
                    // FIXME: see what we lose here (colisions)
                    // FIXME: do this whole thing in pure LINQ

                    // FIXME: also apply this at save time. Right now it is load time only.

                    new_definitions.Add(used_definitions.First());
                }
            }

            // todo: remove colisions
            if (what == MappingType.In)
            {
                RawDevice.Data.MidiDefinitions.In.Definitions = new_definitions;
            }
            else
            {
                RawDevice.Data.MidiDefinitions.Out.Definitions = new_definitions;
            }
        }
Esempio n. 14
0
 public Mapping(string mappingKey, int localUserId, MappingType type)
 {
     this.LocalUserId = localUserId;
     this.MappingType = type;
     this.CreateTime  = DateTime.Now;
     this.MappingKey  = mappingKey;
 }
Esempio n. 15
0
 public XmlMappingAttribute(string mappingName, int index, MappingType mappingType, XmlObjectType objectType)
 {
     MappingName = mappingName;
     Index       = index;
     MappingType = mappingType;
     ObjectType  = objectType;
 }
Esempio n. 16
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            (IPEndPoint ipEndPoint0, IPEndPoint ipEndPoint1) = _portMapping.Mapping;
            MappingType mappingType = _portMapping.MappingType;

            if (mappingType == MappingType.Prot2Prot)
            {
                TcpListener tcpListener0 = new TcpListener(ipEndPoint0);
                TcpListener tcpListener1 = new TcpListener(ipEndPoint1);
                tcpListener0.Start();
                tcpListener1.Start();

                Task <TcpClient> task0 = tcpListener0.AcceptTcpClientAsync();
                Task <TcpClient> task1 = tcpListener1.AcceptTcpClientAsync();

                TcpClient[] tcpClients = await Task.WhenAll(task0, task1);

                _ = ForwardStreamAsync(tcpClients[0].GetStream(), tcpClients[1].GetStream(), cancellationToken);
            }
            else
            {
                TcpClient tcpClient0 = new TcpClient();
                TcpClient tcpClient1 = new TcpClient();
                Task      task0      = tcpClient0.ConnectAsync(ipEndPoint0.Address, ipEndPoint0.Port);
                Task      task1      = tcpClient1.ConnectAsync(ipEndPoint1.Address, ipEndPoint1.Port);

                await Task.WhenAll(task0, task1);

                _ = ForwardStreamAsync(tcpClient0.GetStream(), tcpClient1.GetStream(), cancellationToken);
            }
        }
        /// <summary>
        /// 根据用户ID和映射类型获取用户映射信息
        /// </summary>
        /// <param name="userId">用户ID</param>
        /// <param name="type">映射类型</param>
        /// <returns>映射信息</returns>
        public Mapping GetMappingByLocalUserId(int userId, MappingType type)
        {
            var spec = mappingRepository.CreateSpecification()
                       .Where(o => o.LocalUserId == userId && o.MappingType == type);

            return(mappingRepository.FindOne(spec));
        }
        /// <summary>
        /// 根据映射键和类型获取映射对象
        /// </summary>
        /// <param name="mappingKey">映射的第三方键</param>
        /// <param name="type">映射类型</param>
        /// <returns>映射对象</returns>
        public Mapping GetMappingByMappingKey(string mappingKey, MappingType type)
        {
            var spec = mappingRepository.CreateSpecification()
                       .Where(o => o.MappingKey == mappingKey && o.MappingType == type);

            return(mappingRepository.FindOne(spec));
        }
Esempio n. 19
0
        private static Dictionary <string, AMidiDefinition> getDefinitionsFromTsi(MappingType type, string tsiFile)
        {
            Dictionary <string, AMidiDefinition> result = new Dictionary <string, AMidiDefinition>();

            try
            {
                TsiFile file = TsiFile.Load(String.Empty, tsiFile);
                if (type == MappingType.In)
                {
                    result = file.Devices.SelectMany(dev =>
                                                     dev.RawDevice.Data.MidiDefinitions.In.Definitions.Select(def =>
                                                                                                              AMidiDefinition.Parse(dev.TypeStr, MappingType.In, def))
                                                     ).DistinctBy(m => m.Note).ToDictionary(k => k.Note, k => k);
                }
                else
                {
                    result
                        = file.Devices.SelectMany(dev =>
                                                  dev.RawDevice.Data.MidiDefinitions.Out.Definitions.Select(def =>
                                                                                                            AMidiDefinition.Parse(dev.TypeStr, MappingType.Out, def))
                                                  ).DistinctBy(m => m.Note).ToDictionary(k => k.Note, k => k);
                }
            }
            catch (Exception)
            {
            }

            return(result);
        }
 public BoxUVModifier()
 {
     mInputTriangleBuffer = null;
     mMappingType         = MappingType.MT_FULL;
     mBoxSize             = Vector3.UNIT_SCALE;
     mBoxCenter           = Vector3.ZERO;
 }
Esempio n. 21
0
 public static void AssertDataColumn(string label, DataColumn col,
                                     string colName, bool allowDBNull,
                                     bool autoIncr, int autoIncrSeed, int autoIncrStep,
                                     string caption, MappingType colMap,
                                     Type type, object defaultValue, string expression,
                                     int maxLength, string ns, int ordinal, string prefix,
                                     bool readOnly, bool unique)
 {
     Assert.Equal(colName, col.ColumnName);
     Assert.Equal(allowDBNull, col.AllowDBNull);
     Assert.Equal(autoIncr, col.AutoIncrement);
     Assert.Equal(autoIncrSeed, col.AutoIncrementSeed);
     Assert.Equal(autoIncrStep, col.AutoIncrementStep);
     Assert.Equal(caption, col.Caption);
     Assert.Equal(colMap, col.ColumnMapping);
     Assert.Equal(type, col.DataType);
     Assert.Equal(defaultValue, col.DefaultValue);
     Assert.Equal(expression, col.Expression);
     Assert.Equal(maxLength, col.MaxLength);
     Assert.Equal(ns, col.Namespace);
     if (ordinal >= 0)
     {
         Assert.Equal(ordinal, col.Ordinal);
     }
     Assert.Equal(prefix, col.Prefix);
     Assert.Equal(readOnly, col.ReadOnly);
     Assert.Equal(unique, col.Unique);
 }
Esempio n. 22
0
        internal DataColumn GetColumnSchemaForNode(XmlBoundElement rowElem, XmlNode node)
        {
            //
            Debug.Assert(rowElem != null);
            // The caller must make sure that node is not a row-element
            Debug.Assert((node is XmlBoundElement) ? ((XmlBoundElement)node).Row == null : true);

            object tid = GetIdentity(rowElem.LocalName, rowElem.NamespaceURI);
            object cid = GetIdentity(node.LocalName, node.NamespaceURI);

            Hashtable columns = (Hashtable)columnSchemaMap[tid];

            if (columns != null)
            {
                DataColumn col = (DataColumn)(columns[cid]);
                if (col == null)
                {
                    return(null);
                }

                MappingType mt = col.ColumnMapping;

                if (node.NodeType == XmlNodeType.Attribute && mt == MappingType.Attribute)
                {
                    return(col);
                }
                if (node.NodeType == XmlNodeType.Element && mt == MappingType.Element)
                {
                    return(col);
                }
                // node's (localName, ns) matches a column, but the MappingType is different (i.e. node is elem, MT is attr)
                return(null);
            }
            return(null);
        }
Esempio n. 23
0
 public QueryParam(object value, string name, MappingType wherefun = MappingType.Contains, int group = 0)
 {
     this.value       = value;
     this.name        = name;
     this.mappingType = wherefun;
     this.group       = group;
 }
Esempio n. 24
0
        private Format.MidiDefinition getMidiDefinition(Device device, MappingType type, int id)
        {
            var deviceData  = device.RawDevice.Data;
            var definitions = (Command.MappingType == MappingType.In) ? deviceData.MidiDefinitions.In.Definitions : deviceData.MidiDefinitions.Out.Definitions;
            var bindings    = deviceData.Mappings.MidiBindings.Bindings;

            var rawBinding = bindings.SingleOrDefault(b => b.BindingId.Equals(id));

            if (rawBinding != null)
            {
                var defs = definitions.Where(d => d.MidiNote.Equals(rawBinding.MidiNote));
                if (defs.Any())
                {
                    if (defs.Count() == 1)
                    {
                        return(defs.Single());
                    }
                    else // definition duplicates found
                    {
                        // this should not happen actually, but there seems to be a bug in
                        // Xtreme Mapping / Traktor Controller Manager.
                        // TODO: Something for the consolidation function
                        return(defs.First());
                    }
                }
            }
            return(null);
        }
Esempio n. 25
0
        /*
            Constructs a DataColumnSurrogate from a DataColumn.
        */
        public DataColumnSurrogate(DataColumn dc)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("The datacolumn parameter is null");
            }
            _columnName = dc.ColumnName;
            _namespace = dc.Namespace;
            _dataType = dc.DataType;
            _prefix = dc.Prefix;
            _columnMapping = dc.ColumnMapping;
            _allowNull = dc.AllowDBNull;
            _autoIncrement = dc.AutoIncrement;
            _autoIncrementStep = dc.AutoIncrementStep;
            _autoIncrementSeed = dc.AutoIncrementSeed;
            _caption = dc.Caption;
            _defaultValue = dc.DefaultValue;
            _readOnly = dc.ReadOnly;
            _maxLength = dc.MaxLength;
            _expression = dc.Expression;

            //ExtendedProperties
            _extendedProperties = new Hashtable();
            if (dc.ExtendedProperties.Keys.Count > 0)
            {
                foreach (object propertyKey in dc.ExtendedProperties.Keys)
                {
                    _extendedProperties.Add(propertyKey, dc.ExtendedProperties[propertyKey]);
                }
            }
        }
Esempio n. 26
0
//                public override Expression CreateCopyExpression(
//                    MapperContext context,
//                    Expression source,
//                    Expression destination,
//                    Mapping mapping,
//                    Mapping.MemberMapInfo memberMapping,
//                    MappingType mappingType)
//                {
//                }

                public override Expression CreateConvertExpression(
                    Context context,
                    Expression source,
                    Type destinationType,
                    MappingType mappingType)
                {
                    var srcType = source.Type;

                    if (destinationType == typeof(string))
                    {
                        return(_toString(source, srcType));
                    }
                    else if (srcType == typeof(string) && destinationType == typeof(Enum))
                    {
                        return(_parse(source, destinationType));
                    }
//                    else if (destinationType.IsEnum && srcType.IsEnum &&
//                             MapEnumByName)
//                    {
//                        return _parse(_toString(source, srcType), destinationType);
//                    }

                    return(base.CreateConvertExpression(
                               context,
                               source,
                               destinationType,
                               mappingType));
                }
        /// <summary>
        /// Polls controllers for a change in inputs and maps a specified button.
        /// </summary>
        /// <param name="index">Index of the mapping.</param>
        /// <param name="type">The type of mapping.</param>
        /// <param name="token">Allows for cancelling the mapping process.</param>
        /// <param name="callback">Executed after every poll attempt for a key or axis.</param>
        public async Task <bool> Map(int index, MappingType type, CancellationToken token = default, Action callback = null)
        {
            const int sleepTime        = 32;
            var       controllerCaches = GetControllerCaches();

            if (type == MappingType.Button)
            {
                while (!token.IsCancellationRequested)
                {
                    foreach (var cache in controllerCaches)
                    {
                        var newButtons = cache.Controller.GetButtons();
                        for (int x = 0; x < ButtonSet.NumberOfButtons; x++)
                        {
                            if (newButtons.GetButton(x) == cache.Buttons.GetButton(x))
                            {
                                continue;
                            }

                            Mappings.Mappings[index] = new Mapping(cache.Controller.GetId(), type, x);
                            return(true);
                        }
                    }

                    callback?.Invoke();
                    await Task.Delay(sleepTime);
                }

                return(false);
            }
            else if (type == MappingType.Axis)
            {
                var halfMaxAxis = AxisSet.MaxValue / 2;
                while (!token.IsCancellationRequested)
                {
                    foreach (var cache in controllerCaches)
                    {
                        var newAxis = cache.Controller.GetAxis();
                        for (int x = 0; x < AxisSet.NumberOfAxis; x++)
                        {
                            var difference = MathF.Abs(cache.Axis.GetAxis(x) - newAxis.GetAxis(x));
                            if (difference < halfMaxAxis)
                            {
                                continue;
                            }

                            Mappings.Mappings[index] = new Mapping(cache.Controller.GetId(), type, x);
                            return(true);
                        }
                    }

                    callback?.Invoke();
                    await Task.Delay(sleepTime);
                }

                return(false);
            }

            return(false);
        }
Esempio n. 28
0
 public void SetSettingFromUI(int _height, MappingType _mapping, bool _spikes, TextAsset _curve)
 {
     spikes  = _spikes;
     height  = _height;
     mapping = _mapping;
     curve   = _curve;
 }
Esempio n. 29
0
        void AddDataToInvestigate(string mapping, MappingType type)
        {
            // avoid dealing with files
            if (String.IsNullOrEmpty(mapping) || mapping.StartsWith("\\\\"))
            {
                Trace.WriteLine("Ignoring addition of mapping " + mapping + "type = " + type);
                return;
            }
            switch (type)
            {
            case MappingType.Name:
                if (!KnownCN.Contains(mapping))
                {
                    if (!CNToInvestigate.Contains(mapping))
                    {
                        CNToInvestigate.Add(mapping);
                    }
                }
                break;

            case MappingType.Sid:
                if (mapping.StartsWith("S-1-5-32-") || mapping.StartsWith(databaseInformation["DomainSid"]))
                {
                    if (!KnownSID.Contains(mapping))
                    {
                        if (!SIDToInvestigate.Contains(mapping))
                        {
                            SIDToInvestigate.Add(mapping);
                        }
                    }
                }
                break;
            }
        }
Esempio n. 30
0
        public static AGenericMidiDefinition Parse(MappingType type, string id)
        {
            if (id.Contains("+"))
            {
                var combo = id.Split('+');
                return(new ComboMidiDefinition(Parse(type, combo[0]), Parse(type, combo[1])));
            }

            int channel = int.Parse(id.Substring(2, 2));
            var parts   = id.Split('.');

            switch (parts[1])
            {
            case "CC":
                return(new ControlChangeMidiDefinition(type, channel, int.Parse(parts[2])));

            case "Note":
                return(new NoteMidiDefinition(type, channel, parts[2]));

            case "PitchBend":
                return(new PitchBendMidiDefinition(type, channel));

            default:
                return(null);
            }
        }
Esempio n. 31
0
/*
 *              Constructs a DataColumnSurrogate from a DataColumn.
 */

        public DataColumnSurrogate(DataColumn dc)
        {
            if (dc == null)
            {
                throw new ArgumentNullException("dc");
            }
            _columnName        = dc.ColumnName;
            _namespace         = dc.Namespace;
            _dataType          = dc.DataType;
            _prefix            = dc.Prefix;
            _columnMapping     = dc.ColumnMapping;
            _allowNull         = dc.AllowDBNull;
            _autoIncrement     = dc.AutoIncrement;
            _autoIncrementStep = dc.AutoIncrementStep;
            _autoIncrementSeed = dc.AutoIncrementSeed;
            _caption           = dc.Caption;
            _defaultValue      = dc.DefaultValue;
            _readOnly          = dc.ReadOnly;
            _maxLength         = dc.MaxLength;
            _expression        = dc.Expression;

            //ExtendedProperties
            _extendedProperties = new Hashtable();
            if (dc.ExtendedProperties.Keys.Count > 0)
            {
                foreach (var propertyKey in dc.ExtendedProperties.Keys)
                {
                    _extendedProperties.Add(propertyKey, dc.ExtendedProperties[propertyKey]);
                }
            }
        }
Esempio n. 32
0
        internal static AGenericMidiDefinition Parse(MappingType type, Format.MidiDefinition definition)
        {
            string id = definition.MidiNote;

            if (string.IsNullOrEmpty(id))
            {
                return(null);
            }

            int channel = int.Parse(id.Substring(2, 2));

            if (id.Contains("+"))
            {
                return(new ComboMidiDefinition(type, channel, definition));
            }

            var parts = id.Split('.');

            switch (parts[1])
            {
            case "CC":
                return(new ControlChangeMidiDefinition(type, channel, int.Parse(parts[2]), definition));

            case "Note":
                return(new NoteMidiDefinition(type, channel, parts[2], definition));

            case "PitchBend":
                return(new PitchBendMidiDefinition(type, channel, definition));

            default:
                return(null);
            }
        }
Esempio n. 33
0
        PropertyInfo propertyInfo2; //fieldof(DPCollection<RoleDpo>)  or fieldof(xxxDpo)

        #endregion Fields

        #region Constructors

        public Mapping(PersistentObject dpo, PropertyInfo propertyInfo2)
        {
            this.association = Reflex.GetAssociationAttribute(propertyInfo2);

            if (association == null)
                return;

            this.dpoInstance = dpo;
            this.propertyInfo2 = propertyInfo2;

            Type dpoType2;            //typeof(RoleDpo)
            if (propertyInfo2.PropertyType.IsGenericType)
            {
                dpoType2 = PersistentObject.GetCollectionGenericType(propertyInfo2);

                if (this.association.TRelation == null)
                    mappingType = MappingType.One2Many;
                else
                    mappingType = MappingType.Many2Many;
            }
            else
            {
                dpoType2 = propertyInfo2.PropertyType;
                mappingType = MappingType.One2One;
            }

            this.propertyInfo1 = dpo.GetType().GetProperty(association.Column1);

            if (mappingType == MappingType.Many2Many)
            {
                this.clause1 = new SqlBuilder()
                    .SELECT.COLUMNS(association.Relation2)
                    .FROM(association.TRelation)
                    .WHERE(association.Relation1.ColumnName() == association.Column1.ParameterName());

                this.clause2 = new SqlBuilder()
                    .SELECT
                    .COLUMNS()
                    .FROM(dpoType2)
                    .WHERE(association.Relation2.ColumnName().IN(this.clause1));

            }
            else
            {
                SqlExpr where = association.Column2.ColumnName() == association.Column1.ParameterName();
                if (association.Filter != null)
                    where = where.AND(association.Filter);

                this.clause2 = new SqlBuilder()
                    .SELECT
                    .COLUMNS()
                    .FROM(dpoType2)
                    .WHERE(where);

                if(association.OrderBy != null)
                    this.clause2 = clause2.ORDER_BY(association.OrderBy);
            }
        }
 public HeaderedFileKeyCofiguration([NotNull] IHeaderedFileSerializerConfiguration config,
                                    [NotNull] SimpleMapper<HeaderdFileContext> mapper, [NotNull] string keyName,
                                    MappingType mappingType, [NotNull] Type type)
 {
     _config = config;
     _mapper = mapper;
     _keyName = keyName;
     _mappingType = mappingType;
     _type = type;
 }
Esempio n. 35
0
		public KeyMapping(Key keyFrom, Key keyTo)
		{
            if (ReferenceEquals(keyFrom, null) || ReferenceEquals(keyTo, null))
            {
                throw new NullReferenceException("Key can't be null");
            }

		    this.@from = keyFrom;
			this.to = keyTo;
			this.type = MappingType.Null;
		}
Esempio n. 36
0
 internal MappingUtility(MappingType mappingType, Dictionary<string, string> dictMapping, string sourceId, string sourceAgencyId, string sourceVersion, string targetId, string targetAgencyId, string targetVersion, string agencyId, string language, Header header, string fileNameWPath, string outputFolder,string codelistName)
     : base(agencyId, language, header, outputFolder)
 {
     this._mappingType = mappingType;
     this._dictMapping = dictMapping;
     this._sourceId = sourceId;
     this._sourceAgencyId = sourceAgencyId;
     this._sourceVersion = sourceVersion;
     this._targetId = targetId;
     this._targetAgencyId = targetAgencyId;
     this._targetVersion = targetVersion;
     this._fileNameWPath = fileNameWPath;
     this._codelistName = codelistName;
 }
Esempio n. 37
0
 public MappingModel(int id, string midiNote, string traktorCommand, TargetType targetType, string comment, MappingTargetDeck deck, MappingType type,
     MappingControllerType controllerType, MappingInteractionMode interactionMode, bool autoRepeat, bool invert, bool softTakeOver, float rotarySensitivity,
     float rotaryAcceleration, int ledInvert, MappingResolution resolution)
 {
     this.id = id;
     this.midiNote = midiNote;
     this.traktorCommand = traktorCommand;
     this.targetType = targetType;
     this.comment = comment;
     this.deck = deck;
     this.type = type;
     this.controllerType = controllerType;
     this.interactionMode = interactionMode;
     this.autoRepeat = autoRepeat;
     this.invert = invert;
     this.softTakeOver = softTakeOver;
     this.rotarySensitivity = rotarySensitivity;
     this.rotaryAcceleration = rotaryAcceleration;
     this.ledInvert = ledInvert;
     this.resolution = resolution;
 }
Esempio n. 38
0
 /// <summary>
 /// Constructs a new <see cref="T:Dataweb.NShape.Advanced.NumericModelMapping" /> instance.
 /// </summary>
 /// <param name="shapePropertyId">PropertyId of the shape's property.</param>
 /// <param name="modelPropertyId">PropertyId of the model's property.</param>
 /// <param name="mappingType">
 /// Type of the mapping:
 /// IntegerFloat e.g. means model's integer property to shapes float property.
 /// </param>
 public NumericModelMapping(int shapePropertyId, int modelPropertyId, MappingType mappingType)
     : this(shapePropertyId, modelPropertyId, mappingType, 0, 1)
 {
 }
Esempio n. 39
0
 /// <summary>
 /// Constructs a new <see cref="T:Dataweb.NShape.Advanced.NumericModelMapping" /> instance.
 /// </summary>
 /// <param name="shapePropertyId">PropertyId of the shape's property.</param>
 /// <param name="modelPropertyId">PropertyId of the model's property.</param>
 /// <param name="mappingType">
 /// Type of the mapping:
 /// IntegerFloat e.g. means model's integer property to shapes float property.
 /// </param>
 /// <param name="intercept">Defines an offset for the mapped value.</param>
 /// <param name="slope">Defines a factor for the mapped value.</param>
 public NumericModelMapping(int shapePropertyId, int modelPropertyId, MappingType mappingType, float intercept, float slope)
     : base(modelPropertyId, shapePropertyId)
 {
     this.mappingType = mappingType;
     this.intercept = intercept;
     this.slope = slope;
 }
Esempio n. 40
0
 public void AssertDataColumn(string label, DataColumn col,
     string colName, bool allowDBNull,
     bool autoIncr, int autoIncrSeed, int autoIncrStep,
     string caption, MappingType colMap,
     Type type, object defaultValue, string expression,
     int maxLength, string ns, int ordinal, string prefix,
     bool readOnly, bool unique)
 {
     Assert.Equal(colName, col.ColumnName);
     Assert.Equal(allowDBNull, col.AllowDBNull);
     Assert.Equal(autoIncr, col.AutoIncrement);
     Assert.Equal(autoIncrSeed, col.AutoIncrementSeed);
     Assert.Equal(autoIncrStep, col.AutoIncrementStep);
     Assert.Equal(caption, col.Caption);
     Assert.Equal(colMap, col.ColumnMapping);
     Assert.Equal(type, col.DataType);
     Assert.Equal(defaultValue, col.DefaultValue);
     Assert.Equal(expression, col.Expression);
     Assert.Equal(maxLength, col.MaxLength);
     Assert.Equal(ns, col.Namespace);
     if (ordinal >= 0)
         Assert.Equal(ordinal, col.Ordinal);
     Assert.Equal(prefix, col.Prefix);
     Assert.Equal(readOnly, col.ReadOnly);
     Assert.Equal(unique, col.Unique);
 }
        public static bool TryGetAmqpObjectFromNetObject(object netObject, MappingType mappingType, out object amqpObject)
        {
            amqpObject = null;
            if (netObject == null)
            {
                return false;
            }

            switch (SerializationUtilities.GetTypeId(netObject))
            {
                case PropertyValueType.Byte:
                case PropertyValueType.SByte:
                case PropertyValueType.Int16:
                case PropertyValueType.Int32:
                case PropertyValueType.Int64:
                case PropertyValueType.UInt16:
                case PropertyValueType.UInt32:
                case PropertyValueType.UInt64:
                case PropertyValueType.Single:
                case PropertyValueType.Double:
                case PropertyValueType.Boolean:
                case PropertyValueType.Decimal:
                case PropertyValueType.Char:
                case PropertyValueType.Guid:
                case PropertyValueType.DateTime:
                case PropertyValueType.String:
                    amqpObject = netObject;
                    break;
                case PropertyValueType.Stream:
                    if (mappingType == MappingType.ApplicationProperty)
                    {
                        amqpObject = ReadStream((Stream)netObject);
                    }
                    break;
                case PropertyValueType.Uri:
                    amqpObject = new DescribedType((AmqpSymbol)UriName, ((Uri)netObject).AbsoluteUri);
                    break;
                case PropertyValueType.DateTimeOffset:
                    amqpObject = new DescribedType((AmqpSymbol)DateTimeOffsetName, ((DateTimeOffset)netObject).UtcTicks);
                    break;
                case PropertyValueType.TimeSpan:
                    amqpObject = new DescribedType((AmqpSymbol)TimeSpanName, ((TimeSpan)netObject).Ticks);
                    break;
                case PropertyValueType.Unknown:
                    if (netObject is Stream)
                    {
                        if (mappingType == MappingType.ApplicationProperty)
                        {
                            amqpObject = ReadStream((Stream)netObject);
                        }
                    }
                    else if (mappingType == MappingType.ApplicationProperty)
                    {
                        throw FxTrace.Exception.AsError(new SerializationException(IotHubApiResources.GetString(ApiResources.FailedToSerializeUnsupportedType, netObject.GetType().FullName)));
                    }
                    else if (netObject is byte[])
                    {
                        amqpObject = new ArraySegment<byte>((byte[])netObject);
                    }
                    else if (netObject is IList)
                    {
                        // Array is also an IList
                        amqpObject = netObject;
                    }
                    else if (netObject is IDictionary)
                    {
                        amqpObject = new AmqpMap((IDictionary)netObject);
                    }
                    break;
                default:
                    break;
            }

            return amqpObject != null;
        }
Esempio n. 42
0
		public DataColumn (string columnName, Type dataType, string expr, MappingType type)
		{
			ColumnName = columnName == null ? String.Empty : columnName;

			if (dataType == null)
				throw new ArgumentNullException ("dataType");

			DataType = dataType;
			Expression = expr == null ? String.Empty : expr;
			ColumnMapping = type;
		}
Esempio n. 43
0
 /// <summary>
 /// Constructs a new FormatModelMapping instance.
 /// </summary>
 /// <param name="shapePropertyId">PropertyId of the shape's property.</param>
 /// <param name="modelPropertyId">PropertyId of the model's property.</param>
 /// <param name="mappingType">
 /// Type of the mapping:
 /// IntegerString e.g. means model's integer property to shapes string property.
 /// </param>
 /// <param name="format">The format for the mapped value.</param>
 public FormatModelMapping(int shapePropertyId, int modelPropertyId, MappingType mappingType, string format)
     : base(modelPropertyId, shapePropertyId)
 {
     this.format = format;
     this.mappingType = mappingType;
 }
Esempio n. 44
0
        /// <devdoc>
        ///    <para>
        ///       Initializes a new instance of the <see cref='System.Data.DataColumn'/> class
        ///       using
        ///       the specified name, data type, expression, and value that determines whether the
        ///       column is an attribute.
        ///    </para>
        /// </devdoc>
        public DataColumn(string columnName, Type dataType, string expr, MappingType type) {
            GC.SuppressFinalize(this);
            Bid.Trace("<ds.DataColumn.DataColumn|API> %d#, columnName='%ls', expr='%ls', type=%d{ds.MappingType}\n",
                          ObjectID, columnName, expr, (int)type);

            if (dataType == null) {
                throw ExceptionBuilder.ArgumentNull("dataType");
            }

            StorageType typeCode = DataStorage.GetStorageType(dataType);
            if (DataStorage.ImplementsINullableValue(typeCode, dataType)) {
                throw ExceptionBuilder.ColumnTypeNotSupported();
            }
            _columnName = columnName ?? string.Empty;

            SimpleType stype = SimpleType.CreateSimpleType(typeCode, dataType);
            if (null != stype) {
                this.SimpleType = stype;
            }
            UpdateColumnType(dataType, typeCode);

            if ((null != expr) && (0 < expr.Length)) {
                // @perfnote: its a performance hit to set Expression to the empty str when we know it will come out null
                this.Expression = expr;
            }
            this.columnMapping = type;
        }
		public void AssertDataColumn (string label, DataColumn col, 
			string colName, bool allowDBNull, 
			bool autoIncr, int autoIncrSeed, int autoIncrStep, 
			string caption, MappingType colMap, 
			Type type, object defaultValue, string expression, 
			int maxLength, string ns, int ordinal, string prefix, 
			bool readOnly, bool unique)
		{
			AssertEquals (label + "ColumnName: " , colName, col.ColumnName);
			AssertEquals (label + "AllowDBNull? " , allowDBNull, col.AllowDBNull);
			AssertEquals (label + "AutoIncrement? " , autoIncr, col.AutoIncrement);
			AssertEquals (label + "  Seed: " , autoIncrSeed, col.AutoIncrementSeed);
			AssertEquals (label + "  Step: " , autoIncrStep, col.AutoIncrementStep);
			AssertEquals (label + "Caption " , caption, col.Caption);
			AssertEquals (label + "Mapping: " , colMap, col.ColumnMapping);
			AssertEquals (label + "Type: " , type, col.DataType);
			AssertEquals (label + "DefaultValue: " , defaultValue, col.DefaultValue);
			AssertEquals (label + "Expression: " , expression, col.Expression);
			AssertEquals (label + "MaxLength: " , maxLength, col.MaxLength);
			AssertEquals (label + "Namespace: " , ns, col.Namespace);
			if (ordinal >= 0)
				AssertEquals (label + "Ordinal: " , ordinal, col.Ordinal);
			AssertEquals (label + "Prefix: " , prefix, col.Prefix);
			AssertEquals (label + "ReadOnly: " , readOnly, col.ReadOnly);
			AssertEquals (label + "Unique: " , unique, col.Unique);
		}
Esempio n. 46
0
 private bool IsColumnMappingValid(StorageType typeCode, MappingType mapping) {
     if ((mapping != MappingType.Element) && DataStorage.IsTypeCustomType(typeCode)) {
         return false;
     }
     return true;
 }
 public AdditionalInfoDescriptor(string name, string value, MappingType mappingType)
 {
     m_Mapping = mappingType;
     m_Name = name;
     m_Value = value;
 }
Esempio n. 48
0
		private DataColumn GetMappedColumn (TableMapping table, string name, string prefix, string ns, MappingType type, Type optColType)
		{
			DataColumn col = table.GetColumn (name);
			// Infer schema
			if (col == null) {
				col = new DataColumn (name);
				col.Prefix = prefix;
				col.Namespace = ns;
				col.ColumnMapping = type;
				switch (type) {
				case MappingType.Element:
					table.Elements.Add (col);
					break;
				case MappingType.Attribute:
					table.Attributes.Add (col);
					break;
				case MappingType.SimpleContent:
					table.SimpleContent = col;
					break;
				case MappingType.Hidden:
					// To generate parent key
					col.DataType = optColType;
					table.ReferenceKey = col;
					break;
				}
			}
			else if (col.ColumnMapping != type) // Check mapping type
				throw new DataException (String.Format ("There are already another column that has different mapping type. Column is {0}, existing mapping type is {1}", col.ColumnName, col.ColumnMapping));

			return col;
		}
 /// <summary>
 /// Initializes a new instance of the <see cref="EntityMappingAttribute"/> class.
 /// </summary>
 /// <param name="mappedEntityTypeFullName">Full name of the mapped entity type.</param>
 /// <param name="mappingType">Type of the mapping.</param>
 public EntityMappingAttribute(string mappedEntityTypeFullName, MappingType mappingType)
 {
     // private set value
     this.MappedEntityTypeFullName = mappedEntityTypeFullName;
     this.MappingType = mappingType;
 }
Esempio n. 50
0
 /// <override></override>
 public override void LoadFields(IRepositoryReader reader, int version)
 {
     base.LoadFields(reader, version);
     mappingType = (MappingType)reader.ReadInt32();
     format = reader.ReadString();
 }
Esempio n. 51
0
 public InvalidMappingException(string name, MappingType type)
     : base($"No {type} mapping found for '{name}'.")
 {
 }
Esempio n. 52
0
 /// <summary>
 /// Constructs a new StyleModelMapping instance.
 /// </summary>
 /// <param name="shapePropertyId">PropertyId of the shape's property.</param>
 /// <param name="modelPropertyId">PropertyId of the model's property.</param>
 /// <param name="mappingType">
 /// Type of the mapping:
 /// IntegerStyle e.g. means model's integer property to shapes style property.
 /// </param>
 /// <param name="style">Specifies the style that is used for all values outside the user defined ranges.</param>
 public StyleModelMapping(int shapePropertyId, int modelPropertyId, MappingType mappingType, IStyle style)
     : this(shapePropertyId, modelPropertyId, mappingType)
 {
     defaultStyle = style;
 }
Esempio n. 53
0
 /// <summary>
 /// Constructs a new FormatModelMapping instance.
 /// </summary>
 /// <param name="shapePropertyId">PropertyId of the shape's property.</param>
 /// <param name="modelPropertyId">PropertyId of the model's property.</param>
 /// <param name="mappingType">
 /// Type of the mapping:
 /// IntegerString e.g. means model's integer property to shapes string property.
 /// </param>
 public FormatModelMapping(int shapePropertyId, int modelPropertyId, MappingType mappingType)
     : this(shapePropertyId, modelPropertyId, mappingType, "{0}")
 {
 }
Esempio n. 54
0
        /// <summary>
        /// Initializes a new instance of the <see cref='System.Data.DataColumn'/> class
        /// using
        /// the specified name, data type, expression, and value that determines whether the
        /// column is an attribute.
        /// </summary>
        public DataColumn(string columnName, Type dataType, string expr, MappingType type)
        {
            GC.SuppressFinalize(this);
            DataCommonEventSource.Log.Trace("<ds.DataColumn.DataColumn|API> {0}, columnName='{1}', expr='{2}', type={3}", ObjectID, columnName, expr, type);

            if (dataType == null)
            {
                throw ExceptionBuilder.ArgumentNull(nameof(dataType));
            }

            StorageType typeCode = DataStorage.GetStorageType(dataType);
            if (DataStorage.ImplementsINullableValue(typeCode, dataType))
            {
                throw ExceptionBuilder.ColumnTypeNotSupported();
            }
            _columnName = columnName ?? string.Empty;

            SimpleType stype = SimpleType.CreateSimpleType(typeCode, dataType);
            if (null != stype)
            {
                SimpleType = stype;
            }
            UpdateColumnType(dataType, typeCode);

            if (!string.IsNullOrEmpty(expr)) // its a performance hit to set Expression to the empty str when we know it will come out null
            {
                Expression = expr;
            }

            _columnMapping = type;
        }
Esempio n. 55
0
 private bool IsColumnMappingValid(StorageType typeCode, MappingType mapping) =>
     !((mapping != MappingType.Element) && DataStorage.IsTypeCustomType(typeCode));
Esempio n. 56
0
 /// <summary>
 /// Constructs a new StyleModelMapping instance.
 /// </summary>
 /// <param name="shapePropertyId">PropertyId of the shape's property.</param>
 /// <param name="modelPropertyId">PropertyId of the model's property.</param>
 /// <param name="mappingType">
 /// Type of the mapping:
 /// IntegerStyle e.g. means model's integer property to shapes style property.
 /// </param>
 public StyleModelMapping(int shapePropertyId, int modelPropertyId, MappingType mappingType)
     : base(modelPropertyId, shapePropertyId)
 {
     this.mappingType = mappingType;
     if (mappingType == MappingType.IntegerStyle)
         intRanges = new SortedList<int, IStyle>();
     else floatRanges = new SortedList<float, IStyle>();
 }
Esempio n. 57
0
        static bool CheckDataSet2(DataSet ds, string tableName, string colName, string typeName, object colValue, MappingType mte)
        {
            bool hasChanges = false;
              DataTable dt = ds.Tables[tableName];
              if (!dt.Columns.Contains(colName))
              {
            Type t = Type.GetType(typeName);
            dt.Columns.Add(colName, t);
            dt.Columns[colName].ColumnMapping = mte;
            dt.Rows[0][colName] = colValue;
            hasChanges = true;
              }

              return hasChanges;
        }
Esempio n. 58
0
 /// <override></override>
 public override void LoadFields(IRepositoryReader reader, int version)
 {
     base.LoadFields(reader, version);
     mappingType = (MappingType)reader.ReadInt32();
     intercept = reader.ReadFloat();
     slope = reader.ReadFloat();
 }
        public static bool TryGetNetObjectFromAmqpObject(object amqpObject, MappingType mappingType, out object netObject)
        {
            netObject = null;
            if (amqpObject == null)
            {
                return false;
            }

            switch (SerializationUtilities.GetTypeId(amqpObject))
            {
                case PropertyValueType.Byte:
                case PropertyValueType.SByte:
                case PropertyValueType.Int16:
                case PropertyValueType.Int32:
                case PropertyValueType.Int64:
                case PropertyValueType.UInt16:
                case PropertyValueType.UInt32:
                case PropertyValueType.UInt64:
                case PropertyValueType.Single:
                case PropertyValueType.Double:
                case PropertyValueType.Boolean:
                case PropertyValueType.Decimal:
                case PropertyValueType.Char:
                case PropertyValueType.Guid:
                case PropertyValueType.DateTime:
                case PropertyValueType.String:
                    netObject = amqpObject;
                    break;
                case PropertyValueType.Unknown:
                    if (amqpObject is AmqpSymbol)
                    {
                        netObject = ((AmqpSymbol)amqpObject).Value;
                    }
                    else if (amqpObject is ArraySegment<byte>)
                    {
                        ArraySegment<byte> binValue = (ArraySegment<byte>)amqpObject;
                        if (binValue.Count == binValue.Array.Length)
                        {
                            netObject = binValue.Array;
                        }
                        else
                        {
                            byte[] buffer = new byte[binValue.Count];
                            Buffer.BlockCopy(binValue.Array, binValue.Offset, buffer, 0, binValue.Count);
                            netObject = buffer;
                        }
                    }
                    else if (amqpObject is DescribedType)
                    {
                        DescribedType describedType = (DescribedType)amqpObject;
                        if (describedType.Descriptor is AmqpSymbol)
                        {
                            AmqpSymbol symbol = (AmqpSymbol)describedType.Descriptor;
                            if (symbol.Equals((AmqpSymbol)UriName))
                            {
                                netObject = new Uri((string)describedType.Value);
                            }
                            else if (symbol.Equals((AmqpSymbol)TimeSpanName))
                            {
                                netObject = new TimeSpan((long)describedType.Value);
                            }
                            else if (symbol.Equals((AmqpSymbol)DateTimeOffsetName))
                            {
                                netObject = new DateTimeOffset(new DateTime((long)describedType.Value, DateTimeKind.Utc));
                            }
                        }
                    }
                    else if (mappingType == MappingType.ApplicationProperty)
                    {
                        throw FxTrace.Exception.AsError(new SerializationException(IotHubApiResources.GetString(ApiResources.FailedToSerializeUnsupportedType, amqpObject.GetType().FullName)));
                    }
                    else if (amqpObject is AmqpMap)
                    {
                        AmqpMap map = (AmqpMap)amqpObject;
                        Dictionary<string, object> dictionary = new Dictionary<string, object>();
                        foreach (var pair in map)
                        {
                            dictionary.Add(pair.Key.ToString(), pair.Value);
                        }

                        netObject = dictionary;
                    }
                    else
                    {
                        netObject = amqpObject;
                    }
                    break;
                default:
                    break;
            }

            return netObject != null;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="HiddenDataColumn"/> class
 /// using the specified name, data type, expression, and value that determines whether the column is an attribute.
 /// </summary>
 /// <param name="columnName">
 /// A string that represents the name of the column to be created. If set to null or an empty string (""), 
 /// a default name will be specified when added to the columns collection.
 /// </param>
 /// <param name="dataType">
 /// A supported <see cref="P:System.Data.DataColumn.DataType"/>.
 /// </param>
 /// <param name="expr">
 /// The expression used to create this column.
 /// For more information, see the <see cref="P:System.Data.DataColumn.Expression"/> property.
 /// </param>
 /// <param name="type">
 /// One of the <see cref="T:System.Data.MappingType"/> values.
 /// </param>
 /// <exception cref="T:System.ArgumentNullException">
 /// No <paramref name="dataType"/> was specified.
 /// </exception>
 public HiddenDataColumn(string columnName, Type dataType, string expr, MappingType type)
     : base(columnName, dataType, expr, type)
 {
     this.ExtendedProperties.Add("Visible", false);
 }