Exemplo n.º 1
0
        private void tvModel_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
#if false
            RcTreeNode rcnode = (RcTreeNode)e.Node;

            RcChipBase c;
            c = RcChipBase.Parse(datasource, e.Label);

            if (c is RcChipCowl && Array.Exists(rcnode.Chip.Child, x => !(x is RcChipCowl)))
            {
                if (
                    MessageBox.Show("派生チップにカウル以外のチップが存在します。すべてカウルに変更しますか?", "ツリービュー編集", MessageBoxButtons.YesNo)
                    == DialogResult.Yes)
                {
                    for (int i = 0; i < RcData.ChildCapasity; i++)
                    {
                        rcnode.Chip.Child[i] = rcnode.Chip.Child[i].ChangeType(RcChipType.Cowl);
                    }
                }
                else
                {
                }
            }
#else
            e.CancelEdit = true;
#endif
        }
Exemplo n.º 2
0
        public static RcChipCore Parse(string modelData, RcChipCore coreChip, RcData gen)
        {
            char openBrace  = char.Parse("{");
            char closeBrace = char.Parse("}");

            modelData = modelData.Replace(" ", "").Replace("\t", "").Replace("\n", "").Replace("\r", "");
            string[]           blocks    = modelData.Split(openBrace, closeBrace);
            Stack <RcChipBase> chipstack = new Stack <RcChipBase>();
            RcChipBase         buff;

            for (int i = 0; i < blocks.Length; i++)
            {
                if (blocks[i].ToLower().StartsWith("core"))
                {
                    coreChip.Read(blocks[i]);
                    chipstack.Push(coreChip);
                }
                else if (blocks[i] == "")
                {
                    if (chipstack.Count == 1)
                    {
                        break;
                    }
                    buff = (RcChipBase)chipstack.Pop();
                    ((RcChipBase)chipstack.Peek()).Add(buff.JointPosition, buff);
                }
                else
                {
                    chipstack.Push(RcChipBase.Parse(gen, blocks[i]));
                }
            }

            return((RcChipCore)chipstack.Pop());
        }