This commit is contained in:
j4587698 2017-02-05 15:30:23 +08:00
commit 2f9aff990f
36 changed files with 4896 additions and 0 deletions

63
.gitattributes vendored Normal file
View File

@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain

189
.gitignore vendored Normal file
View File

@ -0,0 +1,189 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
x64/
build/
bld/
[Bb]in/
[Oo]bj/
# Roslyn cache directories
*.ide/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
#NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding addin-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
_NCrunch_*
.*crunch*.local.xml
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
## TODO: Comment the next line if you want to checkin your
## web deploy settings but do note that will include unencrypted
## passwords
#*.pubxml
# NuGet Packages Directory
packages/*
## TODO: If the tool you use requires repositories.config
## uncomment the next line
#!packages/repositories.config
# Enable "build/" folder in the NuGet Packages folder since
# NuGet packages use it for MSBuild targets.
# This line needs to be after the ignore of the build folder
# (and the packages folder if the line above has been uncommented)
!packages/build/
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.pfx
*.publishsettings
node_modules/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# LightSwitch generated files
GeneratedArtifacts/
_Pvt_Extensions/
ModelManifest.xml

22
AutoPackage.sln Normal file
View File

@ -0,0 +1,22 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AutoPackage", "AutoPekage\AutoPackage.csproj", "{2BFA2AB8-A979-4C70-B1E7-5FCA3DEFFD46}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{2BFA2AB8-A979-4C70-B1E7-5FCA3DEFFD46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{2BFA2AB8-A979-4C70-B1E7-5FCA3DEFFD46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2BFA2AB8-A979-4C70-B1E7-5FCA3DEFFD46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2BFA2AB8-A979-4C70-B1E7-5FCA3DEFFD46}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{2BFA2AB8-A979-4C70-B1E7-5FCA3DEFFD46}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AutoPackage</RootNamespace>
<AssemblyName>AutoPackage</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<NuGetPackageImportStamp>13a4b414</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Folder_Zip_128px_1163283_easyicon.net.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="LiteDB">
<HintPath>..\packages\LiteDB.2.0.4\lib\net35\LiteDB.dll</HintPath>
</Reference>
<Reference Include="SharpCompress, Version=0.14.1.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
<HintPath>..\packages\SharpCompress.0.14.1\lib\net40\SharpCompress.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="frmAddSender.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmAddSender.Designer.cs">
<DependentUpon>frmAddSender.cs</DependentUpon>
</Compile>
<Compile Include="Form1.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Form1.Designer.cs">
<DependentUpon>Form1.cs</DependentUpon>
</Compile>
<Compile Include="frmPackage.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmPackage.Designer.cs">
<DependentUpon>frmPackage.cs</DependentUpon>
</Compile>
<Compile Include="frmSettings.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmSettings.Designer.cs">
<DependentUpon>frmSettings.cs</DependentUpon>
</Compile>
<Compile Include="frmStmpServer.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="frmStmpServer.Designer.cs">
<DependentUpon>frmStmpServer.cs</DependentUpon>
</Compile>
<Compile Include="GetFileIcon.cs" />
<Compile Include="LiteDbHelper.cs" />
<Compile Include="MailToDao.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SenderDao.cs" />
<Compile Include="SettingsDao.cs" />
<Compile Include="StmpServerDao.cs" />
<Compile Include="ZipControl.cs" />
<EmbeddedResource Include="frmAddSender.resx">
<DependentUpon>frmAddSender.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Form1.resx">
<DependentUpon>Form1.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmPackage.resx">
<DependentUpon>frmPackage.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmSettings.resx">
<DependentUpon>frmSettings.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="frmStmpServer.resx">
<DependentUpon>frmStmpServer.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
</ItemGroup>
<ItemGroup>
<Content Include="FodyWeavers.xml" />
<Content Include="Folder_Zip_128px_1163283_easyicon.net.ico" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="..\packages\Fody.1.28.3\build\Fody.targets" Condition="Exists('..\packages\Fody.1.28.3\build\Fody.targets')" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>这台计算机上缺少此项目引用的 NuGet 程序包。启用“NuGet 程序包还原”可下载这些程序包。有关详细信息,请参阅 http://go.microsoft.com/fwlink/?LinkID=322105。缺少的文件是 {0}。</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\packages\Fody.1.28.3\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.1.28.3\build\Fody.targets'))" />
</Target>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<Costura/>
</Weavers>

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

169
AutoPekage/Form1.Designer.cs generated Normal file
View File

@ -0,0 +1,169 @@
namespace AutoPekage
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
this.lvFileList = new System.Windows.Forms.ListView();
this.cmsFileContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ilFileList = new System.Windows.Forms.ImageList(this.components);
this.btnStart = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.btnSettings = new System.Windows.Forms.Button();
this.cmsFileContextMenu.SuspendLayout();
this.SuspendLayout();
//
// lvFileList
//
this.lvFileList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvFileList.ContextMenuStrip = this.cmsFileContextMenu;
this.lvFileList.LargeImageList = this.ilFileList;
this.lvFileList.Location = new System.Drawing.Point(0, 1);
this.lvFileList.Name = "lvFileList";
this.lvFileList.Size = new System.Drawing.Size(452, 328);
this.lvFileList.TabIndex = 0;
this.lvFileList.UseCompatibleStateImageBehavior = false;
this.lvFileList.ItemCheck += new System.Windows.Forms.ItemCheckEventHandler(this.lvFileList_ItemCheck);
this.lvFileList.DoubleClick += new System.EventHandler(this.lvFileList_DoubleClick);
//
// cmsFileContextMenu
//
this.cmsFileContextMenu.ImageScalingSize = new System.Drawing.Size(20, 20);
this.cmsFileContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ToolStripMenuItem,
this.ToolStripMenuItem,
this.ToolStripMenuItem});
this.cmsFileContextMenu.Name = "cmsFileContextMenu";
this.cmsFileContextMenu.Size = new System.Drawing.Size(149, 70);
this.cmsFileContextMenu.Opening += new System.ComponentModel.CancelEventHandler(this.cmsFileContextMenu_Opening);
//
// 打开文件ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "打开文件ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(148, 22);
this.ToolStripMenuItem.Text = "打开文件";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 移除文件ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "移除文件ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(148, 22);
this.ToolStripMenuItem.Text = "移除文件";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// 打开所在目录ToolStripMenuItem
//
this.ToolStripMenuItem.Name = "打开所在目录ToolStripMenuItem";
this.ToolStripMenuItem.Size = new System.Drawing.Size(148, 22);
this.ToolStripMenuItem.Text = "打开所在目录";
this.ToolStripMenuItem.Click += new System.EventHandler(this.ToolStripMenuItem_Click);
//
// ilFileList
//
this.ilFileList.ColorDepth = System.Windows.Forms.ColorDepth.Depth32Bit;
this.ilFileList.ImageSize = new System.Drawing.Size(48, 48);
this.ilFileList.TransparentColor = System.Drawing.Color.Transparent;
//
// btnStart
//
this.btnStart.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.btnStart.Location = new System.Drawing.Point(41, 347);
this.btnStart.Name = "btnStart";
this.btnStart.Size = new System.Drawing.Size(75, 23);
this.btnStart.TabIndex = 2;
this.btnStart.Text = "开始打包";
this.btnStart.UseVisualStyleBackColor = true;
this.btnStart.Click += new System.EventHandler(this.btnStart_Click);
//
// btnExit
//
this.btnExit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnExit.Location = new System.Drawing.Point(321, 347);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(75, 23);
this.btnExit.TabIndex = 3;
this.btnExit.Text = "退出";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// btnSettings
//
this.btnSettings.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
this.btnSettings.Location = new System.Drawing.Point(183, 347);
this.btnSettings.Name = "btnSettings";
this.btnSettings.Size = new System.Drawing.Size(75, 23);
this.btnSettings.TabIndex = 4;
this.btnSettings.Text = "设置";
this.btnSettings.UseVisualStyleBackColor = true;
this.btnSettings.Click += new System.EventHandler(this.btnSettings_Click);
//
// Form1
//
this.AllowDrop = true;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(452, 382);
this.Controls.Add(this.btnSettings);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.btnStart);
this.Controls.Add(this.lvFileList);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.KeyPreview = true;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "文件修改打包";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
this.Load += new System.EventHandler(this.Form1_Load);
this.DragDrop += new System.Windows.Forms.DragEventHandler(this.Form1_DragDrop);
this.DragEnter += new System.Windows.Forms.DragEventHandler(this.Form1_DragEnter);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.Form1_KeyDown);
this.cmsFileContextMenu.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.ListView lvFileList;
private System.Windows.Forms.ImageList ilFileList;
private System.Windows.Forms.ContextMenuStrip cmsFileContextMenu;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.Button btnStart;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.Button btnSettings;
}
}

270
AutoPekage/Form1.cs Normal file
View File

@ -0,0 +1,270 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Text;
using System.Windows.Forms;
using System.Linq;
namespace AutoPekage
{
public partial class Form1 : Form
{
public static string tempPath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), Path.Combine("AutoPackage", "tempfile"));
//Dictionary<string, int>
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
var dao = LiteDbHelper.Settings;
if (Directory.Exists(tempPath) &&
((dao.AskAutoLoadFile && MessageBox.Show("发现临时目录存在文件,是否自动加载内容?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) ||
(!dao.AskAutoLoadFile && dao.AutoLoadFile == 1)))
{
var files = Directory.GetFiles(tempPath);
foreach (var file in files)
{
AddNewFile(file);
}
}
}
private void Form1_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
{
e.Effect = DragDropEffects.Link;
}
else
{
e.Effect = DragDropEffects.None;
}
}
private void Form1_DragDrop(object sender, DragEventArgs e)
{
var dropList = (System.Array)e.Data.GetData(DataFormats.FileDrop);
foreach (var item in dropList)
{
string filePath = item.ToString();
AddDropFile(filePath);
}
}
private void AddDropFile(string filePath)
{
FileInfo fi = new FileInfo(filePath);
if (fi.Attributes == FileAttributes.Directory)
{
var files = Directory.EnumerateFiles(filePath, "*", SearchOption.AllDirectories);
foreach (var file in files)
{
AddDropFile(file);
}
return;
}
string extension = Path.GetExtension(filePath);
if (extension.ToLower() == ".zip" || extension.ToLower() == ".rar" || extension.ToLower() == ".7z" || extension.ToLower() == ".gzip" || extension.ToLower() == ".tar")
{
ZipControl.NewFileDecompress += AddNewFile;
//ZipControl.UnZip(filePath, "");
ZipControl.FileWillDecompress += ZipControl_FileWillDecompress;
ZipControl.UnCompress(filePath, tempPath);
ZipControl.FileWillDecompress -= ZipControl_FileWillDecompress;
ZipControl.NewFileDecompress -= AddNewFile;
}
else
{
var itemlist = lvFileList.Items.Cast<ListViewItem>().Where(x => Path.GetFileName(x.Tag as string) == Path.GetFileName(filePath));
if (itemlist.Count() > 0)
{
if (itemlist.First().Tag as string == filePath)
{
return;
}
else
{
if (MessageBox.Show(Path.GetFileName(filePath) + "已存在并且与目前列表中文件不同,是否替换?"
, "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
AddNewFile(filePath);
}
}
}
else
{
AddNewFile(filePath);
}
}
}
private void AddNewFile(string filePath)
{
var itemlist = lvFileList.Items.Cast<ListViewItem>().Where(x => Path.GetFileName(x.Tag as string) == Path.GetFileName(filePath));
if (itemlist.Count() > 0)
{
itemlist.First().Tag = filePath;
}
else
{
ilFileList.Images.Add(GetIcon.GetFileIcon(filePath));
string filename = Path.GetFileName(filePath);
var item = new ListViewItem(filename);
item.ImageIndex = ilFileList.Images.Count - 1;
item.Tag = filePath;
lvFileList.Items.Add(item);
}
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
var dao = LiteDbHelper.Settings;
if (Directory.Exists(tempPath) &&
((dao.AskAutoDeleteFile && MessageBox.Show("发现临时目录存在文件,是否删除?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)||
(!dao.AskAutoDeleteFile && dao.AutoDeleteFile == 1)))
{
Directory.Delete(tempPath, true);
}
}
private void cmsFileContextMenu_Opening(object sender, CancelEventArgs e)
{
bool showMenu = false;
//要判断是否点击项,控件里至少要有一个项
if (this.lvFileList.Items.Count > 0)
{
Point point = this.lvFileList.PointToClient(MousePosition);
ListViewHitTestInfo hitTest = this.lvFileList.HitTest(point);
if ( hitTest.Item != null)
{//点击的不是列且不是空白区域
showMenu = true;
}
}
e.Cancel = !showMenu;
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in lvFileList.SelectedItems)
{
Process.Start(item.Tag as string);
}
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in lvFileList.SelectedItems)
{
lvFileList.Items.Remove(item);
}
}
private void ToolStripMenuItem_Click(object sender, EventArgs e)
{
foreach (ListViewItem item in lvFileList.SelectedItems)
{
Process.Start("Explorer.exe", Path.GetDirectoryName(item.Tag as string));
}
}
private void lvFileList_ItemCheck(object sender, ItemCheckEventArgs e)
{
}
private void lvFileList_DoubleClick(object sender, EventArgs e)
{
//要判断是否点击项,控件里至少要有一个项
if (this.lvFileList.Items.Count > 0)
{
Point point = this.lvFileList.PointToClient(MousePosition);
ListViewHitTestInfo hitTest = this.lvFileList.HitTest(point);
if (hitTest.Item != null)
{//点击的不是列且不是空白区域
Process.Start(lvFileList.SelectedItems[0].Tag as string);
}
}
}
private void btnStart_Click(object sender, EventArgs e)
{
if (lvFileList.Items.Count == 0)
{
MessageBox.Show("打包前至少应该有一个文件", "自动打包", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
frmPackage package = new frmPackage(lvFileList.Items.Cast<ListViewItem>().Select(x => x.Tag as string).ToList());
package.ShowDialog();
}
bool ZipControl_FileWillDecompress(string filePath)
{
if (lvFileList.Items.Cast<ListViewItem>().Where(x => Path.GetFileName(x.Tag as string) == Path.GetFileName(filePath)).Count() > 0)
{
if (MessageBox.Show(Path.GetFileName(filePath) + "已存在在列表中,是否覆盖?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
return true;
}
else
{
return false;
}
}
return true;
}
private void btnExit_Click(object sender, EventArgs e)
{
Close();
}
private void btnSettings_Click(object sender, EventArgs e)
{
new frmSettings().ShowDialog();
}
private void Form1_KeyDown(object sender, KeyEventArgs e)
{
//要判断是否点击项,控件里至少要有一个项
if (this.lvFileList.SelectedItems.Count > 0)
{
if(e.Shift && e.KeyCode == Keys.Delete)
{
if (MessageBox.Show("确实要同时删除此文件吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
foreach (ListViewItem item in lvFileList.SelectedItems)
{
File.Delete(item.Tag as string);
lvFileList.Items.Remove(item);
}
}
}
else if (e.KeyCode == Keys.Delete)
{
foreach (ListViewItem item in lvFileList.SelectedItems)
{
lvFileList.Items.Remove(item);
}
}
}
}
}
}

1259
AutoPekage/Form1.resx Normal file

File diff suppressed because it is too large Load Diff

69
AutoPekage/GetFileIcon.cs Normal file
View File

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Runtime.InteropServices;
using System.Text;
namespace AutoPekage
{
class GetIcon
{
[StructLayout(LayoutKind.Sequential)]
public struct SHFILEINFO
{
public IntPtr hIcon;
public IntPtr iIcon;
public uint dwAttributes;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 260)]
public string szDisplayName;
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 80)]
public string szTypeName;
}
/// <summary>
/// 返回系统设置的图标
/// </summary>
/// <param name="pszPath">文件路径 如果为"" 返回文件夹的</param>
/// <param name="dwFileAttributes">0</param>
/// <param name="psfi">结构体</param>
/// <param name="cbSizeFileInfo">结构体大小</param>
/// <param name="uFlags">枚举类型</param>
/// <returns>-1失败</returns>
[DllImport("shell32.dll")]
public static extern IntPtr SHGetFileInfo(string pszPath, uint dwFileAttributes, ref SHFILEINFO psfi, uint cbSizeFileInfo, uint uFlags);
public enum SHGFI
{
SHGFI_ICON = 0x100,
SHGFI_LARGEICON = 0x0,
SHGFI_USEFILEATTRIBUTES = 0x10
}
/// <summary>
/// 获取文件图标 zgke@sina.com qq:116149
/// </summary>
/// <param name="p_Path">文件全路径</param>
/// <returns>图标</returns>
public static Icon GetFileIcon(string p_Path)
{
SHFILEINFO _SHFILEINFO = new SHFILEINFO();
IntPtr _IconIntPtr = SHGetFileInfo(p_Path, 0, ref _SHFILEINFO, (uint)Marshal.SizeOf(_SHFILEINFO), (uint)(SHGFI.SHGFI_ICON | SHGFI.SHGFI_LARGEICON | SHGFI.SHGFI_USEFILEATTRIBUTES));
if (_IconIntPtr.Equals(IntPtr.Zero)) return null;
Icon _Icon = System.Drawing.Icon.FromHandle(_SHFILEINFO.hIcon);
return _Icon;
}
/// <summary>
/// 获取文件夹图标 zgke@sina.com qq:116149
/// </summary>
/// <returns>图标</returns>
public static Icon GetDirectoryIcon()
{
SHFILEINFO _SHFILEINFO = new SHFILEINFO();
IntPtr _IconIntPtr = SHGetFileInfo(@"", 0, ref _SHFILEINFO, (uint)Marshal.SizeOf(_SHFILEINFO), (uint)(SHGFI.SHGFI_ICON | SHGFI.SHGFI_LARGEICON));
if (_IconIntPtr.Equals(IntPtr.Zero)) return null;
Icon _Icon = System.Drawing.Icon.FromHandle(_SHFILEINFO.hIcon);
return _Icon;
}
}
}

180
AutoPekage/LiteDbHelper.cs Normal file
View File

@ -0,0 +1,180 @@
using LiteDB;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
namespace AutoPekage
{
class LiteDbHelper
{
private static string liteDbPath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "AutoPackage", "sittings.db");
public static void init()
{
if (!File.Exists(liteDbPath))
{
Directory.CreateDirectory(Path.GetDirectoryName(liteDbPath));
AddStmpServer("qq", "smtp.qq.com");
CreateDefaultSettings();
}
}
public static SettingsDao CreateDefaultSettings()
{
SettingsDao dao = new SettingsDao();
dao.AskAutoDeleteFile = true;
dao.AskAutoLoadFile = true;
dao.AutoDeleteFile = 0;
dao.AutoLoadFile = 0;
dao.DefaultFileName = "我的打包文件.zip";
dao.LastPath = null;
dao.SendMail = false;
dao.TitleModel = 0;
Settings = dao;
return dao;
}
public static void AddStmpServer(string serverName, string stmp)
{
var dao = new StmpServerDao();
dao.ServerName = serverName;
dao.Stmp = stmp;
AddStmpServer(dao);
}
public static void AddStmpServer(StmpServerDao dao)
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<StmpServerDao>("stmpservers");
col.Insert(dao);
}
}
public static List<StmpServerDao> GetAllStmpServer()
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<StmpServerDao>("stmpservers");
return col.FindAll().ToList();
}
}
public static void AddSender(string name)
{
var dao = new SenderDao();
dao.Name = name;
AddSender(dao);
}
public static void AddSender(string name, string username, string password, string nikename, string stmpServer)
{
var dao = new SenderDao();
dao.Name = name;
dao.NickName = nikename;
dao.Password = password;
dao.StmpServer = stmpServer;
dao.UserName = username;
AddSender(dao);
}
public static void AddSender(SenderDao dao)
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<SenderDao>("senders");
if (dao.Id == 0)
{
col.Insert(dao);
}
else
{
col.Update(dao);
}
}
}
public static void DelSender(SenderDao dao)
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<SenderDao>("senders");
col.Delete(dao.Id);
}
}
public static List<SenderDao> GetAllSender()
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<SenderDao>("senders");
return col.FindAll().ToList();
}
}
public static SenderDao GetSenderById(int id)
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<SenderDao>("senders");
return col.FindById(id);
}
}
public static void AddMailTo(string mailto)
{
var mailToDao = new MailToDao();
mailToDao.MailTo = mailto;
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<MailToDao>("mailto");
col.Insert(mailToDao);
}
}
public static List<MailToDao> GetAllMailTo()
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<MailToDao>("mailto");
return col.FindAll().ToList();
}
}
public static SettingsDao Settings
{
get
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<SettingsDao>("settings");
var dao = col.FindOne(Query.All());
if (dao == null)
{
dao = CreateDefaultSettings();
}
return dao;
}
}
set
{
using (var db = new LiteDatabase(liteDbPath))
{
var col = db.GetCollection<SettingsDao>("settings");
if (col.Count() > 0)
{
col.Update(value);
}
else
{
col.Insert(value);
}
}
}
}
}
}

12
AutoPekage/MailToDao.cs Normal file
View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AutoPekage
{
public class MailToDao
{
public string MailTo { get; set; }
}
}

21
AutoPekage/Program.cs Normal file
View File

@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace AutoPekage
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
LiteDbHelper.init();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}

View File

@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// 有关程序集的常规信息通过以下
// 特性集控制。更改这些特性值可修改
// 与程序集关联的信息。
[assembly: AssemblyTitle("自动打包发邮件")]
[assembly: AssemblyDescription("一个可以自动解压压缩包,并打包发邮件的程序")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("JX")]
[assembly: AssemblyProduct("AutoPackage")]
[assembly: AssemblyCopyright("Copyright © 2016")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// 将 ComVisible 设置为 false 使此程序集中的类型
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
// 则将该类型上的 ComVisible 特性设置为 true。
[assembly: ComVisible(false)]
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
[assembly: Guid("7d8db1ae-da15-4a37-bb28-5377390b520c")]
// 程序集的版本信息由下面四个值组成:
//
// 主版本
// 次版本
// 生成号
// 修订号
//
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

View File

@ -0,0 +1,63 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AutoPackage.Properties {
using System;
/// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存的 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("AutoPackage.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 使用此强类型资源类,为所有资源查找
/// 重写当前线程的 CurrentUICulture 属性。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
}
}

View File

@ -0,0 +1,117 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace AutoPackage.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "12.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default {
get {
return defaultInstance;
}
}
}
}

View File

@ -0,0 +1,7 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>

22
AutoPekage/SenderDao.cs Normal file
View File

@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AutoPekage
{
public class SenderDao
{
public int Id { get; set; }
public string Name { get; set; }
public string StmpServer { get; set; }
public string UserName { get; set; }
public string Password { get; set; }
public string NickName { get; set; }
}
}

64
AutoPekage/SettingsDao.cs Normal file
View File

@ -0,0 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AutoPekage
{
public class SettingsDao
{
public int Id { get; set; }
/// <summary>
/// 默认打包文件名
/// </summary>
public string DefaultFileName { get; set; }
/// <summary>
/// 最后一次打包路径
/// </summary>
public string LastPath { get; set; }
/// <summary>
/// 是否勾选发送邮件
/// </summary>
public bool SendMail { get; set; }
/// <summary>
/// 是否询问自动加载temp目录的文件
/// </summary>
public bool AskAutoLoadFile { get; set; }
/// <summary>
/// 是否自动加载temp目录文件
/// 1加载文件
/// 0不加载文件
/// </summary>
public int AutoLoadFile { get; set; }
/// <summary>
/// 询问是否自动删除temp目录文件
/// </summary>
public bool AskAutoDeleteFile { get; set; }
/// <summary>
/// 是否自动删除temp目录文件
/// 1删除文件
/// 0不删除文件
/// </summary>
public int AutoDeleteFile { get; set; }
/// <summary>
/// 邮件标题模式
/// 1自定义标题
/// 0使用文件名作为标题
/// </summary>
public int TitleModel { get; set; }
/// <summary>
/// 邮件标题
/// </summary>
public string Title { get; set; }
}
}

View File

@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace AutoPekage
{
public class StmpServerDao
{
public string ServerName { get; set; }
public string Stmp { get; set; }
}
}

202
AutoPekage/ZipControl.cs Normal file
View File

@ -0,0 +1,202 @@
using SharpCompress.Archives;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using System.Linq;
using SharpCompress.Readers;
using SharpCompress.Writers;
using SharpCompress.Common;
namespace AutoPekage
{
class ZipControl
{
public delegate void NewFileDecompressHandle(string filePath);
public static event NewFileDecompressHandle NewFileDecompress;
public delegate bool FileWillDecompressHandle(string filePath);
public static event FileWillDecompressHandle FileWillDecompress;
/// <summary>
/// ZIP:解压一个zip文件
/// add yuangang by 2016-06-13
/// </summary>
/// <param name="ZipFile">需要解压的Zip文件绝对路径</param>
/// <param name="Password">解压密码</param>
/// <param name="OverWrite">是否覆盖已存在的文件</param>
public static void UnZip(string ZipFile, string Password, bool OverWrite = true)
{
//如果解压到的目录不存在,则报错
//if (!System.IO.Directory.Exists(Form1.tempPath))
//{
// Directory.CreateDirectory(Form1.tempPath);
//}
//using (ZipInputStream zipfiles = new ZipInputStream(File.OpenRead(ZipFile)))
//{
// zipfiles.Password = Password;
// ZipEntry theEntry;
// while ((theEntry = zipfiles.GetNextEntry()) != null)
// {
// string pathToZip = "";
// pathToZip = theEntry.Name;
// string fileName = Path.GetFileName(pathToZip);
// if (fileName != "")
// {
// string filePath = Path.Combine(Form1.tempPath, fileName);
// if ((File.Exists(Form1.tempPath + fileName) && OverWrite) || (!File.Exists(filePath)))
// {
// using (FileStream streamWriter = File.Create(filePath))
// {
// int size = 2048;
// byte[] data = new byte[2048];
// while (true)
// {
// size = zipfiles.Read(data, 0, data.Length);
// if (size > 0)
// streamWriter.Write(data, 0, size);
// else
// break;
// }
// streamWriter.Close();
// }
// if (NewFileDecompress != null)
// {
// NewFileDecompress(filePath);
// }
// }
// }
// }
// zipfiles.Close();
//}
}
/// <summary>
/// 压缩文件
/// </summary>
/// <param name="zipPath">压缩文件路径</param>
/// <param name="fileList">文件列表</param>
public static void Zip(string zipPath, List<string> fileList)
{
//ZipOutputStream zipStream = null;
//FileStream streamWriter = null;
//try
//{
// //Use Crc32
// Crc32 crc32 = new Crc32();
// //Create Zip File
// zipStream = new ZipOutputStream(File.Create(zipPath));
// //Specify Level
// zipStream.SetLevel(9);
// //Foreach File
// foreach (string file in fileList)
// {
// //Check Whether the file exists
// if (!File.Exists(file))
// {
// throw new FileNotFoundException(file);
// }
// //Read the file to stream
// streamWriter = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
// byte[] buffer = new byte[streamWriter.Length];
// streamWriter.Read(buffer, 0, buffer.Length);
// streamWriter.Close();
// //Specify ZipEntry
// crc32.Reset();
// crc32.Update(buffer);
// ZipEntry zipEntry = new ZipEntry(Path.GetFileName(file));
// zipEntry.DateTime = DateTime.Now;
// zipEntry.Size = buffer.Length;
// zipEntry.Crc = crc32.Value;
// //Put file info into zip stream
// zipStream.PutNextEntry(zipEntry);
// //Put file data into zip stream
// zipStream.Write(buffer, 0, buffer.Length);
// }
//}
//catch
//{
// throw;
//}
//finally
//{
// //Clear Resource
// if (streamWriter != null)
// {
// streamWriter.Close();
// }
// if (zipStream != null)
// {
// zipStream.Finish();
// zipStream.Close();
// }
//}
using (Stream stream = File.OpenWrite(zipPath))
{
using (var writer = WriterFactory.Open(stream, ArchiveType.Zip, new WriterOptions(CompressionType.Deflate)
{
LeaveStreamOpen = true
}))
{
foreach (var file in fileList)
{
writer.Write(Path.GetFileName(file), file);
}
}
if (!stream.CanWrite)
{
throw new InvalidOperationException();
}
}
}
public static void UnCompress(string ZipFile, string unCompressPath, bool OverWrite = true)
{
if (!Directory.Exists(unCompressPath))
{
Directory.CreateDirectory(unCompressPath);
}
using (Stream stream = File.OpenRead(ZipFile))
using (var archive = ArchiveFactory.Open(stream))
{
SharpCompress.Common.ArchiveEncoding.Default = Encoding.Default;
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
{
if (FileWillDecompress != null)
{
if (!FileWillDecompress(entry.Key))
{
continue;
}
}
entry.WriteToDirectory(unCompressPath, new ExtractionOptions()
{
Overwrite = true
});
if (NewFileDecompress != null)
{
NewFileDecompress(Path.Combine(unCompressPath, Path.GetFileName(entry.Key)));
}
}
}
}
}
}

3
AutoPekage/app.config Normal file
View File

@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>

259
AutoPekage/frmAddSender.Designer.cs generated Normal file
View File

@ -0,0 +1,259 @@
namespace AutoPekage
{
partial class frmAddSender
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.cbStmpAll = new System.Windows.Forms.ComboBox();
this.txtMailAddr = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.txtPassword = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.cbShowPwd = new System.Windows.Forms.CheckBox();
this.txtNickName = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.btnModify = new System.Windows.Forms.Button();
this.btnAddStmpServer = new System.Windows.Forms.Button();
this.btnCencel = new System.Windows.Forms.Button();
this.lbSender = new System.Windows.Forms.ListBox();
this.txtName = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.btnAd = new System.Windows.Forms.Button();
this.btnDel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(130, 41);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(77, 12);
this.label1.TabIndex = 0;
this.label1.Text = "发信服务器:";
//
// cbStmpAll
//
this.cbStmpAll.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbStmpAll.FormattingEnabled = true;
this.cbStmpAll.Location = new System.Drawing.Point(213, 38);
this.cbStmpAll.Name = "cbStmpAll";
this.cbStmpAll.Size = new System.Drawing.Size(146, 20);
this.cbStmpAll.TabIndex = 1;
this.cbStmpAll.SelectedIndexChanged += new System.EventHandler(this.cbStmpAll_SelectedIndexChanged);
//
// txtMailAddr
//
this.txtMailAddr.Location = new System.Drawing.Point(213, 91);
this.txtMailAddr.Name = "txtMailAddr";
this.txtMailAddr.Size = new System.Drawing.Size(146, 21);
this.txtMailAddr.TabIndex = 5;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(130, 94);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 4;
this.label3.Text = "邮箱地址:";
//
// txtPassword
//
this.txtPassword.Location = new System.Drawing.Point(213, 145);
this.txtPassword.Name = "txtPassword";
this.txtPassword.PasswordChar = '*';
this.txtPassword.Size = new System.Drawing.Size(146, 21);
this.txtPassword.TabIndex = 7;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(130, 148);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 6;
this.label4.Text = "密钥:";
//
// cbShowPwd
//
this.cbShowPwd.AutoSize = true;
this.cbShowPwd.Location = new System.Drawing.Point(287, 172);
this.cbShowPwd.Name = "cbShowPwd";
this.cbShowPwd.Size = new System.Drawing.Size(72, 16);
this.cbShowPwd.TabIndex = 8;
this.cbShowPwd.Text = "显示密钥";
this.cbShowPwd.UseVisualStyleBackColor = true;
this.cbShowPwd.CheckedChanged += new System.EventHandler(this.cbShowPwd_CheckedChanged);
//
// txtNickName
//
this.txtNickName.Location = new System.Drawing.Point(213, 118);
this.txtNickName.Name = "txtNickName";
this.txtNickName.Size = new System.Drawing.Size(146, 21);
this.txtNickName.TabIndex = 6;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(130, 121);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(41, 12);
this.label5.TabIndex = 9;
this.label5.Text = "昵称:";
//
// btnModify
//
this.btnModify.Location = new System.Drawing.Point(179, 201);
this.btnModify.Name = "btnModify";
this.btnModify.Size = new System.Drawing.Size(75, 23);
this.btnModify.TabIndex = 11;
this.btnModify.Text = "修改";
this.btnModify.UseVisualStyleBackColor = true;
this.btnModify.Click += new System.EventHandler(this.btnAdd_Click);
//
// btnAddStmpServer
//
this.btnAddStmpServer.Location = new System.Drawing.Point(250, 64);
this.btnAddStmpServer.Name = "btnAddStmpServer";
this.btnAddStmpServer.Size = new System.Drawing.Size(109, 23);
this.btnAddStmpServer.TabIndex = 14;
this.btnAddStmpServer.Text = "添加发信服务器";
this.btnAddStmpServer.UseVisualStyleBackColor = true;
this.btnAddStmpServer.Click += new System.EventHandler(this.btnAddStmpServer_Click);
//
// btnCencel
//
this.btnCencel.Location = new System.Drawing.Point(269, 201);
this.btnCencel.Name = "btnCencel";
this.btnCencel.Size = new System.Drawing.Size(75, 23);
this.btnCencel.TabIndex = 13;
this.btnCencel.Text = "关闭";
this.btnCencel.UseVisualStyleBackColor = true;
this.btnCencel.Click += new System.EventHandler(this.btnCencel_Click);
//
// lbSender
//
this.lbSender.FormattingEnabled = true;
this.lbSender.HorizontalScrollbar = true;
this.lbSender.ItemHeight = 12;
this.lbSender.Location = new System.Drawing.Point(4, 10);
this.lbSender.Name = "lbSender";
this.lbSender.Size = new System.Drawing.Size(120, 184);
this.lbSender.TabIndex = 15;
this.lbSender.SelectedIndexChanged += new System.EventHandler(this.lbSender_SelectedIndexChanged);
//
// txtName
//
this.txtName.Location = new System.Drawing.Point(213, 10);
this.txtName.Name = "txtName";
this.txtName.Size = new System.Drawing.Size(146, 21);
this.txtName.TabIndex = 17;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(130, 13);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(41, 12);
this.label2.TabIndex = 16;
this.label2.Text = "名称:";
//
// btnAd
//
this.btnAd.Location = new System.Drawing.Point(23, 201);
this.btnAd.Name = "btnAd";
this.btnAd.Size = new System.Drawing.Size(31, 23);
this.btnAd.TabIndex = 18;
this.btnAd.Text = "+";
this.btnAd.UseVisualStyleBackColor = true;
this.btnAd.Click += new System.EventHandler(this.btnAd_Click);
//
// btnDel
//
this.btnDel.Location = new System.Drawing.Point(71, 201);
this.btnDel.Name = "btnDel";
this.btnDel.Size = new System.Drawing.Size(31, 23);
this.btnDel.TabIndex = 19;
this.btnDel.Text = "-";
this.btnDel.UseVisualStyleBackColor = true;
this.btnDel.Click += new System.EventHandler(this.btnDel_Click);
//
// frmAddSender
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(367, 233);
this.Controls.Add(this.btnDel);
this.Controls.Add(this.btnAd);
this.Controls.Add(this.txtName);
this.Controls.Add(this.label2);
this.Controls.Add(this.lbSender);
this.Controls.Add(this.btnCencel);
this.Controls.Add(this.btnAddStmpServer);
this.Controls.Add(this.btnModify);
this.Controls.Add(this.txtNickName);
this.Controls.Add(this.label5);
this.Controls.Add(this.cbShowPwd);
this.Controls.Add(this.txtPassword);
this.Controls.Add(this.label4);
this.Controls.Add(this.txtMailAddr);
this.Controls.Add(this.label3);
this.Controls.Add(this.cbStmpAll);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmAddSender";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "配置发件人";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.ComboBox cbStmpAll;
private System.Windows.Forms.TextBox txtMailAddr;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox txtPassword;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.CheckBox cbShowPwd;
private System.Windows.Forms.TextBox txtNickName;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Button btnModify;
private System.Windows.Forms.Button btnAddStmpServer;
private System.Windows.Forms.Button btnCencel;
private System.Windows.Forms.ListBox lbSender;
private System.Windows.Forms.TextBox txtName;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnAd;
private System.Windows.Forms.Button btnDel;
}
}

103
AutoPekage/frmAddSender.cs Normal file
View File

@ -0,0 +1,103 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AutoPekage
{
public partial class frmAddSender : Form
{
public frmAddSender()
{
InitializeComponent();
cbStmpAll.DataSource = LiteDbHelper.GetAllStmpServer();
cbStmpAll.DisplayMember = "ServerName";
cbStmpAll.ValueMember = "Stmp";
lbSender.DataSource = LiteDbHelper.GetAllSender();
lbSender.DisplayMember = "Name";
//lbSender.ValueMember = "Id";
if (lbSender.SelectedIndex == -1)
{
btnModify.Enabled = false;
}
}
private void cbStmpAll_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void btnAddStmpServer_Click(object sender, EventArgs e)
{
if (new frmStmpServer().ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
cbStmpAll.DataSource = LiteDbHelper.GetAllStmpServer();
}
}
private void cbShowPwd_CheckedChanged(object sender, EventArgs e)
{
if (cbShowPwd.Checked)
{
txtPassword.PasswordChar = '\0';
}
else
{
txtPassword.PasswordChar = '*';
}
}
private void btnAdd_Click(object sender, EventArgs e)
{
//LiteDbHelper.AddSender(txtName.Text, txtMailAddr.Text, txtPassword.Text, txtNickName.Text, cbStmpAll.SelectedValue.ToString());
var mailSender = lbSender.SelectedValue as SenderDao;
mailSender.Name = txtName.Text;
mailSender.UserName = txtMailAddr.Text;
mailSender.NickName = txtNickName.Text;
mailSender.Password = txtPassword.Text;
mailSender.StmpServer = cbStmpAll.SelectedValue.ToString();
LiteDbHelper.AddSender(mailSender);
lbSender.DataSource = LiteDbHelper.GetAllSender();
}
private void btnCencel_Click(object sender, EventArgs e)
{
Close();
}
private void btnAd_Click(object sender, EventArgs e)
{
LiteDbHelper.AddSender("新建发件人");
lbSender.DataSource = LiteDbHelper.GetAllSender();
btnModify.Enabled = true;
}
private void lbSender_SelectedIndexChanged(object sender, EventArgs e)
{
var mailSender = lbSender.SelectedValue as SenderDao;
txtName.Text = mailSender.Name;
txtMailAddr.Text = mailSender.UserName;
txtNickName.Text = mailSender.NickName;
txtPassword.Text = mailSender.Password;
if (mailSender.StmpServer != null)
{
cbStmpAll.SelectedValue = mailSender.StmpServer;
}
}
private void btnDel_Click(object sender, EventArgs e)
{
LiteDbHelper.DelSender(lbSender.SelectedValue as SenderDao);
lbSender.DataSource = LiteDbHelper.GetAllSender();
if (lbSender.SelectedIndex == -1)
{
btnModify.Enabled = false;
}
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

288
AutoPekage/frmPackage.Designer.cs generated Normal file
View File

@ -0,0 +1,288 @@
namespace AutoPekage
{
partial class frmPackage
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.rbDesktop = new System.Windows.Forms.RadioButton();
this.rbCustom = new System.Windows.Forms.RadioButton();
this.label1 = new System.Windows.Forms.Label();
this.txtPackagePath = new System.Windows.Forms.TextBox();
this.btnSelectPath = new System.Windows.Forms.Button();
this.sfdPackagePath = new System.Windows.Forms.SaveFileDialog();
this.btnOK = new System.Windows.Forms.Button();
this.btnExit = new System.Windows.Forms.Button();
this.gbMail = new System.Windows.Forms.GroupBox();
this.txtContext = new System.Windows.Forms.TextBox();
this.label5 = new System.Windows.Forms.Label();
this.txtCaption = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.cbMailTo = new System.Windows.Forms.ComboBox();
this.btnAddSender = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.cbSender = new System.Windows.Forms.ComboBox();
this.cbSendMail = new System.Windows.Forms.CheckBox();
this.gbMail.SuspendLayout();
this.SuspendLayout();
//
// rbDesktop
//
this.rbDesktop.AutoSize = true;
this.rbDesktop.Checked = true;
this.rbDesktop.Location = new System.Drawing.Point(9, 13);
this.rbDesktop.Name = "rbDesktop";
this.rbDesktop.Size = new System.Drawing.Size(83, 16);
this.rbDesktop.TabIndex = 0;
this.rbDesktop.TabStop = true;
this.rbDesktop.Text = "打包到桌面";
this.rbDesktop.UseVisualStyleBackColor = true;
this.rbDesktop.CheckedChanged += new System.EventHandler(this.rbDesktop_CheckedChanged);
//
// rbCustom
//
this.rbCustom.AutoSize = true;
this.rbCustom.Location = new System.Drawing.Point(139, 13);
this.rbCustom.Name = "rbCustom";
this.rbCustom.Size = new System.Drawing.Size(107, 16);
this.rbCustom.TabIndex = 1;
this.rbCustom.Text = "打包到指定路径";
this.rbCustom.UseVisualStyleBackColor = true;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 40);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(41, 12);
this.label1.TabIndex = 2;
this.label1.Text = "路径:";
//
// txtPackagePath
//
this.txtPackagePath.Enabled = false;
this.txtPackagePath.Location = new System.Drawing.Point(56, 37);
this.txtPackagePath.Name = "txtPackagePath";
this.txtPackagePath.ReadOnly = true;
this.txtPackagePath.Size = new System.Drawing.Size(311, 21);
this.txtPackagePath.TabIndex = 3;
this.txtPackagePath.TextChanged += new System.EventHandler(this.txtPackagePath_TextChanged);
this.txtPackagePath.DoubleClick += new System.EventHandler(this.txtPackagePath_DoubleClick);
//
// btnSelectPath
//
this.btnSelectPath.Enabled = false;
this.btnSelectPath.Location = new System.Drawing.Point(374, 37);
this.btnSelectPath.Name = "btnSelectPath";
this.btnSelectPath.Size = new System.Drawing.Size(40, 23);
this.btnSelectPath.TabIndex = 4;
this.btnSelectPath.Text = "...";
this.btnSelectPath.UseVisualStyleBackColor = true;
this.btnSelectPath.Click += new System.EventHandler(this.btnSelectPath_Click);
//
// sfdPackagePath
//
this.sfdPackagePath.DefaultExt = "zip";
this.sfdPackagePath.FileName = "我的打包文件.zip";
this.sfdPackagePath.Filter = "zip文件|*.zip|所有文件|*.*";
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(56, 295);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 5;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnExit
//
this.btnExit.Location = new System.Drawing.Point(292, 295);
this.btnExit.Name = "btnExit";
this.btnExit.Size = new System.Drawing.Size(75, 23);
this.btnExit.TabIndex = 6;
this.btnExit.Text = "返回";
this.btnExit.UseVisualStyleBackColor = true;
this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
//
// gbMail
//
this.gbMail.Controls.Add(this.txtContext);
this.gbMail.Controls.Add(this.label5);
this.gbMail.Controls.Add(this.txtCaption);
this.gbMail.Controls.Add(this.label4);
this.gbMail.Controls.Add(this.label3);
this.gbMail.Controls.Add(this.cbMailTo);
this.gbMail.Controls.Add(this.btnAddSender);
this.gbMail.Controls.Add(this.label2);
this.gbMail.Controls.Add(this.cbSender);
this.gbMail.Enabled = false;
this.gbMail.Location = new System.Drawing.Point(9, 72);
this.gbMail.Name = "gbMail";
this.gbMail.Size = new System.Drawing.Size(405, 217);
this.gbMail.TabIndex = 7;
this.gbMail.TabStop = false;
this.gbMail.Text = "发送邮件";
//
// txtContext
//
this.txtContext.Location = new System.Drawing.Point(53, 100);
this.txtContext.Multiline = true;
this.txtContext.Name = "txtContext";
this.txtContext.Size = new System.Drawing.Size(348, 106);
this.txtContext.TabIndex = 14;
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(6, 103);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(41, 12);
this.label5.TabIndex = 13;
this.label5.Text = "内容:";
//
// txtCaption
//
this.txtCaption.Location = new System.Drawing.Point(53, 73);
this.txtCaption.Name = "txtCaption";
this.txtCaption.Size = new System.Drawing.Size(348, 21);
this.txtCaption.TabIndex = 12;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(6, 76);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(41, 12);
this.label4.TabIndex = 11;
this.label4.Text = "标题:";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(6, 48);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(77, 12);
this.label3.TabIndex = 10;
this.label3.Text = "收件人信息:";
//
// cbMailTo
//
this.cbMailTo.FormattingEnabled = true;
this.cbMailTo.Location = new System.Drawing.Point(89, 45);
this.cbMailTo.Name = "cbMailTo";
this.cbMailTo.Size = new System.Drawing.Size(310, 20);
this.cbMailTo.TabIndex = 9;
//
// btnAddSender
//
this.btnAddSender.Location = new System.Drawing.Point(326, 15);
this.btnAddSender.Name = "btnAddSender";
this.btnAddSender.Size = new System.Drawing.Size(75, 23);
this.btnAddSender.TabIndex = 8;
this.btnAddSender.Text = "添加发件人";
this.btnAddSender.UseVisualStyleBackColor = true;
this.btnAddSender.Click += new System.EventHandler(this.btnAddSender_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(6, 20);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(77, 12);
this.label2.TabIndex = 2;
this.label2.Text = "发件人信息:";
//
// cbSender
//
this.cbSender.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbSender.FormattingEnabled = true;
this.cbSender.Location = new System.Drawing.Point(89, 17);
this.cbSender.Name = "cbSender";
this.cbSender.Size = new System.Drawing.Size(231, 20);
this.cbSender.TabIndex = 1;
//
// cbSendMail
//
this.cbSendMail.AutoSize = true;
this.cbSendMail.Location = new System.Drawing.Point(318, 12);
this.cbSendMail.Name = "cbSendMail";
this.cbSendMail.Size = new System.Drawing.Size(96, 16);
this.cbSendMail.TabIndex = 0;
this.cbSendMail.Text = "同时发送邮件";
this.cbSendMail.UseVisualStyleBackColor = true;
this.cbSendMail.CheckedChanged += new System.EventHandler(this.cbSendMail_CheckedChanged);
//
// frmPackage
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(427, 330);
this.Controls.Add(this.gbMail);
this.Controls.Add(this.btnExit);
this.Controls.Add(this.cbSendMail);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.btnSelectPath);
this.Controls.Add(this.txtPackagePath);
this.Controls.Add(this.label1);
this.Controls.Add(this.rbCustom);
this.Controls.Add(this.rbDesktop);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Name = "frmPackage";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "打包选项";
this.gbMail.ResumeLayout(false);
this.gbMail.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.RadioButton rbDesktop;
private System.Windows.Forms.RadioButton rbCustom;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtPackagePath;
private System.Windows.Forms.Button btnSelectPath;
private System.Windows.Forms.SaveFileDialog sfdPackagePath;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnExit;
private System.Windows.Forms.GroupBox gbMail;
private System.Windows.Forms.TextBox txtContext;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox txtCaption;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.ComboBox cbMailTo;
private System.Windows.Forms.Button btnAddSender;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.ComboBox cbSender;
private System.Windows.Forms.CheckBox cbSendMail;
}
}

182
AutoPekage/frmPackage.cs Normal file
View File

@ -0,0 +1,182 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Windows.Forms;
using System.Linq;
namespace AutoPekage
{
public partial class frmPackage : Form
{
List<string> fileList;
public frmPackage(List<string> fileList)
{
this.fileList = fileList;
InitializeComponent();
cbSender.DataSource = LiteDbHelper.GetAllSender();
cbSender.DisplayMember = "Name";
cbSender.ValueMember = "Id";
cbMailTo.DataSource = LiteDbHelper.GetAllMailTo();
cbMailTo.DisplayMember = "MailTo";
var dao = LiteDbHelper.Settings;
cbSendMail.Checked = dao.SendMail;
if (dao.LastPath == null)
{
rbDesktop.Checked = true;
}
else
{
rbCustom.Checked = true;
txtPackagePath.Text = dao.LastPath;
}
}
private void btnSelectPath_Click(object sender, EventArgs e)
{
var dao = LiteDbHelper.Settings;
sfdPackagePath.FileName = dao.DefaultFileName;
if (sfdPackagePath.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
txtPackagePath.Text = sfdPackagePath.FileName;
}
}
private void rbDesktop_CheckedChanged(object sender, EventArgs e)
{
if (rbDesktop.Checked)
{
txtPackagePath.Enabled = false;
btnSelectPath.Enabled = false;
txtCaption.Text = LiteDbHelper.Settings.DefaultFileName;
}
else
{
txtPackagePath.Enabled = true;
btnSelectPath.Enabled = true;
if (txtPackagePath.Text != null)
{
txtCaption.Text = Path.GetFileName(txtPackagePath.Text);
}
}
}
private void txtPackagePath_DoubleClick(object sender, EventArgs e)
{
btnSelectPath.PerformClick();
}
private void btnOK_Click(object sender, EventArgs e)
{
string filePath;
var dao = LiteDbHelper.Settings;
if (rbDesktop.Checked)
{
filePath = Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), dao.DefaultFileName);
if (dao.LastPath != null)
{
dao.LastPath = null;
LiteDbHelper.Settings = dao;
}
}
else
{
filePath = txtPackagePath.Text;
if (dao.LastPath != filePath)
{
dao.LastPath = filePath;
LiteDbHelper.Settings = dao;
}
}
if (File.Exists(filePath))
{
if (MessageBox.Show("该文件已存在,是否替换?", "自动打包", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
{
File.Delete(filePath);
}
else
{
return;
}
}
ZipControl.Zip(filePath, fileList);
if (cbSendMail.Checked)
{
var info = LiteDbHelper.GetSenderById((int)cbSender.SelectedValue);
MailMessage msg = new MailMessage();
msg.To.Add(cbMailTo.Text);
msg.From = new MailAddress(info.UserName, info.NickName, System.Text.Encoding.UTF8);
msg.Subject = txtCaption.Text;//邮件标题
msg.SubjectEncoding = System.Text.Encoding.UTF8;//邮件标题编码
msg.Body = txtContext.Text;//邮件内容
msg.BodyEncoding = System.Text.Encoding.UTF8;//邮件内容编码
msg.IsBodyHtml = false;//是否是HTML邮件
msg.Priority = MailPriority.Normal;//邮件优先级
msg.Attachments.Add(new Attachment(filePath));
SmtpClient client = new SmtpClient(info.StmpServer);
client.Credentials = new NetworkCredential(info.UserName, info.Password);
client.EnableSsl = true;
try
{
client.Send(msg);
//简单一点儿可以client.Send(msg);
MessageBox.Show("打包并发送邮件成功");
if (LiteDbHelper.GetAllMailTo().Where(x => x.MailTo == cbMailTo.Text).Count() == 0)
{
LiteDbHelper.AddMailTo(cbMailTo.Text);
cbMailTo.DataSource = LiteDbHelper.GetAllMailTo();
}
}
catch (System.Net.Mail.SmtpException ex)
{
MessageBox.Show(ex.Message, "打包成功,发送邮件出错");
return;
}
}
else
{
MessageBox.Show("打包完成");
}
}
private void btnExit_Click(object sender, EventArgs e)
{
Close();
}
private void cbSendMail_CheckedChanged(object sender, EventArgs e)
{
if (cbSendMail.Checked)
{
gbMail.Enabled = true;
}
else
{
gbMail.Enabled = false;
}
}
private void btnAddSender_Click(object sender, EventArgs e)
{
new frmAddSender().ShowDialog();
cbSender.DataSource = LiteDbHelper.GetAllSender();
}
private void txtPackagePath_TextChanged(object sender, EventArgs e)
{
if (txtPackagePath.Text != null)
{
txtCaption.Text = Path.GetFileName(txtPackagePath.Text);
}
}
}
}

123
AutoPekage/frmPackage.resx Normal file
View File

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="sfdPackagePath.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

330
AutoPekage/frmSettings.Designer.cs generated Normal file
View File

@ -0,0 +1,330 @@
namespace AutoPekage
{
partial class frmSettings
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.txtPackageName = new System.Windows.Forms.TextBox();
this.rbLoad = new System.Windows.Forms.RadioButton();
this.cbSendMail = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.rbUnload = new System.Windows.Forms.RadioButton();
this.cbAskLoad = new System.Windows.Forms.CheckBox();
this.label2 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.rbUnDelete = new System.Windows.Forms.RadioButton();
this.cbAskDelete = new System.Windows.Forms.CheckBox();
this.rbDelete = new System.Windows.Forms.RadioButton();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.groupBox3 = new System.Windows.Forms.GroupBox();
this.label3 = new System.Windows.Forms.Label();
this.rbFileName = new System.Windows.Forms.RadioButton();
this.rbCustom = new System.Windows.Forms.RadioButton();
this.txtTitle = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.groupBox3.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 19);
this.label1.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(101, 12);
this.label1.TabIndex = 0;
this.label1.Text = "默认打包文件名:";
//
// txtPackageName
//
this.txtPackageName.Location = new System.Drawing.Point(117, 17);
this.txtPackageName.Margin = new System.Windows.Forms.Padding(2);
this.txtPackageName.Name = "txtPackageName";
this.txtPackageName.Size = new System.Drawing.Size(140, 21);
this.txtPackageName.TabIndex = 1;
//
// rbLoad
//
this.rbLoad.AutoSize = true;
this.rbLoad.Location = new System.Drawing.Point(130, 18);
this.rbLoad.Margin = new System.Windows.Forms.Padding(2);
this.rbLoad.Name = "rbLoad";
this.rbLoad.Size = new System.Drawing.Size(47, 16);
this.rbLoad.TabIndex = 2;
this.rbLoad.TabStop = true;
this.rbLoad.Text = "加载";
this.rbLoad.UseVisualStyleBackColor = true;
//
// cbSendMail
//
this.cbSendMail.AutoSize = true;
this.cbSendMail.Location = new System.Drawing.Point(112, 15);
this.cbSendMail.Margin = new System.Windows.Forms.Padding(2);
this.cbSendMail.Name = "cbSendMail";
this.cbSendMail.Size = new System.Drawing.Size(108, 16);
this.cbSendMail.TabIndex = 3;
this.cbSendMail.Text = "是否勾选发邮件";
this.cbSendMail.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.rbUnload);
this.groupBox1.Controls.Add(this.cbAskLoad);
this.groupBox1.Controls.Add(this.rbLoad);
this.groupBox1.Location = new System.Drawing.Point(11, 42);
this.groupBox1.Margin = new System.Windows.Forms.Padding(2);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Padding = new System.Windows.Forms.Padding(2);
this.groupBox1.Size = new System.Drawing.Size(244, 38);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "自动加载临时目录文件";
//
// rbUnload
//
this.rbUnload.AutoSize = true;
this.rbUnload.Location = new System.Drawing.Point(181, 19);
this.rbUnload.Margin = new System.Windows.Forms.Padding(2);
this.rbUnload.Name = "rbUnload";
this.rbUnload.Size = new System.Drawing.Size(59, 16);
this.rbUnload.TabIndex = 8;
this.rbUnload.TabStop = true;
this.rbUnload.Text = "不加载";
this.rbUnload.UseVisualStyleBackColor = true;
//
// cbAskLoad
//
this.cbAskLoad.AutoSize = true;
this.cbAskLoad.Location = new System.Drawing.Point(4, 18);
this.cbAskLoad.Margin = new System.Windows.Forms.Padding(2);
this.cbAskLoad.Name = "cbAskLoad";
this.cbAskLoad.Size = new System.Drawing.Size(96, 16);
this.cbAskLoad.TabIndex = 7;
this.cbAskLoad.Text = "询问是否加载";
this.cbAskLoad.UseVisualStyleBackColor = true;
this.cbAskLoad.CheckedChanged += new System.EventHandler(this.cbAskLoad_CheckedChanged);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(4, 16);
this.label2.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(101, 12);
this.label2.TabIndex = 5;
this.label2.Text = "勾选自动发邮件:";
//
// groupBox2
//
this.groupBox2.Controls.Add(this.rbUnDelete);
this.groupBox2.Controls.Add(this.cbAskDelete);
this.groupBox2.Controls.Add(this.rbDelete);
this.groupBox2.Location = new System.Drawing.Point(11, 84);
this.groupBox2.Margin = new System.Windows.Forms.Padding(2);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Padding = new System.Windows.Forms.Padding(2);
this.groupBox2.Size = new System.Drawing.Size(244, 40);
this.groupBox2.TabIndex = 9;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "自动删除临时目录文件";
//
// rbUnDelete
//
this.rbUnDelete.AutoSize = true;
this.rbUnDelete.Location = new System.Drawing.Point(181, 18);
this.rbUnDelete.Margin = new System.Windows.Forms.Padding(2);
this.rbUnDelete.Name = "rbUnDelete";
this.rbUnDelete.Size = new System.Drawing.Size(59, 16);
this.rbUnDelete.TabIndex = 8;
this.rbUnDelete.TabStop = true;
this.rbUnDelete.Text = "不删除";
this.rbUnDelete.UseVisualStyleBackColor = true;
//
// cbAskDelete
//
this.cbAskDelete.AutoSize = true;
this.cbAskDelete.Location = new System.Drawing.Point(4, 18);
this.cbAskDelete.Margin = new System.Windows.Forms.Padding(2);
this.cbAskDelete.Name = "cbAskDelete";
this.cbAskDelete.Size = new System.Drawing.Size(96, 16);
this.cbAskDelete.TabIndex = 7;
this.cbAskDelete.Text = "询问是否删除";
this.cbAskDelete.UseVisualStyleBackColor = true;
this.cbAskDelete.CheckedChanged += new System.EventHandler(this.cbAskDelete_CheckedChanged);
//
// rbDelete
//
this.rbDelete.AutoSize = true;
this.rbDelete.Location = new System.Drawing.Point(130, 18);
this.rbDelete.Margin = new System.Windows.Forms.Padding(2);
this.rbDelete.Name = "rbDelete";
this.rbDelete.Size = new System.Drawing.Size(47, 16);
this.rbDelete.TabIndex = 2;
this.rbDelete.TabStop = true;
this.rbDelete.Text = "删除";
this.rbDelete.UseVisualStyleBackColor = true;
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(41, 219);
this.btnOK.Margin = new System.Windows.Forms.Padding(2);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 10;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Location = new System.Drawing.Point(162, 219);
this.btnCancel.Margin = new System.Windows.Forms.Padding(2);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 11;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// groupBox3
//
this.groupBox3.Controls.Add(this.txtTitle);
this.groupBox3.Controls.Add(this.rbCustom);
this.groupBox3.Controls.Add(this.rbFileName);
this.groupBox3.Controls.Add(this.label3);
this.groupBox3.Controls.Add(this.label2);
this.groupBox3.Controls.Add(this.cbSendMail);
this.groupBox3.Location = new System.Drawing.Point(11, 128);
this.groupBox3.Margin = new System.Windows.Forms.Padding(2);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Padding = new System.Windows.Forms.Padding(2);
this.groupBox3.Size = new System.Drawing.Size(244, 87);
this.groupBox3.TabIndex = 10;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "邮件相关";
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(4, 38);
this.label3.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(65, 12);
this.label3.TabIndex = 6;
this.label3.Text = "邮件标题:";
//
// rbFileName
//
this.rbFileName.AutoSize = true;
this.rbFileName.Location = new System.Drawing.Point(85, 36);
this.rbFileName.Margin = new System.Windows.Forms.Padding(2);
this.rbFileName.Name = "rbFileName";
this.rbFileName.Size = new System.Drawing.Size(59, 16);
this.rbFileName.TabIndex = 9;
this.rbFileName.TabStop = true;
this.rbFileName.Text = "文件名";
this.rbFileName.UseVisualStyleBackColor = true;
//
// rbCustom
//
this.rbCustom.AutoSize = true;
this.rbCustom.Location = new System.Drawing.Point(157, 36);
this.rbCustom.Margin = new System.Windows.Forms.Padding(2);
this.rbCustom.Name = "rbCustom";
this.rbCustom.Size = new System.Drawing.Size(83, 16);
this.rbCustom.TabIndex = 10;
this.rbCustom.TabStop = true;
this.rbCustom.Text = "自定义内容";
this.rbCustom.UseVisualStyleBackColor = true;
this.rbCustom.CheckedChanged += new System.EventHandler(this.rbCustom_CheckedChanged);
//
// txtTitle
//
this.txtTitle.Enabled = false;
this.txtTitle.Location = new System.Drawing.Point(4, 56);
this.txtTitle.Margin = new System.Windows.Forms.Padding(2);
this.txtTitle.Name = "txtTitle";
this.txtTitle.Size = new System.Drawing.Size(236, 21);
this.txtTitle.TabIndex = 12;
//
// frmSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(270, 249);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.txtPackageName);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Margin = new System.Windows.Forms.Padding(2);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmSettings";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "设置";
this.Load += new System.EventHandler(this.frmSettings_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
this.groupBox2.ResumeLayout(false);
this.groupBox2.PerformLayout();
this.groupBox3.ResumeLayout(false);
this.groupBox3.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtPackageName;
private System.Windows.Forms.RadioButton rbLoad;
private System.Windows.Forms.CheckBox cbSendMail;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RadioButton rbUnload;
private System.Windows.Forms.CheckBox cbAskLoad;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.RadioButton rbUnDelete;
private System.Windows.Forms.CheckBox cbAskDelete;
private System.Windows.Forms.RadioButton rbDelete;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.GroupBox groupBox3;
private System.Windows.Forms.TextBox txtTitle;
private System.Windows.Forms.RadioButton rbCustom;
private System.Windows.Forms.RadioButton rbFileName;
private System.Windows.Forms.Label label3;
}
}

122
AutoPekage/frmSettings.cs Normal file
View File

@ -0,0 +1,122 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AutoPekage
{
public partial class frmSettings : Form
{
private SettingsDao dao;
public frmSettings()
{
InitializeComponent();
}
private void frmSettings_Load(object sender, EventArgs e)
{
dao = LiteDbHelper.Settings;
txtPackageName.Text = dao.DefaultFileName;
cbSendMail.Checked = dao.SendMail;
cbAskLoad.Checked = dao.AskAutoLoadFile;
cbAskDelete.Checked = dao.AskAutoDeleteFile;
rbLoad.Checked = dao.AutoLoadFile == 1 ? true : false;
rbUnload.Checked = dao.AutoLoadFile == 0 ? true : false;
rbDelete.Checked = dao.AutoDeleteFile == 1 ? true : false;
rbUnDelete.Checked = dao.AutoDeleteFile == 0 ? true : false;
rbCustom.Checked = dao.TitleModel == 1 ? true : false;
rbFileName.Checked = dao.TitleModel == 0 ? true : false;
if (rbCustom.Checked)
{
txtTitle.Text = dao.Title;
txtTitle.Enabled = true;
}
}
private void cbAskLoad_CheckedChanged(object sender, EventArgs e)
{
if (cbAskLoad.Checked)
{
rbLoad.Enabled = false;
rbUnload.Enabled = false;
}
else
{
rbLoad.Enabled = true;
rbUnload.Enabled = true;
}
}
private void cbAskDelete_CheckedChanged(object sender, EventArgs e)
{
if (cbAskDelete.Checked)
{
rbDelete.Enabled = false;
rbUnDelete.Enabled = false;
}
else
{
rbDelete.Enabled = true;
rbUnDelete.Enabled = true;
}
}
private void btnOK_Click(object sender, EventArgs e)
{
dao.DefaultFileName = txtPackageName.Text;
dao.SendMail = cbSendMail.Checked;
dao.AskAutoLoadFile = cbAskLoad.Checked;
dao.AskAutoDeleteFile = cbAskDelete.Checked;
if (rbLoad.Checked)
{
dao.AutoLoadFile = 1;
}
else
{
dao.AutoLoadFile = 0;
}
if (rbDelete.Checked)
{
dao.AutoDeleteFile = 1;
}
else
{
dao.AutoDeleteFile = 0;
}
if (rbFileName.Checked)
{
dao.TitleModel = 0;
}
else
{
dao.TitleModel = 1;
dao.Title = txtTitle.Text;
}
LiteDbHelper.Settings = dao;
Close();
}
private void btnCancel_Click(object sender, EventArgs e)
{
Close();
}
private void rbCustom_CheckedChanged(object sender, EventArgs e)
{
if (rbCustom.Checked)
{
txtTitle.Enabled = true;
}
else
{
txtTitle.Enabled = false;
}
}
}
}

120
AutoPekage/frmSettings.resx Normal file
View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

122
AutoPekage/frmStmpServer.Designer.cs generated Normal file
View File

@ -0,0 +1,122 @@
namespace AutoPekage
{
partial class frmStmpServer
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.txtServerName = new System.Windows.Forms.TextBox();
this.txtStmpAddr = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.btnOK = new System.Windows.Forms.Button();
this.btnCencel = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(12, 24);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(101, 12);
this.label1.TabIndex = 0;
this.label1.Text = "发信服务器名称:";
//
// txtServerName
//
this.txtServerName.Location = new System.Drawing.Point(119, 21);
this.txtServerName.Name = "txtServerName";
this.txtServerName.Size = new System.Drawing.Size(153, 21);
this.txtServerName.TabIndex = 1;
//
// txtStmpAddr
//
this.txtStmpAddr.Location = new System.Drawing.Point(119, 53);
this.txtStmpAddr.Name = "txtStmpAddr";
this.txtStmpAddr.Size = new System.Drawing.Size(153, 21);
this.txtStmpAddr.TabIndex = 3;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 56);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(65, 12);
this.label2.TabIndex = 2;
this.label2.Text = "Smtp地址";
//
// btnOK
//
this.btnOK.Location = new System.Drawing.Point(26, 88);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 4;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCencel
//
this.btnCencel.Location = new System.Drawing.Point(181, 88);
this.btnCencel.Name = "btnCencel";
this.btnCencel.Size = new System.Drawing.Size(75, 23);
this.btnCencel.TabIndex = 5;
this.btnCencel.Text = "返回";
this.btnCencel.UseVisualStyleBackColor = true;
this.btnCencel.Click += new System.EventHandler(this.btnCencel_Click);
//
// frmStmpServer
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 126);
this.Controls.Add(this.btnCencel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.txtStmpAddr);
this.Controls.Add(this.label2);
this.Controls.Add(this.txtServerName);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "frmStmpServer";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "添加发信服务器";
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox txtServerName;
private System.Windows.Forms.TextBox txtStmpAddr;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCencel;
}
}

View File

@ -0,0 +1,35 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace AutoPekage
{
public partial class frmStmpServer : Form
{
public frmStmpServer()
{
InitializeComponent();
}
private void btnOK_Click(object sender, EventArgs e)
{
if (LiteDbHelper.GetAllStmpServer().Where(x => x.Stmp == txtStmpAddr.Text || x.ServerName == txtServerName.Text).Count() > 0)
{
MessageBox.Show("stmp地址或发信服务器名字已经存在请检查!", "自动打包", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
LiteDbHelper.AddStmpServer(txtServerName.Text, txtStmpAddr.Text);
this.DialogResult = DialogResult.OK;
}
private void btnCencel_Click(object sender, EventArgs e)
{
this.DialogResult = DialogResult.Cancel;
}
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Costura.Fody" version="1.3.3.0" targetFramework="net40" developmentDependency="true" />
<package id="Fody" version="1.28.3" targetFramework="net40" developmentDependency="true" />
<package id="LiteDB" version="2.0.4" targetFramework="net40" />
<package id="SharpCompress" version="0.14.1" targetFramework="net40" />
</packages>