コード例 #1
0
        public void GenerateCode(InterfaceDeclarationSyntax idecl, CodeWriter.CodeWriter w)
        {
            var iname = idecl.Identifier.ToString();

            Console.WriteLine("GenerateCode: " + iname);

            w._($"#region {iname}");
            w._();

            var namespaceScope  = idecl.GetNamespaceScope();
            var namespaceHandle = (string.IsNullOrEmpty(namespaceScope) == false)
                                      ? w.B($"namespace {idecl.GetNamespaceScope()}")
                                      : null;

            var useProtoContract = idecl.AttributeLists.GetAttribute("ProtoContractAttribute") != null;

            GenerateTrackablePocoCode(idecl, w, useProtoContract);

            if (useProtoContract)
            {
                GenerateTrackablePocoSurrogateCode(idecl, w);
            }

            namespaceHandle?.Dispose();

            w._();
            w._($"#endregion");
        }
コード例 #2
0
        public void GenerateCode(InterfaceDeclarationSyntax idecl, CodeWriter.CodeWriter w)
        {
            var iname = idecl.Identifier.ToString();

            Console.WriteLine("GenerateCode: " + iname);

            w._($"#region {iname}");
            w._();

            var namespaceScope  = idecl.GetNamespaceScope();
            var namespaceHandle = (string.IsNullOrEmpty(namespaceScope) == false)
                                      ? w.B($"namespace {idecl.GetNamespaceScope()}")
                                      : null;

            // Collect all methods and make payload type name for each one

            var methods = GetMethods(idecl);
            var method2PayloadTypeNameMap = GetPayloadTypeName(idecl, methods);

            // Collect all properties

            var snapshotProperty    = GetSnapshotProperty(idecl);
            var trackableProperties = GetTrackableProperties(idecl);

            // Generate all

            var hasServerOnlyAttribute = idecl.AttributeLists.GetAttribute("ServerOnlyAttribute") != null;

            GeneratePayloadCode(idecl, w, methods, method2PayloadTypeNameMap,
                                snapshotProperty, trackableProperties);

            GenerateServerEntityBaseCode(idecl, w, methods, method2PayloadTypeNameMap,
                                         snapshotProperty, trackableProperties);

            if (hasServerOnlyAttribute == false)
            {
                GenerateClientEntityBaseCode(idecl, w, methods, method2PayloadTypeNameMap,
                                             snapshotProperty, trackableProperties);
            }

            namespaceHandle?.Dispose();

            w._();
            w._($"#endregion");
        }
コード例 #3
0
        public void GenerateCode(InterfaceDeclarationSyntax idecl, CodeWriter.CodeWriter w)
        {
            var iname = idecl.Identifier.ToString();
            Console.WriteLine("GenerateCode: " + iname);

            w._($"#region {iname}");
            w._();

            var namespaceScope = idecl.GetNamespaceScope();
            var namespaceHandle = (string.IsNullOrEmpty(namespaceScope) == false)
                                      ? w.B($"namespace {idecl.GetNamespaceScope()}")
                                      : null;

            GenerateTrackableContainerCode(idecl, w);
            GenerateTrackableContainerTrackerCode(idecl, w);

            namespaceHandle?.Dispose();

            w._();
            w._($"#endregion");
        }
コード例 #4
0
        public void GenerateCode(InterfaceDeclarationSyntax idecl, CodeWriter.CodeWriter w)
        {
            var iname = idecl.Identifier.ToString();

            Console.WriteLine("GenerateCode: " + iname);

            w._($"#region {iname}");
            w._();

            var namespaceScope  = idecl.GetNamespaceScope();
            var namespaceHandle = (string.IsNullOrEmpty(namespaceScope) == false)
                                      ? w.B($"namespace {idecl.GetNamespaceScope()}")
                                      : null;

            GenerateTrackableContainerCode(idecl, w);
            GenerateTrackableContainerTrackerCode(idecl, w);

            namespaceHandle?.Dispose();

            w._();
            w._($"#endregion");
        }
コード例 #5
0
        public void GenerateCode(InterfaceDeclarationSyntax idecl, ICodeGenWriter writer)
        {
            var iname = idecl.Identifier.ToString();
            Console.WriteLine("GenerateCode: " + iname);

            writer.PushRegion(iname);
            writer.PushNamespace(idecl.GetNamespaceScope());

            GenerateTrackableContainerCode(idecl, writer);
            GenerateTrackableContainerTrackerCode(idecl, writer);

            writer.PopNamespace();
            writer.PopRegion();
        }
コード例 #6
0
        public void GenerateCode(InterfaceDeclarationSyntax idecl, CodeWriter.CodeWriter w)
        {
            var iname = idecl.Identifier.ToString();
            Console.WriteLine("GenerateCode: " + iname);

            w._($"#region {iname}");
            w._();

            var namespaceScope = idecl.GetNamespaceScope();
            var namespaceHandle = (string.IsNullOrEmpty(namespaceScope) == false)
                                      ? w.B($"namespace {idecl.GetNamespaceScope()}")
                                      : null;

            var useProtoContract = idecl.AttributeLists.GetAttribute("ProtoContractAttribute") != null;
            GenerateTrackablePocoCode(idecl, w, useProtoContract);

            if (useProtoContract)
                GenerateTrackablePocoSurrogateCode(idecl, w);

            namespaceHandle?.Dispose();

            w._();
            w._($"#endregion");
        }
コード例 #7
0
        public void GenerateCode(InterfaceDeclarationSyntax idecl, ICodeGenWriter writer)
        {
            var iname = idecl.Identifier.ToString();
            Console.WriteLine("GenerateCode: " + iname);

            writer.PushRegion(iname);
            writer.PushNamespace(idecl.GetNamespaceScope());

            var useProtoContract = idecl.AttributeLists.GetAttribute("ProtoContractAttribute") != null;
            GenerateTrackablePocoCode(idecl, writer, useProtoContract);

            if (useProtoContract)
                GenerateTrackablePocoSurrogateCode(idecl, writer);

            writer.PopNamespace();
            writer.PopRegion();
        }