Пример #1
0
        void ProcessAssemblyClasses()
        {
            var types = new List <TypeDefinition>(module.Types);

            foreach (TypeDefinition klass in types)
            {
                // extension methods only live in static classes
                // static classes are represented as sealed and abstract
                if (klass.IsAbstract && klass.IsSealed)
                {
                    LoadDeclaredWriters(klass);
                    LoadDeclaredReaders(klass);
                }

                if (klass.GetCustomAttribute <NetworkMessageAttribute>() != null)
                {
                    readers.GetReadFunc(klass, null);
                    writers.GetWriteFunc(klass, null);
                    messages.Add(klass);
                }
            }

            // Generate readers and writers
            // find all the Send<> and Register<> calls and generate
            // readers and writers for them.
            CodePass.ForEachInstruction(module, (md, instr, sequencePoint) => GenerateReadersWriters(instr, sequencePoint));
        }
Пример #2
0
        public void Process(ModuleDefinition moduleDef)
        {
            DateTime startTime = DateTime.Now;

            // replace all field access with property access for syncvars
            CodePass.ForEachInstruction(moduleDef, WeavedMethods, ProcessInstruction);

            Console.WriteLine("  ProcessSitesModule " + moduleDef.Name + " elapsed time:" + (DateTime.Now - startTime));
        }
Пример #3
0
        void ProcessAssemblyClasses()
        {
            var types = new List <TypeDefinition>(module.Types);

            // find all extension methods first, then find message.
            // we need to do this incase message is defined before the extension class
            LoadModuleExtensions(types);
            LoadModuleMessages(types);

            // Generate readers and writers
            // find all the Send<> and Register<> calls and generate
            // readers and writers for them.
            CodePass.ForEachInstruction(module, (md, instr, sequencePoint) => GenerateReadersWriters(instr, sequencePoint));
        }
Пример #4
0
        private void ProcessModule()
        {
            // create copy incase we modify types
            var types = new List <TypeDefinition>(module.Types);

            // find NetworkMessages
            foreach (var klass in types)
            {
                CheckForNetworkMessage(klass);
            }

            // Generate readers and writers
            // find all the Send<> and Register<> calls and generate
            // readers and writers for them.
            CodePass.ForEachInstruction(module, GenerateReadersWriters);
        }
Пример #5
0
 public void Process(ModuleDefinition moduleDef)
 {
     // replace all field access with property access for syncvars
     CodePass.ForEachInstruction(moduleDef, WeavedMethods, ProcessInstruction);
 }