예제 #1
0
 internal void Read(EndianReader reader)
 {
     if (RTTIClassHierarchyDescriptor.IsReadSignature(Header.Generation))
     {
         ReadAssets(reader);
     }
     else
     {
         Logger.Log(LogType.Warning, LogCategory.Import, $"Can't determine file version for generation {Header.Generation} for file '{Name}'");
         string[] versions = GetGenerationVersions(Header.Generation);
         for (int i = 0; i < versions.Length; i++)
         {
             string version = versions[i];
             Logger.Log(LogType.Debug, LogCategory.Import, $"Try parse {Name} as {version} version");
             Metadata.Hierarchy.Version.Parse(version);
             m_assets.Clear();
             try
             {
                 ReadAssets(reader);
                 UpdateFileVersion();
                 break;
             }
             catch
             {
                 Logger.Log(LogType.Debug, LogCategory.Import, "Faild");
                 if (i == versions.Length - 1)
                 {
                     throw;
                 }
             }
         }
     }
 }
예제 #2
0
 private void UpdateFileVersion()
 {
     if (!RTTIClassHierarchyDescriptor.IsReadSignature(Header.Generation))
     {
         foreach (Object asset in FetchAssets())
         {
             if (asset.ClassID == ClassIDType.BuildSettings)
             {
                 BuildSettings settings = (BuildSettings)asset;
                 Metadata.Hierarchy.Version.Parse(settings.Version);
                 return;
             }
         }
     }
 }
예제 #3
0
        private void AddSerializedFile(SerializedFile file)
        {
            if (m_files.Any(t => t.Name == file.Name))
            {
                throw new ArgumentException($"Assets file with name '{file.Name}' already presents in collection", nameof(file));
            }

            if (!RTTIClassHierarchyDescriptor.IsReadSignature(file.Header.Generation))
            {
                SetVersion(file);
            }

            if (m_files.Any(t => !t.Platform.IsCompatible(file.Platform)))
            {
                throw new ArgumentException($"Assets file '{file.Name}' has incompatible with other assets files platform {file.Platform} ", nameof(file));
            }

            m_files.Add(file);
        }