📄 filesys.cpp
字号:
#include <stdio.h>
#include <iostream>
#include <vector>
#include <string>
#include "File.h"
#include "FileSys.h"
#include "Texts.h"
using namespace std ;
int main ()
{
PreShow();
cout << "FileSystem:\\>";
MyFile.FileRow = 1;
MyFile.FileLie = 1;
MyText.Lies = 1;
MyFile.TextAmount = 0;
TextConfig = 0;
//Files MyFile;
vector<string>::iterator Pos;
//string Commands;
string MainFile = "MainDiractory";
cin >> Commands;
while (Commands!="-Exit")
{
if (Commands=="-CreFile")
{
CreateFile();
MyFile.ChangeDir = 1;
}
if (Commands=="-CreSFile")
{
if (MyFile.FileRow==1)
{
cout <<"请先使用-CreFile命令创建文件"<<endl;
cout <<"FileSystem:\\>";
cin>>Commands;
}
else
{
CreSFile();
MyFile.ChangeDir = 1;
}
}
if (Commands=="-DelFile")
{
DeleteFile();
}
//if (Commands=="-DelText")
//{
// DeleteText();
//}
if (Commands=="-CreText")
{
CreateText();
MyFile.TextAmount++;
TextConfig=MyFile.TextAmount;
MyFile.ChangeDir = 2;
}
if (Commands=="-ChaDir")
{
if (MyFile.ChangeDir==1)
{
MyFile.FileRow--;
}
if (MyFile.ChangeDir==2)
{
MyFile.ChangeDir=1;
}
ChangeDir();
}
if (Commands=="-ShowDir")
{
if (MyFile.ChangeDir==1)
{
cout << "当前目录下文件为:"<<endl;
cout << "文件夹: ";
for (int m=1;m<=MyFile.FileLie;m++)
{
cout<<MyFile.FileName[m][MyFile.FileRow]<<" ";
}
cout <<endl;
cout << "文本文件: ";
for (int m=1;m<=MyText.Lies;m++)
{
cout<<MyText.TextName[m][MyFile.FileRow]<<" ";
}
cout <<endl;
}
else
{
cout << "当前所在位置为文本,没有子目录,查询文本内容请输入命令'-SFCont'"<<endl;
}
cout <<"FileSystem:\\>";
cin>>Commands;
}
if (Commands=="-Help")
{
Helps();
}
if (Commands=="-SFCont")
{
//if ((MyFile.TextAmount==0)||(TextConfig!=MyFile.TextAmount))
//{
// cout <<"没有可显示的文档";
//}
//if ((MyFile.TextAmount==0)||MyText.Contents[MyFile.FileLie][MyFile.FileRow]==0)
//{
// cout <<"没有可显示的文档";
//}
if (MyFile.TextAmount==0)
{
cout <<"没有可显示的文档";
}
else
{
/*cout <<"最近文本"<<MyFile.CurrentDir<<" 内容是:"<<endl;*/
for (int m=1;m<=MyText.Lies;m++)
{
cout <<"文本"<<MyText.TextName[m][MyFile.FileRow]<<"内容是:"<<endl;
for (Pos=MyText.FileContents[m][MyFile.FileRow].begin();Pos!=MyText.FileContents[m][MyFile.FileRow].end();Pos++)
{
cout <<*Pos<<" ";
}
cout <<endl;
}
}
cout << endl<<"FileSystem:\\>";
cin>>Commands;
}
else if((Commands!="-ShowDir")&&(Commands!="-CreSFile")&&(Commands!="-ChaDir")&&(Commands!="-SFCont")&&(Commands!="-Exit")&&(Commands!="-Help")&&(Commands!="-CreFile")&&(Commands!="-DelFile")&&(Commands!="-CreText"))
{
cout << "没有此项命令,请输入-Help查询命令"<<endl;
cout << "FileSystem:\\>";
cin>>Commands;
}
}
//for (Pos=MyFile.FileContents[MyFile.TextAmount-1].begin();Pos!=MyFile.FileContents[MyFile.TextAmount-1].end();Pos++)
//{
// cout <<*Pos<<" ";
//}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -