Exemplo n.º 1
0
        private void btnSelect_Click(object sender, EventArgs e)
        {
            rtbInfo.Text = "";
            bool flag = openFileDialogeFunc();

            if (flag)
            {
                fileIsSelected = true;
                foreach (string file in ofdApk.FileNames)
                {
                    apkSelected         = ofdApk.FileName;
                    apkSelectedFileName = ofdApk.SafeFileName;
                    var readApk = new Apk_Reader();

                    file_info          = readApk.Get_File_Info(file);
                    panel1.Visible     = true;
                    lblAppInfo.Visible = true;
                    lblAppInfo.Text    = "APK Name: " + file_info.apkName + "\n" + "APK Version: " + file_info.versionName + "\n";
                }

                /*string[] apkSelected2 = ofdApk.FileNames;
                 * int i = 0;
                 * foreach (string str in apkSelected2)
                 * {
                 *  i++;
                 *  long lengthApk = new System.IO.FileInfo(str).Length;
                 *  string retSize = humanReadableConvert(lengthApk);
                 *  rtbInfo.Text = rtbInfo.Text + "\nSuccesful Select[" + i + "]" + ":\n" +
                 *      "\t>> Apk Path: " + str + "\n" +
                 *      "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
                 * }*/
            }
        }
Exemplo n.º 2
0
        private void btnRename_Click(object sender, EventArgs e)
        {
            if (!fileIsSelected)
            {
                rtbInfo.Text = "";
                rtbInfo.Text = "Please Select a Apk File First";
            }
            else
            {
                rtbInfo.Text = "";
                int i = 0;
                foreach (string file in ofdApk.FileNames)
                {
                    apkSelected         = ofdApk.FileNames[i];
                    apkSelectedFileName = ofdApk.SafeFileNames[i];
                    i += 1;
                    var readApk2 = new Apk_Reader();

                    file_info2 = readApk2.Get_File_Info(file);

                    if (apkSelectedFileName != file_info2.apkName + " " + file_info2.versionName + ".apk")
                    {
                        string tempStr = Path.GetDirectoryName(apkSelected);

                        if (File.Exists(tempStr + "\\" + file_info2.apkName + " " + file_info2.versionName + ".apk"))
                        {
                            rtbInfo.Text = "A File With This Apk Name Exist IN Your Computer, Please Rename That File And Try Agian.";
                            rtbInfo.Text = rtbInfo.Text + "\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
                        }
                        else
                        {
                            if (!File.Exists(apkSelected))
                            {
                                rtbInfo.Text = "You Already Changed The Apk Name.";
                                rtbInfo.Text = rtbInfo.Text + "\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
                            }
                            else
                            {
                                FileSystem.RenameFile(apkSelected, file_info2.apkName + " " + file_info2.versionName + ".apk");
                                string apkPathPrint = Path.GetDirectoryName(apkSelected);
                                rtbInfo.Text = rtbInfo.Text + "\n" + "Successful:";
                                rtbInfo.Text = rtbInfo.Text + "\n\t>> Apk Path: " + apkPathPrint + "\\" + file_info2.apkName + " " + file_info2.versionName + ".apk";
                                rtbInfo.Text = rtbInfo.Text + "\n\t>> APK Renamed From \"" + apkSelectedFileName + "\" To \"" + file_info2.apkName + " " + file_info2.versionName + ".apk\"";

                                long   length = new System.IO.FileInfo(tempStr + "\\" + file_info2.apkName + " " + file_info2.versionName + ".apk").Length;
                                string ffSize = humanReadableConvert(length);
                                rtbInfo.Text = rtbInfo.Text + "\n\t>> APK Size: " + ffSize + "\n"; //length.ToString() + " Bytes\n";
                                rtbInfo.Text = rtbInfo.Text + "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
                            }
                        }
                    }
                    else
                    {
                        rtbInfo.Text = rtbInfo.Text + "\n" + apkSelectedFileName + " >> The Original APK File Name IS The Same AS The Previous One, No Need TO Change The APK Name.";
                        rtbInfo.Text = rtbInfo.Text + "\n- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ";
                    }
                }
            }
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Starting Apk Reader ...");

            string RunningPath = AppDomain.CurrentDomain.BaseDirectory;
            string FileName    = string.Format("{0}Resources\\cpu-z-1-26.apk", Path.GetFullPath(Path.Combine(RunningPath, @"..\..\")));

            Console.WriteLine("Test Apk File Path: " + FileName);

            var read = new Apk_Reader();

            Console.WriteLine("File Size: " + read.showFileSize(FileName));
            ApkInfo file_info = read.Get_File_Info(FileName);

            Console.WriteLine("apkName: " + file_info.apkName);
            Console.WriteLine("versionName: " + file_info.versionName);
            Console.WriteLine("packageName: " + file_info.packageName);
            Console.WriteLine("sdkVersion: " + file_info.sdkVersion);
            Console.WriteLine("targetSdkVersion: " + file_info.targetSdkVersion);
            Console.WriteLine("versionCode: " + file_info.versionCode);
            Console.WriteLine("nativeCode: " + file_info.nativeCode);

            Console.ReadKey();
        }