Example #1
0
 private void refreshEntry(MetaValue metaValue, int index)
 {
     if (metaValue.Type.CategoryType == ECategoryType.Integral)
     {
         if (Constants.TYPES_INT.Contains(metaValue.Type.Name))
         {
             NumericUpDown numericUpDown = (NumericUpDown)this.valueControls[index];
             numericUpDown.Value = metaValue.Decimal;
         }
         else if (Constants.TYPES_BOOL.Contains(metaValue.Type.Name))
         {
             CheckBox checkBox = (CheckBox)this.valueControls[index];
             checkBox.Checked = metaValue.Bool;
         }
         else if (!Constants.TYPES_VOID.Contains(metaValue.Type.Name))
         {
             TextBox textBox = (TextBox)this.valueControls[index];
             textBox.Text = metaValue.String;
         }
     }
     else if (metaValue.Type.CategoryType == ECategoryType.Enum)
     {
         NumericUpDown numericUpDown = (NumericUpDown)this.valueControls[index];
         numericUpDown.Value = metaValue.Decimal;
     }
 }
 public static void Clear()
 {
     cachedType     = null;
     cachedClass    = null;
     cachedVariable = null;
     cachedMethod   = null;
     cachedValue    = null;
 }
 public static void Clear()
 {
     cachedType = null;
     cachedClass = null;
     cachedVariable = null;
     cachedMethod = null;
     cachedValue = null;
 }
Example #4
0
 public void ClearData()
 {
     if (this.owner != null)
     {
         this.Controls.Clear();
         this.valueControls.Clear();
         this.value = null;
         this.Enabled = false;
     }
 }
Example #5
0
 public void ClearData()
 {
     if (this.owner != null)
     {
         this.Controls.Clear();
         this.valueControls.Clear();
         this.value   = null;
         this.Enabled = false;
     }
 }
Example #6
0
 public VariableList()
 {
     InitializeComponent();
     this.owner         = null;
     this.repository    = null;
     this.type          = null;
     this.value         = null;
     this.valueControls = new List <Control>();
     this.refreshing    = false;
     this.Enabled       = false;
 }
Example #7
0
 public VariableList()
 {
     InitializeComponent();
     this.owner = null;
     this.repository = null;
     this.type = null;
     this.value = null;
     this.valueControls = new List<Control>();
     this.refreshing = false;
     this.Enabled = false;
 }
 private void bEdit_Click(object sender, EventArgs e)
 {
     if (this.lbKeys.SelectedIndex >= 0)
     {
         MetaValue       value        = this.dictionaryKeys[this.lbKeys.SelectedIndex];
         ManagerInstance formInstance = new ManagerInstance(this.repository, value.Type, value);
         formInstance.Text = value.Type.GetNameWithModule();
         formInstance.ShowDialog();
         this.dictionaryKeys[this.lbKeys.SelectedIndex] = formInstance.Value;
         this.RefreshData();
     }
 }
                public override int GetHashCode()
                {
                    int hash = 1;

                    if (Type != 0)
                    {
                        hash ^= Type.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.Int32Value)
                    {
                        hash ^= Int32Value.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.Int64Value)
                    {
                        hash ^= Int64Value.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.FloatValue)
                    {
                        hash ^= FloatValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.DoubleValue)
                    {
                        hash ^= DoubleValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.BooleanValue)
                    {
                        hash ^= BooleanValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.StringValue)
                    {
                        hash ^= StringValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.BytesValue)
                    {
                        hash ^= BytesValue.GetHashCode();
                    }
                    if (valueCase_ == ValueOneofCase.MetaValue)
                    {
                        hash ^= MetaValue.GetHashCode();
                    }
                    hash ^= (int)valueCase_;
                    return(hash);
                }
Example #10
0
 public ManagerInstance(Repository repository, MetaType metaType, MetaValue metaValue, bool nullable = false)
 {
     InitializeComponent();
     this.repository        = repository;
     this.value             = metaValue;
     this.cbxExists.Checked = (this.value.Instance != null);
     if (this.value.Type.CategoryType == ECategoryType.Class && this.value.Instance == null)
     {
         this.value.Instance = new MetaInstance((MetaClass)metaType);
     }
     this.type = metaType;
     this.vlVariables.SetData(this, this.repository, this.type);
     this.vlVariables.SetValue(this.value);
     if (!nullable)
     {
         this.cbxExists.Enabled = false;
         this.cbxExists.Checked = true;
     }
     this.RefreshData();
 }
 public ManagerInstance(Repository repository, MetaType metaType, MetaValue metaValue, bool nullable = false)
 {
     InitializeComponent();
     this.repository = repository;
     this.value = metaValue;
     this.cbxExists.Checked = (this.value.Instance != null);
     if (this.value.Type.CategoryType == ECategoryType.Class && this.value.Instance == null)
     {
         this.value.Instance = new MetaInstance((MetaClass)metaType);
     }
     this.type = metaType;
     this.vlVariables.SetData(this, this.repository, this.type);
     this.vlVariables.SetValue(this.value);
     if (!nullable)
     {
         this.cbxExists.Enabled = false;
         this.cbxExists.Checked = true;
     }
     this.RefreshData();
 }
Example #12
0
 public void SetValue(MetaValue metaValue)
 {
     this.value = metaValue;
     this.Enabled = (this.value != null);
     this.RefreshData();
 }
Example #13
0
 public override MetaValue VisitMetaValue(MetaValue metaValue)
 {
     metaValue = metaValueDelegate?.Invoke(metaValue) ?? metaValue;
     return(base.VisitMetaValue(metaValue));
 }
Example #14
0
 public void SetValue(MetaValue metaValue)
 {
     this.value   = metaValue;
     this.Enabled = (this.value != null);
     this.RefreshData();
 }
Example #15
0
        void fill_metadata(List<Metadata> list, int offs, MetadataClassSchema mc)
        {
            ulong pos = map.Position;

            obj2.Get(offs);
            offs = obj2.Offset;

            xmap.IAttrs hf = obj2.hf;

            int n = hf.Count;
            for (int i = 0; i < n; i++)
            {
                string key, str;
                double v1, v2; int op;
                hf.GetValue(i, out key, out str, out v1, out v2, out op);

                if (convert.IsString(key))
                    if (convert.IsString(str))
                    {
                        Metadata m = metadata(key, mc.Cl_Id);

                        m.IsCompositeAttribute = false;

                        MetaValue v = new MetaValue();
                        v.Value = str;

                        m.Values = new List<MetaValue>();
                        m.Values.Add(v);

                        list.Add(m);
                    }
            }

            if (map.get_Seek_Node(offs, "") > 0)
                if (map.Goto_down > 0)
                    do
                    {
                        obj2.Get(0);
                        int loc = obj2.Loc;
                        if (loc == 30)
                        {
                            string key = obj2.acronym;
                            if (convert.IsString(key))
                            {
                                Metadata m = metadata(key, mc.Cl_Id);
                                m.IsCompositeAttribute = true;
                                m.CompositeMetadata = new List<Metadata>();

                                MetadataClassSchema mc1 = GetMetaCompositAcronim(mc, key);

                                if (mc1 != null)
                                    fill_metadata(m.CompositeMetadata, obj2.Offset, mc1);

                                list.Add(m);
                            }
                        }

                    } while (map.Goto_right > 0);

            map.Position = pos;
        }
        private void dump(MetaValue metaValue)
        {
            switch (metaValue.Type.CategoryType)
            {
            case ECategoryType.Integral:
                switch (metaValue.Type.Name)
                {
                case Constants.TYPE_INT:
                    this.dump(metaValue.AsInt);
                    break;

                case Constants.TYPE_UINT:
                    this.dump(metaValue.AsUInt);
                    break;

                case Constants.TYPE_SHORT:
                    this.dump(metaValue.AsShort);
                    break;

                case Constants.TYPE_USHORT:
                    this.dump(metaValue.AsUShort);
                    break;

                case Constants.TYPE_UCHAR:
                    this.dump(metaValue.AsByte);
                    break;

                case Constants.TYPE_INT64:
                    this.dump(metaValue.AsInt64);
                    break;

                case Constants.TYPE_UINT64:
                    this.dump(metaValue.AsUInt64);
                    break;

                case Constants.TYPE_FLOAT:
                    this.dump(metaValue.AsFloat);
                    break;

                case Constants.TYPE_DOUBLE:
                    this.dump(metaValue.AsDouble);
                    break;

                case Constants.TYPE_BOOL:
                    this.dump(metaValue.Bool);
                    break;

                case Constants.TYPE_CHAR:
                    this.dump(metaValue.AsSByte);
                    break;

                case Constants.TYPE_VERSION:
                    this.dump(metaValue.AsUInt4);
                    break;

                case Constants.TYPE_GVEC2:
                    this.dump(metaValue.AsFloat2);
                    break;

                case Constants.TYPE_GVEC3:
                    this.dump(metaValue.AsFloat3);
                    break;

                case Constants.TYPE_GRECT:
                    this.dump(metaValue.AsFloat4);
                    break;

                default:
                    this.dump(metaValue.String);
                    break;
                }
                break;

            case ECategoryType.Class:
                this.dump(metaValue.Instance);
                break;

            case ECategoryType.List:
                this.dump(metaValue.List);
                break;

            case ECategoryType.Dictionary:
                this.dump(metaValue.Dictionary);
                break;

            case ECategoryType.Enum:
                this.dump(metaValue.AsInt);
                break;
            }
        }
Example #17
0
        private void vlButtonManage_Click(object sender, EventArgs e)
        {
            Button               button = (Button)sender;
            ManagerInstance      formInstance;
            ManagerList          formList;
            ManagerDictionary    formDictionary;
            MetaInstanceVariable metaInstanceVariable;

            switch (this.value.Type.CategoryType)
            {
            case ECategoryType.Integral:
                // can't happen
                break;

            case ECategoryType.Enum:
                // can't happen (for now)
                break;

            case ECategoryType.Class:
                for (int i = 0; i < this.value.Instance.InstanceVariables.Count; i++)
                {
                    metaInstanceVariable = this.value.Instance.InstanceVariables[i];
                    if (button.Name == metaInstanceVariable.ToString())
                    {
                        MetaValue value = metaInstanceVariable.Value;
                        switch (value.Type.CategoryType)
                        {
                        case ECategoryType.Integral:
                            // can't happen
                            break;

                        case ECategoryType.Class:
                            formInstance      = new ManagerInstance(this.repository, value.Type, value, metaInstanceVariable.Variable.Nullable);
                            formInstance.Text = metaInstanceVariable.ToString();
                            formInstance.ShowDialog();
                            metaInstanceVariable.Value = formInstance.Value;
                            break;

                        case ECategoryType.List:
                            formList      = new ManagerList(this.repository, value.Type.SubType1, value.List);
                            formList.Text = metaInstanceVariable.ToString();
                            formList.ShowDialog();
                            value.List = formList.ListValues;
                            break;

                        case ECategoryType.Dictionary:
                            formDictionary      = new ManagerDictionary(this.repository, value.Type.SubType1, value.Type.SubType2, value.Dictionary);
                            formDictionary.Text = metaInstanceVariable.ToString();
                            formDictionary.ShowDialog();
                            value.Dictionary = formDictionary.DictionaryValues;
                            break;
                        }
                        this.RefreshData();
                        break;
                    }
                }
                break;

            case ECategoryType.List:
                formList      = new ManagerList(this.repository, this.value.Type.SubType1, this.value.List);
                formList.Text = this.value.Type.GetNameWithModule();
                formList.ShowDialog();
                this.value.List = formList.ListValues;
                break;

            case ECategoryType.Dictionary:
                formList      = new ManagerList(this.repository, this.value.Type.SubType1, this.value.List);
                formList.Text = this.value.Type.GetNameWithModule();
                formList.ShowDialog();
                this.value.List = formList.ListValues;
                break;
            }
        }
Example #18
0
 private void refreshEntry(MetaValue metaValue, int index)
 {
     if (metaValue.Type.CategoryType == ECategoryType.Integral)
     {
         if (Constants.TYPES_INT.Contains(metaValue.Type.Name))
         {
             NumericUpDown numericUpDown = (NumericUpDown)this.valueControls[index];
             numericUpDown.Value = metaValue.Decimal;
         }
         else if (Constants.TYPES_BOOL.Contains(metaValue.Type.Name))
         {
             CheckBox checkBox = (CheckBox)this.valueControls[index];
             checkBox.Checked = metaValue.Bool;
         }
         else if (!Constants.TYPES_VOID.Contains(metaValue.Type.Name))
         {
             TextBox textBox = (TextBox)this.valueControls[index];
             textBox.Text = metaValue.String;
         }
     }
     else if (metaValue.Type.CategoryType == ECategoryType.Enum)
     {
         NumericUpDown numericUpDown = (NumericUpDown)this.valueControls[index];
         numericUpDown.Value = metaValue.Decimal;
     }
 }
 private void dump(MetaValue metaValue)
 {
     switch (metaValue.Type.CategoryType)
     {
         case ECategoryType.Integral:
             switch (metaValue.Type.Name)
             {
                 case Constants.TYPE_INT:
                     this.dump(metaValue.AsInt);
                     break;
                 case Constants.TYPE_UINT:
                     this.dump(metaValue.AsUInt);
                     break;
                 case Constants.TYPE_SHORT:
                     this.dump(metaValue.AsShort);
                     break;
                 case Constants.TYPE_USHORT:
                     this.dump(metaValue.AsUShort);
                     break;
                 case Constants.TYPE_UCHAR:
                     this.dump(metaValue.AsByte);
                     break;
                 case Constants.TYPE_FLOAT:
                     this.dump(metaValue.AsFloat);
                     break;
                 case Constants.TYPE_DOUBLE:
                     this.dump(metaValue.AsDouble);
                     break;
                 case Constants.TYPE_BOOL:
                     this.dump(metaValue.Bool);
                     break;
                 case Constants.TYPE_CHAR:
                     this.dump(metaValue.AsSByte);
                     break;
                 default:
                     this.dump(metaValue.String);
                     break;
             }
             break;
         case ECategoryType.Class:
             this.dump(metaValue.Instance);
             break;
         case ECategoryType.List:
             this.dump(metaValue.List);
             break;
         case ECategoryType.Dictionary:
             this.dump(metaValue.Dictionary);
             break;
     }
 }