Example #1
0
        public override bool IsEqual(TunableStore o)
        {
            ValueStore store = o as ValueStore;

            if (store == null)
            {
                return(false);
            }

            // We do not compare value, only hierarchy
            //if (mValue != store.mValue) return false;

            return(base.IsEqual(o));
        }
Example #2
0
 public ValueStore(ValueStore store)
     : base(store)
 {
     mValue = store.mValue;
 }
Example #3
0
 public ValueStore(ValueStore store)
     : base(store)
 {
     mValue = store.mValue;
 }
Example #4
0
        public override bool Parse(XmlDbRow row)
        {
            if (!base.Parse(row)) return false;

            List<string> subFieldNames = new List<string>();

            int count = 1;
            while (true)
            {
                string suffix = null;
                if (count > 1)
                {
                    suffix = count.ToString();
                }

                string subFieldName = row.GetString("SubFieldName" + suffix);
                if (string.IsNullOrEmpty(subFieldName))
                {
                    break;
                }

                subFieldNames.Add(subFieldName);
                count++;
            }

            if (subFieldNames.Count == 0)
            {
                BooterLogger.AddError("SubFieldName missing for " + mParentType + "." + mFieldName);
                return false;
            }

            FieldInfo subField = GetFieldInfo();
            if (subField == null)
            {
                BooterLogger.AddError("Unknown Field for " + mParentType.ToString() + "." + mFieldName);
                return false;
            }

            NestedStore parentStore = this;

            for (int i = 0; i < subFieldNames.Count - 1; i++)
            {
                FieldInfo newField = subField.FieldType.GetField(subFieldNames[i], BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
                if (newField == null)
                {
                    BooterLogger.AddError("Unknown SubField for " + subField.FieldType.ToString() + "." + subFieldNames[i]);
                    return false;
                }

                NestedStore newStore = new NestedStore(newField, null);

                parentStore.mChild = newStore;

                subField = newField;
                parentStore = newStore;
            }

            string finalFieldName = subFieldNames[subFieldNames.Count - 1];

            FieldInfo finalField = subField.FieldType.GetField(finalFieldName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
            if (finalField == null)
            {
                BooterLogger.AddError("Unknown SubField for " + subField.FieldType.ToString() + "." + finalFieldName);
                return false;
            }            

            ValueStore child = null;
            if (row.Exists("Index"))
            {
                int index = row.GetInt("Index", -1);
                if (index < 0)
                {
                    BooterLogger.AddError("Invalid Index for " + mParentType + "." + mFieldName);
                    return false;
                }

                child = new ArrayValueStore(finalField, index, null);
            }
            else
            {
                child = new ValueStore(finalField, null);
            }

            parentStore.mChild = child;

            return child.ParseValue(row);
        }
Example #5
0
        public override bool Parse(XmlDbRow row)
        {
            if (!base.Parse(row))
            {
                return(false);
            }

            List <string> subFieldNames = new List <string>();

            int count = 1;

            while (true)
            {
                string suffix = null;
                if (count > 1)
                {
                    suffix = count.ToString();
                }

                string subFieldName = row.GetString("SubFieldName" + suffix);
                if (string.IsNullOrEmpty(subFieldName))
                {
                    break;
                }

                subFieldNames.Add(subFieldName);
                count++;
            }

            if (subFieldNames.Count == 0)
            {
                BooterLogger.AddError("SubFieldName missing for " + mParentType + "." + mFieldName);
                return(false);
            }

            FieldInfo subField = GetFieldInfo();

            if (subField == null)
            {
                BooterLogger.AddError("Unknown Field for " + mParentType.ToString() + "." + mFieldName);
                return(false);
            }

            NestedStore parentStore = this;

            for (int i = 0; i < subFieldNames.Count - 1; i++)
            {
                FieldInfo newField = subField.FieldType.GetField(subFieldNames[i], BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);
                if (newField == null)
                {
                    BooterLogger.AddError("Unknown SubField for " + subField.FieldType.ToString() + "." + subFieldNames[i]);
                    return(false);
                }

                NestedStore newStore = new NestedStore(newField, null);

                parentStore.mChild = newStore;

                subField    = newField;
                parentStore = newStore;
            }

            string finalFieldName = subFieldNames[subFieldNames.Count - 1];

            FieldInfo finalField = subField.FieldType.GetField(finalFieldName, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance);

            if (finalField == null)
            {
                BooterLogger.AddError("Unknown SubField for " + subField.FieldType.ToString() + "." + finalFieldName);
                return(false);
            }

            ValueStore child = null;

            if (row.Exists("Index"))
            {
                int index = row.GetInt("Index", -1);
                if (index < 0)
                {
                    BooterLogger.AddError("Invalid Index for " + mParentType + "." + mFieldName);
                    return(false);
                }

                child = new ArrayValueStore(finalField, index, null);
            }
            else
            {
                child = new ValueStore(finalField, null);
            }

            parentStore.mChild = child;

            return(child.ParseValue(row));
        }