提交: 初始化github code
This commit is contained in:
commit
37e1490b57
330
.gitignore
vendored
Normal file
330
.gitignore
vendored
Normal file
@ -0,0 +1,330 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# 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
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
**/Properties/launchSettings.json
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.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
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# 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 add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# 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
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# 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
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2019 月夜
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
4
README.md
Normal file
4
README.md
Normal file
@ -0,0 +1,4 @@
|
||||
# MsAnalyzeDemo
|
||||
安捷伦气相色谱质谱数据解析测试。
|
||||
|
||||
目前对于.MS文件解析已经实现,色谱、质谱点等数据的提取。
|
BIN
data/DATA110109.MS
Normal file
BIN
data/DATA110109.MS
Normal file
Binary file not shown.
7215
data/tic_front110119.csv
Normal file
7215
data/tic_front110119.csv
Normal file
File diff suppressed because it is too large
Load Diff
22
dataAnalize.sln
Normal file
22
dataAnalize.sln
Normal file
@ -0,0 +1,22 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 2013
|
||||
VisualStudioVersion = 12.0.21005.1
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dataAnalize", "dataAnalize\dataAnalize.csproj", "{413C6A2F-A21C-472B-9669-50BDDCC65F51}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{413C6A2F-A21C-472B-9669-50BDDCC65F51}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{413C6A2F-A21C-472B-9669-50BDDCC65F51}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{413C6A2F-A21C-472B-9669-50BDDCC65F51}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{413C6A2F-A21C-472B-9669-50BDDCC65F51}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
612
dataAnalize/FileHelper.cs
Normal file
612
dataAnalize/FileHelper.cs
Normal file
@ -0,0 +1,612 @@
|
||||
/**
|
||||
* Title: 文件操作的方法工具
|
||||
* Author: other
|
||||
* Date: long long ago
|
||||
* Desp:
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
|
||||
namespace dataAnalize
|
||||
{
|
||||
public class FileHelper
|
||||
{
|
||||
#region 目录检测相关操作
|
||||
|
||||
/// <summary>
|
||||
/// 检测指定目录是否存在
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">目录的绝对路径</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsExistDirectory(string directoryPath)
|
||||
{
|
||||
return Directory.Exists(directoryPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测指定目录是否为空
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">指定目录的绝对路径</param>
|
||||
public static bool IsEmptyDirectory(string directoryPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] fileNames = GetDirectoryFileNames(directoryPath, "*", false); //判断是否存在文件
|
||||
if (fileNames.Length > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
string[] directoryNames = GetDirectories(directoryPath, "*", false); //判断是否存在文件夹
|
||||
if (directoryNames.Length > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测指定目录中是否存在指定的文件,若要搜索子目录请使用重载方法.
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">指定目录的绝对路径</param>
|
||||
/// <param name="searchPattern">模式字符串,"*"代表0或N个字符,"?"代表1个字符。
|
||||
/// 范例:"Log*.xml"表示搜索所有以Log开头的Xml文件。</param>
|
||||
public static bool DirectoryContains(string directoryPath, string searchPattern)
|
||||
{
|
||||
try
|
||||
{
|
||||
string[] fileNames = GetDirectoryFileNames(directoryPath, searchPattern, false); //获取指定的文件列表
|
||||
|
||||
if (fileNames.Length == 0) //判断指定文件是否存在
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检测指定目录中是否存在指定的文件
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">指定目录的绝对路径</param>
|
||||
/// <param name="searchPattern">模式字符串,"*"代表0或N个字符,"?"代表1个字符。
|
||||
/// 范例:"Log*.xml"表示搜索所有以Log开头的Xml文件。</param>
|
||||
/// <param name="isSearchChild">是否搜索子目录</param>
|
||||
public static bool DirectoryContains(string directoryPath, string searchPattern, bool isSearchChild)
|
||||
{
|
||||
try
|
||||
{
|
||||
//获取指定的文件列表
|
||||
string[] fileNames = GetDirectoryFileNames(directoryPath, searchPattern, true);
|
||||
|
||||
//判断指定文件是否存在
|
||||
if (fileNames.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new Exception(ex.Message);
|
||||
//LogHelper.WriteTraceLog(TraceLogLevel.Error, ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定目录及子目录中所有子目录列表
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">指定目录的绝对路径</param>
|
||||
/// <param name="searchPattern">模式字符串,"*"代表0或N个字符,"?"代表1个字符。
|
||||
/// 范例:"Log*.xml"表示搜索所有以Log开头的Xml文件。</param>
|
||||
/// <param name="isSearchChild">是否搜索子目录</param>
|
||||
public static string[] GetDirectories(string directoryPath, string searchPattern, bool isSearchChild)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (isSearchChild)
|
||||
{
|
||||
return Directory.GetDirectories(directoryPath, searchPattern, SearchOption.AllDirectories);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Directory.GetDirectories(directoryPath, searchPattern, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取指定目录及子目录中所有文件列表
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">指定目录的绝对路径</param>
|
||||
/// <param name="searchPattern">模式字符串,"*"代表0或N个字符,"?"代表1个字符。
|
||||
/// 范例:"Log*.xml"表示搜索所有以Log开头的Xml文件。</param>
|
||||
/// <param name="isSearchChild">是否搜索子目录</param>
|
||||
public static string[] GetDirectoryFileNames(string directoryPath, string searchPattern, bool isSearchChild)
|
||||
{
|
||||
//如果目录不存在,则抛出异常
|
||||
if (!IsExistDirectory(directoryPath))
|
||||
{
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
if (isSearchChild)
|
||||
{
|
||||
return Directory.GetFiles(directoryPath, searchPattern, SearchOption.AllDirectories);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Directory.GetFiles(directoryPath, searchPattern, SearchOption.TopDirectoryOnly);
|
||||
}
|
||||
}
|
||||
catch (IOException ex)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 目录相关操作的内容
|
||||
|
||||
/// <summary>
|
||||
/// 创建目录
|
||||
/// </summary>
|
||||
/// <param name="dir">要创建的目录路径包括目录名</param>
|
||||
public static void CreateDirectory(string dir)
|
||||
{
|
||||
if (dir.Length == 0) return;
|
||||
if (!Directory.Exists(dir))
|
||||
Directory.CreateDirectory(dir);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除目录
|
||||
/// </summary>
|
||||
/// <param name="dir">要删除的目录路径和名称</param>
|
||||
public static void DeleteDirectory(string dir)
|
||||
{
|
||||
if (dir.Length == 0) return;
|
||||
if (Directory.Exists(dir))
|
||||
Directory.Delete(dir, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空指定目录下所有文件及子目录,但该目录依然保存.
|
||||
/// </summary>
|
||||
/// <param name="directoryPath">指定目录的绝对路径</param>
|
||||
public static void ClearDirectory(string directoryPath)
|
||||
{
|
||||
if (IsExistDirectory(directoryPath))
|
||||
{
|
||||
//删除目录中所有的文件
|
||||
string[] fileNames = GetDirectoryFileNames(directoryPath, "*", false);
|
||||
for (int i = 0; i < fileNames.Length; i++)
|
||||
{
|
||||
DeleteFile(fileNames[i]);
|
||||
}
|
||||
//删除目录中所有的子目录
|
||||
string[] directoryNames = GetDirectories(directoryPath, "*", false);
|
||||
for (int i = 0; i < directoryNames.Length; i++)
|
||||
{
|
||||
DeleteDirectory(directoryNames[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复制文件夹(递归)
|
||||
/// </summary>
|
||||
/// <param name="varFromDirectory">源文件夹路径</param>
|
||||
/// <param name="varToDirectory">目标文件夹路径</param>
|
||||
public static void CopyDirectory(string varFromDirectory, string varToDirectory)
|
||||
{
|
||||
Directory.CreateDirectory(varToDirectory);
|
||||
|
||||
if (!Directory.Exists(varFromDirectory)) return;
|
||||
|
||||
string[] directories = Directory.GetDirectories(varFromDirectory);
|
||||
|
||||
if (directories.Length > 0)
|
||||
{
|
||||
foreach (string d in directories)
|
||||
{
|
||||
CopyDirectory(d, varToDirectory + d.Substring(d.LastIndexOf("\\")));
|
||||
}
|
||||
}
|
||||
string[] files = Directory.GetFiles(varFromDirectory);
|
||||
if (files.Length > 0)
|
||||
{
|
||||
foreach (string s in files)
|
||||
{
|
||||
File.Copy(s, varToDirectory + s.Substring(s.LastIndexOf("\\")), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 文件本身操作
|
||||
|
||||
/// <summary>
|
||||
/// 检测指定文件是否存在,如果存在则返回true。
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static bool IsExistFile(string filePath)
|
||||
{
|
||||
return File.Exists(filePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 创建一个文件。
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static void CreateFile(string filePath)
|
||||
{
|
||||
try
|
||||
{
|
||||
//如果文件不存在则创建该文件
|
||||
if (!IsExistFile(filePath))
|
||||
{
|
||||
//创建一个FileInfo对象
|
||||
FileInfo file = new FileInfo(filePath);
|
||||
|
||||
//创建文件
|
||||
FileStream fs = file.Create();
|
||||
|
||||
//关闭文件流
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//LogHelper.WriteTraceLog(TraceLogLevel.Error, ex.Message);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建文件
|
||||
/// </summary>
|
||||
/// <param name="path">路径</param>
|
||||
/// <param name="content">内容</param>
|
||||
public static void CreateFile(string path, string content)
|
||||
{
|
||||
FileInfo fi = new FileInfo(path);
|
||||
var di = fi.Directory;
|
||||
if (!di.Exists)
|
||||
{
|
||||
di.Create();
|
||||
}
|
||||
StreamWriter sw = new StreamWriter(path, false, Encoding.GetEncoding("GB2312"));
|
||||
sw.Write(content);
|
||||
sw.Close();
|
||||
|
||||
//path = path.Replace("/", "\\");
|
||||
//if (path.IndexOf("\\") > -1)
|
||||
// CreateDirectory(dir.Substring(0, path.LastIndexOf("\\")));
|
||||
//StreamWriter sw = new StreamWriter(path, false, Encoding.GetEncoding("GB2312"));
|
||||
//sw.Write(pagestr);
|
||||
//sw.Close();
|
||||
}
|
||||
/// <summary>
|
||||
/// 创建一个文件,并将字节流写入文件。
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
/// <param name="buffer">二进制流数据</param>
|
||||
public static void CreateFile(string filePath, byte[] buffer)
|
||||
{
|
||||
try
|
||||
{
|
||||
//如果文件不存在则创建该文件
|
||||
if (!IsExistFile(filePath))
|
||||
{
|
||||
//创建一个FileInfo对象
|
||||
FileInfo file = new FileInfo(filePath);
|
||||
|
||||
//创建文件
|
||||
FileStream fs = file.Create();
|
||||
|
||||
//写入二进制流
|
||||
fs.Write(buffer, 0, buffer.Length);
|
||||
|
||||
//关闭文件流
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
//LogHelper.WriteTraceLog(TraceLogLevel.Error, ex.Message);
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 删除文件
|
||||
/// </summary>
|
||||
/// <param name="file">要删除的文件路径和名称</param>
|
||||
public static void DeleteFile(string file)
|
||||
{
|
||||
if (File.Exists(file))
|
||||
{
|
||||
File.Delete(file);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将文件移动到指定目录
|
||||
/// </summary>
|
||||
/// <param name="sourceFilePath">需要移动的源文件的绝对路径</param>
|
||||
/// <param name="descDirectoryPath">移动到的目录的绝对路径</param>
|
||||
public static void MoveFile(string sourceFilePath, string descDirectoryPath)
|
||||
{
|
||||
//获取源文件的名称
|
||||
string sourceFileName = GetFileName(sourceFilePath);
|
||||
|
||||
if (IsExistDirectory(descDirectoryPath))
|
||||
{
|
||||
//如果目标中存在同名文件,则删除
|
||||
if (IsExistFile(descDirectoryPath + "\\" + sourceFileName))
|
||||
{
|
||||
DeleteFile(descDirectoryPath + "\\" + sourceFileName);
|
||||
}
|
||||
//将文件移动到指定目录
|
||||
File.Move(sourceFilePath, descDirectoryPath + "\\" + sourceFileName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 复制文件
|
||||
/// </summary>
|
||||
/// <param name="dir1">要复制的文件的路径已经全名(包括后缀)</param>
|
||||
/// <param name="dir2">目标位置,并指定新的文件名</param>
|
||||
public static void CopyFile(string dir1, string dir2)
|
||||
{
|
||||
if (File.Exists(dir1))
|
||||
{
|
||||
File.Copy(dir1, dir2, true);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 文件内容检测
|
||||
/// <summary>
|
||||
/// 获取文本文件的行数
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static int GetLineCount(string filePath)
|
||||
{
|
||||
//将文本文件的各行读到一个字符串数组中
|
||||
string[] rows = File.ReadAllLines(filePath);
|
||||
|
||||
//返回行数
|
||||
return rows.Length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取一个文件的长度,单位为Byte
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static long GetFileSize(string filePath)
|
||||
{
|
||||
//创建一个文件对象
|
||||
FileInfo fi = new FileInfo(filePath);
|
||||
|
||||
//获取文件的大小
|
||||
return fi.Length;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 计算文件大小函数(保留两位小数),Size为字节大小
|
||||
/// </summary>
|
||||
/// <param name="size">初始文件大小</param>
|
||||
/// <returns></returns>
|
||||
public static string ToFileSize(long size)
|
||||
{
|
||||
string m_strSize = "";
|
||||
long FactSize = 0;
|
||||
FactSize = size;
|
||||
if (FactSize < 1024.00)
|
||||
m_strSize = FactSize.ToString("F2") + " 字节";
|
||||
else if (FactSize >= 1024.00 && FactSize < 1048576)
|
||||
m_strSize = (FactSize / 1024.00).ToString("F2") + " KB";
|
||||
else if (FactSize >= 1048576 && FactSize < 1073741824)
|
||||
m_strSize = (FactSize / 1024.00 / 1024.00).ToString("F2") + " MB";
|
||||
else if (FactSize >= 1073741824)
|
||||
m_strSize = (FactSize / 1024.00 / 1024.00 / 1024.00).ToString("F2") + " GB";
|
||||
return m_strSize;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 文件内容操作
|
||||
|
||||
/// <summary>
|
||||
/// 向文本文件中写入内容
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
/// <param name="text">写入的内容</param>
|
||||
/// <param name="encoding">编码</param>
|
||||
public static void WriteText(string filePath, string text, Encoding encoding)
|
||||
{
|
||||
//向文件写入内容
|
||||
File.WriteAllText(filePath, text, encoding);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 向文本文件的尾部追加内容
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
/// <param name="content">写入的内容</param>
|
||||
public static void AppendText(string filePath, string content)
|
||||
{
|
||||
File.AppendAllText(filePath, content);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取文件的所有内容
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static string ReadAllFileContent(string filePath)
|
||||
{
|
||||
StreamReader sr = new StreamReader(filePath);
|
||||
string strRead = sr.ReadToEnd(); //从开始到末尾读取文件的所有内容
|
||||
sr.Close(); //读完文件记得关闭流
|
||||
|
||||
return strRead;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将文件转换成byte[] 数组
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件路径文件名称</param>
|
||||
/// <returns>byte[]</returns>
|
||||
public static byte[] ReadFileByteData(string filePath)
|
||||
{
|
||||
using (FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
|
||||
{
|
||||
byte[] buffur = new byte[fs.Length];
|
||||
using (BinaryReader br = new BinaryReader(fs))
|
||||
{
|
||||
br.Read(buffur, 0, (int)fs.Length);
|
||||
br.Close();
|
||||
}
|
||||
return buffur;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 将文件转换成byte[] 数组
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件路径文件名称</param>
|
||||
/// <returns>byte[]</returns>
|
||||
public static byte[] ReadFileByteData2(string filePath)
|
||||
{
|
||||
FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read);
|
||||
try
|
||||
{
|
||||
byte[] buffur = new byte[fs.Length];
|
||||
fs.Read(buffur, 0, (int)fs.Length);
|
||||
|
||||
return buffur;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
finally
|
||||
{
|
||||
fs.Close();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空文件内容,文件流不会关闭
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static void ClearFile(string filePath)
|
||||
{
|
||||
FileStream fs = new FileStream(filePath, FileMode.Truncate, FileAccess.ReadWrite);
|
||||
fs.Close();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 清空文件内容,文件流不会关闭
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static FileStream ClearFileAndGet(string filePath)
|
||||
{
|
||||
FileStream fs = new FileStream(filePath, FileMode.Truncate, FileAccess.ReadWrite);
|
||||
return fs;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region 文件路径处理
|
||||
|
||||
/// <summary>
|
||||
/// 从文件的绝对路径中获取扩展名
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static string GetExtension(string filePath)
|
||||
{
|
||||
filePath = filePath.Trim();
|
||||
//获取文件的名称
|
||||
FileInfo fi = new FileInfo(filePath);
|
||||
string suffix = fi.Extension;
|
||||
return suffix.ToLower();
|
||||
//string suffix = filePath.Substring(filePath.LastIndexOf(".") + 1);
|
||||
//return suffix.ToLower();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从文件的绝对路径中获取最末层文件夹路径
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static string GetDirectoryPath(string filePath)
|
||||
{
|
||||
FileInfo fi = new FileInfo(filePath);
|
||||
return fi.DirectoryName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从文件的绝对路径中获取文件名( 包含扩展名 )
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static string GetFileName(string filePath)
|
||||
{
|
||||
filePath = filePath.Trim();
|
||||
//获取文件的名称
|
||||
FileInfo fi = new FileInfo(filePath);
|
||||
return fi.Name;
|
||||
//string fileName = filePath.Substring(filePath.LastIndexOf('/') + 1);
|
||||
//return fileName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 从文件的绝对路径中获取文件名( 不包含扩展名 )
|
||||
/// </summary>
|
||||
/// <param name="filePath">文件的绝对路径</param>
|
||||
public static string GetFileNameNoExtension(string filePath)
|
||||
{
|
||||
//获取文件的名称
|
||||
FileInfo fi = new FileInfo(filePath);
|
||||
return fi.Name.Split('.')[0];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 根据相对路径转化为绝对路径
|
||||
/// </summary>
|
||||
/// <param name="relativePath">相对路径, 直接加文件夹名称即可</param>
|
||||
/// <returns></returns>
|
||||
public static string GetFullPath(string relativePath)
|
||||
{
|
||||
string basePath = AppDomain.CurrentDomain.BaseDirectory;
|
||||
|
||||
return basePath + relativePath;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
147
dataAnalize/MainForm.Designer.cs
generated
Normal file
147
dataAnalize/MainForm.Designer.cs
generated
Normal file
@ -0,0 +1,147 @@
|
||||
namespace dataAnalize
|
||||
{
|
||||
partial class MainForm
|
||||
{
|
||||
/// <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.btnSelFilePath = new System.Windows.Forms.Button();
|
||||
this.TestStart = new System.Windows.Forms.Button();
|
||||
this.txtFilePath = new System.Windows.Forms.TextBox();
|
||||
this.listResult = new System.Windows.Forms.ListBox();
|
||||
this.label1 = new System.Windows.Forms.Label();
|
||||
this.AllStart = new System.Windows.Forms.Button();
|
||||
this.btnSelSavePath = new System.Windows.Forms.Button();
|
||||
this.txtSavePath = new System.Windows.Forms.TextBox();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// btnSelFilePath
|
||||
//
|
||||
this.btnSelFilePath.Location = new System.Drawing.Point(52, 20);
|
||||
this.btnSelFilePath.Name = "btnSelFilePath";
|
||||
this.btnSelFilePath.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnSelFilePath.TabIndex = 0;
|
||||
this.btnSelFilePath.Text = "文件选择";
|
||||
this.btnSelFilePath.UseVisualStyleBackColor = true;
|
||||
this.btnSelFilePath.Click += new System.EventHandler(this.btnSelFilePath_Click);
|
||||
//
|
||||
// TestStart
|
||||
//
|
||||
this.TestStart.Location = new System.Drawing.Point(249, 96);
|
||||
this.TestStart.Name = "TestStart";
|
||||
this.TestStart.Size = new System.Drawing.Size(75, 23);
|
||||
this.TestStart.TabIndex = 0;
|
||||
this.TestStart.Text = "测试解析";
|
||||
this.TestStart.UseVisualStyleBackColor = true;
|
||||
this.TestStart.Click += new System.EventHandler(this.TestStart_Click);
|
||||
//
|
||||
// txtFilePath
|
||||
//
|
||||
this.txtFilePath.Location = new System.Drawing.Point(134, 21);
|
||||
this.txtFilePath.Name = "txtFilePath";
|
||||
this.txtFilePath.Size = new System.Drawing.Size(291, 21);
|
||||
this.txtFilePath.TabIndex = 1;
|
||||
//
|
||||
// listResult
|
||||
//
|
||||
this.listResult.FormattingEnabled = true;
|
||||
this.listResult.ItemHeight = 12;
|
||||
this.listResult.Location = new System.Drawing.Point(52, 144);
|
||||
this.listResult.Name = "listResult";
|
||||
this.listResult.Size = new System.Drawing.Size(373, 328);
|
||||
this.listResult.TabIndex = 2;
|
||||
//
|
||||
// label1
|
||||
//
|
||||
this.label1.AutoSize = true;
|
||||
this.label1.Location = new System.Drawing.Point(50, 128);
|
||||
this.label1.Name = "label1";
|
||||
this.label1.Size = new System.Drawing.Size(59, 12);
|
||||
this.label1.TabIndex = 3;
|
||||
this.label1.Text = "结果展示:";
|
||||
//
|
||||
// AllStart
|
||||
//
|
||||
this.AllStart.Location = new System.Drawing.Point(350, 96);
|
||||
this.AllStart.Name = "AllStart";
|
||||
this.AllStart.Size = new System.Drawing.Size(75, 23);
|
||||
this.AllStart.TabIndex = 0;
|
||||
this.AllStart.Text = "全部解析";
|
||||
this.AllStart.UseVisualStyleBackColor = true;
|
||||
this.AllStart.Click += new System.EventHandler(this.AllStart_Click);
|
||||
//
|
||||
// btnSelSavePath
|
||||
//
|
||||
this.btnSelSavePath.Location = new System.Drawing.Point(52, 56);
|
||||
this.btnSelSavePath.Name = "btnSelSavePath";
|
||||
this.btnSelSavePath.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnSelSavePath.TabIndex = 0;
|
||||
this.btnSelSavePath.Text = "保存文件";
|
||||
this.btnSelSavePath.UseVisualStyleBackColor = true;
|
||||
this.btnSelSavePath.Click += new System.EventHandler(this.btnSelSavePath_Click);
|
||||
//
|
||||
// txtSavePath
|
||||
//
|
||||
this.txtSavePath.Location = new System.Drawing.Point(134, 57);
|
||||
this.txtSavePath.Name = "txtSavePath";
|
||||
this.txtSavePath.Size = new System.Drawing.Size(291, 21);
|
||||
this.txtSavePath.TabIndex = 1;
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(463, 497);
|
||||
this.Controls.Add(this.label1);
|
||||
this.Controls.Add(this.listResult);
|
||||
this.Controls.Add(this.txtSavePath);
|
||||
this.Controls.Add(this.txtFilePath);
|
||||
this.Controls.Add(this.AllStart);
|
||||
this.Controls.Add(this.btnSelSavePath);
|
||||
this.Controls.Add(this.TestStart);
|
||||
this.Controls.Add(this.btnSelFilePath);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.Name = "MainForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "测试界面";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button btnSelFilePath;
|
||||
private System.Windows.Forms.Button TestStart;
|
||||
private System.Windows.Forms.TextBox txtFilePath;
|
||||
private System.Windows.Forms.ListBox listResult;
|
||||
private System.Windows.Forms.Label label1;
|
||||
private System.Windows.Forms.Button AllStart;
|
||||
private System.Windows.Forms.Button btnSelSavePath;
|
||||
private System.Windows.Forms.TextBox txtSavePath;
|
||||
}
|
||||
}
|
||||
|
175
dataAnalize/MainForm.cs
Normal file
175
dataAnalize/MainForm.cs
Normal file
@ -0,0 +1,175 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace dataAnalize
|
||||
{
|
||||
public partial class MainForm : Form
|
||||
{
|
||||
public MainForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void btnSelFilePath_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(ofd.FileName))
|
||||
{
|
||||
txtFilePath.Text = ofd.FileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void btnSelSavePath_Click(object sender, EventArgs e)
|
||||
{
|
||||
FolderBrowserDialog dialog = new FolderBrowserDialog();
|
||||
|
||||
if (dialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
string foldPath = dialog.SelectedPath;
|
||||
txtSavePath.Text = foldPath;
|
||||
}
|
||||
}
|
||||
|
||||
// 测试解析点击事件
|
||||
private void TestStart_Click(object sender, EventArgs e)
|
||||
{
|
||||
string filePath = txtFilePath.Text;
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
MessageBox.Show("请选择数据文件", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
|
||||
ClearShow();
|
||||
|
||||
try
|
||||
{
|
||||
// 获取文件的所有字节信息
|
||||
byte[] allbytes = FileHelper.ReadFileByteData(filePath);
|
||||
AddShow("总体", "总字节数:" + allbytes.Length);
|
||||
AddLine();
|
||||
|
||||
// 获取头信息
|
||||
int sNumber = MsAnalyzeUtil.GetIntLitter(allbytes, 278, 281 - 278 + 1);
|
||||
AddShow("头信息", "色谱数据数量:" + sNumber);
|
||||
int startB = MsAnalyzeUtil.GetIntLitter(allbytes, 260, 263 - 260 + 1);
|
||||
AddShow("头信息", "第一个色谱数据起点:" + startB);
|
||||
AddLine();
|
||||
|
||||
// 第一个色谱数据
|
||||
int sStartA = 2 * (startB - 1);
|
||||
int zStartB = MsAnalyzeUtil.GetIntLitter(allbytes, sStartA, 4);
|
||||
AddShow("色谱数据", "第一个色谱的质谱地址:" + zStartB);
|
||||
int sTime = MsAnalyzeUtil.GetIntLitter(allbytes, sStartA + 4, 4);
|
||||
AddShow("色谱数据", "第一个色谱的保留时间(ms):" + sTime);
|
||||
AddShow("色谱数据", "第一个色谱的保留时间(m):" + MsAnalyzeUtil.MsToMin(sTime));
|
||||
int sAbundance = MsAnalyzeUtil.GetIntLitter(allbytes, sStartA + 8, 4);
|
||||
AddShow("色谱数据", "第一个色谱的信号值:" + sAbundance);
|
||||
AddLine();
|
||||
|
||||
// 第一个质谱数据
|
||||
int zStartA = zStartB * 2;
|
||||
int zTime = MsAnalyzeUtil.GetIntLitter(allbytes, zStartA, 4);
|
||||
AddShow("质谱头", "第一个质谱的保留时间(ms):" + zTime);
|
||||
AddShow("质谱头", "第一个质谱的保留时间(m):" + MsAnalyzeUtil.MsToMin(zTime));
|
||||
int zNumber = MsAnalyzeUtil.GetIntLitter(allbytes, zStartA + 10, 2);
|
||||
AddShow("质谱头", "第一个质谱的峰个数:" + zNumber);
|
||||
int zMaxMass = MsAnalyzeUtil.GetIntLitter(allbytes, zStartA + 12, 2);
|
||||
AddShow("质谱头", "第一个质谱最高峰的质量数:" + zMaxMass);
|
||||
int zMaxAbundance = MsAnalyzeUtil.GetIntLitter(allbytes, zStartA + 14, 2);
|
||||
AddShow("质谱头", "第一个质谱最高峰的信号值:" + zMaxAbundance);
|
||||
AddLine();
|
||||
|
||||
// 第一个色谱的所有质谱点
|
||||
zStartA = zStartA + 16;
|
||||
int zMass = MsAnalyzeUtil.GetIntLitter(allbytes, zStartA, 2);
|
||||
AddShow("质谱数据", "第一个质谱第一峰的质量数:" + zMass);
|
||||
int zAbundance = MsAnalyzeUtil.GetIntLitter(allbytes, zStartA + 2, 2);
|
||||
AddShow("质谱数据", "第一个质谱第一峰的信号值:" + zAbundance);
|
||||
zStartA = zStartA + 4;
|
||||
zMass = MsAnalyzeUtil.GetIntLitter(allbytes, zStartA, 2);
|
||||
AddShow("质谱数据", "第一个质谱第二峰的质量数:" + zMass);
|
||||
zAbundance = MsAnalyzeUtil.GetIntLitter(allbytes, zStartA + 2, 2);
|
||||
AddShow("质谱数据", "第一个质谱第二峰的信号值:" + zAbundance);
|
||||
AddLine();
|
||||
|
||||
// 第二个色谱数据
|
||||
sStartA = sStartA + 12;
|
||||
zStartB = MsAnalyzeUtil.GetIntLitter(allbytes, sStartA, 4);
|
||||
AddShow("色谱数据", "第二个色谱的质谱地址:" + zStartB);
|
||||
sTime = MsAnalyzeUtil.GetIntLitter(allbytes, sStartA + 4, 4);
|
||||
AddShow("色谱数据", "第二个色谱的保留时间(ms):" + sTime);
|
||||
AddShow("色谱数据", "第二个色谱的保留时间(m):" + MsAnalyzeUtil.MsToMin(sTime));
|
||||
sAbundance = MsAnalyzeUtil.GetIntLitter(allbytes, sStartA + 8, 4);
|
||||
AddShow("色谱数据", "第二个色谱的信号值:" + sAbundance);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddShow("错误", "文件解析错误:" + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
// 全部解析点击事件
|
||||
private void AllStart_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 所有的路径处理
|
||||
string filePath = txtFilePath.Text;
|
||||
string savePath = txtSavePath.Text;
|
||||
if (string.IsNullOrEmpty(filePath) || string.IsNullOrEmpty(savePath))
|
||||
{
|
||||
MessageBox.Show("请选择数据文件与保存路径", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
||||
return;
|
||||
}
|
||||
string saveFilePath = savePath + "\\" + FileHelper.GetFileNameNoExtension(filePath) + ".txt";
|
||||
if (FileHelper.IsExistFile(saveFilePath))
|
||||
FileHelper.ClearFile(saveFilePath);
|
||||
else
|
||||
FileHelper.CreateFile(saveFilePath);
|
||||
MsAnalyzeUtil.Init(saveFilePath);
|
||||
|
||||
// 开始解析
|
||||
ClearShow();
|
||||
AddShow("说明", "开始进行文本解析");
|
||||
AddShow("说明", "保存文件路径:" + saveFilePath);
|
||||
try
|
||||
{
|
||||
Stopwatch stopwatch = Stopwatch.StartNew();
|
||||
// 获取文件的所有字节信息
|
||||
byte[] allDatas = FileHelper.ReadFileByteData(filePath);
|
||||
|
||||
// 进行全部文件的解析导出
|
||||
MsAnalyzeUtil.GetChrom(allDatas);
|
||||
stopwatch.Stop();
|
||||
AddShow("说明", "文件解析完成。用时(ms):" + stopwatch.ElapsedMilliseconds);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
AddShow("错误", "文件解析错误:" + ex.Message);
|
||||
}
|
||||
Process.Start("explorer.exe", savePath);
|
||||
}
|
||||
|
||||
/*--------------- 数据输出的方法 ----------------------*/
|
||||
|
||||
// 清理展示内容
|
||||
private void ClearShow()
|
||||
{
|
||||
listResult.Items.Clear();
|
||||
}
|
||||
|
||||
// 本地输出
|
||||
private void AddShow(string type, string msg)
|
||||
{
|
||||
listResult.Items.Add("【" + type + "】 " + msg);
|
||||
}
|
||||
// 本地输出
|
||||
private void AddLine()
|
||||
{
|
||||
listResult.Items.Add("--------------------------------------");
|
||||
}
|
||||
}
|
||||
}
|
120
dataAnalize/MainForm.resx
Normal file
120
dataAnalize/MainForm.resx
Normal 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=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>
|
175
dataAnalize/MsAnalyzeUtil.cs
Normal file
175
dataAnalize/MsAnalyzeUtil.cs
Normal file
@ -0,0 +1,175 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace dataAnalize
|
||||
{
|
||||
/// <summary>
|
||||
/// 安捷伦数据MS文件,解析的实现类,具体协议信息,可以找对应的文献对应,这里不单独提供了。
|
||||
///
|
||||
/// 后续完善考虑:
|
||||
/// 1、 对于解析的数据,可以存放到实体类,然后统一进行输出。
|
||||
/// 2、 转化效率上进行优化提升。
|
||||
/// 3、 单例结构改造 or 静态初始化方法优化,模块封装更集中。
|
||||
/// </summary>
|
||||
public class MsAnalyzeUtil
|
||||
{
|
||||
private static string _logFilePath = "";
|
||||
|
||||
/// <summary>
|
||||
/// 初始化分析方法
|
||||
/// 可以改造为using方式,将具体操作都私有化,资源释放管理起来。
|
||||
/// </summary>
|
||||
/// <param name="logFilePath"></param>
|
||||
public static void Init(string logFilePath = "")
|
||||
{
|
||||
_logFilePath = logFilePath;
|
||||
}
|
||||
|
||||
/**------------------- 文件解析的主要方法 -----------------------**/
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有的色谱数据,包括其下质谱数据
|
||||
/// </summary>
|
||||
/// <param name="allData">全部的数据</param>
|
||||
public static void GetChrom(byte[] allData)
|
||||
{
|
||||
OutResult("总体", "总字节数:" + allData.Length);
|
||||
|
||||
int number = GetIntLitter(allData, 278, 281 - 278 + 1); // 色谱总数量
|
||||
int startAddr = GetIntLitter(allData, 260, 263 - 260 + 1); //第一个色谱的地址
|
||||
OutResult("头信息", string.Format("色谱数据信息: 色谱点数-{0}", number));
|
||||
|
||||
int startBit = 2 * (startAddr - 1); //第一个色谱的位地址
|
||||
int startMass, time, abundance;
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
startMass = GetIntLitter(allData, startBit, 4);
|
||||
time = GetIntLitter(allData, startBit + 4, 4);
|
||||
abundance = GetIntLitter(allData, startBit + 8, 4);
|
||||
|
||||
OutResult("色谱", String.Format("{0,4}:[{3},{1},{2}]", i + 1, MsToMin(time), abundance, time));
|
||||
|
||||
GetAllMass(allData, startMass, i + 1);
|
||||
|
||||
startBit = startBit + 12;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取所有质谱数据
|
||||
/// </summary>
|
||||
/// <param name="allData"></param>
|
||||
/// <param name="startAddr"></param>
|
||||
/// <param name="sNo"></param>
|
||||
private static void GetAllMass(byte[] allData, int startAddr, int sNo)
|
||||
{
|
||||
int startBit = startAddr * 2;
|
||||
int time = GetIntLitter(allData, startBit, 4);
|
||||
int number = GetIntLitter(allData, startBit + 10, 2);
|
||||
int maxMass = GetIntLitter(allData, startBit + 12, 2);
|
||||
int maxAbundance = GetIntLitter(allData, startBit + 14, 2);
|
||||
OutResult("质谱数据", String.Format("{0,4}:保留时间-{1},质谱点数-{2},最高峰-[{3},{4}]",
|
||||
sNo, MsToMin(time), number, maxMass, maxAbundance));
|
||||
|
||||
Dictionary<int, int> massPoints = new Dictionary<int, int>();
|
||||
string allPoints = "";
|
||||
|
||||
startBit = startBit + 16;
|
||||
int mass, abundance;
|
||||
for (int i = 0; i < number; i++)
|
||||
{
|
||||
mass = GetIntLitter(allData, startBit, 2);
|
||||
abundance = GetIntLitter(allData, startBit + 2, 2);
|
||||
abundance = abundance / 20;
|
||||
|
||||
massPoints.Add(mass, abundance);
|
||||
allPoints += string.Format("[{0},{1}] ", mass, abundance);
|
||||
|
||||
startBit = startBit + 4;
|
||||
}
|
||||
|
||||
OutResult("质谱数据", String.Format("{0,4}:{1}", sNo, allPoints));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 解析结果的输出
|
||||
/// </summary>
|
||||
/// <param name="type"></param>
|
||||
/// <param name="msg"></param>
|
||||
private static void OutResult(string type, string msg)
|
||||
{
|
||||
if (string.IsNullOrEmpty(_logFilePath))
|
||||
{
|
||||
string str = string.Format("【{0}】 {1}", type, msg) + Environment.NewLine;
|
||||
FileHelper.AppendText(_logFilePath, str);
|
||||
}
|
||||
}
|
||||
|
||||
/*----------- 对外的公开方法 不测试时,可以私有化 -------------*/
|
||||
|
||||
/// <summary>
|
||||
/// 在字节数组的指定位置获取数值
|
||||
/// </summary>
|
||||
/// <param name="srcArr"></param>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="count">可以为:2,4</param>
|
||||
/// <returns></returns>
|
||||
public static int GetIntLitter(byte[] srcArr, int start, int count)
|
||||
{
|
||||
byte[] times = new byte[count];
|
||||
Buffer.BlockCopy(srcArr, start, times, 0, count);
|
||||
Array.Reverse(times);
|
||||
|
||||
if (count == 4)
|
||||
{
|
||||
int number = BitConverter.ToInt32(times, 0);
|
||||
return number;
|
||||
}
|
||||
else
|
||||
{
|
||||
int number = BitConverter.ToInt16(times, 0);
|
||||
return number;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在字节数组的指定位置获取数值
|
||||
/// </summary>
|
||||
/// <param name="srcArr"></param>
|
||||
/// <param name="start"></param>
|
||||
/// <param name="count">可以为:4,8</param>
|
||||
/// <returns></returns>
|
||||
public static double GetFloatLitter(byte[] srcArr, int start, int count)
|
||||
{
|
||||
byte[] times = new byte[count];
|
||||
Buffer.BlockCopy(srcArr, start, times, 0, 4);
|
||||
Array.Reverse(times);
|
||||
|
||||
if (count == 4)
|
||||
{
|
||||
double number = BitConverter.ToSingle(times, 0);
|
||||
return number;
|
||||
}
|
||||
else
|
||||
{
|
||||
double number = BitConverter.ToDouble(times, 0);
|
||||
return number;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="ms"></param>
|
||||
/// <returns></returns>
|
||||
public static double MsToMin(int ms)
|
||||
{
|
||||
int sToMs = 60 * 1000;
|
||||
int m = ms / sToMs;
|
||||
double mx = (ms % sToMs) / (sToMs * 1.0);
|
||||
double min = Math.Round(m + mx, 5, MidpointRounding.AwayFromZero);
|
||||
|
||||
return min;
|
||||
}
|
||||
}
|
||||
}
|
20
dataAnalize/Program.cs
Normal file
20
dataAnalize/Program.cs
Normal file
@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace dataAnalize
|
||||
{
|
||||
static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// 应用程序的主入口点。
|
||||
/// </summary>
|
||||
[STAThread]
|
||||
static void Main()
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new MainForm());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
36
dataAnalize/Properties/AssemblyInfo.cs
Normal file
36
dataAnalize/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 有关程序集的常规信息通过以下
|
||||
// 特性集控制。更改这些特性值可修改
|
||||
// 与程序集关联的信息。
|
||||
[assembly: AssemblyTitle("dataAnalize")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Microsoft")]
|
||||
[assembly: AssemblyProduct("dataAnalize")]
|
||||
[assembly: AssemblyCopyright("Copyright © Microsoft 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// 将 ComVisible 设置为 false 使此程序集中的类型
|
||||
// 对 COM 组件不可见。 如果需要从 COM 访问此程序集中的类型,
|
||||
// 则将该类型上的 ComVisible 特性设置为 true。
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 如果此项目向 COM 公开,则下列 GUID 用于类型库的 ID
|
||||
[assembly: Guid("c1b83702-cb37-4d03-baca-1efef01050ea")]
|
||||
|
||||
// 程序集的版本信息由下面四个值组成:
|
||||
//
|
||||
// 主版本
|
||||
// 次版本
|
||||
// 生成号
|
||||
// 修订号
|
||||
//
|
||||
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
|
||||
// 方法是按如下所示使用“*”:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
63
dataAnalize/Properties/Resources.Designer.cs
generated
Normal file
63
dataAnalize/Properties/Resources.Designer.cs
generated
Normal file
@ -0,0 +1,63 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.18408
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace dataAnalize.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("dataAnalize.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
117
dataAnalize/Properties/Resources.resx
Normal file
117
dataAnalize/Properties/Resources.resx
Normal 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>
|
26
dataAnalize/Properties/Settings.Designer.cs
generated
Normal file
26
dataAnalize/Properties/Settings.Designer.cs
generated
Normal file
@ -0,0 +1,26 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.18408
|
||||
//
|
||||
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||
// 重新生成代码,这些更改将会丢失。
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace dataAnalize.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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
7
dataAnalize/Properties/Settings.settings
Normal file
7
dataAnalize/Properties/Settings.settings
Normal 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>
|
3
dataAnalize/app.config
Normal file
3
dataAnalize/app.config
Normal file
@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup><supportedRuntime version="v2.0.50727"/></startup></configuration>
|
89
dataAnalize/dataAnalize.csproj
Normal file
89
dataAnalize/dataAnalize.csproj
Normal file
@ -0,0 +1,89 @@
|
||||
<?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>{413C6A2F-A21C-472B-9669-50BDDCC65F51}</ProjectGuid>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>dataAnalize</RootNamespace>
|
||||
<AssemblyName>dataAnalize</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<TargetFrameworkProfile />
|
||||
</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>
|
||||
</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>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<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="FileHelper.cs" />
|
||||
<Compile Include="MainForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainForm.Designer.cs">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MsAnalyzeUtil.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.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="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>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<!-- 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>
|
Loading…
x
Reference in New Issue
Block a user