void SelectIPA(IPAInfo info)
        {
            bool enable = false;

            if (null != info)
            {
                IPADisplayName.Text = info.BundleDisplayName;
                IPAName.Text        = info.BundleName;
                IPAPath.Text        = info.BundlePath;
                IPAIdentifier.Text  = info.BundleIdentifier;
                IPAVersion.Text     = info.BundleVersion;
                IPAMinOS.Text       = info.MinimumOSVersion;
                IPADate.Text        = info.BuildDate.ToString();
                IPAIcon.Image       = info.Icon72.Icon;

                Text = Title + " - " + info.BundleDisplayName;

                Settings.Default.IPAPath = info.BundlePath;
                Settings.Default.Save();

                enable = true;
            }
            else
            {
                IPADisplayName.Text = string.Empty;
                IPAName.Text        = string.Empty;
                IPAPath.Text        = string.Empty;
                IPAIdentifier.Text  = string.Empty;
                IPAVersion.Text     = string.Empty;
                IPAMinOS.Text       = string.Empty;
                IPADate.Text        = string.Empty;
                IPAIcon.Image       = null;

                Text = Title;

                Settings.Default.IPAPath = string.Empty;
                Settings.Default.Save();
            }

            if (IPAIcon.Image == null)
            {
                IPAIcon.Image = Resources.Icon;
            }

            if (null != Worker)
            {
                enable = false;
            }

            ControlInput(enable, true);

            Info = info;
        }
 private bool LoadIPA(string path)
 {
     try
     {
         IPAInfo info = IPAParser.Parse(path);
         SelectIPA(info);
         return(info != null);
     }
     catch (Exception ex)
     {
         MessageBoxEx.Show(this, ex.Message, Title, MessageBoxButtons.OK, MessageBoxIcon.Error);
         return(false);
     }
 }
        private void GenerateInstaller(IPAInfo info, string outputDir)
        {
            ControlInput(false, false);

            Worker = new BackgroundWorker();
            Worker.WorkerReportsProgress      = true;
            Worker.WorkerSupportsCancellation = false;
            Worker.DoWork             += new DoWorkEventHandler(Worker_DoWork);
            Worker.ProgressChanged    += new ProgressChangedEventHandler(Worker_ProgressChanged);
            Worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Worker_RunWorkerCompleted);
            //Worker.RunWorkerAsync(new string[] { source, destination });

            GenerateProgressBar.Value   = 0;
            GenerateProgressBar.Minimum = 0;
            GenerateProgressBar.Maximum = 100;
            GenerateProgressBar.Visible = true;

            IPAInstallerGenerator generator = new IPAInstallerGenerator(info, outputDir, GetHostUrl(), null,
                                                                        new IPAInstallerGenerator.CustomFileCopyHandler(Worker_Runner));

            generator.Run();
        }
        static void Main(string[] args)
        {
            List <string> ipaList        = new List <string>();
            string        outputDir      = string.Empty;
            string        baseUrl        = string.Empty;
            string        uuidServiceUrl = string.Empty;
            bool          infoOnly       = false;
            bool          skipCopy       = false;

            try
            {
                if (args.Length == 0)
                {
                    ShowHelp();
                    return;
                }

                for (int i = 0; i < args.Length; ++i)
                {
                    string arg = args[i];

                    if (arg.StartsWith("-"))
                    {
                        arg = arg.Substring(1);
                    }

                    if (arg == "help")
                    {
                        ShowHelp();
                        return;
                    }

                    try
                    {
                        switch (arg)
                        {
                        case "ipa": break;

                        case "outputDir": outputDir = args[++i]; break;

                        case "baseUrl": baseUrl = args[++i]; break;

                        case "uuidServiceUrl": uuidServiceUrl = args[++i]; break;

                        case "info": infoOnly = true; break;

                        case "skipCopy": skipCopy = true; break;

                        default:
                            if (File.Exists(arg) && Path.GetExtension(arg).Equals(".ipa", StringComparison.InvariantCultureIgnoreCase))
                            {
                                ipaList.Add(arg);
                            }
                            else
                            {
                                throw new ArgumentException(string.Format("unrecognized argument \"{0}\".", args[i]));
                            }
                            break;
                        }
                    }
                    catch (IndexOutOfRangeException)
                    {
                        throw new ArgumentException(string.Format("missing value for \"{0}\" argument.", arg));
                    }
                }
            }
            catch (ArgumentException e)
            {
                Console.WriteLine(TAG + ": " + e.Message);
                Console.WriteLine("Try " + TAG + " --help for more information.");
                Environment.Exit(-1);
            }


            List <IPAInfo> infoList = new List <IPAInfo>();

            try
            {
                foreach (var ipaPath in ipaList)
                {
                    Console.Write("Parsing IPA archive \"" + Path.GetFileName(ipaPath) + "\"...");
                    IPAInfo info = IPAParser.Parse(ipaPath);

                    Console.WriteLine(" Done!");
                    Console.WriteLine();
                    Console.WriteLine("  Bundle details");
                    Console.WriteLine("    Display Name:          " + info.BundleDisplayName);
                    Console.WriteLine("    Name:                  " + info.BundleName);
                    Console.WriteLine("    ID:                    " + info.BundleIdentifier);
                    Console.WriteLine("    Version:               " + info.BundleVersion);
                    Console.WriteLine("    Date:                  " + info.BuildDate.ToString(CultureInfo.InvariantCulture));
                    Console.WriteLine();
                    Console.WriteLine("  Restrictions");
                    Console.WriteLine("    Platform:              " + info.PlatformName);
                    Console.WriteLine("    Minimum OS version:    " + info.MinimumOSVersion);
                    Console.WriteLine("    Device:                " + info.DeviceFamily.ToString());
                    Console.WriteLine();
                    Console.WriteLine();

                    infoList.Add(info);
                }

                if (infoOnly)
                {
                    return;
                }

                Console.Write("Generating installer...");
                IPATools.IPAInstallerGenerator generator = new IPATools.IPAInstallerGenerator(
                    infoList.ToArray(), outputDir, baseUrl, uuidServiceUrl, null);
                generator.SkipCopying = skipCopy;
                generator.Run();
                Console.WriteLine(" Done!");
            }
            catch (Exception e)
            {
                Console.WriteLine();
                Console.WriteLine(TAG + ": " + e.Message);
                Environment.Exit(-1);
            }
        }