コード例 #1
0
        /// <summary>
        /// パケットリストを取得
        /// </summary>
        /// <param name="EnumName">enum名</param>
        /// <returns>パケットリスト</returns>
        public PacketData[] GetPackets(string EnumName)
        {
            List <PacketData> Packets = new List <PacketData>();

            XmlDocument EnumXml = new XmlDocument();

            EnumXml.Load(ProjectPath + EnumName + ".xml");

            XmlNode RootNode = EnumXml.SelectSingleNode(XmlRootElementName);

            foreach (XmlElement PacketNode in RootNode.ChildNodes)
            {
                PacketData Data = new PacketData();
                Data.Name     = PacketNode.GetAttribute("Name");
                Data.IsPacket = (PacketNode.GetAttribute("IsPacket") == "True");
                Data.ID       = PacketNode.GetAttribute("ID");

                foreach (XmlElement MemberNode in PacketNode.ChildNodes)
                {
                    PacketMemberData MemberData = new PacketMemberData();
                    MemberData.Name = MemberNode.GetAttribute("Name");
                    MemberData.Type = MemberNode.GetAttribute("Type");
                    Data.Member.Add(MemberData);
                }

                Packets.Add(Data);
            }

            return(Packets.ToArray());
        }
コード例 #2
0
        // メンバ追加ボタンが押された。
        private void AddMemberButton_Click(object sender, EventArgs e)
        {
            PacketMemberData Member = new PacketMemberData();

            Member.Name = "NewMember";
            Member.Type = "int";
            MemberListBox.Items.Add(Member);
        }