📄 detailoperation.cs
字号:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
namespace Scanner
{
public partial class PrintFrom
{
private string path;
private PrintService ps = new PrintService();
private FileOperation fo = new FileOperation();
public string Path
{
get
{
return path;
}
set
{
path = value;
}
}
private void PrintFile(string path)
{
FileStream fs = File.Create(path);
FileInfo fi = new FileInfo(path);
string type = fi.Extension;
switch (type)
{
case ".cpp":
case ".h":
case ".txt":
ps.StartPrint(fs, "txt");
break;
case ".jpg":
case ".bmp":
ps.StartPrint(fs, "image");
break;
default:
break;
}
}
private void SaveDlgFilter(string path, ref SaveFileDialog savefiledlg, int type)
{
FileInfo fi = new FileInfo(path);
switch (type)
{
case 0:
if (fi.Extension.CompareTo(".cpp") == 0)
{
savefiledlg.Filter = "C++源文件(*.cpp)|*.cpp";
}
else if (fi.Extension.CompareTo(".h") == 0)
{
savefiledlg.Filter = "C++源文件(*.h)|*.h";
}
break;
case 1:
savefiledlg.Filter = "压缩文件(*.zip)|*.zip";
break;
default:
savefiledlg.Filter = "所有文件(*.*)|*.*";
break;
}
string name = fi.Name;
string modifyname = "Compress";
modifyname += name.Remove(name.IndexOf('.'));
savefiledlg.FileName = modifyname;
}
private string Printsplit(string path)
{
StringBuilder content = new StringBuilder();
string number = "";
string comment = "";
string identifier = "";
string keyword = "";
string importan = "";
Filter filter = new Filter();
filter.Seperator(path, ref number, ref identifier, ref keyword, ref comment, ref importan);
content.Append(comment);
content.Append("--------------------------------------------------------------");
content.Append("\r\n");
content.Append(importan);
content.Append("--------------------------------------------------------------");
content.Append("\r\n");
content.Append(number);
content.Append("--------------------------------------------------------------");
content.Append("\r\n");
content.Append(identifier);
content.Append("--------------------------------------------------------------");
content.Append("\r\n");
content.Append(keyword);
content.Append("--------------------------------------------------------------");
content.Append("\r\n");
return content.ToString();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -