コード例 #1
0
ファイル: uiBitmask.cs プロジェクト: mirkomihaljcic/Ascension
        public uiBitmask(mBitmask bitmaskdata)
        {
            components = null;
            InitializeComponent();
            foreach (Control control in base.Controls)
            {
                control.ContextMenuStrip = contextMenuStrip1;
            }
            BitmaskData       = bitmaskdata;
            lblValueName.Text = bitmaskdata.Name;
            int num = 8;

            switch (bitmaskdata.Attributes)
            {
            case mValue.ObjectAttributes.Bitmask8:
                num = 8;
                break;

            case mValue.ObjectAttributes.Bitmask16:
                num = 0x10;
                break;

            case mValue.ObjectAttributes.Bitmask32:
                num = 0x20;
                break;
            }
            lblCount.Text = "{" + num.ToString() + "}";
            for (int i = 0; i < num; i++)
            {
                bool flag = false;
                for (int j = 0; j < bitmaskdata.Options.Count; j++)
                {
                    if (bitmaskdata.Options[j].BitIndex == i)
                    {
                        lstBitOptions.Items.Add(bitmaskdata.Options[j].Name);
                        flag = true;
                        break;
                    }
                }
                if (!flag)
                {
                    lstBitOptions.Items.Add("bit " + i.ToString());
                }
            }
            Editted = false;
        }
コード例 #2
0
ファイル: MetaViewer.cs プロジェクト: YeeB3Warned/Delegate
        private void LoadControls()
        {
            pnlContainer.Controls.Clear();

            int yLoc = 5;

            foreach (XmlNode n in element.ChildNodes)
            {
                iValue val;
                try { val = new iValue(n); }
                catch { continue; }
                if (!val.Visible && !showInvis)
                {
                    continue;
                }

                MetaViewerControl mvc = new MetaViewerControl();

                switch (val.Type)
                {
                case iValue.ValueType.Comment:
                    mvc = new mComment(val, cache);
                    break;

                case iValue.ValueType.Struct:
                    mvc = new mStructure(val, cache, tag, showInvis);
                    ((mStructure)mvc).RequestTagLoad += new RequestTagLoadEventHandler(MetaViewer_TagLoadRequested);
                    ((mStructure)mvc).ResizeNeeded   += new ResizeNeededEvent(mStructure_ResizeNeeded);
                    break;

                case iValue.ValueType.TagRef:
                    mvc = new mTagRef(val, cache);
                    ((mTagRef)mvc).RequestTagLoad += new RequestTagLoadEventHandler(MetaViewer_TagLoadRequested);
                    break;

                case iValue.ValueType.String:
                case iValue.ValueType.StringID:
                    mvc = new mString(val, cache);
                    break;

                case iValue.ValueType.Bitmask8:
                case iValue.ValueType.Bitmask16:
                case iValue.ValueType.Bitmask32:
                    mvc = new mBitmask(val, cache);
                    break;

                case iValue.ValueType.Int8:
                case iValue.ValueType.Int16:
                case iValue.ValueType.Int32:
                case iValue.ValueType.Float32:
                case iValue.ValueType.UInt16:
                case iValue.ValueType.UInt32:
                case iValue.ValueType.Undefined:
                case iValue.ValueType.RawID:
                    mvc = new mValue(val, cache);
                    break;

                case iValue.ValueType.Enum8:
                case iValue.ValueType.Enum16:
                case iValue.ValueType.Enum32:
                    mvc = new mEnum(val, cache);
                    break;

                case iValue.ValueType.ShortBounds:
                case iValue.ValueType.RealBounds:
                case iValue.ValueType.ShortPoint2D:
                case iValue.ValueType.RealPoint2D:
                case iValue.ValueType.RealPoint3D:
                case iValue.ValueType.RealPoint4D:
                case iValue.ValueType.RealVector2D:
                case iValue.ValueType.RealVector3D:
                case iValue.ValueType.RealVector4D:
                case iValue.ValueType.Colour32RGB:
                case iValue.ValueType.Colour32ARGB:
                    mvc = new mMultiValue(val, cache);
                    break;
                }

                mvc.Reload(tag.Offset);
                if (mvc is mStructure || mvc is mComment)
                {
                    yLoc += 5;
                }
                mvc.Location = new Point(5, yLoc);
                yLoc        += mvc.Height;
                if (mvc is mStructure || mvc is mComment)
                {
                    yLoc += 5;
                }
                pnlContainer.Controls.Add(mvc);
            }
        }