/// <summary> /// Gets a new <see cref="IFileContainer"/> for the provided <see cref="path"/> and type. /// </summary> /// <param name="path">File location</param> /// <param name="t">File type</param> public static IFileContainer GetContainer(string path, ContainerType t) { return(t switch { ContainerType.GARC => (IFileContainer) new GARC(path), ContainerType.Mini => MiniUtil.GetMini(path), ContainerType.SARC => new SARC(path), ContainerType.Folder => new FolderContainer(path), ContainerType.SingleFile => new SingleFileContainer(path), ContainerType.GFPack => new GFPack(path), _ => throw new ArgumentOutOfRangeException(nameof(t), t, null) });
/// <summary> /// Gets a <see cref="IFileContainer"/> for the stream within the <see cref="BinaryReader"/>. /// </summary> /// <param name="br">Reader for the binary data</param> public static IFileContainer GetContainer(BinaryReader br) { IFileContainer container; if ((container = GARC.GetGARC(br)) != null) { return(container); } if ((container = MiniUtil.GetMini(br)) != null) { return(container); } if ((container = SARC.GetSARC(br)) != null) { return(container); } return(null); }
/// <summary> /// Gets a new <see cref="IFileContainer"/> for the provided <see cref="path"/> and type. /// </summary> /// <param name="path">File location</param> /// <param name="t">File type</param> public static IFileContainer GetContainer(string path, ContainerType t) { switch (t) { case ContainerType.GARC: return(new GARC(path)); case ContainerType.Mini: return(MiniUtil.GetMini(path)); case ContainerType.SARC: return(new SARC(path)); case ContainerType.Folder: return(new FolderContainer(path)); case ContainerType.SingleFile: return(new SingleFileContainer(path)); case ContainerType.GFPack: return(new GFPack(path)); default: throw new ArgumentOutOfRangeException(nameof(t), t, null); } }