//********************************************************************** //********************************************************************** //********************************************************************** public void writeBlock(BlockData aBlock) { //****************************************************************** //****************************************************************** //****************************************************************** // Class Begin mWCS.WriteBar(1, 3); mWCS.WritePreCommentList(1, aBlock.mPreCommentList); mWCS.WriteSkip(); if (aBlock.mBlockType == Defs.cBlockT_Message) { mWCS.WriteLine(1, "public partial class {0} : BaseMsg", aBlock.mName); } else { mWCS.WriteLine(1, "public partial class {0} : ByteContent", aBlock.mName); } mWCS.WriteLine(1, "{"); //****************************************************************** //****************************************************************** //****************************************************************** // Members mWCS.WriteBar(2, 1); mWCS.WriteLine(2, "// Members:"); mWCS.WriteSkip(); aBlock.mConstList.ForEach(delegate(ConstData tConst) { mWCS.WritePreCommentList(2, tConst.mPreCommentList); mWCS.Write(2, "public const int {0} = {1};", stringExtend(tConst.mName, aBlock.mConstMaxSize), tConst.mInitialValue); if (String.IsNullOrEmpty(tConst.mPostComment)) { mWCS.WriteEOL(); } else { mWCS.WriteSpace(4); mWCS.Write("{0}", tConst.mPostComment); mWCS.WriteEOL(); } }); if (aBlock.mConstList.Count > 0) { mWCS.WriteSkip(); } aBlock.mMemberList.ForEach(delegate(MemberData tMember) { mWCS.WritePreCommentList(2, tMember.mPreCommentList); if (!tMember.mIsArray) { mWCS.Write(2, "public {0} {1};", stringExtend(tMember.mTypeNameCS, aBlock.mTypeMaxSize), tMember.mName); } else { mWCS.Write(2, "public {0} {1};", stringExtend(tMember.mTypeNameCS + "[]", aBlock.mTypeMaxSize), tMember.mName); } if (String.IsNullOrEmpty(tMember.mPostComment)) { mWCS.WriteEOL(); } else { mWCS.WriteSpace(4 + aBlock.mNameMaxSize - tMember.mName.Length); mWCS.Write("{0}", tMember.mPostComment); mWCS.WriteEOL(); } }); mWCS.WriteSkip(); //****************************************************************** //****************************************************************** //****************************************************************** // Class End mWCS.WriteLine(1, "};"); mWCS.WriteSkip(); }
//********************************************************************** //********************************************************************** //********************************************************************** public void writeBlock(BlockData aBlock) { //****************************************************************** //****************************************************************** //****************************************************************** // Class Begin mWCH.WriteBar(0, 3); mWCH.WritePreCommentList(0, aBlock.mPreCommentList); mWCH.WriteSkip(); if (aBlock.mBlockType == Defs.cBlockT_Message) { mWCH.WriteLine(0, "class {0} : public BaseMsg", aBlock.mName); } else { mWCH.WriteLine(0, "class {0} : public Ris::ByteContent", aBlock.mName); } mWCH.WriteLine(0, "{"); mWCH.WriteLine(0, "public:"); mWCH.WriteSkip(); //****************************************************************** //****************************************************************** //****************************************************************** // Members mWCH.WriteBar(1, 1); mWCH.WriteLine(1, "// Members:"); mWCH.WriteSkip(); aBlock.mConstList.ForEach(delegate(ConstData tConst) { mWCH.WritePreCommentList(1, tConst.mPreCommentList); mWCH.Write(1, "static const int {0} = {1};", stringExtend(tConst.mName, aBlock.mConstMaxSize), tConst.mInitialValue); if (String.IsNullOrEmpty(tConst.mPostComment)) { mWCH.WriteEOL(); } else { mWCH.WriteSpace(4); mWCH.Write("{0}", tConst.mPostComment); mWCH.WriteEOL(); } }); if (aBlock.mConstList.Count > 0) { mWCH.WriteSkip(); } aBlock.mMemberList.ForEach(delegate(MemberData tMember) { mWCH.WritePreCommentList(1, tMember.mPreCommentList); if (tMember.mMemberType == Defs.cMemberT_String) { mWCH.Write(1, "{0} {1} [{2}];", stringExtend("char", aBlock.mTypeMaxSize), tMember.mName, tMember.mArraySize); } else if (!tMember.mIsArray) { mWCH.Write(1, "{0} {1};", stringExtend(tMember.mTypeNameCP, aBlock.mTypeMaxSize), tMember.mName); } else { mWCH.Write(1, "{0} {1} [{2}];", stringExtend(tMember.mTypeNameCP, aBlock.mTypeMaxSize), tMember.mName, tMember.mArraySize); } if (String.IsNullOrEmpty(tMember.mPostComment)) { mWCH.WriteEOL(); } else { mWCH.WriteSpace(4 + aBlock.mNameMaxSize - tMember.mName.Length); mWCH.Write("{0}", tMember.mPostComment); mWCH.WriteEOL(); } }); mWCH.WriteSkip(); //****************************************************************** //****************************************************************** //****************************************************************** // Methods mWCH.WriteBar(1, 1); mWCH.WriteLine(1, "// Methods:"); mWCH.WriteSkip(); mWCH.WriteLine(1, "{0}();", aBlock.mName); mWCH.WriteLine(1, "void copyToFrom (Ris::ByteBuffer* aBuffer);"); //****************************************************************** //****************************************************************** //****************************************************************** // Class End mWCH.WriteLine(0, "};"); mWCH.WriteSkip(); }