private List <InputScreenStorage.Input> ConvertDetail2InputList(CommandJsonStorage.Detail target)
        {
            int X = 5;
            int Y = 15;
            List <InputScreenStorage.Input> inputObjList = new List <InputScreenStorage.Input>();

            foreach (var parameter in target.Controls)
            {
                InputScreenStorage.Input inputObj = new InputScreenStorage.Input(
                    parameter.Name,
                    new Font("MS UI Gothic", 16F, FontStyle.Regular, GraphicsUnit.Point, 128),
                    new Point(X, Y),
                    parameter.Type,
                    parameter.Size,
                    parameter.Value
                    );
                X = inputObj.InputBox.Location.X + inputObj.InputBox.Size.Width + 5;

                if (parameter.Fixed)
                {
                    inputObj.Disabled();
                }
                else
                {
                    inputObj.Enabled();
                }

                inputObjList.Add(inputObj);
            }

            return(inputObjList);
        }
Beispiel #2
0
        private void AddDetail(TreeNodeCollection nodes, int insertPos)
        {
            CommandJsonStorage.Detail detail = new CommandJsonStorage.Detail();
            detail.Name   = "DefaultDetail";
            detail.Offset = 0;
            detail.Size   = 1;

            AddDetail(nodes, insertPos, detail);
        }
Beispiel #3
0
        private void Save()
        {
            var obj = new CommandJsonStorage.CommandJsonObject();

            obj.Name    = textBoxName.Text;
            obj.Version = textBoxVersion.Text;
            foreach (TreeNode item in treeView.Nodes)
            {
                var input_items = (MyLayoutClass)item.Tag;
                var items       = new CommandJsonStorage.Item();

                items.Name   = input_items.Search("Name").Text;
                items.Length = int.Parse(input_items.Search("Length").Text);
                foreach (TreeNode detail in item.Nodes)
                {
                    var input_details = (MyLayoutClass)detail.Tag;
                    var details       = new CommandJsonStorage.Detail();

                    details.Name   = input_details.Search("Name").Text;
                    details.Offset = int.Parse(input_details.Search("Offset").Text);
                    details.Size   = int.Parse(input_details.Search("Size").Text);
                    foreach (TreeNode parameter in detail.Nodes)
                    {
                        var input_parameter = (MyLayoutClass)parameter.Tag;
                        var parameters      = new CommandJsonStorage.Parameter();

                        parameters.Name   = input_parameter.Search("Name").Text;
                        parameters.Offset = int.Parse(input_parameter.Search("Offset").Text);
                        parameters.Size   = int.Parse(input_parameter.Search("Size").Text);
                        parameters.Type   = input_parameter.Search("Type").Text;
                        parameters.Value  = input_parameter.Search("Value").Text;
                        parameters.Fixed  = input_parameter.Search("Fixed").Text == "True" ? true : false;
                        details.Controls.Add(parameters);
                    }
                    items.Controls.Add(details);
                }
                obj.Controls.Add(items);
            }

            CommandObj = obj.Clone();
        }
Beispiel #4
0
        private void AddDetail(TreeNodeCollection nodes, int insertPos, CommandJsonStorage.Detail detail)
        {
            var _list   = new MyLayoutClass(new VerticalLayout(), splitContainer.Panel2);
            var _search = new Searcher();
            var _input  = new List <UserControlInput>
            {
                _search.getInputDisplayOfType("ASCII").
                SetFont(FONT).
                SetName("Name").
                SetRange(new Range <int>(MAX_TEXT)).
                SetValue(detail.Name).
                GetInputDisplay(),

                _search.getInputDisplayOfType("DEC").
                SetFont(FONT).
                SetName("Offset").
                SetRange(new Range <int>(ushort.MaxValue)).
                SetValue(detail.Offset.ToString()).
                GetInputDisplay(),

                _search.getInputDisplayOfType("DEC").
                SetFont(FONT).
                SetName("Size").
                SetRange(new Range <int>(ushort.MaxValue)).
                SetValue(detail.Size.ToString()).
                GetInputDisplay()
            };

            _list.Layout(_input);

            TreeNode nodeDetail = new TreeNode();

            nodeDetail.NodeFont = FONT;
            nodeDetail.Name     = detail.Name;
            nodeDetail.Text     = detail.Name;
            nodeDetail.Tag      = _list;
            nodes.Insert(insertPos, nodeDetail);

            AddParameter(nodeDetail.Nodes);
        }