Base64 Converter
<Window x:Class="Base64Convertor.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="387" Width="629">
<Grid>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<GroupBox Grid.Row="0" Header="Input" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="groupBox1" VerticalAlignment="Stretch">
<TextBox Name="txtInput" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Yellow" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" />
</GroupBox>
<TabControl Grid.Row="1">
<TabItem Header="Encode" >
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Name="btnEncodeInputText" Content="From Input Text" Height="25" Margin="5" Click="btnEncodeInputText_Click" />
<Button Name="btnEncodeInputFile" Content="From Input File" Height="25" Margin="5" Click="btnEncodeInputFile_Click" />
<Button Name="btnCopyToClipboard" Content="Copy to Clipboard" Height="25" Margin="5" Click="btnCopyToClipboard_Click" />
</StackPanel>
</TabItem>
<TabItem Header="Decode">
<StackPanel Grid.Row="1" Orientation="Horizontal">
<Button Name="btnDecodeToOutput" Content="Decode to Output" Margin="5" Height="25" Click="btnDecodeToOutput_Click" />
<Button Name="btnDecodeToFile" Content="Decode to File" Height="25" Margin="5" Click="btnDecodeToFile_Click" />
</StackPanel>
</TabItem>
</TabControl>
<GroupBox Grid.Row="2" Header="Output" HorizontalAlignment="Stretch" Margin="0,0,0,0" Name="groupBox2" VerticalAlignment="Stretch">
<TextBox Name="txtOutput" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="Yellow" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" AcceptsReturn="True" />
</GroupBox>
</Grid>
</Window>
public
partial
class
MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private
void btnEncodeInputText_Click(object sender, RoutedEventArgs e)
{
txtOutput.Text = Convert.ToBase64String(Encoding.UTF8.GetBytes(txtInput.Text.Trim()));
}
private
void btnDecodeToOutput_Click(object sender, RoutedEventArgs e)
{
txtOutput.Text = Encoding.UTF8.GetString(Convert.FromBase64String(txtInput.Text.Trim()));
}
private
void btnEncodeInputFile_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog ofd = new
OpenFileDialog();
if (ofd.ShowDialog().Value == true)
{
var fileContent = File.ReadAllBytes(ofd.FileName);
txtOutput.Text = Convert.ToBase64String(fileContent);
MessageBox.Show("done!");
}
}
private
void btnCopyToClipboard_Click(object sender, RoutedEventArgs e)
{
Clipboard.SetText(txtOutput.Text);
}
private
void btnDecodeToFile_Click(object sender, RoutedEventArgs e)
{
SaveFileDialog sfd = new
SaveFileDialog();
if (sfd.ShowDialog().Value == true)
{
var fileContent = Convert.FromBase64String(txtInput.Text.Trim());
File.WriteAllBytes(sfd.FileName, fileContent);
MessageBox.Show("done!");
}
}
}
Base64 Converter的更多相关文章
- 加密代理和Retrofit解密Converter
最近在研究安卓的Retrofit框架,服务器的数据全部用加密算法加密了,发现无法使用"com.squareup.retrofit2:converter-gson:2.1.0"Jar ...
- Bugku一段base64
本文转自:本文为博主原创文章,如有转载请注明出处,谢谢. https://blog.csdn.net/pdsu161530247/article/details/74640746 链接中高手给出的解题 ...
- WPF converter(包含传递复杂参数)
单值转换器 将单一值转换为特定类型的值,以日期转换为例如下: 1.定制DateConverter类,其中当值从绑定源传播给绑定目标时,调用方法Convert. 1 public class DateC ...
- SSL Converter & Formats
https://www.sslshopper.com/ssl-converter.html PEM Format The PEM format is the most common format th ...
- coding++:js实现基于Base64的编码及解码
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- URL安全的Base64编码
Base64编码可用于在HTTP环境下传递较长的标识信息.在其他应用程序中,也常常需要把二进制数据编码为适合放在URL(包括隐藏表单域)中的形式.此时,采用Base64编码不仅比较简短,同时也具有不可 ...
- Base64编码
Base64编码 写在前面 今天在做一个Android app时遇到了一个问题:Android端采用ASE对称加密的数据在JavaWeb(jre1.8.0_7)后台解密时,居然解密失败了!经过测试后发 ...
- Android数据加密之Base64编码算法
前言: 前面学习总结了平时开发中遇见的各种数据加密方式,最终都会对加密后的二进制数据进行Base64编码,起到一种二次加密的效果,其实呢Base64从严格意义上来说的话不是一种加密算法,而是一种编码算 ...
- java单向加密算法小结(1)--Base64算法
从这一篇起整理一下常见的加密算法以及在java中使用的demo,首先从最简单的开始. 简单了解 Base64严格来说并不是一种加密算法,而是一种编码/解码的实现方式. 我们都知道,数据在计算机网络之间 ...
随机推荐
- ShineTime - 带有 CSS3 闪亮特效的缩略图相册
ShineTime 是一个效果非常精致的缩略图相册,鼠标悬停到缩略图的时候有很炫的闪光效果,基于 CSS3 实现,另外缩略图也会有立体移动的效果.特别适用于个人摄影作品,公司产品展示等用途,快来来围观 ...
- [转]Struts2数据传输的背后机制:ValueStack(值栈)
1. 数据传输背后机制:ValueStack(值栈) 在这一切的背后,是因为有了ValueStack(值栈)! 2. ValueStack基础:OGNL 要了解ValueStack,必须先理解OGNL ...
- 【Java基础】创建和销毁对象
Num1:考虑用静态工厂方法代替构造器 对于类而言,常见的方法是提供一个公有的构造器,但其实还有一种方法叫做静态工厂方法(static factory method),它只是一个返回类的实例静态方法. ...
- (翻译)编写属于你的jQuery插件
Writing Your Own jQuery Plugins 原文地址:http://blog.teamtreehouse.com/writing-your-own-jquery-plugins j ...
- SQL Server安全(2/11):身份验证(Authentication)
在保密你的服务器和数据,防备当前复杂的攻击,SQL Server有你需要的一切.但在你能有效使用这些安全功能前,你需要理解你面对的威胁和一些基本的安全概念.这篇文章提供了基础,因此你可以对SQL Se ...
- 基于HTML5的WebGL电信网管3D机房监控应用
先上段视频,不是在玩游戏哦,是规规矩矩的电信网管企业应用,嗯,全键盘的漫游3D机房: http://www.hightopo.com/guide/guide/core/3d/examples/exam ...
- 在Excel中使用频率最高的函数的功能和使用方法
在Excel中使用频率最高的函数的功能和使用方法,按字母排序: 1.ABS函数 函数名称:ABS 主要功能:求出相应数字的绝对值. 使用格式:ABS(number) 参数说明:number代表需要求绝 ...
- Android使用SAX解析XML(4)
util.java文件如下: package com.hzhi.my_sax; import java.io.IOException; import java.io.InputStream; impo ...
- maven安装与配置(第一天学习笔记)
Maven下载:http://maven.apache.org/ 1.首先要确保JDK已经安装与配置(注意:用的是apache-maven-3.3.3的JDK1.6不行,我用的是JDK1.8) 2.把 ...
- 详解 Spring 3.0 基于 Annotation 的依赖注入实现(转)
使用 @Repository.@Service.@Controller 和 @Component 将类标识为 Bean Spring 自 2.0 版本开始,陆续引入了一些注解用于简化 Spring 的 ...