-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
1,060 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
Microsoft Visual Studio Solution File, Format Version 12.00 | ||
# Visual Studio Version 17 | ||
VisualStudioVersion = 17.7.34003.232 | ||
MinimumVisualStudioVersion = 10.0.40219.1 | ||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TsegabOS", "TsegabOS\TsegabOS.csproj", "{D3938BD9-9675-48BA-826A-1297871428E2}" | ||
EndProject | ||
Global | ||
GlobalSection(SolutionConfigurationPlatforms) = preSolution | ||
Debug|Any CPU = Debug|Any CPU | ||
Release|Any CPU = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
{D3938BD9-9675-48BA-826A-1297871428E2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU | ||
{D3938BD9-9675-48BA-826A-1297871428E2}.Debug|Any CPU.Build.0 = Debug|Any CPU | ||
{D3938BD9-9675-48BA-826A-1297871428E2}.Release|Any CPU.ActiveCfg = Release|Any CPU | ||
{D3938BD9-9675-48BA-826A-1297871428E2}.Release|Any CPU.Build.0 = Release|Any CPU | ||
EndGlobalSection | ||
GlobalSection(SolutionProperties) = preSolution | ||
HideSolutionNode = FALSE | ||
EndGlobalSection | ||
GlobalSection(ExtensibilityGlobals) = postSolution | ||
SolutionGuid = {6205A50E-A6EE-43DF-AD3C-C77D1B0CDD23} | ||
EndGlobalSection | ||
EndGlobal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using Sys = Cosmos.System; | ||
using System.Threading; | ||
using System.ComponentModel.Design; | ||
using Cosmos.System.Graphics; | ||
using System.Drawing; | ||
using Cosmos.System.FileSystem; | ||
using TsegabOS; | ||
using System.Linq; | ||
|
||
namespace TsegabOS.Apps | ||
{ | ||
public class Ascii | ||
{ | ||
public static string Command1; | ||
public static void Test() | ||
{ | ||
|
||
//Welcome | ||
Console.ForegroundColor = ConsoleColor.Green; | ||
Console.WriteLine(@" | ||
__ __ .__ | ||
/ \ / \ ____ | | ____ ____ _____ ____ | ||
\ \/\/ /_/ __ \ | | _/ ___\ / _ \ / \ _/ __ \ | ||
\ / \ ___/ | |__\ \___( <_> )| Y Y \\ ___/ | ||
\__/\ / \___ >|____/ \___ >\____/ |__|_| / \___ > | ||
\/ \/ \/ \/ \/ | ||
"); | ||
Console.ResetColor(); | ||
//end of the welcome sign | ||
while (true) | ||
{ | ||
Console.Write("Ascii>"); | ||
Command1 = Console.ReadLine(); | ||
if (Command1 == "a") | ||
{ | ||
Console.WriteLine(@" | ||
________ | ||
|\ __ \ | ||
\ \ \|\ \ | ||
\ \ __ \ | ||
\ \ \ \ \ | ||
\ \__\ \__\ | ||
\|__|\|__| | ||
"); | ||
} | ||
else if (Command1 == "b") | ||
{ | ||
Console.WriteLine(@" | ||
________ | ||
|\ __ \ | ||
\ \ \|\ /_ | ||
\ \ __ \ | ||
\ \ \|\ \ | ||
\ \_______\ | ||
\|_______| | ||
"); | ||
} | ||
else if (Command1 == "c") | ||
{ | ||
Console.WriteLine(@" | ||
________ | ||
|\ ____\ | ||
\ \ \___| | ||
\ \ \ | ||
\ \ \____ | ||
\ \_______\ | ||
\|_______| | ||
"); | ||
} | ||
else if (Command1 == "d") | ||
{ | ||
Console.WriteLine(@" | ||
,---, | ||
,---.'| | ||
| | : | ||
| | | | ||
,--.__| | | ||
/ ,' | | ||
. ' / | | ||
' ; |: | | ||
| | '/ ' | ||
| : :| | ||
\ \ / | ||
`----' | ||
"); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Cosmos.System.FileSystem; | ||
using Cosmos.System.FileSystem.VFS; | ||
using Sys = Cosmos.System; | ||
|
||
namespace TsegabOS.Apps | ||
{ | ||
public class Program | ||
{ | ||
public static void Main() | ||
{ | ||
FileOperations(); | ||
} | ||
|
||
public static void FileOperations() | ||
{ | ||
SimpleFileSystem fileSystem = new SimpleFileSystem(); // Create an instance of your file system | ||
|
||
while (true) | ||
{ | ||
Console.Write("FileViewer> "); | ||
string command = Console.ReadLine(); | ||
|
||
if (command == "help") | ||
{ | ||
Console.WriteLine(@"add [your file name.txt] - to create a new file | ||
delete [your file name.txt] - to delete the file | ||
edit [your file name.txt] - to edit the file contents | ||
view [your file name.txt] - to view the contents"); | ||
} | ||
if (command == "exit") | ||
{ | ||
break; | ||
} | ||
else if (command == "list") | ||
{ | ||
List<string> fileList = fileSystem.GetFileList(); | ||
Console.WriteLine("Files in the system:"); | ||
foreach (string fileName in fileList) | ||
{ | ||
Console.WriteLine(fileName); | ||
} | ||
} | ||
else if (command.StartsWith("add ")) | ||
{ | ||
string fileName = command.Substring(4); | ||
fileSystem.CreateFile(fileName); | ||
Console.WriteLine($"File '{fileName}' added."); | ||
} | ||
else if (command.StartsWith("delete ")) | ||
{ | ||
string fileName = command.Substring(7); | ||
if (fileSystem.FileExists(fileName)) | ||
{ | ||
fileSystem.DeleteFile(fileName); | ||
Console.WriteLine($"File '{fileName}' deleted."); | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"File '{fileName}' not found."); | ||
} | ||
} | ||
else if (command.StartsWith("edit ")) | ||
{ | ||
string fileName = command.Substring(5); | ||
if (fileSystem.FileExists(fileName)) | ||
{ | ||
Console.Write("Enter additional content: "); | ||
string additionalContent = Console.ReadLine(); | ||
fileSystem.EditFile(fileName, additionalContent); | ||
Console.WriteLine($"File '{fileName}' edited."); | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"File '{fileName}' not found."); | ||
} | ||
} | ||
else if (command.StartsWith("view ")) | ||
{ | ||
string fileName = command.Substring(5); | ||
if (fileSystem.FileExists(fileName)) | ||
{ | ||
string content = fileSystem.ReadFile(fileName); | ||
Console.WriteLine($"Content of '{fileName}':"); | ||
Console.WriteLine(content); | ||
} | ||
else | ||
{ | ||
Console.WriteLine($"File '{fileName}' not found."); | ||
} | ||
} | ||
else | ||
{ | ||
Console.WriteLine("Invalid command."); | ||
} | ||
} | ||
} | ||
} | ||
|
||
public class SimpleFileSystem | ||
{ | ||
private string fileContent = ""; | ||
private bool fileExists = false; | ||
private List<string> fileNames = new List<string>(); | ||
|
||
public void CreateFile(string fileName) | ||
{ | ||
Console.WriteLine($"Creating file: {fileName}"); | ||
fileExists = true; | ||
fileNames.Add(fileName); | ||
} | ||
|
||
public void WriteToFile(string fileName, string content) | ||
{ | ||
Console.WriteLine($"Writing content to {fileName}: {content}"); | ||
fileContent = content; | ||
} | ||
|
||
public string ReadFile(string fileName) | ||
{ | ||
Console.WriteLine($"Reading content from {fileName}"); | ||
return fileContent; | ||
} | ||
|
||
public void DeleteFile(string fileName) | ||
{ | ||
Console.WriteLine($"Deleting file: {fileName}"); | ||
fileContent = ""; | ||
fileExists = false; | ||
fileNames.Remove(fileName); | ||
} | ||
|
||
public void EditFile(string fileName, string additionalContent) | ||
{ | ||
Console.WriteLine($"Editing content of {fileName}: {additionalContent}"); | ||
fileContent += additionalContent; | ||
} | ||
|
||
public bool FileExists(string fileName) | ||
{ | ||
return fileExists; | ||
} | ||
|
||
public List<string> GetFileList() | ||
{ | ||
return fileNames; | ||
} | ||
} | ||
} |
Oops, something went wrong.