Exemplo n.º 1
0
        private static void GenerateHead(StringBuilder sb, HeadFlag flag, string opcodeClassName)
        {
            sb.AppendLine("#if SERVER");
            sb.AppendLine("namespace Model\n{");
            foreach (string parentClass in parentMsg.GetDictionary().Keys)
            {
                if ((flag & HeadFlag.Bson) != 0)
                {
                    foreach (string s in parentMsg.GetAll(parentClass))
                    {
                        sb.Append($"\t[BsonKnownTypes(typeof({s}))]\n");
                    }
                }


                sb.Append($"\tpublic partial class {parentClass} {{}}\n\n");
            }
            sb.AppendLine("}");
            sb.AppendLine("#endif");

            sb.AppendLine("namespace Model\n{");
            foreach (string parentClass in parentMsg.GetDictionary().Keys)
            {
                if ((flag & HeadFlag.Proto) != 0)
                {
                    foreach (string s in parentMsg.GetAll(parentClass))
                    {
                        sb.Append($"\t[ProtoInclude({opcodeClassName}.{s}, typeof({s}))]\n");
                    }
                }

                sb.Append($"\tpublic partial class {parentClass} {{}}\n\n");
            }
            sb.AppendLine("}");
        }
Exemplo n.º 2
0
        private static void GenerateHead(StringBuilder sb, HeadFlag flag)
        {
            foreach (string parentClass in parentMsg.GetDictionary().Keys)
            {
                if ((flag & HeadFlag.Proto) != 0)
                {
                    foreach (string s in parentMsg.GetAll(parentClass))
                    {
                        sb.Append($"\t[ProtoInclude((int)Opcode.{s}, typeof({s}))]\n");
                    }
                }

                if ((flag & HeadFlag.Bson) != 0)
                {
                    foreach (string s in parentMsg.GetAll(parentClass))
                    {
                        sb.Append($"\t[BsonKnownTypes(typeof({s}))]\n");
                    }
                }


                sb.Append($"\tpublic partial class {parentClass} {{}}\n\n");
            }
        }
Exemplo n.º 3
0
        private static void GenerateHead(StringBuilder sb, string ns, HeadFlag flag, string opcodeClassName)
        {
            sb.AppendLine($"namespace {ns}");
            sb.AppendLine("{");
            foreach (string parentClass in parentMsg.GetDictionary().Keys)
            {
                if ((flag & HeadFlag.Bson) != 0)
                {
                    foreach (string s in parentMsg.GetAll(parentClass))
                    {
                        sb.Append($"\t[BsonKnownTypes(typeof({s}))]\n");
                    }
                }


                sb.Append($"\tpublic partial class {parentClass} {{}}\n\n");
            }
            sb.AppendLine("}");
        }