Exemplo n.º 1
0
        static void GetPackageData(string line, ApkData apk)
        {
            if (line.Contains("package:"))
            {
                var values = line.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                Debug.WriteLine(values);
                foreach (
                    var items in values.Select(value => value.Split(new[] { '\'', '=' }, StringSplitOptions.RemoveEmptyEntries))
                        .Where(items => items.Length > 1))
                {
                    if (items[0] == "name")
                    {
                        apk.Identifier = items[1];
                    }
                    else if (items[0] == "versionName")

                    {
                        apk.VersionName = items[1];
                    }
                }
            }
        }
Exemplo n.º 2
0
        static void InitiateBadgingProcess(string apkPath)
        {
            const string aaptPath = @"C:\Users\Prashant\AppData\Local\Android\sdk\build-tools\22.0.1\aapt.exe";
            var process = new Process
            {
                StartInfo =
                {
                    FileName = aaptPath,
                    Arguments = "dump badging " + apkPath,
                    UseShellExecute = false,
                    RedirectStandardOutput = true,
                    RedirectStandardError = true
                }
            };

            process.OutputDataReceived += ProcessOnOutputDataReceived;

            apk = new ApkData();

            Console.WriteLine("APK badging started!");
            StartProcess(process);

            process.Close();
            Console.WriteLine("Process completed");
            CleanBadgingProcess(process);
        }