public DeliverOptions FindVersion(DeliverOptions opts) { if (string.IsNullOrEmpty(opts.appVersion)) { return(opts); } try { if (string.IsNullOrEmpty(opts.ipa)) { opts.appVersion = IpaFileAnalyser.FetchAppVersion(opts.ipa); } else if (string.IsNullOrEmpty(opts.pkg)) { opts.appVersion = PkgFileAnalyser.FetchAppVersion(opts.pkg); } return(opts); } catch (Exception ex) { Console.WriteLine($"{ex.Message}\n{ex.StackTrace}"); Console.WriteLine("Could not infer your app's version"); return(null); } }
public DeliverOptions FindAppIdentifier(DeliverOptions opts) { try { if (string.IsNullOrEmpty(opts.appIdentifier)) { return(opts); } string identifier = ""; if (string.IsNullOrEmpty(opts.ipa)) { identifier = IpaFileAnalyser.FetchAppIdentifier(opts.ipa); } else if (string.IsNullOrEmpty(opts.pkg)) { identifier = PkgFileAnalyser.FindAppIdentifier(opts.pkg); } if (identifier.Length > 0) { opts.appIdentifier = identifier; } Console.Write("The Bundle Identifier of your App: "); StringBuilder sb = new StringBuilder(); while (true) { ConsoleKeyInfo cki = Console.ReadKey(true); if (cki.Key == ConsoleKey.Enter) { Console.WriteLine(); break; } if (cki.Key == ConsoleKey.Backspace) { //Prevent an exception when you hit backspace with no characters on the array. if (sb.Length > 0) { sb.Remove(sb.Length - 1, 1); Console.Write("\b \b"); } } sb.Append(cki.KeyChar); } opts.appIdentifier = sb.ToString(); return(opts); } catch (Exception ex) { Console.WriteLine(ex.Message); Console.WriteLine("Could not infer your App's Bundle Identifier"); return(null); } }