private async void EncryptFileToBase64String_Clicked(object sender, EventArgs e) { FileData file = await CrossFilePicker.Current.PickFile(); if (file != null) { await Navigation.PushModalAsync(popup); await Task.Delay(5000); StringBuilder stb = new StringBuilder(file.FilePath); int postIndex = IndexOf(stb, file.FileName, 0, true); string folderPath = stb.Remove(postIndex, file.FilePath.Length - postIndex).ToString(); //convert android content Uri into physical path, normally happens in Android emulator folderPath = ConvertAndroidContentUriPath(folderPath); string encryptedStr = await XamEncDec.EncryptFileAsBase64String(false, false, folderPath, "", file.FileName, "myPassword"); //edt_encfiletostr.Text = encryptedStr; file.Dispose(); Output outp = new Output(); outp.OutputStr = encryptedStr; var OutputPage = new OutputText(); OutputPage.BindingContext = outp; await Navigation.PushAsync(OutputPage); await Navigation.PopModalAsync(); } }
private async void EncryptResFileToBase64String_Clicked(object sender, EventArgs e) { if (p_resfile1.SelectedIndex == -1) { await DisplayAlert("Error", "Please select resource file", "OK"); } else { await Navigation.PushModalAsync(popup); await Task.Delay(5000); string encryptedStr = await XamEncDec.EncryptResourceFileAsBase64String(assembly, GetResourceValue(p_resfile1.SelectedIndex), "myPassword"); if (encryptedStr != "") { //edt_encrestostr.Text = encryptedStr; Output outp = new Output(); outp.OutputStr = encryptedStr; var OutputPage = new OutputText(); OutputPage.BindingContext = outp; await Navigation.PushAsync(OutputPage); } else { await DisplayAlert("Error", "Resource file failed to encrypted", "OK"); } await Navigation.PopModalAsync(); } }