internal static DotNetObject CreateScriptComponentInstance(
     string className,
     GameEntity entity,
     ManagedScriptComponent managedScriptComponent)
 {
     System.Type moduleType = Managed.ModuleTypes[className];
     if (moduleType != (System.Type)null)
     {
         ConstructorInfo constructor = moduleType.GetConstructor(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.CreateInstance, (Binder)null, new System.Type[0], (ParameterModifier[])null);
         if (constructor != (ConstructorInfo)null && constructor.Invoke(new object[0]) is ScriptComponentBehaviour componentBehaviour2)
         {
             componentBehaviour2.Construct(entity, managedScriptComponent);
             return((DotNetObject)componentBehaviour2);
         }
     }
     else
     {
         MBDebug.ShowWarning("CreateScriptComponentInstance failed: " + className);
     }
     return((DotNetObject)null);
 }
 public void FinalizeAndWrite(string filePath)
 {
     try
     {
         XmlDocument xmlDocument = new XmlDocument();
         XmlNode     element1    = (XmlNode)xmlDocument.CreateElement("objects");
         xmlDocument.AppendChild(element1);
         foreach (PerformanceAnalyzer.PerformanceObject performanceObject in this.objects)
         {
             XmlNode     element2 = (XmlNode)xmlDocument.CreateElement("object");
             XmlNode     node     = element2;
             XmlDocument document = xmlDocument;
             performanceObject.Write(node, document);
             element1.AppendChild(element2);
         }
         xmlDocument.Save(filePath);
     }
     catch (Exception ex)
     {
         MBDebug.ShowWarning("Exception occurred while trying to write " + filePath + ": " + ex.ToString());
     }
 }