结构化读取csv中的光谱数据
This commit is contained in:
@ -16,10 +16,11 @@ namespace mainProgram
|
||||
}
|
||||
|
||||
private string mProjectPath;
|
||||
private string mMetadataPath;
|
||||
private string mRawPath;
|
||||
private string mRadPath;
|
||||
private string mSifPath;
|
||||
|
||||
|
||||
public string ProjectPath
|
||||
{
|
||||
get
|
||||
@ -32,12 +33,31 @@ namespace mainProgram
|
||||
}
|
||||
}
|
||||
|
||||
public void CreateProject()
|
||||
public void CreateProject(string dataPath)
|
||||
{
|
||||
//if (mProjectPath.Length==0)
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
if (mProjectPath.Length == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
DelectDir(mProjectPath);//删除工程路径下的所有内容
|
||||
CreateProjectStructure();
|
||||
CopyFileToFile(dataPath);//复制原始数据文件到工程结构对应文件夹
|
||||
|
||||
////创建工程元数据
|
||||
//string myXMLFilePath = mMetadataPath + "/metadata.xml";
|
||||
////生成xml文件
|
||||
//GenerateXMLFile(myXMLFilePath);
|
||||
////遍历xml文件的信息
|
||||
//GetXMLInformation(myXMLFilePath);
|
||||
////修改xml文件的信息
|
||||
//ModifyXmlInformation(myXMLFilePath);
|
||||
////向xml文件添加节点信息
|
||||
//AddXmlInformation(myXMLFilePath);
|
||||
////删除指定节点信息
|
||||
//DeleteXmlInformation(myXMLFilePath);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void OpenProject()
|
||||
@ -254,19 +274,19 @@ namespace mainProgram
|
||||
|
||||
for (int i = 0; i < sourceFilesPath.Length; i++)
|
||||
{
|
||||
string sourceFilePath = (sourceFilesPath[i]).Replace("\\", "/");
|
||||
string[] forlders = sourceFilePath.Split('/');
|
||||
string sourceFilePath = sourceFilesPath[i];
|
||||
string[] forlders = sourceFilePath.Split('\\');
|
||||
|
||||
if (File.Exists(sourceFilePath))//是文件,直接拷贝
|
||||
{
|
||||
string dest = destFolderName;
|
||||
string sourceFileName = Path.GetFileName(sourceFilePath);
|
||||
string sourceFileName = Path.GetFileName(sourceFilePath);//获取文件名
|
||||
File.Copy(sourceFilePath, Path.Combine(dest, sourceFileName), overwrite);
|
||||
}
|
||||
else if (Directory.Exists(sourceFilePath))//是文件夹,拷贝文件夹;并递归
|
||||
{
|
||||
string lastDirectory = forlders[forlders.Length - 1];
|
||||
string dest = Path.Combine(destFolderName, lastDirectory).Replace("\\", "/");
|
||||
string dest = Path.Combine(destFolderName, lastDirectory);
|
||||
|
||||
if (!Directory.Exists(dest))
|
||||
{
|
||||
@ -279,7 +299,6 @@ namespace mainProgram
|
||||
|
||||
private void DelectDir(string srcPath)
|
||||
{
|
||||
|
||||
DirectoryInfo dir = new DirectoryInfo(srcPath);
|
||||
FileSystemInfo[] fileinfo = dir.GetFileSystemInfos(); //返回目录中所有文件和子目录
|
||||
foreach (FileSystemInfo i in fileinfo)
|
||||
@ -302,9 +321,20 @@ namespace mainProgram
|
||||
public void CreateProjectStructure()
|
||||
{
|
||||
//创建工程文件夹结构
|
||||
mRawPath = mProjectPath + "/raw/";
|
||||
mRadPath = mProjectPath + "/rad/";
|
||||
mSifPath = mProjectPath + "/sif/";
|
||||
//mMetadataPath = mProjectPath + "\\.project\\";
|
||||
//mRawPath = mProjectPath + "\\1raw\\";
|
||||
//mRadPath = mProjectPath + "\\2rad\\";
|
||||
//mSifPath = mProjectPath + "\\3sif\\";
|
||||
|
||||
mMetadataPath = Path.Combine(mProjectPath, ".project");
|
||||
mRawPath = Path.Combine(mProjectPath, "1raw");
|
||||
mRadPath = Path.Combine(mProjectPath, "2rad");
|
||||
mSifPath = Path.Combine(mProjectPath, "3sif");
|
||||
|
||||
if (false == Directory.Exists(mMetadataPath))
|
||||
{
|
||||
Directory.CreateDirectory(mMetadataPath);
|
||||
}
|
||||
if (false == Directory.Exists(mRawPath))
|
||||
{
|
||||
Directory.CreateDirectory(mRawPath);
|
||||
@ -318,5 +348,37 @@ namespace mainProgram
|
||||
Directory.CreateDirectory(mSifPath);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//处理工程中的数据
|
||||
public void Rad()
|
||||
{
|
||||
//string[] sourceFilesPath = Directory.GetFileSystemEntries(sourceFolderName);
|
||||
|
||||
//for (int i = 0; i < sourceFilesPath.Length; i++)
|
||||
//{
|
||||
// string sourceFilePath = sourceFilesPath[i];
|
||||
// string[] forlders = sourceFilePath.Split('\\');
|
||||
|
||||
// if (File.Exists(sourceFilePath))//是文件,直接拷贝
|
||||
// {
|
||||
// string dest = destFolderName;
|
||||
// string sourceFileName = Path.GetFileName(sourceFilePath);//获取文件名
|
||||
// File.Copy(sourceFilePath, Path.Combine(dest, sourceFileName), overwrite);
|
||||
// }
|
||||
// else if (Directory.Exists(sourceFilePath))//是文件夹,拷贝文件夹;并递归
|
||||
// {
|
||||
// string lastDirectory = forlders[forlders.Length - 1];
|
||||
// string dest = Path.Combine(destFolderName, lastDirectory);
|
||||
|
||||
// if (!Directory.Exists(dest))
|
||||
// {
|
||||
// Directory.CreateDirectory(dest);
|
||||
// }
|
||||
// CopySubFun(sourceFilePath, dest, overwrite);
|
||||
// }
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user