1. gacutil /if E:\ThirdParty\RockyLib\Rocky\bin\Release\Rocky.dll
  2. gacutil /u Rocky
  1. partial class GmailForm
  2. {
  3. /// <summary>
  4. /// Required designer variable.
  5. /// </summary>
  6. private System.ComponentModel.IContainer components = null;
  7.  
  8. /// <summary>
  9. /// Clean up any resources being used.
  10. /// </summary>
  11. /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
  12. protected override void Dispose(bool disposing)
  13. {
  14. if (disposing && (components != null))
  15. {
  16. components.Dispose();
  17. }
  18. base.Dispose(disposing);
  19. }
  20.  
  21. #region Windows Form Designer generated code
  22.  
  23. /// <summary>
  24. /// Required method for Designer support - do not modify
  25. /// the contents of this method with the code editor.
  26. /// </summary>
  27. private void InitializeComponent()
  28. {
  29. this.groupBox1 = new System.Windows.Forms.GroupBox();
  30. this.button3 = new System.Windows.Forms.Button();
  31. this.txtPwd = new System.Windows.Forms.TextBox();
  32. this.button2 = new System.Windows.Forms.Button();
  33. this.button1 = new System.Windows.Forms.Button();
  34. this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
  35. this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
  36. this.groupBox2 = new System.Windows.Forms.GroupBox();
  37. this.button6 = new System.Windows.Forms.Button();
  38. this.button5 = new System.Windows.Forms.Button();
  39. this.button4 = new System.Windows.Forms.Button();
  40. this.txtKey = new System.Windows.Forms.TextBox();
  41. this.groupBox1.SuspendLayout();
  42. this.groupBox2.SuspendLayout();
  43. this.SuspendLayout();
  44. //
  45. // groupBox1
  46. //
  47. this.groupBox1.Controls.Add(this.button3);
  48. this.groupBox1.Controls.Add(this.txtPwd);
  49. this.groupBox1.Controls.Add(this.button2);
  50. this.groupBox1.Controls.Add(this.button1);
  51. this.groupBox1.Location = new System.Drawing.Point(, );
  52. this.groupBox1.Name = "groupBox1";
  53. this.groupBox1.Size = new System.Drawing.Size(, );
  54. this.groupBox1.TabIndex = ;
  55. this.groupBox1.TabStop = false;
  56. this.groupBox1.Text = "Encrypt";
  57. //
  58. // button3
  59. //
  60. this.button3.Location = new System.Drawing.Point(, );
  61. this.button3.Name = "button3";
  62. this.button3.Size = new System.Drawing.Size(, );
  63. this.button3.TabIndex = ;
  64. this.button3.Text = "Send";
  65. this.button3.UseVisualStyleBackColor = true;
  66. this.button3.Click += new System.EventHandler(this.button3_Click);
  67. //
  68. // txtPwd
  69. //
  70. this.txtPwd.Location = new System.Drawing.Point(, );
  71. this.txtPwd.Name = "txtPwd";
  72. this.txtPwd.PasswordChar = '囧';
  73. this.txtPwd.Size = new System.Drawing.Size(, );
  74. this.txtPwd.TabIndex = ;
  75. //
  76. // button2
  77. //
  78. this.button2.Location = new System.Drawing.Point(, );
  79. this.button2.Name = "button2";
  80. this.button2.Size = new System.Drawing.Size(, );
  81. this.button2.TabIndex = ;
  82. this.button2.Text = "EncryptOutFilePath";
  83. this.button2.UseVisualStyleBackColor = true;
  84. this.button2.Click += new System.EventHandler(this.button2_Click);
  85. //
  86. // button1
  87. //
  88. this.button1.Location = new System.Drawing.Point(, );
  89. this.button1.Name = "button1";
  90. this.button1.Size = new System.Drawing.Size(, );
  91. this.button1.TabIndex = ;
  92. this.button1.Text = "EncryptInFilePath ";
  93. this.button1.UseVisualStyleBackColor = true;
  94. this.button1.Click += new System.EventHandler(this.button1_Click);
  95. //
  96. // openFileDialog1
  97. //
  98. this.openFileDialog1.FileName = "openFileDialog1";
  99. //
  100. // groupBox2
  101. //
  102. this.groupBox2.Controls.Add(this.button6);
  103. this.groupBox2.Controls.Add(this.button5);
  104. this.groupBox2.Controls.Add(this.button4);
  105. this.groupBox2.Controls.Add(this.txtKey);
  106. this.groupBox2.Location = new System.Drawing.Point(, );
  107. this.groupBox2.Name = "groupBox2";
  108. this.groupBox2.Size = new System.Drawing.Size(, );
  109. this.groupBox2.TabIndex = ;
  110. this.groupBox2.TabStop = false;
  111. this.groupBox2.Text = "Decrypt";
  112. //
  113. // button6
  114. //
  115. this.button6.Location = new System.Drawing.Point(, );
  116. this.button6.Name = "button6";
  117. this.button6.Size = new System.Drawing.Size(, );
  118. this.button6.TabIndex = ;
  119. this.button6.Text = "Decrypt";
  120. this.button6.UseVisualStyleBackColor = true;
  121. this.button6.Click += new System.EventHandler(this.button6_Click);
  122. //
  123. // button5
  124. //
  125. this.button5.Location = new System.Drawing.Point(, );
  126. this.button5.Name = "button5";
  127. this.button5.Size = new System.Drawing.Size(, );
  128. this.button5.TabIndex = ;
  129. this.button5.Text = "DecryptOutFilePath";
  130. this.button5.UseVisualStyleBackColor = true;
  131. this.button5.Click += new System.EventHandler(this.button5_Click);
  132. //
  133. // button4
  134. //
  135. this.button4.Location = new System.Drawing.Point(, );
  136. this.button4.Name = "button4";
  137. this.button4.Size = new System.Drawing.Size(, );
  138. this.button4.TabIndex = ;
  139. this.button4.Text = "DecryptInFilePath ";
  140. this.button4.UseVisualStyleBackColor = true;
  141. this.button4.Click += new System.EventHandler(this.button4_Click);
  142. //
  143. // txtKey
  144. //
  145. this.txtKey.Location = new System.Drawing.Point(, );
  146. this.txtKey.Name = "txtKey";
  147. this.txtKey.Size = new System.Drawing.Size(, );
  148. this.txtKey.TabIndex = ;
  149. //
  150. // GmailForm
  151. //
  152. this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
  153. this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
  154. this.ClientSize = new System.Drawing.Size(, );
  155. this.Controls.Add(this.groupBox2);
  156. this.Controls.Add(this.groupBox1);
  157. this.Name = "GmailForm";
  158. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  159. this.Text = "GmailHepler";
  160. this.groupBox1.ResumeLayout(false);
  161. this.groupBox1.PerformLayout();
  162. this.groupBox2.ResumeLayout(false);
  163. this.groupBox2.PerformLayout();
  164. this.ResumeLayout(false);
  165.  
  166. }
  167.  
  168. #endregion
  169.  
  170. private System.Windows.Forms.GroupBox groupBox1;
  171. private System.Windows.Forms.Button button1;
  172. private System.Windows.Forms.Button button2;
  173. private System.Windows.Forms.Button button3;
  174. private System.Windows.Forms.OpenFileDialog openFileDialog1;
  175. private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1;
  176. private System.Windows.Forms.TextBox txtPwd;
  177. private System.Windows.Forms.GroupBox groupBox2;
  178. private System.Windows.Forms.TextBox txtKey;
  179. private System.Windows.Forms.Button button4;
  180. private System.Windows.Forms.Button button6;
  181. private System.Windows.Forms.Button button5;
  182.  
  183. }

GmailForm.Designer.cs

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Windows.Forms;
  10. using System.Net;
  11.  
  12. namespace Rocky.App
  13. {
  14. public partial class GmailForm : Form
  15. {
  16. long splitLength = 1024L * 1024L * 20L;
  17.  
  18. public GmailForm()
  19. {
  20. InitializeComponent();
  21. }
  22.  
  23. private void button1_Click(object sender, EventArgs e)
  24. {
  25. openFileDialog1.ShowDialog();
  26. }
  27.  
  28. private void button2_Click(object sender, EventArgs e)
  29. {
  30. folderBrowserDialog1.ShowDialog();
  31. }
  32.  
  33. private void button3_Click(object sender, EventArgs e)
  34. {
  35. string inFilePath = openFileDialog1.FileName, outFolderPath = folderBrowserDialog1.SelectedPath;
  36. if (!string.IsNullOrEmpty(txtPwd.Text) && !string.IsNullOrEmpty(inFilePath) && !string.IsNullOrEmpty(outFolderPath))
  37. {
  38. string fileName = Path.GetFileName(inFilePath);
  39. string encryptInFilePath = inFilePath,
  40. encryptOutFilePath = Path.Combine(outFolderPath, fileName);
  41. CryptoManaged c = new CryptoManaged(string.Empty);
  42. c.EncryptFile(encryptInFilePath, encryptOutFilePath, splitLength, SplitFileMode.InputFileLength);
  43. var gmail = new MailClient();
  44. gmail.Config(MailClient.SystemMail.Gmail, txtPwd.Text);
  45. //gmail.Priority = System.Net.Mail.MailPriority.High;
  46. gmail.SetBody("Key 4 EncryptLib.", c.Key + "," + c.IV, Directory.GetFiles(outFolderPath, fileName + "_Part*.temp"));
  47. gmail.AddTo("ilovehaley.kid@gmail.com", string.Empty);
  48. try
  49. {
  50. txtPwd.ReadOnly = false;
  51. gmail.Send();
  52. }
  53. catch (Exception ex)
  54. {
  55. MessageBox.Show(ex.Message);
  56. }
  57. finally
  58. {
  59. txtPwd.ReadOnly = true;
  60. Console.WriteLine("SendCompleted.");
  61. }
  62. }
  63. }
  64.  
  65. private void button4_Click(object sender, EventArgs e)
  66. {
  67. openFileDialog1.ShowDialog();
  68. }
  69.  
  70. private void button5_Click(object sender, EventArgs e)
  71. {
  72. folderBrowserDialog1.ShowDialog();
  73. }
  74.  
  75. private void button6_Click(object sender, EventArgs e)
  76. {
  77. string inFilePath = openFileDialog1.FileName, outFolderPath = folderBrowserDialog1.SelectedPath;
  78. if (!string.IsNullOrEmpty(txtKey.Text) && !string.IsNullOrEmpty(inFilePath) && !string.IsNullOrEmpty(outFolderPath))
  79. {
  80. string temp = Path.GetFileNameWithoutExtension(inFilePath);
  81. temp = temp.Remove(temp.IndexOf("_"));
  82. string fileName = temp + Path.GetExtension(inFilePath);
  83. string[] keys = txtKey.Text.Split(',');
  84. CryptoManaged c = new CryptoManaged(keys[], keys[]);
  85. string decryptOutFilePath = Path.Combine(outFolderPath, "D_" + fileName);
  86. c.DecryptFile(Path.GetDirectoryName(inFilePath) + fileName, decryptOutFilePath, splitLength, SplitFileMode.InputFileLength);
  87. }
  88. }
  89. }
  90. }

GmailForm

Lib New的更多相关文章

  1. 新手,Visual Studio 2015 配置Boost库,如何编译和选择,遇到无法打开文件“libboost_thread-vc140-mt-gd-1_63.lib“的解决办法

    1,到官网下载最新的boost,www.boost.org 这里我下载的1-63版本. 2,安装,解压后运行bootstrap.bat文件.稍等一小会就OK. 3,编译boost库.注意一定要使用VS ...

  2. ubuntu 常见错误--Could not get lock /var/lib/dpkg/lock

    ubuntu 常见错误--Could not get lock /var/lib/dpkg/lock 通过终端安装程序sudo apt-get install xxx时出错:E: Could not ...

  3. OSG3.40 编译时,无法打开输入文件“optimized.lib”

    解决方案: 正常情况下,下图中会多出一项:ZLIB_LIBRARY_RELEASE,之后屡次编译,都提示"无法打开输入文件"optimized.lib"" 因为 ...

  4. Eclipse部署Maven web项目到tomcat服务器时,没有将lib下的jar复制过去的解决办法

    我们在做web开发是,经常都要在eclipse中搭建web服务器,并将开发中的web项目部署到web服务器进行调试,在此,我选择的是tomcat服务器.之前部署web项目到tomcat进行启动调试都很 ...

  5. 解决VS2015安装后stdio.h ucrtd.lib等文件无法识别问题

    今天突然想在windows上装个 VS2015 玩玩,结果遇到了如下bug:安装完 VS2015 后,直接新建项目->win32控制台->运行,结果报错!"无法打开包括文件: & ...

  6. locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory

    # locate zabbix locate: can not open `/var/lib/mlocate/mlocate.db': No such file or directory locate ...

  7. 通过dll或def文件提取lib导入库文件

    很多时候第三方库或其他项目提供的库多数会以动态库的形式提供dll以及相应的lib导入库.头文件,不过也有的只是提供dll和头文件,或者也提供了def模块定义(用于导出函数)文件,此时若使用将不得不调用 ...

  8. make: *** [out/host/linux-x86/obj/EXECUTABLES/aidl_intermediates/aidl] 错误 1,make: *** [out/host/linux-x86/obj/lib/libESR_Portable.so] 错误 1

    错误3: g++: g++: selected multilib '32' not installed selected multilib '32' not installed make: *** [ ...

  9. ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

    有时候,当我们使用"mysql"."mysqladmin"."mysqldump"等命令管理数据库时,服务器抛出类似如下错误: 一.错误现场 ...

  10. 缺少.lib文件导致的Link2019 解决方案汇总

    环境Vs2015,  Win10 添加lib的方法在末尾 下面的错误都是我在写Direct3D程序中遇到的, 记下来方便查找 4.ws2_32.lib 3.   version.lib _GetFil ...

随机推荐

  1. hiho1096_divided_product

    题目 给出两个正整数N和M, N <= 100, M <= 50, 可以将N分解成若干个不相等的正整数A1, A2... Ak的和,且A1, A2 ... Ak的乘积为M的倍数.即 N = ...

  2. JSON和JSONP区别和联系

    由于Sencha Touch 2这种开发模式的特性,基本决定了它原生的数据交互行为几乎只能通过AJAX来实现. 当然了,通过调用强大的PhoneGap插件然后打包,你可以实现100%的Socket通讯 ...

  3. 深入理解PHP原理之变量分离/引用

    19 Sep 08 深入理解PHP原理之变量分离/引用(Variables Separation) 作者: Laruence(   ) 本文地址: http://www.laruence.com/20 ...

  4. [转] Android OkHttp完全解析 是时候来了解OkHttp了

    http://blog.csdn.net/lmj623565791/article/details/47911083: 本文出自:[张鸿洋的博客] 一.概述 最近在群里听到各种讨论okhttp的话题, ...

  5. Activity UI Handler ProgressBar AsyncTask

    package io.vov.vitamio.activity; import android.app.Activity; import android.app.ProgressDialog; imp ...

  6. SQL中SUBSTRING函数的用法

    功能:返回字符.二进制.文本或图像表达式的一部分 语法:SUBSTRING ( expression, start, length ) SQL 中的 substring 函数是用来抓出一个栏位资料中的 ...

  7. jsp 页面 jstl 日期的计算

    1. <% page import ="java.util.Date"%> 2. <% Date date = new Date(); date = new Da ...

  8. android AutoCompleteTextView和Spinner选中项加亮

    package com.example.spinnerexample; import java.util.ArrayList; import java.util.List; import androi ...

  9. Ubuntu下解决bash 没有那个文件或目录的方法

    因为之前电脑硬盘坏掉,维修换了新硬盘,今天重新安装了ubuntu,装好之后就赶紧搭建工作环境,将备份的资料拷贝进来,搭建交叉编译环境,但是发现,修改bashrc中PATH绝对路径指向交叉编译器后,在命 ...

  10. hdu 3635 Dragon Balls (带权并查集)

    Dragon Balls Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Tota ...