public override ExportPointer CreateExportPointer(Object asset, bool isLocal)
        {
            if (isLocal)
            {
                throw new NotSupportedException();
            }

            MonoScript script = m_scripts[asset];

            if (!MonoScript.IsReadAssemblyName(script.File.Version, script.File.Flags) || s_unityEngine.IsMatch(script.AssemblyName))
            {
                if (MonoScript.IsReadNamespace(script.File.Version))
                {
                    int fileID = Compute(script.Namespace, script.ClassName);
                    return(new ExportPointer(fileID, UnityEngineGUID, AssetExporter.ToExportType(asset)));
                }
                else
                {
                    ScriptIdentifier scriptInfo = script.GetScriptID();
                    if (!scriptInfo.IsDefault)
                    {
                        int fileID = Compute(scriptInfo.Namespace, scriptInfo.Name);
                        return(new ExportPointer(fileID, UnityEngineGUID, AssetExporter.ToExportType(asset)));
                    }
                }
            }

            long exportID   = GetExportID(asset);
            GUID uniqueGUID = script.GUID;

            return(new ExportPointer(exportID, uniqueGUID, AssetExporter.ToExportType(asset)));
        }
예제 #2
0
        public ScriptExportType GetExportType(ScriptExportManager exportManager)
        {
            ScriptIdentifier scriptID = IsReadNamespace(File.Version) ?
                                        File.AssemblyManager.GetScriptID(AssemblyName, Namespace, ClassName) :
                                        File.AssemblyManager.GetScriptID(AssemblyName, ClassName);

            return(File.AssemblyManager.GetExportType(exportManager, scriptID));
        }
예제 #3
0
        public bool IsScriptPresents()
        {
            ScriptIdentifier scriptID = IsReadNamespace(File.Version) ?
                                        File.AssemblyManager.GetScriptID(AssemblyName, Namespace, ClassName) :
                                        File.AssemblyManager.GetScriptID(AssemblyName, ClassName);

            return(File.AssemblyManager.IsPresent(scriptID));
        }
예제 #4
0
 public ScriptExportType GetExportType(ScriptExportManager exportManager, ScriptIdentifier scriptID)
 {
     if (ScriptingBackend == ScriptingBackend.Unknown)
     {
         throw new Exception("You have to set backend first");
     }
     return(m_manager.GetExportType(exportManager, scriptID));
 }
예제 #5
0
        public SerializableType GetSerializableType(ScriptIdentifier scriptID)
        {
            TypeDefinition type = FindType(scriptID);

            if (type == null)
            {
                throw new ArgumentException($"Can't find type {scriptID.UniqueName}");
            }
            return(new MonoType(this, type));
        }
예제 #6
0
        public bool IsValid(ScriptIdentifier scriptID)
        {
            TypeDefinition type = FindType(scriptID);

            if (type == null)
            {
                return(false);
            }
            return(IsTypeValid(type, s_emptyArguments));
        }
예제 #7
0
        public SerializableType GetSerializableType(ScriptIdentifier scriptID)
        {
            string uniqueName = scriptID.UniqueName;

            if (m_serializableTypes.TryGetValue(uniqueName, out SerializableType type))
            {
                return(type);
            }
            return(m_manager.GetSerializableType(scriptID));
        }
예제 #8
0
        public ScriptExportType GetExportType(ScriptExportManager exportManager, ScriptIdentifier scriptID)
        {
            TypeDefinition type = FindType(scriptID);

            if (type == null)
            {
                throw new ArgumentException($"Can't find type {scriptID.UniqueName}");
            }
            return(exportManager.RetrieveType(type));
        }
예제 #9
0
        public SerializableType GetBehaviourType()
        {
            ScriptIdentifier scriptID = IsReadNamespace(File.Version) ?
                                        File.AssemblyManager.GetScriptID(AssemblyName, Namespace, ClassName) :
                                        File.AssemblyManager.GetScriptID(AssemblyName, ClassName);

            if (File.AssemblyManager.IsValid(scriptID))
            {
                return(File.AssemblyManager.GetSerializableType(scriptID));
            }
            return(null);
        }
예제 #10
0
 public bool IsPresent(ScriptIdentifier scriptID)
 {
     if (m_manager == null)
     {
         return(false);
     }
     if (scriptID.IsDefault)
     {
         return(false);
     }
     return(m_manager.IsPresent(scriptID));
 }
예제 #11
0
 public bool IsValid(ScriptIdentifier scriptID)
 {
     if (ScriptingBackend == ScriptingBackend.Unknown)
     {
         return(false);
     }
     if (scriptID.IsDefault)
     {
         return(false);
     }
     return(m_manager.IsValid(scriptID));
 }
예제 #12
0
 public bool IsValid(ScriptIdentifier scriptID)
 {
     if (!IsSet)
     {
         return(false);
     }
     if (scriptID.IsDefault)
     {
         return(false);
     }
     return(m_manager.IsValid(scriptID));
 }
예제 #13
0
        public bool IsValid(ScriptIdentifier scriptID)
        {
            TypeDefinition type = FindType(scriptID);

            if (type == null)
            {
                return(false);
            }
            MonoTypeContext context = new MonoTypeContext(type);

            if (!IsTypeValid(context))
            {
                return(false);
            }
            if (!IsUnityObject(type))
            {
                return(false);
            }
            return(true);
        }
예제 #14
0
        public override MetaPtr CreateExportPointer(Object asset, bool isLocal)
        {
            if (isLocal)
            {
                throw new NotSupportedException();
            }

            MonoScript script = m_scripts[asset];

            if (!MonoScript.HasAssemblyName(script.File.Version, script.File.Flags) || s_unityEngine.IsMatch(script.AssemblyName))
            {
                if (MonoScript.HasNamespace(script.File.Version))
                {
                    int fileID = Compute(script.Namespace, script.ClassName);
                    return(new MetaPtr(fileID, UnityEngineGUID, AssetExporter.ToExportType(asset)));
                }
                else
                {
                    ScriptIdentifier scriptInfo = script.GetScriptID();
                    if (!scriptInfo.IsDefault)
                    {
                        int fileID = Compute(scriptInfo.Namespace, scriptInfo.Name);
                        return(new MetaPtr(fileID, UnityEngineGUID, AssetExporter.ToExportType(asset)));
                    }
                }
            }

            if (!AssemblyHash.ContainsKey(script.AssemblyNameOrigin))
            {
                AssemblyHash[script.AssemblyNameOrigin] = GetAssemblyHashGuid(script.AssemblyNameOrigin);
            }

            var scriptKey = $"{script.AssemblyNameOrigin}{script.Namespace}{script.ClassName}";

            if (!ScriptId.ContainsKey(scriptKey))
            {
                ScriptId[scriptKey] = Compute(script.Namespace, script.ClassName);
            }

            return(new MetaPtr(ScriptId[scriptKey], new UnityGUID(AssemblyHash[script.AssemblyNameOrigin]), AssetExporter.ToExportType(asset)));
        }
        public bool IsValid(ScriptIdentifier scriptID)
        {
            TypeDefinition type = FindType(scriptID);

            if (type == null)
            {
                return(false);
            }
            if (type.IsAbstract)
            {
                return(false);
            }
            MonoTypeContext context = new MonoTypeContext(type);

            if (!IsTypeValid(context))
            {
                return(false);
            }
            if (!IsInheritanceValid(type))
            {
                return(false);
            }
            return(true);
        }
예제 #16
0
 public ScriptExportType GetExportType(ScriptExportManager exportManager, ScriptIdentifier scriptID)
 {
     return(m_manager.GetExportType(exportManager, scriptID));
 }
예제 #17
0
        public static string GetUniqueName(TypeReference type)
        {
            string assembly = FilenameUtils.FixAssemblyEndian(type.Module.Name);

            return(ScriptIdentifier.ToUniqueName(assembly, type.FullName));
        }
예제 #18
0
 public bool IsPresent(ScriptIdentifier scriptID)
 {
     return(FindType(scriptID.Assembly, scriptID.Namespace, scriptID.Name) != null);
 }