WriteStaticallyLinkedModuleRegistration() private static method

private static WriteStaticallyLinkedModuleRegistration ( TextWriter w, HashSet nativeModules, HashSet nativeClasses ) : void
w System.IO.TextWriter
nativeModules HashSet
nativeClasses HashSet
return void
コード例 #1
0
 private static void WriteModuleAndClassRegistrationFile(string file, HashSet <string> nativeModules, HashSet <string> nativeClasses)
 {
     using (TextWriter textWriter = new StreamWriter(file))
     {
         CodeStrippingUtils.WriteStaticallyLinkedModuleRegistration(textWriter, nativeModules, nativeClasses);
         textWriter.WriteLine();
         textWriter.WriteLine("void RegisterAllClasses()");
         textWriter.WriteLine("{");
         if (nativeClasses == null)
         {
             textWriter.WriteLine("\tvoid RegisterAllClassesGranular();");
             textWriter.WriteLine("\tRegisterAllClassesGranular();");
         }
         else
         {
             textWriter.WriteLine(string.Format("\t//Total: {0} classes", nativeClasses.Count));
             int num = 0;
             foreach (string current in nativeClasses)
             {
                 textWriter.WriteLine(string.Format("\t//{0}. {1}", num, current));
                 if (current == "MasterServerInterface")
                 {
                     textWriter.WriteLine("\t//Skipping");
                 }
                 else
                 {
                     if (current == "NetworkManager")
                     {
                         textWriter.WriteLine("\t//Skipping");
                     }
                     else
                     {
                         textWriter.WriteLine(string.Format("\tvoid RegisterClass_{0}();", current));
                         textWriter.WriteLine(string.Format("\tRegisterClass_{0}();", current));
                     }
                 }
                 textWriter.WriteLine();
                 num++;
             }
         }
         textWriter.WriteLine("}");
         textWriter.Close();
     }
 }
コード例 #2
0
 private static void WriteModuleAndClassRegistrationFile(string file, HashSet <string> nativeModules, HashSet <string> nativeClasses, HashSet <string> classesToSkip)
 {
     using (TextWriter w = (TextWriter) new StreamWriter(file))
     {
         CodeStrippingUtils.WriteStaticallyLinkedModuleRegistration(w, nativeModules, nativeClasses);
         w.WriteLine();
         w.WriteLine("void RegisterAllClasses()");
         w.WriteLine("{");
         if (nativeClasses == null)
         {
             w.WriteLine("\tvoid RegisterAllClassesGranular();");
             w.WriteLine("\tRegisterAllClassesGranular();");
         }
         else
         {
             w.WriteLine("\t//Total: {0} classes", (object)nativeClasses.Count);
             int num = 0;
             using (HashSet <string> .Enumerator enumerator = nativeClasses.GetEnumerator())
             {
                 while (enumerator.MoveNext())
                 {
                     string current = enumerator.Current;
                     w.WriteLine("\t//{0}. {1}", (object)num, (object)current);
                     if (classesToSkip.Contains(current))
                     {
                         w.WriteLine("\t//Skipping {0}", (object)current);
                     }
                     else
                     {
                         w.WriteLine("\tvoid RegisterClass_{0}();", (object)current);
                         w.WriteLine("\tRegisterClass_{0}();", (object)current);
                     }
                     w.WriteLine();
                     ++num;
                 }
             }
         }
         w.WriteLine("}");
         w.Close();
     }
 }
コード例 #3
0
 private static void WriteModuleAndClassRegistrationFile(string file, HashSet <string> nativeModules, HashSet <UnityType> nativeClasses, HashSet <UnityType> classesToSkip)
 {
     using (TextWriter textWriter = new StreamWriter(file))
     {
         textWriter.WriteLine("template <typename T> void RegisterClass();");
         textWriter.WriteLine("template <typename T> void RegisterStrippedTypeInfo(int, const char*, const char*);");
         textWriter.WriteLine();
         CodeStrippingUtils.WriteStaticallyLinkedModuleRegistration(textWriter, nativeModules, nativeClasses);
         textWriter.WriteLine();
         if (nativeClasses != null)
         {
             foreach (UnityType current in UnityType.GetTypes())
             {
                 if (current.baseClass != null && !current.isEditorOnly && !classesToSkip.Contains(current))
                 {
                     if (current.hasNativeNamespace)
                     {
                         textWriter.Write("namespace {0} {{ class {1}; }} ", current.nativeNamespace, current.name);
                     }
                     else
                     {
                         textWriter.Write("class {0}; ", current.name);
                     }
                     if (nativeClasses.Contains(current))
                     {
                         textWriter.WriteLine("template <> void RegisterClass<{0}>();", current.qualifiedName);
                     }
                     else
                     {
                         textWriter.WriteLine();
                     }
                 }
             }
             textWriter.WriteLine();
         }
         textWriter.WriteLine("void RegisterAllClasses()");
         textWriter.WriteLine("{");
         if (nativeClasses == null)
         {
             textWriter.WriteLine("\tvoid RegisterAllClassesGranular();");
             textWriter.WriteLine("\tRegisterAllClassesGranular();");
         }
         else
         {
             textWriter.WriteLine("void RegisterBuiltinTypes();");
             textWriter.WriteLine("RegisterBuiltinTypes();");
             textWriter.WriteLine("\t//Total: {0} non stripped classes", nativeClasses.Count);
             int num = 0;
             foreach (UnityType current2 in nativeClasses)
             {
                 textWriter.WriteLine("\t//{0}. {1}", num, current2.qualifiedName);
                 if (classesToSkip.Contains(current2))
                 {
                     textWriter.WriteLine("\t//Skipping {0}", current2.qualifiedName);
                 }
                 else
                 {
                     textWriter.WriteLine("\tRegisterClass<{0}>();", current2.qualifiedName);
                 }
                 num++;
             }
             textWriter.WriteLine();
         }
         textWriter.WriteLine("}");
         textWriter.Close();
     }
 }