Esempio n. 1
0
 public static Scaling AddBase(this Scaling child, Scaling baseScaling)
 {
     foreach (KeyValuePair <string, string> property in baseScaling.properties)
     {
         //If property doesn't exist in the child, add it from the base!
         if (!child.properties.ContainsKey(property.Key))
         {
             child.properties.Add(property.Key, property.Value);
         }
     }
     return(child);
 }
Esempio n. 2
0
        private void ParseAttributes(XElement xel)
        {
            try
            {
                foreach (XAttribute attribute in xel.Attributes())
                {
                    switch (attribute.Name.ToString().ToLower())
                    {
                    case "name":
                        this.name = attribute.Value.ToString();
                        continue;

                    case "address":
                        this.address = attribute.Value.ConvertHexToInt();
                        continue;

                    case "elements":
                        this.elements = attribute.Value.ConvertStringToInt();
                        continue;

                    case "scaling":
                        Scaling sca = new Scaling();
                        if (this.parentDef.ScalingList.TryGetValue(attribute.Value, out sca))
                        {
                            this.scaling        = sca;
                            this.defaultScaling = sca;
                        }
                        else
                        {
                            Trace.WriteLine("Error finding scaling " + attribute.Value);
                        }
                        continue;

                    case "type":
                        this.type = attribute.Value.ToString();
                        continue;

                    case "category":
                        this.category = attribute.Value.ToString();
                        continue;

                    default:
                        continue;
                    }
                }
            }
            catch (Exception e)
            {
                Exception ne = new Exception("Error parsing table xml attributes", e);
                throw;
            }
        }
Esempio n. 3
0
        public static Scaling PopulateProperties(this Scaling scaling)
        {
            foreach (KeyValuePair <string, string> property in scaling.properties)
            {
                switch (property.Key.ToString())
                {
                case "name":
                    continue;

                case "storagetype":
                    continue;

                default:
                    continue;
                }
            }
            return(scaling);
        }
Esempio n. 4
0
 public static Scaling AddBase(this Scaling child, Scaling baseScaling)
 {
     foreach (KeyValuePair<string, string> property in baseScaling.properties)
     {
         //If property doesn't exist in the child, add it from the base!
         if (!child.properties.ContainsKey(property.Key))
         {
             child.properties.Add(property.Key, property.Value);
         }
     }
     return child;
 }
Esempio n. 5
0
        public Axis parentAxis; //todo: resolve accessibility!

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Constructor from XElement
        /// </summary>
        /// <param name="xel"></param>
        public Axis(XElement xel, TableMetaData table)
        {
            try
            {
                this.isXAxis = true;
                this.name = "base";
                this.elements = new int();
                this.address = new int();
                this.type = "generic axis";
                this.floatList = new List<float>();
                this.baseTable = table;
                this.parentDef = table.parentDef;

                foreach (XAttribute attribute in xel.Attributes())
                {

                    switch (attribute.Name.ToString())
                    {
                        case "name":
                            if (parentAxis != null && parentAxis.name != null)
                                break;
                            this.name = attribute.Value.ToString();
                            continue;

                        case "address":
                            this.address = System.Int32.Parse(attribute.Value.ToString(), System.Globalization.NumberStyles.AllowHexSpecifier);
                            continue;

                        case "elements":
                            this.elements = System.Int32.Parse(attribute.Value.ToString(), System.Globalization.NumberStyles.Integer);
                            continue;

                        case "scaling":
                            Scaling sca = new Scaling();
                            if (this.parentDef.ScalingList.TryGetValue(attribute.Value, out sca))
                                this.defaultScaling = sca;
                            else
                                Trace.WriteLine("Error finding scaling " + attribute.Value);
                            continue;
                        //TODO FIX: this.endian = this.defaultScaling.endian;

                        case "type":
                            this.type = attribute.Value.ToString();
                            if (this.type.ToString().Contains("y"))
                            {
                                this.isXAxis = false;
                            }
                            continue;

                        default:
                            continue;
                    }
                }
            }
            catch (Exception crap)
            {
                Trace.WriteLine("Error creating axis in " + table);
                Trace.WriteLine("XML: " + xel.ToString());
                throw;
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Constructor from XElement
        /// </summary>
        /// <param name="xel"></param>
        public Axis(XElement xel, TableMetaData table)
        {
            try
            {
                this.isXAxis   = true;
                this.name      = "base";
                this.elements  = new int();
                this.address   = new int();
                this.type      = "generic axis";
                this.floatList = new List <float>();
                this.baseTable = table;
                this.parentDef = table.parentDef;

                foreach (XAttribute attribute in xel.Attributes())
                {
                    switch (attribute.Name.ToString())
                    {
                    case "name":
                        if (attribute.Value.ToString().EqualsCI("y"))
                        {
                            this.isXAxis = false;
                        }
                        if (parentAxis != null && parentAxis.name != null)
                        {
                            break;
                        }
                        this.name = attribute.Value.ToString();
                        continue;

                    case "address":
                        this.address = System.Int32.Parse(attribute.Value.ToString(), System.Globalization.NumberStyles.AllowHexSpecifier);
                        continue;

                    case "elements":
                        this.elements = System.Int32.Parse(attribute.Value.ToString(), System.Globalization.NumberStyles.Integer);
                        continue;

                    case "scaling":
                        Scaling sca = new Scaling();
                        if (this.parentDef.ScalingList.TryGetValue(attribute.Value, out sca))
                        {
                            this.defaultScaling = sca;
                        }
                        else
                        {
                            Trace.WriteLine("Error finding scaling " + attribute.Value);
                        }
                        continue;
                    //TODO FIX: this.endian = this.defaultScaling.endian;

                    case "type":
                        this.type = attribute.Value.ToString();
                        if (this.type.ToString().ContainsCI("y"))
                        {
                            this.isXAxis = false;
                        }
                        continue;

                    default:
                        continue;
                    }
                }
            }
            catch (Exception crap)
            {
                Trace.WriteLine("Error creating axis in " + table);
                Trace.WriteLine("XML: " + xel.ToString());
                throw;
            }
        }
Esempio n. 7
0
        private void ParseAttributes(XElement xel)
        {
            try
            {
                foreach (XAttribute attribute in xel.Attributes())
                {
                    switch (attribute.Name.ToString().ToLower())
                    {
                        case "name":
                            this.name = attribute.Value.ToString();
                            continue;

                        case "address":
                            this.address = attribute.Value.ConvertHexToInt();
                            continue;

                        case "elements":
                            this.elements = attribute.Value.ConvertStringToInt();
                            continue;

                        case "scaling":
                            Scaling sca = new Scaling();
                            if (this.parentDef.ScalingList.TryGetValue(attribute.Value, out sca))
                            {
                                this.scaling = sca;
                                this.defaultScaling = sca;
                            }
                            else
                                Trace.WriteLine("Error finding scaling " + attribute.Value);
                            continue;

                        case "type":
                            this.type = attribute.Value.ToString();
                            continue;

                        case "category":
                            this.category = attribute.Value.ToString();
                            continue;

                        default:
                            continue;
                    }
                }
            }
            catch (Exception e)
            {
                Exception ne = new Exception("Error parsing table xml attributes", e);
                throw;
            }
        }