Example #1
0
        static void Unpack(string[] args)
        {
            // -type unpack
            // -file d:\1.exe
            string file = CommandLineParser.GetArgumentValue(args, "file", "");

            try
            {
                Console.WriteLine("正在解包...");
                var storage = new XmPackagingStorage();
                var info    = storage.UnPack(file);
                if (info.Files.Count == 0)
                {
                    Console.WriteLine("没有封装任何文件");
                }
                else
                {
                    string dir = Path.GetDirectoryName(info.Files[0].OuputFilePath);
                    CommonUtil.OpenInExplorer(dir);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("解包失败," + ex);
            }
        }
Example #2
0
        static void Pack(string[] args, string outputFile)
        {
            PackagingInfo p           = new PackagingInfo();
            string        addFile     = CommandLineParser.GetArgumentValue(args, "addfile", "");
            string        addFileName = Path.GetFileName(addFile);

            p.Files = new List <AddFileInfo>();
            p.Files.Add(new AddFileInfo(addFile, "%Root Folder%\\" + addFileName));
            p.Operations = new List <ExecuteOperationInfo>();
            for (int i = 0; i < 10; i++)
            {
                string opeFile = CommandLineParser.GetArgumentValue(args, "opefile" + (i + 1), null);
                string opeArg  = CommandLineParser.GetArgumentValue(args, "opearg" + (i + 1), "");
                if (opeFile == null)
                {
                    break;
                }
                p.Operations.Add(new ExecuteOperationInfo(opeFile, opeArg));
            }
            p.Option = new OptionInfo();
            p.Option.IsCompressFile      = CommandLineParser.GetArgumentValue(args, "compress", "true").ToLower() == "true";
            p.Option.IsCreateRandomBytes =
                CommandLineParser.GetArgumentValue(args, "genrandombytes", "true").ToLower() == "true";
            p.Option.RandomBytes = CommandLineParser.GetArgumentValue(args, "randombytes", "").ToHexArray();
            var storage = new XmPackagingStorage();

            storage.Pack(p, outputFile);
        }
Example #3
0
 static void Main(string[] args)
 {
     try
     {
         var packaging = new XmPackagingStorage();
         var output    = PathUtil.GetEntryFilePath();
         packaging.UnPackAndExecute(output);
     }
     catch (Exception ex)
     {
         Environment.Exit(-1);
     }
 }