Exemple #1
0
        public static void AppUnpack(this ICakeContext context, FilePath inputPackage, DirectoryPath outputDirectory, AppPackagerSettings settings)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            var resolver = new AppPackagerResolver(context.FileSystem, context.Environment, context.Tools, context.Registry);
            var unPacker = new AppUnpacker(context.FileSystem, context.Environment, context.ProcessRunner, context.Tools, resolver);

            unPacker.Unpack(inputPackage, outputDirectory, settings);
        }
        private IEnumerator UnpackFile(byte[] data, ECompressionType compression = ECompressionType.LMZA)
        {
            Debug.Log("[BundleLoader] Commencing unpack...");

            using (new HighCpuLevelSection())
            {
                SetState(State.Unpacking);

                var unpacker = new AppUnpacker();

                try
                {
                    unpacker.UnpackAsync(data, compression);
                }
                catch (Exception e)
                {
                    Debug.Log("[BundleLoader]" + e);
                }

                if (IsFaulted)
                {
                    Debug.Log("[BundleLoader] Bundle is faulted.");
                    yield break;
                }

                yield return(new WaitUntil(() => unpacker.IsDone));

                if (unpacker.IsFaulted)
                {
                    Debug.LogError("[BundleLoader] Unpack failed");
                    Debug.LogException(unpacker.Exception);
                    Cancel();
                    yield break;
                }
                else
                {
                    Debug.Log("[BundleLoader] Unpack complete");
                    mAppPack = unpacker.Data;

                    /*
                     * if (mAppPack.ApplicationId != mExperience.Id)
                     * {
                     *  var message = string.Format("[BundleLoader] Bundle Application Id {0} did not match Experience Id {1}", mAppPack.ApplicationId, mExperience.Id);
                     *  FaultWithException(new BundleFileException(mExperience, message));
                     *  Cancel();
                     *  yield break;
                     * }
                     */
                }
            }
        }
        protected override void RunTool()
        {
            var tool = new AppUnpacker(FileSystem, Environment, ProcessRunner, Tools, Resolver);

            tool.Unpack(InputPackage, OutputDirectory, Settings);
        }