using System;
usingSystem.Collections.Generic;
usingSystem.Text;
using System.IO;
namespace ConsoleApplication1
{
class Program
{
stringchoice,c,d,E;
public void n()
{
Console.WriteLine("Welcome To Turning GNIITians Discovery !!!!");
Console.WriteLine("");
Console.WriteLine("Choice-");
Console.WriteLine("A.New");
Console.WriteLine("B.Edit");
Console.WriteLine("C.Close");
Console.WriteLine("");
Console.WriteLine(" Enter Your Choice From The Above:- ");
choice = Console.ReadLine();
Directory.CreateDirectory("D:\\SMBRD");
if (choice == "A")
{
Console.WriteLine("Enter Your File Name(Max 8 characters)-");
string name = Console.ReadLine();
if(name.Length>8 || name.Length<=0)
{
do
{
Console.WriteLine("Please re-enter file name");
name = Console.ReadLine();
}
while(name.Length>8 || name.Length<=0);
}
else
{
Console.WriteLine(" Enter Your Data ");
E = Console.ReadLine();
FileStreamfs = new FileStream(@"D:\SMBRD\" + name + ".txt", FileMode.Create, FileAccess.Write, FileShare.Write);
StreamWriterst = new StreamWriter(fs);
st.WriteLine(E);
st.Flush();
st.Close();
fs.Close();
}
}
else if (choice == "B")
{
string search;
Console.WriteLine("Please Enter The FileName");
search= Console.ReadLine();
StreamReadersr = new StreamReader(new FileStream(@"D:\SMBRD\" + search + ".txt", FileMode.Open, FileAccess.ReadWrite));
sr.BaseStream.Seek(0, SeekOrigin.Begin);
stringnem = sr.ReadToEnd();
if (nem != null)
{
Console.WriteLine("");
Console.WriteLine(nem);
Console.WriteLine("");
Console.WriteLine("Want to Edit??");
if (c == "y")
{
Console.WriteLine("Enter The Data");
d = Console.ReadLine();
FileStreamfs = new FileStream(@"D:\SMBRD\" + search + ".txt", FileMode.Append, FileAccess.Write);
StreamWriterstt = new StreamWriter(fs);
stt.WriteLine(d);
Console.WriteLine("Data Saved");
}
}
}
else if (choice == "c")
{
Console.WriteLine("Thank You For Using HC Notepad !!!!");
Environment.Exit(0);
}
}
static void Main(string[] args)
{
Program m = new Program();
m.n();
Console.ReadLine();
}
}
}
It is successfully Running .. But there Are Some Problems ....
- I Want to Know How To search files that are saved on the Driive ??
- ANy more suggestions regarding it?
- How to Make It more UseFul ?
Please also me the mistakes i am doing in it.