Пример #1
0
        public void EraFile_ExpandTest()
        {
            bool result = false;

            string input_path = kEraExpanderInputFile;

            Console.WriteLine("Reading from: {0}", input_path);

            using (var expander = new EraFileExpander(input_path))
            {
                expander.Options         = kEraUtilTestOptions;
                expander.ExpanderOptions = kEraExpanderTestOptions;
                expander.ProgressOutput  = Console.Out;
                expander.VerboseOutput   = Console.Out;

                result = expander.Read();
                Assert.IsTrue(result, "Read failed");

                result = expander.ExpandTo(kEraExpanderOutputDir, kEraExpanderFileName);
                Assert.IsTrue(result, "Expansion failed: " + kEraExpanderOutputDir);
            }
        }
Пример #2
0
        public void EraFile_ExpandAndBuildTest()
        {
            const string k_input_era =
                kEraCryptInputDir
                + kEraExpanderFileName
                + EraFileUtil.kExtensionEncrypted
            ;
            string       k_listing_path = System.IO.Path.Combine(kEraExpanderOutputDir, kEraExpanderFileName);
            const string k_rebuilt_name = kEraCryptTestFileName + "_rebuilt";
            const string k_rebuilt_era  =
                kEraCryptInputDir
                + k_rebuilt_name
                + EraFileUtil.kExtensionEncrypted
            ;

            bool result = false;

            #region Expand
            var expand = false;
            if (expand)
            {
                using (var expander = new EraFileExpander(k_input_era))
                {
                    expander.Options         = kEraUtilTestOptions;
                    expander.ExpanderOptions = kEraExpanderTestOptions
                                               //.Set(EraFileExpanderOptions.DontTranslateXmbFiles)
                                               .Set(EraFileExpanderOptions.Decrypt);
                    expander.ProgressOutput = Console.Out;
                    expander.VerboseOutput  = Console.Out;

                    result = expander.Read();
                    Assert.IsTrue(result, "Read failed");

                    result = expander.ExpandTo(kEraExpanderOutputDir, kEraExpanderFileName);
                    Assert.IsTrue(result, "Expansion failed");
                }
            }
            #endregion
            #region Build
            using (var builder = new EraFileBuilder(k_listing_path))
            {
                builder.Options        = kEraUtilTestOptions;
                builder.BuilderOptions = kEraBuilderTestOptions
                                         .Set(EraFileBuilderOptions.Encrypt);
                builder.ProgressOutput = Console.Out;
                builder.VerboseOutput  = Console.Out;

                result = builder.Read();
                Assert.IsTrue(result, "Read listing failed");

                result = builder.Build(kEraExpanderOutputDir, k_rebuilt_name, kEraBuilderOutputDir);
                Assert.IsTrue(result, "Build failed");
            }
            #endregion
            #region Verify
            using (var expander = new EraFileExpander(k_rebuilt_era))
            {
                expander.Options         = kEraUtilTestOptions;
                expander.ExpanderOptions = kEraExpanderTestOptions
                                           .Set(EraFileExpanderOptions.DontTranslateXmbFiles)
                                           .Set(EraFileExpanderOptions.Decrypt);
                expander.ProgressOutput = Console.Out;
                expander.VerboseOutput  = Console.Out;

                result = expander.Read();
                Assert.IsTrue(result, "Re-Read failed");

                //result = expander.ExpandTo(kTestResultsPath + @"assets2\", k_rebuilt_name);
                //Assert.IsTrue(result, "Re-Expansion failed");
            }
            #endregion
        }