private LayoutInfo GetLayoutInfo(SerializedFileScheme serialized) { if (RTTIClassHierarchyDescriptor.HasPlatform(serialized.Header.Generation)) { RTTIClassHierarchyDescriptor hierarchy = serialized.Metadata.Hierarchy; return(new LayoutInfo(hierarchy.Version, hierarchy.Platform, serialized.Flags)); } else { const Platform DefaultPlatform = Platform.StandaloneWinPlayer; const TransferInstructionFlags DefaultFlags = TransferInstructionFlags.SerializeGameRelease; BundleFileScheme bundle = GetBundleFile(); if (bundle == null) { Logger.Log(LogType.Warning, LogCategory.Import, "Unable to determine layout for provided files. Tring default one"); Version version = GetDefaultGenerationVersions(serialized.Header.Generation); return(new LayoutInfo(version, DefaultPlatform, DefaultFlags)); } else { Logger.Log(LogType.Warning, LogCategory.Import, "Unable to precisly determine layout for provided files. Tring default one"); return(new LayoutInfo(bundle.Header.EngineVersion, DefaultPlatform, DefaultFlags)); } } }
private LayoutInfo GetLayoutInfo(SerializedFileScheme serialized) { if (SerializedFileMetadata.HasPlatform(serialized.Header.Version)) { SerializedFileMetadata metadata = serialized.Metadata; return(new LayoutInfo(metadata.UnityVersion, metadata.TargetPlatform, serialized.Flags)); } else { const Platform DefaultPlatform = Platform.StandaloneWinPlayer; const TransferInstructionFlags DefaultFlags = TransferInstructionFlags.SerializeGameRelease; BundleFileScheme bundle = GetBundleFile(); if (bundle == null) { Logger.Log(LogType.Warning, LogCategory.Import, "Unable to determine layout for provided files. Tring default one"); Version version = GetDefaultGenerationVersions(serialized.Header.Version); return(new LayoutInfo(version, DefaultPlatform, DefaultFlags)); } else { Logger.Log(LogType.Warning, LogCategory.Import, "Unable to precisly determine layout for provided files. Tring default one"); return(new LayoutInfo(bundle.Header.UnityWebMinimumRevision, DefaultPlatform, DefaultFlags)); } } }
internal static BundleFileScheme ReadScheme(Stream stream, string filePath, string fileName) { BundleFileScheme scheme = new BundleFileScheme(filePath, fileName); scheme.ReadScheme(stream); return(scheme); }
internal static BundleFileScheme ReadScheme(SmartStream stream, long offset, long size, string filePath, string fileName) { BundleFileScheme scheme = new BundleFileScheme(stream, offset, size, filePath, fileName); scheme.ReadScheme(); scheme.ProcessEntries(); return(scheme); }
internal BundleFile(IFileCollection collection, BundleFileScheme scheme) { if (scheme == null) { throw new ArgumentNullException(nameof(scheme)); } Header = scheme.Header; Metadata = scheme.Metadata; }
internal static BundleFileScheme ReadScheme(byte[] buffer, string filePath, string fileName) { BundleFileScheme scheme = new BundleFileScheme(filePath, fileName); using (MemoryStream stream = new MemoryStream(buffer, 0, buffer.Length, false)) { scheme.ReadScheme(stream); } return(scheme); }
internal BundleFile(BundleFileScheme scheme) : base(scheme.NameOrigin) { if (scheme == null) { throw new ArgumentNullException(nameof(scheme)); } Header = scheme.Header; Metadata = scheme.Metadata; }
internal void AddFile(FileScheme scheme, IFileCollection collection, IAssemblyManager manager) { switch (scheme.SchemeType) { case FileEntryType.Serialized: { SerializedFileScheme serializedScheme = (SerializedFileScheme)scheme; SerializedFile file = serializedScheme.ReadFile(collection, manager); m_serializedFiles.Add(file); OnSerializedFileAdded(file); } break; case FileEntryType.Bundle: { BundleFileScheme bundleScheme = (BundleFileScheme)scheme; BundleFile bundle = bundleScheme.ReadFile(collection, manager); m_fileLists.Add(bundle); OnFileListAdded(bundle); } break; case FileEntryType.Archive: { ArchiveFileScheme archiveScheme = (ArchiveFileScheme)scheme; ArchiveFile archive = archiveScheme.ReadFile(collection, manager); m_fileLists.Add(archive); OnFileListAdded(archive); } break; case FileEntryType.Web: { WebFileScheme webScheme = (WebFileScheme)scheme; WebFile webFile = webScheme.ReadFile(collection, manager); m_fileLists.Add(webFile); OnFileListAdded(webFile); } break; case FileEntryType.Resource: { ResourceFileScheme resourceScheme = (ResourceFileScheme)scheme; ResourceFile resource = resourceScheme.ReadFile(); m_resourceFiles.Add(resource); OnResourceFileAdded(resource); } break; default: throw new NotSupportedException(scheme.SchemeType.ToString()); } }
internal void AddFile(GameProcessorContext context, FileScheme scheme) { switch (scheme.SchemeType) { case FileEntryType.Serialized: { SerializedFileScheme serializedScheme = (SerializedFileScheme)scheme; SerializedFile file = serializedScheme.ReadFile(context); AddSerializedFile(file); } break; case FileEntryType.Bundle: { BundleFileScheme bundleScheme = (BundleFileScheme)scheme; BundleFile bundle = bundleScheme.ReadFile(context); AddFileList(bundle); } break; case FileEntryType.Archive: { ArchiveFileScheme archiveScheme = (ArchiveFileScheme)scheme; ArchiveFile archive = archiveScheme.ReadFile(context); AddFileList(archive); } break; case FileEntryType.Web: { WebFileScheme webScheme = (WebFileScheme)scheme; WebFile webFile = webScheme.ReadFile(context); AddFileList(webFile); } break; case FileEntryType.Resource: { ResourceFileScheme resourceScheme = (ResourceFileScheme)scheme; ResourceFile resource = resourceScheme.ReadFile(); AddResourceFile(resource); } break; default: throw new NotSupportedException(scheme.SchemeType.ToString()); } }
public static BundleFileScheme ReadScheme(SmartStream stream, long offset, long size, string filePath, string fileName) { return(BundleFileScheme.ReadScheme(stream, offset, size, filePath, fileName)); }
public static BundleFileScheme ReadScheme(Stream stream, string filePath, string fileName) { return(BundleFileScheme.ReadScheme(stream, filePath, fileName)); }
public static BundleFileScheme ReadScheme(byte[] buffer, string filePath, string fileName) { return(BundleFileScheme.ReadScheme(buffer, filePath, fileName)); }