public void AddScheme(string filePath, string fileName) { FileScheme scheme = GameCollection.LoadScheme(filePath, fileName); OnSchemeLoaded(scheme); m_schemes.Add(scheme); }
private void ProcessEntries() { foreach (WebFileEntry entry in Metadata.Entries.Values) { FileScheme scheme = GameCollection.ReadScheme(m_stream, entry.Offset, entry.Size, FilePath, entry.NameOrigin); AddScheme(scheme); } }
private void ProcessEntries() { foreach (BundleFileEntry entry in Metadata.Entries.Values) { FileEntryOffset offset = m_entryStreams[entry]; FileScheme scheme = GameCollection.ReadScheme(offset.Stream, offset.Offset, entry.Size, FilePath, entry.NameOrigin); AddScheme(scheme); } }
private GameStructure() { GameCollection.Parameters pars = new GameCollection.Parameters() { RequestAssemblyCallback = OnRequestAssembly, RequestResourceCallback = OnRequestResource, }; FileCollection = new GameCollection(pars); }
public void ProcessSchemes(GameCollection fileCollection) { GameProcessorContext context = new GameProcessorContext(fileCollection); foreach (FileScheme scheme in m_schemes) { fileCollection.AddFile(context, scheme); } context.ReadSerializedFiles(); }
private void ReadPre530Data(Stream stream, long metadataOffset) { foreach (BundleFileEntry entry in Metadata.Entries) { byte[] buffer = new byte[entry.Size]; stream.Position = metadataOffset + entry.Offset; stream.ReadBuffer(buffer, 0, buffer.Length); FileScheme scheme = GameCollection.ReadScheme(buffer, FilePath, entry.NameOrigin); AddScheme(scheme); } }
private void ReadRawWebData(Stream stream, long metadataOffset) { foreach (Node entry in Metadata.DirectoryInfo.Nodes) { byte[] buffer = new byte[entry.Size]; stream.Position = metadataOffset + entry.Offset; stream.ReadBuffer(buffer, 0, buffer.Length); FileScheme scheme = GameCollection.ReadScheme(buffer, FilePath, entry.PathOrigin); AddScheme(scheme); } }
private void Load(List <string> pathes, LayoutInfo layinfo) { if (CheckPC(pathes)) { } else if (CheckLinux(pathes)) { } else if (CheckMac(pathes)) { } else if (CheckAndroid(pathes)) { } else if (CheckiOS(pathes)) { } else if (CheckSwitch(pathes)) { } else if (CheckWebGL(pathes)) { } else if (CheckWebPlayer(pathes)) { } CheckMixed(pathes); using (GameStructureProcessor processor = new GameStructureProcessor()) { if (PlatformStructure != null) { ProcessPlatformStructure(processor, PlatformStructure); } if (MixedStructure != null) { ProcessPlatformStructure(processor, MixedStructure); } processor.AddDependencySchemes(RequestDependency); if (processor.IsValid) { layinfo = layinfo ?? processor.GetLayoutInfo(); AssetLayout layout = new AssetLayout(layinfo); GameCollection.Parameters pars = new GameCollection.Parameters(layout); pars.ScriptBackend = GetScriptingBackend(); pars.RequestAssemblyCallback = OnRequestAssembly; pars.RequestResourceCallback = OnRequestResource; FileCollection = new GameCollection(pars); processor.ProcessSchemes(FileCollection); } } }
private static AssetLayout GetLayout(GameCollection collection, SerializedFileScheme scheme, string name) { if (!RTTIClassHierarchyDescriptor.HasPlatform(scheme.Header.Generation)) { return(collection.Layout); } if (FilenameUtils.IsDefaultResource(name)) { return(collection.Layout); } LayoutInfo info = new LayoutInfo(scheme.Metadata.Hierarchy.Version, scheme.Metadata.Hierarchy.Platform, scheme.Flags); return(collection.GetLayout(info)); }
private static AssetLayout GetLayout(GameCollection collection, SerializedFileScheme scheme, string name) { if (!SerializedFileMetadata.HasPlatform(scheme.Header.Version)) { return(collection.Layout); } if (FilenameUtils.IsDefaultResource(name)) { return(collection.Layout); } LayoutInfo info = new LayoutInfo(scheme.Metadata.UnityVersion, scheme.Metadata.TargetPlatform, scheme.Flags); return(collection.GetLayout(info)); }
internal SerializedFile(GameCollection collection, SerializedFileScheme scheme) { Collection = collection ?? throw new ArgumentNullException(nameof(collection)); FilePath = scheme.FilePath; NameOrigin = scheme.Name; Name = FilenameUtils.FixFileIdentifier(scheme.Name); Layout = GetLayout(collection, scheme, Name); Header = scheme.Header; Metadata = scheme.Metadata; for (int i = 0; i < Metadata.Entries.Length; i++) { m_assetEntryLookup.Add(Metadata.Entries[i].PathID, i); } }
private void ReadScheme(Stream stream) { using (EndianReader reader = new EndianReader(stream, EndianType.LittleEndian)) { Header.Read(reader); Metadata.Read(reader); } foreach (WebFileEntry entry in Metadata.Entries) { byte[] buffer = new byte[entry.Size]; stream.Position = entry.Offset; stream.ReadBuffer(buffer, 0, buffer.Length); FileScheme scheme = GameCollection.ReadScheme(buffer, FilePath, entry.NameOrigin); AddScheme(scheme); } }
private void Read530Data(Stream stream, long headerSize) { if (Header.Flags.IsMetadataAtTheEnd()) { stream.Position = headerSize; } using (BundleFileBlockReader blockReader = new BundleFileBlockReader(stream, Metadata)) { foreach (BundleFileEntry entry in Metadata.Entries) { SmartStream entryStream = blockReader.ReadEntry(entry); FileScheme scheme = GameCollection.ReadScheme(entryStream, FilePath, entry.NameOrigin); AddScheme(scheme); } } }
private void ReadFileStreamData(Stream stream, long basePosition, long headerSize) { if (Header.FileStream.Flags.IsBlocksInfoAtTheEnd()) { stream.Position = basePosition + headerSize; } using (BundleFileBlockReader blockReader = new BundleFileBlockReader(stream, Metadata.BlocksInfo)) { foreach (Node entry in Metadata.DirectoryInfo.Nodes) { SmartStream entryStream = blockReader.ReadEntry(entry); FileScheme scheme = GameCollection.ReadScheme(entryStream, FilePath, entry.PathOrigin); AddScheme(scheme); } } }
public void ProcessFile(string fileName, string filePath) { if (m_loadedFiles.Contains(fileName)) { return; } FileScheme scheme = GameCollection.LoadScheme(filePath, fileName); OnSchemeLoaded(scheme); if (LoadDependencies(scheme)) { m_fileCollection.AddFile(scheme, m_fileCollection, m_fileCollection.AssemblyManager); scheme.Dispose(); } else { m_delayedSchemes.Add(fileName, scheme); } }
public GameProcessorContext(GameCollection collection) { Collection = collection; }
public Processor(GameCollection fileCollection, Func <string, string> dependencyCallback) { m_fileCollection = fileCollection ?? throw new ArgumentNullException(nameof(fileCollection)); m_dependencyCallback = dependencyCallback ?? throw new ArgumentNullException(nameof(dependencyCallback)); }