mirror of
https://github.com/danbulant/Cosmos
synced 2026-06-06 16:22:40 +00:00
Merge remote-tracking branch 'refs/remotes/CosmosOS/master'
This commit is contained in:
commit
a260690028
10 changed files with 225 additions and 169 deletions
|
|
@ -6,122 +6,118 @@ At a first look, the directory structure of Cosmos is quite confusing. There are
|
||||||
|
|
||||||
### \Artwork
|
### \Artwork
|
||||||
|
|
||||||
Just some Cosmos artwork. It contains Cosmos logo and YouTube channel logo.
|
This directory cointains it contains Cosmos logos and a YouTube channel logo.
|
||||||
|
|
||||||
### \Build
|
### \Build
|
||||||
|
|
||||||
The build directory contains file used to build ISO images and Virtual Machines files and images. There is a folder with support files for BOCHS, for Virtual PC, for VMware, QEMU, for support for boot from ISO CD, USB, Ethernet (PXE).
|
This directory contains file used to build ISO images and Virtual Machines files and images, there is a folder with supporting files for BOCHS, for Virtual PC, for VMware, QEMU and for boot from ISO CD, USB, Ethernet (PXE).
|
||||||
|
|
||||||
### \Demos
|
### \Demos
|
||||||
|
|
||||||
This folder contains some Cosmos demo projects to help you.
|
This directory contains the Cosmos demos projects to help you in programming your operating system.
|
||||||
|
|
||||||
#### \Demos\Guess
|
#### \Demos\Guess
|
||||||
|
|
||||||
This is the basic Cosmos demo project. It's a simple guess-the-number game.
|
This directory contains the basic Cosmos demo project, it's a simple guess-the-number game.
|
||||||
|
|
||||||
### \Docs
|
### \Docs
|
||||||
|
|
||||||
This folder contains the Cosmos documentation that you're currently reading.
|
This direcotry contains the Cosmos documentation that you're currently reading.
|
||||||
|
|
||||||
### \QA
|
### \QA
|
||||||
|
|
||||||
This folder contains the old Cosmos build scripts.
|
This directory contains the old Cosmos build scripts, it's no more used at the moment.
|
||||||
It isn't used at the moment.
|
|
||||||
|
|
||||||
### \Resources
|
### \Resources
|
||||||
|
|
||||||
This folder contains the 3rd party libraries that Cosmos uses.
|
This directory contains the third party libraries that Cosmos uses.
|
||||||
|
|
||||||
### \Setup
|
### \Setup
|
||||||
|
|
||||||
Contains scripts and languages to build the Cosmos User Kit Installer. The creation (and execution) of the installer is started from \install-VS2015.bat.
|
This directory contains all the scripts and languages to build the Cosmos User Kit Installer. The creation (and execution) of the installer is started from '.\install-VS2015.bat'.
|
||||||
|
|
||||||
### \Source
|
### \Source
|
||||||
|
|
||||||
Contains all the code of the Cosmos project. You will spend most of your time here.including the Compiler, Installer, Debugger and the main features of Cosmos. It also contains unused code.
|
This directory contains all the code of the Cosmos project. You will spend most of your time here, including the Compiler, Installer, Debugger and the main features of Cosmos. It's contains unused code, the solution file of Cosmos and some support libraries.
|
||||||
|
|
||||||
It also contains the solution file of Cosmos and some support libraries.
|
|
||||||
|
|
||||||
#### \Source\Cosmos.Assembler
|
#### \Source\Cosmos.Assembler
|
||||||
|
|
||||||
This folder contains the Cosmos assembler, the thing that writes generated assembly code in the kernel file.
|
This directory contains the Cosmos assembler, the thing that writes generated assembly code in the kernel file.
|
||||||
|
|
||||||
#### \Source\Cosmos.Build
|
#### \Source\Cosmos.Build
|
||||||
|
|
||||||
Any code related to the building process of Cosmos with the exception of
|
This directory contains any code related to the building process of Cosmos with the exception of
|
||||||
IL2CPU which is however executed from here. Contains code for executing ld,
|
IL2CPU which is however executed from here, it's contains code for executing ld,
|
||||||
nasm, makeiso, MSBuild, and others.
|
nasm, makeiso, MSBuild, and others.
|
||||||
|
|
||||||
#### \Source\Cosmos.Common
|
#### \Source\Cosmos.Common
|
||||||
|
|
||||||
Contains various helpers and files for Cosmos.
|
This directory contains various helpers and files for Cosmos.
|
||||||
|
|
||||||
#### \Source\Cosmos.Core
|
#### \Source\Cosmos.Core
|
||||||
|
|
||||||
This is the core assembly of cosmos. It contains code for managing CPU, IO groups, interrupts, etc.
|
This directory contains the core assembly of cosmos. It contains code for managing CPU, IO groups, interrupts, etc..
|
||||||
|
|
||||||
##### \Source\Cosmos.Core.Plugs
|
##### \Source\Cosmos.Core.Plugs
|
||||||
|
|
||||||
This folder contains the low-level plugs for Cosmos.Core.
|
This directory contains the low-level plugs for Cosmos.Core.
|
||||||
|
|
||||||
#### \Source\Cosmos.Debug
|
#### \Source\Cosmos.Debug
|
||||||
|
|
||||||
Contains the Debug Engine and Connector code. Also gives the possibility to
|
This directory contains the Debug Engine and Connector code and also, it's gives the possibility to
|
||||||
work with GDB. For more informations about debugging see
|
work with GDB. For more informations about debugging see the [Debugger](debugger.htm) page
|
||||||
[Debugger](debugger.htm)
|
|
||||||
|
|
||||||
#### \Source\Cosmos.Deploy
|
#### \Source\Cosmos.Deploy
|
||||||
|
|
||||||
Contains the deployment code.
|
This directory contains the deployment code.
|
||||||
|
|
||||||
#### \Source\Cosmos.HAL
|
#### \Source\Cosmos.HAL
|
||||||
|
|
||||||
Contains code for Csosmos HAL (Hardware Abstraction Layer), means the hardware drivers for graphics, networking, HDD, etc.
|
This directory contains the Cosmos HAL (Hardware Abstraction Layer), means the hardware drivers for graphics, networking, HDD, etc.
|
||||||
|
|
||||||
#### \Source\Cosmos.IL2CPU
|
#### \Source\Cosmos.IL2CPU
|
||||||
|
|
||||||
Code for the IL2CPU program. It's the Cosmos AOT Compiler. For more
|
This directory contains the code for the IL2CPU program, the Cosmos AOT Compiler. For more
|
||||||
informations about AOT compilers and IL2CPU see [IL2CPU](https://github.com/CosmosOS/Cosmos/blob/master/Docs/Compiler/il2cpu.md)
|
informations about the AOT compilers and IL2CPU, see [IL2CPU](https://github.com/CosmosOS/Cosmos/blob/master/Docs/Compiler/il2cpu.md) documentation.
|
||||||
|
|
||||||
#### \Source\Cosmos.System
|
#### \Source\Cosmos.System
|
||||||
|
|
||||||
Contains the system-level code for Cosmos. It contains wrappers for Console, networking and filesystem. It also contains the base class for Kernel.
|
This directory contains the system-level code for Cosmos. It contains wrappers for Console, networking, filesystem and also contains the base class for Kernel.
|
||||||
|
|
||||||
#### \Source\Cosmos.VS
|
#### \Source\Cosmos.VS
|
||||||
|
|
||||||
Contains the code for the integration with Visual Studio. Adds support for the Cosmos Kernel project type, and custom build steps.
|
This directory contains the code for the integration with Visual Studio. Adds support for the Cosmos Kernel project type, and custom build steps.
|
||||||
|
|
||||||
##### \Source\Cosmos.VS.Debug
|
##### \Source\Cosmos.VS.Debug
|
||||||
|
|
||||||
Contains the code for the Visual Studio debugger integration.
|
This directory contains the code for the Visual Studio debugger integration.
|
||||||
|
|
||||||
##### \Source\Cosmos.VS.Package
|
##### \Source\Cosmos.VS.Package
|
||||||
|
|
||||||
Contains the code for the Visual Studio package of Cosmos.
|
This directory contains the code for the Visual Studio package of Cosmos.
|
||||||
|
|
||||||
##### \Source\Cosmos.VS.Windows
|
##### \Source\Cosmos.VS.Windows
|
||||||
|
|
||||||
Contains the Cosmos windows in VS, like the Registers window.
|
This directory contains the Cosmos windows in Visual Studio, like the Registers Window.
|
||||||
|
|
||||||
##### \Source\Cosmos.VS.Windows.Test
|
##### \Source\Cosmos.VS.Windows.Test
|
||||||
|
|
||||||
Contains the tests for Cosmos.VS.Windows.
|
This directory contains the tests for Cosmos.VS.Windows.
|
||||||
|
|
||||||
##### \Source\Cosmos.VS.Wizards
|
##### \Source\Cosmos.VS.Wizards
|
||||||
|
|
||||||
Contains the project wizards of Cosmos.
|
This directory contains the wizards projects of Cosmos.
|
||||||
|
|
||||||
#### \Source\Unused
|
#### \Source\Unused
|
||||||
|
|
||||||
This folder contains work-in-progress or deprecated features, like FAT, VGA and Networking.
|
This directory contains work-in-progress or deprecated features, like FAT, VGA, Networking and more.
|
||||||
|
|
||||||
#### \Source\XSharp
|
#### \Source\XSharp
|
||||||
|
|
||||||
This piece of code gives us the possibility to write Assembly in C#. In this way we can keep all in an OO-like style.
|
This directory contains code for the possibility to write Assembly in C#. In this way we can keep all in an OO-like style.
|
||||||
|
|
||||||
#### \Users
|
#### \Users
|
||||||
|
|
||||||
Custom code playground. You can put your examples, random code, and toughts
|
This directory contains the custom code playground. You can put your examples, random code, and toughts
|
||||||
here
|
here
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -104,7 +104,7 @@ namespace Cosmos.Compiler.Tests.Exceptions
|
||||||
{
|
{
|
||||||
TestReturnSimpleException();
|
TestReturnSimpleException();
|
||||||
}
|
}
|
||||||
catch (Exception ex) where (xShouldCatch == true)
|
catch (Exception ex) when (xShouldCatch == true)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Caught filtered exception.");
|
Console.WriteLine("Caught filtered exception.");
|
||||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||||
|
|
@ -136,7 +136,7 @@ namespace Cosmos.Compiler.Tests.Exceptions
|
||||||
{
|
{
|
||||||
TestReturnSimpleException();
|
TestReturnSimpleException();
|
||||||
}
|
}
|
||||||
catch (Exception ex) where (xShouldCatch == true)
|
catch (Exception ex) when (xShouldCatch == true)
|
||||||
{
|
{
|
||||||
Console.WriteLine("Caught filtered exception.");
|
Console.WriteLine("Caught filtered exception.");
|
||||||
mDebugger.Send("EXCEPTION: " + ex.Message);
|
mDebugger.Send("EXCEPTION: " + ex.Message);
|
||||||
|
|
|
||||||
|
|
@ -1,69 +1,28 @@
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Text;
|
using System.Linq;
|
||||||
using System.IO;
|
|
||||||
using Cosmos.Common.Extensions;
|
|
||||||
using Cosmos.System.FileSystem.VFS;
|
|
||||||
using Cosmos.TestRunner;
|
|
||||||
using Sys = Cosmos.System;
|
using Sys = Cosmos.System;
|
||||||
|
|
||||||
namespace SentinelKernel
|
namespace SentinelKernel
|
||||||
{
|
{
|
||||||
using Cosmos.System.FileSystem;
|
|
||||||
|
|
||||||
public class Kernel : Sys.Kernel
|
public class Kernel : Sys.Kernel
|
||||||
{
|
{
|
||||||
private VFSBase myVFS;
|
|
||||||
|
|
||||||
protected override void BeforeRun()
|
protected override void BeforeRun()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Cosmos booted successfully.");
|
|
||||||
myVFS = new CosmosVFS();
|
|
||||||
VFSManager.RegisterVFS(myVFS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void Run()
|
protected override void Run()
|
||||||
{
|
{
|
||||||
Console.WriteLine("Run");
|
var xList = new List<string> { "A", "B" };
|
||||||
try
|
|
||||||
{
|
|
||||||
var xRoot = Path.GetPathRoot(@"0:\test");
|
|
||||||
bool xTest = Directory.Exists("0:\\test");
|
|
||||||
Console.WriteLine("After test");
|
|
||||||
Assert.IsTrue(xTest, "Folder does not exist!");
|
|
||||||
|
|
||||||
Console.WriteLine("Folder exists!");
|
string[] xArray = new[] { "A", "B" };
|
||||||
xTest = Directory.Exists("0:\\test\\DirInTest");
|
// var xItem = xList.First(); // mkrefany
|
||||||
Assert.IsTrue(xTest, "Subfolder doesn't exist!");
|
|
||||||
|
|
||||||
xTest = File.Exists(@"0:\KudzU.txt");
|
|
||||||
Assert.IsTrue(xTest, @"\Kudzu.txt not found!");
|
|
||||||
|
|
||||||
Console.WriteLine("Kudzu.txt found!");
|
string xItem = string.Join("|", xArray);
|
||||||
Console.Write("File contents of Kudzu.txt: ");
|
Console.WriteLine(xItem);
|
||||||
Console.WriteLine(File.ReadAllText(@"0:\Kudzu.txt"));
|
|
||||||
// File.WriteAllText(@"0:\Kudzu.txt", "Test FAT write.");
|
|
||||||
// Console.WriteLine(File.ReadAllText(@"0:\Kudzu.txt"));
|
|
||||||
|
|
||||||
//xTest = File.Exists(@"0:\Test\DirInTest\Readme.txt");
|
|
||||||
//if (!xTest)
|
|
||||||
//{
|
|
||||||
// Console.WriteLine(@"\Test\DirInTest\Readme.txt not found!");
|
|
||||||
// return;
|
|
||||||
//}
|
|
||||||
|
|
||||||
//Console.WriteLine(@"Test\DirInTest\Readme.txt found!");
|
|
||||||
|
|
||||||
//Console.WriteLine(@"File contents of Test\DirInTest\Readme.txt: ");
|
|
||||||
//Console.WriteLine(File.ReadAllText(@"0:\Test\DirInTest\Readme.txt"));
|
|
||||||
Stop();
|
|
||||||
}
|
|
||||||
catch (Exception e)
|
|
||||||
{
|
|
||||||
Console.WriteLine("Exception occurred:");
|
|
||||||
Console.WriteLine(e.Message);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@
|
||||||
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
|
<VMware_OutputPath>bin\Debug\</VMware_OutputPath>
|
||||||
<VMware_EnableGDB>False</VMware_EnableGDB>
|
<VMware_EnableGDB>False</VMware_EnableGDB>
|
||||||
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
|
<VMware_StartCosmosGDB>False</VMware_StartCosmosGDB>
|
||||||
<EnableBochsDebug>True</EnableBochsDebug>
|
<EnableBochsDebug>False</EnableBochsDebug>
|
||||||
<Bochs_Name>SentinelKernelBoot</Bochs_Name>
|
<Bochs_Name>SentinelKernelBoot</Bochs_Name>
|
||||||
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
|
<Bochs_Description>Use Bochs emulator to deploy and debug.</Bochs_Description>
|
||||||
<Bochs_Deployment>ISO</Bochs_Deployment>
|
<Bochs_Deployment>ISO</Bochs_Deployment>
|
||||||
|
|
@ -56,9 +56,9 @@
|
||||||
<Bochs_OutputPath>bin\Debug\</Bochs_OutputPath>
|
<Bochs_OutputPath>bin\Debug\</Bochs_OutputPath>
|
||||||
<Bochs_EnableGDB>False</Bochs_EnableGDB>
|
<Bochs_EnableGDB>False</Bochs_EnableGDB>
|
||||||
<Bochs_StartCosmosGDB>false</Bochs_StartCosmosGDB>
|
<Bochs_StartCosmosGDB>false</Bochs_StartCosmosGDB>
|
||||||
<Bochs_EnableBochsDebug>True</Bochs_EnableBochsDebug>
|
<Bochs_EnableBochsDebug>False</Bochs_EnableBochsDebug>
|
||||||
<VMware_EnableBochsDebug>True</VMware_EnableBochsDebug>
|
<VMware_EnableBochsDebug>True</VMware_EnableBochsDebug>
|
||||||
<TraceAssemblies>All</TraceAssemblies>
|
<TraceAssemblies>User</TraceAssemblies>
|
||||||
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
|
<VMware_TraceAssemblies>All</VMware_TraceAssemblies>
|
||||||
<IntelEdison_Name>SentinelKernelBoot</IntelEdison_Name>
|
<IntelEdison_Name>SentinelKernelBoot</IntelEdison_Name>
|
||||||
<IntelEdison_Description>Connect to Intel Edison device to deploy and debug.</IntelEdison_Description>
|
<IntelEdison_Description>Connect to Intel Edison device to deploy and debug.</IntelEdison_Description>
|
||||||
|
|
@ -102,7 +102,7 @@
|
||||||
<USB_EnableGDB>True</USB_EnableGDB>
|
<USB_EnableGDB>True</USB_EnableGDB>
|
||||||
<USB_StartCosmosGDB>True</USB_StartCosmosGDB>
|
<USB_StartCosmosGDB>True</USB_StartCosmosGDB>
|
||||||
<USB_EnableBochsDebug>True</USB_EnableBochsDebug>
|
<USB_EnableBochsDebug>True</USB_EnableBochsDebug>
|
||||||
<Bochs_TraceAssemblies>All</Bochs_TraceAssemblies>
|
<Bochs_TraceAssemblies>User</Bochs_TraceAssemblies>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\..\..\source\Cosmos.Core.Plugs\Cosmos.Core.Plugs.csproj">
|
<ProjectReference Include="..\..\..\source\Cosmos.Core.Plugs\Cosmos.Core.Plugs.csproj">
|
||||||
|
|
|
||||||
40
readme.md
40
readme.md
|
|
@ -1,42 +1,40 @@
|
||||||
### C# Open Source Managed Operating System
|
### Cosmos (C# Open Source Managed Operating System)
|
||||||
|
|
||||||
[](https://gitter.im/CosmosOS/Cosmos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
[](https://gitter.im/CosmosOS/Cosmos?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
||||||
[](https://github.com/CosmosOS/Cosmos/releases)
|
[](https://github.com/CosmosOS/Cosmos/releases)
|
||||||
|
|
||||||
[We are currently migrating from codeplex](http://cosmos.codeplex.com/)
|
|
||||||
|
|
||||||
Cosmos is an operating system "construction kit", built from the ground up around the IL2CPU compiler in C# and our home-brewed language called X#.
|
Cosmos is an operating system "construction kit", built from the ground up around the IL2CPU compiler in C# and our home-brewed language called X#.
|
||||||
|
|
||||||
It's current stage is only usable for academic work. Some day Cosmos will be ready for production work, but to reach that stage we need more developers. Specifically, we need a few more low level developers to help the few core developers who are currently overwhelmed with work.
|
It's current stage is only usable for academic work. Some day Cosmos will be ready for production work, but to reach that stage we need more developers. Specifically, we need a few more low-level developers to help the few core developers who are currently overwhelmed with work.
|
||||||
|
|
||||||
|
|
||||||
Download
|
Downloads:
|
||||||
---------
|
---------
|
||||||
|
|
||||||
Cosmos is available in two forms:
|
Cosmos is available in two flavors:
|
||||||
* **User Kit** - User Kit allows you to develop your own custom operating system in Visual Studio.
|
* **User Kit** - The User Kit is used to develop your operating system in Visual Studio.
|
||||||
If you are new to Cosmos, [start here](https://github.com/CosmosOS/Cosmos/wiki). [Latest Release](https://github.com/CosmosOS/Cosmos/releases/latest)
|
If you are new to Cosmos, you can learn [here](https://github.com/CosmosOS/Cosmos/wiki). [Latest Release anvailable](https://github.com/CosmosOS/Cosmos/releases/latest)
|
||||||
* **Dev Kit** - Dev Kit is the full Cosmos source with build tools.
|
* **Development Kit** - The Development Kit is the full Cosmos source and build tools.
|
||||||
If you need to modify core Cosmos functions or modify built in drivers, boot, compiler, etc then you will need to use Dev Kit.
|
If you need to modify the Cosmos core functions or modify built-in drivers, boot, compiler, etc.. you will need to use Development Kit.
|
||||||
[How to build the Dev Kit](https://github.com/CosmosOS/Cosmos/wiki/Devkit) - Building from source is easy with our automated builder.
|
[Tutorial for building the Development Kit](https://github.com/CosmosOS/Cosmos/wiki/Devkit) - Building from the source is easy with our automated builder.
|
||||||
|
|
||||||
|
|
||||||
Getting Started
|
Getting Started
|
||||||
---------
|
---------
|
||||||
|
|
||||||
* [Cosmos Documentation](https://github.com/CosmosOS/Cosmos/wiki)
|
* [Documentation for Cosmos](https://github.com/CosmosOS/Cosmos/wiki)
|
||||||
* Video: [Using VS Express Editions](https://www.youtube.com/watch?v=NNl8S2xOtdo)
|
* Video Tutorial for [using Visual Studio Express Editions](https://www.youtube.com/watch?v=NNl8S2xOtdo)
|
||||||
* [FAQ](https://github.com/CosmosOS/Cosmos/wiki/FAQ)
|
* [FAQ (Frequently Asked Questions)](https://github.com/CosmosOS/Cosmos/wiki/FAQ)
|
||||||
* [Low Hanging Fruit](https://github.com/CosmosOS/Cosmos/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity_low+sort%3Acreated-asc) - Looking for something easy to do and prove your worth in Cosmos? Here are a few easy tasks we have on our to do list that are also of importance to us.
|
* [Low Hanging Fruit](https://github.com/CosmosOS/Cosmos/issues?q=is%3Aopen+is%3Aissue+label%3Acomplexity_low+sort%3Acreated-asc) - Looking for something easy to do and prove your worth in Cosmos? Here are a few easy tasks we have on our to do list that are also of importance to us.
|
||||||
|
|
||||||
|
|
||||||
Joining Cosmos
|
Joining and helping Cosmos
|
||||||
---------
|
---------
|
||||||
|
|
||||||
* [Gitter.im](https://gitter.im/CosmosOS/Cosmos) - Live chat. Click the green `Join Chat` badge at the top of this file. As with the IRC and CodePlex chatroom, please be patient if we don't respond immediately (no pinging).
|
* [Gitter.im](https://gitter.im/CosmosOS/Cosmos) - The Live Chat: Click the green `Join Chat` badge at the top of this file. As with the IRC and CodePlex chat, please be patient if we don't respond immediately (no pinging).
|
||||||
* [Yahoo Group](https://tech.groups.yahoo.com/group/Cosmos-Dev) - Email Discussion List. To prevent spambots from spamming our list we ask you introduce yourself to join. Please mention something specific to Cosmos. "Hey I want to join" won't get you in....
|
* [Yahoo Group](https://tech.groups.yahoo.com/group/Cosmos-Dev) - Email Discussion List: To prevent spam-bots from spamming, we ask you introduce yourself to join. Please mention something specific to Cosmos. For example: "Hey, I want to join" and will won't get you in....
|
||||||
* [Facebook](http://www.facebook.com/pages/Cosmos-Operating-System/10235842745) - Like us to see frequent updates of what is going on with Cosmos.
|
* [Facebook](http://www.facebook.com/pages/Cosmos-Operating-System/10235842745) - Like us to see frequent updates of what is going on with Cosmos.
|
||||||
* [YouTube Channel](https://www.youtube.com/channel/UCsSKtqjfpSR0B3Ov4cBIarQ/) - Follow use to see useful videos.
|
* [YouTube Channel](https://www.youtube.com/channel/UCsSKtqjfpSR0B3Ov4cBIarQ/) - Follow to see useful videos and help you programming your operating system.
|
||||||
* [Resources](https://github.com/CosmosOS/Cosmos/wiki/Resources) - More Cosmos related links.
|
* [Resources](https://github.com/CosmosOS/Cosmos/wiki/Resources) - More Cosmos related links.
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -48,14 +46,14 @@ Articles and Resources
|
||||||
* [Intro to Plugs](https://github.com/CosmosOS/Cosmos/wiki/Intro-to-Plugs)
|
* [Intro to Plugs](https://github.com/CosmosOS/Cosmos/wiki/Intro-to-Plugs)
|
||||||
* [X86 Assembly Debugger Preview](https://github.com/CosmosOS/Cosmos/wiki/Visual-Studio-X86-Assembly-Debugger)
|
* [X86 Assembly Debugger Preview](https://github.com/CosmosOS/Cosmos/wiki/Visual-Studio-X86-Assembly-Debugger)
|
||||||
* [Making a Remote PC Slave for Debugging or Fun](http://www.codeproject.com/Articles/413942/Making-a-Remote-PC-Slave-for-Debugging-or-Fun) (old article, code deprecated)
|
* [Making a Remote PC Slave for Debugging or Fun](http://www.codeproject.com/Articles/413942/Making-a-Remote-PC-Slave-for-Debugging-or-Fun) (old article, code deprecated)
|
||||||
* [Cosmos Tutorials](https://int0x10.com/forums/forum-22.html)
|
* [Tutorials for Cosmos](https://int0x10.com/forums/forum-22.html)
|
||||||
* [Cosmos Projects](https://github.com/CosmosOS/Cosmos/wiki/Cosmos-Projects)
|
* [Projects for Cosmos](https://github.com/CosmosOS/Cosmos/wiki/Cosmos-Projects)
|
||||||
|
|
||||||
|
|
||||||
Publicity
|
Publicity
|
||||||
---------
|
---------
|
||||||
|
|
||||||
* [Mary Jo Foley - Cosmos: An open-source .Net-based microkernel OS is born](http://www.zdnet.com/blog/microsoft/cosmos-an-open-source-net-based-microkernel-os-is-born/1162)
|
* [Mary Jo Foley - Cosmos: An open-source .Net-based micro-kernel OS is born](http://www.zdnet.com/blog/microsoft/cosmos-an-open-source-net-based-microkernel-os-is-born/1162)
|
||||||
* [Scott Hanselman - Tiny Managed Operating System Edition](http://www.hanselman.com/blog/TheWeeklySourceCode15TinyManagedOperatingSystemEdition.aspx)
|
* [Scott Hanselman - Tiny Managed Operating System Edition](http://www.hanselman.com/blog/TheWeeklySourceCode15TinyManagedOperatingSystemEdition.aspx)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
|
|
||||||
using Cosmos.Common;
|
using Cosmos.Common;
|
||||||
using Cosmos.Debug.Kernel;
|
using Cosmos.Debug.Kernel;
|
||||||
using Cosmos.IL2CPU.Plugs;
|
using Cosmos.IL2CPU.Plugs;
|
||||||
|
|
||||||
namespace Cosmos.Core.Plugs.System
|
namespace Cosmos.Core.Plugs.System
|
||||||
{
|
{
|
||||||
|
|
@ -178,7 +178,6 @@ namespace Cosmos.Core.Plugs.System
|
||||||
bool xParamNumberDone = true;
|
bool xParamNumberDone = true;
|
||||||
for (int i = 0; i < xCharArray.Length; i++)
|
for (int i = 0; i < xCharArray.Length; i++)
|
||||||
{
|
{
|
||||||
mDebugger.Send(aFormat[i].ToString());
|
|
||||||
if (xFoundPlaceholder)
|
if (xFoundPlaceholder)
|
||||||
{
|
{
|
||||||
if (xCharArray[i] == '{')
|
if (xCharArray[i] == '{')
|
||||||
|
|
@ -213,9 +212,9 @@ namespace Cosmos.Core.Plugs.System
|
||||||
else if (xCharArray[i] == '{')
|
else if (xCharArray[i] == '{')
|
||||||
{
|
{
|
||||||
mDebugger.SendInternal("Found opening placeholder");
|
mDebugger.SendInternal("Found opening placeholder");
|
||||||
xFoundPlaceholder = true;
|
xFoundPlaceholder = true;
|
||||||
xParamNumberDone = false;
|
xParamNumberDone = false;
|
||||||
xParamNumber = string.Empty;
|
xParamNumber = string.Empty;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -228,7 +227,21 @@ namespace Cosmos.Core.Plugs.System
|
||||||
|
|
||||||
public static bool StartsWith(string aThis, string aSubstring, StringComparison aComparison)
|
public static bool StartsWith(string aThis, string aSubstring, StringComparison aComparison)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
Char[] di = aThis.ToCharArray();
|
||||||
|
Char[] ci = aSubstring.ToCharArray();
|
||||||
|
if (aSubstring.Length > aThis.Length)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < ci.Length; i++)
|
||||||
|
{
|
||||||
|
if (di[i] != ci[i])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string PadHelper(string aThis, int totalWidth, char paddingChar, bool isRightPadded)
|
public static string PadHelper(string aThis, int totalWidth, char paddingChar, bool isRightPadded)
|
||||||
|
|
@ -464,11 +477,36 @@ namespace Cosmos.Core.Plugs.System
|
||||||
|
|
||||||
public static bool Contains(string aThis, string value)
|
public static bool Contains(string aThis, string value)
|
||||||
{
|
{
|
||||||
if (aThis.IndexOf(value) != -1)
|
Char[] di = aThis.ToCharArray();
|
||||||
|
Char[] ci = value.ToCharArray();
|
||||||
|
if (value.Length == aThis.Length)
|
||||||
{
|
{
|
||||||
|
if (value == aThis)
|
||||||
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(value.Length > aThis.Length) && (value.Length != aThis.Length))
|
||||||
|
{
|
||||||
|
for (int i = 0; i < aThis.Length; i++)
|
||||||
|
{
|
||||||
|
if (di[i] == ci[0])
|
||||||
|
{
|
||||||
|
for (int j = 1; j < value.Length; j++)
|
||||||
|
{
|
||||||
|
if (di[i + j] != ci[j])
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -479,31 +517,32 @@ namespace Cosmos.Core.Plugs.System
|
||||||
|
|
||||||
public static bool EndsWith(string aThis, string aSubStr, StringComparison aComparison)
|
public static bool EndsWith(string aThis, string aSubStr, StringComparison aComparison)
|
||||||
{
|
{
|
||||||
if (aSubStr == null)
|
Char[] di = aThis.ToCharArray();
|
||||||
|
Char[] ci = aSubStr.ToCharArray();
|
||||||
|
if (aThis.Length == aSubStr.Length)
|
||||||
{
|
{
|
||||||
throw new ArgumentNullException("aSubStr");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (aThis == aSubStr)
|
if (aThis == aSubStr)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
if (aSubStr.Length == 0)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
else if (aThis.Length > aSubStr.Length)
|
||||||
int xLastIdx = aThis.Length - aSubStr.Length;
|
|
||||||
for (int i = 0; i < aSubStr.Length; i++)
|
|
||||||
{
|
{
|
||||||
if (aThis[xLastIdx + i] != aSubStr[i])
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (int i = aThis.Length - aSubStr.Length; i < aThis.Length; i++)
|
||||||
|
{
|
||||||
|
if (di[aThis.Length - aSubStr.Length + i] != ci[i])
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// System.Int32 System.String.IndexOf(System.String, System.Int32, System.Int32, System.StringComparison)
|
// System.Int32 System.String.IndexOf(System.String, System.Int32, System.Int32, System.StringComparison)
|
||||||
|
|
||||||
|
|
@ -604,15 +643,15 @@ namespace Cosmos.Core.Plugs.System
|
||||||
{
|
{
|
||||||
mDebugger.SendInternal("nativeCompareOrdinalEx : aStrA is null");
|
mDebugger.SendInternal("nativeCompareOrdinalEx : aStrA is null");
|
||||||
if (aStrB == null)
|
if (aStrB == null)
|
||||||
{
|
{
|
||||||
mDebugger.SendInternal($"nativeCompareOrdinalEx : aStrB is null");
|
mDebugger.SendInternal($"nativeCompareOrdinalEx : aStrB is null");
|
||||||
mDebugger.SendInternal($"nativeCompareOrdinalEx : returning 0");
|
mDebugger.SendInternal($"nativeCompareOrdinalEx : returning 0");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
mDebugger.SendInternal($"nativeCompareOrdinalEx : aStrB is not null");
|
mDebugger.SendInternal($"nativeCompareOrdinalEx : aStrB is not null");
|
||||||
mDebugger.SendInternal($"nativeCompareOrdinalEx : returning -1");
|
mDebugger.SendInternal($"nativeCompareOrdinalEx : returning -1");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (aStrB == null)
|
if (aStrB == null)
|
||||||
{
|
{
|
||||||
mDebugger.SendInternal("nativeCompareOrdinalEx : aStrA is not null");
|
mDebugger.SendInternal("nativeCompareOrdinalEx : aStrA is not null");
|
||||||
|
|
@ -652,11 +691,18 @@ namespace Cosmos.Core.Plugs.System
|
||||||
|
|
||||||
public static bool StartsWith(string aThis, string aSubStr, bool aIgnoreCase, CultureInfo aCulture)
|
public static bool StartsWith(string aThis, string aSubStr, bool aIgnoreCase, CultureInfo aCulture)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < aSubStr.Length; i++)
|
Char[] di = aThis.ToCharArray();
|
||||||
|
Char[] ci = aSubStr.ToCharArray();
|
||||||
|
if (aSubStr.Length > aThis.Length)
|
||||||
{
|
{
|
||||||
if (aThis[i] != aSubStr[i])
|
return false;
|
||||||
|
}
|
||||||
|
for (int i = 0; i < ci.Length; i++)
|
||||||
|
{
|
||||||
|
if (di[i] != ci[i])
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -722,5 +768,29 @@ namespace Cosmos.Core.Plugs.System
|
||||||
{
|
{
|
||||||
return new string(new char[length]);
|
return new string(new char[length]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string TrimStart(string aThis, string aSubStr)
|
||||||
|
{
|
||||||
|
char[] ci = aThis.ToCharArray();
|
||||||
|
char[] di = aSubStr.ToCharArray();
|
||||||
|
|
||||||
|
if(aThis.StartsWith(aSubStr))
|
||||||
|
{
|
||||||
|
if(aThis != aSubStr)
|
||||||
|
{
|
||||||
|
char[] oi = new char[ci.Length - di.Length];
|
||||||
|
for(int i=0; i < ci.Length - di.Length; i++)
|
||||||
|
{
|
||||||
|
oi[i] = ci[i + di.Length];
|
||||||
|
}
|
||||||
|
return oi.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new ArgumentNullException();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
|
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
|
|
@ -19,11 +20,11 @@ namespace Cosmos.Debug.Common
|
||||||
/// <summary>Get a flag that tell whether Bochs is enabled on this system.</summary>
|
/// <summary>Get a flag that tell whether Bochs is enabled on this system.</summary>
|
||||||
public static bool BochsEnabled
|
public static bool BochsEnabled
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return (null != BochsExe);
|
return (null != BochsExe);
|
||||||
//return false;
|
//return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Get a descriptor for the Bochs emulator with debugger support program. The return value
|
/// <summary>Get a descriptor for the Bochs emulator with debugger support program. The return value
|
||||||
|
|
@ -42,6 +43,44 @@ namespace Cosmos.Debug.Common
|
||||||
private set;
|
private set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ExtractBochsDebugSymbols(string xInputFile, string xOutputFile)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
int i = 0;
|
||||||
|
using (var reader = new StreamReader(xInputFile))
|
||||||
|
{
|
||||||
|
using (var writer = new StreamWriter(xOutputFile))
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Exporting symbols for Bochs: {xInputFile} -> {xOutputFile}");
|
||||||
|
bool startSymbolTable = false;
|
||||||
|
while (!reader.EndOfStream)
|
||||||
|
{
|
||||||
|
string line = reader.ReadLine();
|
||||||
|
if (startSymbolTable)
|
||||||
|
{
|
||||||
|
string[] items = line.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
if (items.Length > 1)
|
||||||
|
{
|
||||||
|
writer.WriteLine($"{items.First()} {items.Last()}");
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (line.Trim().ToUpper().Contains("SYMBOL TABLE"))
|
||||||
|
{
|
||||||
|
startSymbolTable = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Console.WriteLine($"Exported {i} symbols.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>Retrieve installation path for Bochs and initialize the <see cref="BochsExe"/> property.
|
/// <summary>Retrieve installation path for Bochs and initialize the <see cref="BochsExe"/> property.
|
||||||
/// Search is performed using the registry and rely on the shell command defined for the
|
/// Search is performed using the registry and rely on the shell command defined for the
|
||||||
/// BochsConfigFile.</summary>
|
/// BochsConfigFile.</summary>
|
||||||
|
|
|
||||||
|
|
@ -43,16 +43,7 @@ namespace Cosmos.System.Plugs.System.IO
|
||||||
{
|
{
|
||||||
Global.mFileSystemDebugger.SendInternal("Converting " + aText + " to UFT8");
|
Global.mFileSystemDebugger.SendInternal("Converting " + aText + " to UFT8");
|
||||||
var xBuff = aText.GetUtf8Bytes(0, (uint)aText.Length);
|
var xBuff = aText.GetUtf8Bytes(0, (uint)aText.Length);
|
||||||
|
|
||||||
#if COSMOSDEBUG
|
|
||||||
for (int i = 0; i < xBuff.Length; i++)
|
|
||||||
{
|
|
||||||
Global.mFileSystemDebugger.SendInternal("xBuff is", xBuff[i].ToString("0:x2"));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
Global.mFileSystemDebugger.SendInternal("Writing bytes");
|
Global.mFileSystemDebugger.SendInternal("Writing bytes");
|
||||||
|
|
||||||
xFS.Write(xBuff, 0, xBuff.Length);
|
xFS.Write(xBuff, 0, xBuff.Length);
|
||||||
Global.mFileSystemDebugger.SendInternal("Bytes written");
|
Global.mFileSystemDebugger.SendInternal("Bytes written");
|
||||||
}
|
}
|
||||||
|
|
@ -64,7 +55,7 @@ namespace Cosmos.System.Plugs.System.IO
|
||||||
using (var xFS = new FileStream(aFile, FileMode.Append))
|
using (var xFS = new FileStream(aFile, FileMode.Append))
|
||||||
{
|
{
|
||||||
Global.mFileSystemDebugger.SendInternal("Converting " + aText + " to UFT8");
|
Global.mFileSystemDebugger.SendInternal("Converting " + aText + " to UFT8");
|
||||||
var xBuff = aText.GetUtf8Bytes(0, (uint)aText.Length);
|
var xBuff = aText.GetUtf8Bytes(0, (uint) aText.Length);
|
||||||
Global.mFileSystemDebugger.SendInternal("Writing bytes");
|
Global.mFileSystemDebugger.SendInternal("Writing bytes");
|
||||||
xFS.Write(xBuff, 0, xBuff.Length);
|
xFS.Write(xBuff, 0, xBuff.Length);
|
||||||
Global.mFileSystemDebugger.SendInternal("Bytes written");
|
Global.mFileSystemDebugger.SendInternal("Bytes written");
|
||||||
|
|
@ -75,12 +66,13 @@ namespace Cosmos.System.Plugs.System.IO
|
||||||
{
|
{
|
||||||
String text = ReadAllText(aFile);
|
String text = ReadAllText(aFile);
|
||||||
|
|
||||||
Global.mFileSystemDebugger.SendInternal("Read content\n" + text);
|
Global.mFileSystemDebugger.SendInternal("Read contents");
|
||||||
|
Global.mFileSystemDebugger.SendInternal(text);
|
||||||
|
|
||||||
String []result = text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
String []result = text.Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
|
||||||
|
|
||||||
#if COSMOSDEBUG
|
|
||||||
Global.mFileSystemDebugger.SendInternal("content as array of lines:");
|
Global.mFileSystemDebugger.SendInternal("content as array of lines:");
|
||||||
|
#if COSMOSDEBUG
|
||||||
for (int i = 0; i < result.Length; i++)
|
for (int i = 0; i < result.Length; i++)
|
||||||
Global.mFileSystemDebugger.SendInternal(result[i]);
|
Global.mFileSystemDebugger.SendInternal(result[i]);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -97,7 +89,8 @@ namespace Cosmos.System.Plugs.System.IO
|
||||||
text = String.Concat(text, contents[i], Environment.NewLine);
|
text = String.Concat(text, contents[i], Environment.NewLine);
|
||||||
}
|
}
|
||||||
|
|
||||||
Global.mFileSystemDebugger.SendInternal("Writing contents\n" + text);
|
Global.mFileSystemDebugger.SendInternal("Writing contents");
|
||||||
|
Global.mFileSystemDebugger.SendInternal(text);
|
||||||
|
|
||||||
WriteAllText(aFile, text);
|
WriteAllText(aFile, text);
|
||||||
}
|
}
|
||||||
|
|
@ -114,7 +107,7 @@ namespace Cosmos.System.Plugs.System.IO
|
||||||
throw new Exception("Couldn't read complete file!");
|
throw new Exception("Couldn't read complete file!");
|
||||||
}
|
}
|
||||||
Global.mFileSystemDebugger.SendInternal("Bytes read");
|
Global.mFileSystemDebugger.SendInternal("Bytes read");
|
||||||
|
|
||||||
return xBuff;
|
return xBuff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -125,7 +118,7 @@ namespace Cosmos.System.Plugs.System.IO
|
||||||
{
|
{
|
||||||
// This variable is not needed 'aBytes' is already a Byte[]
|
// This variable is not needed 'aBytes' is already a Byte[]
|
||||||
//var xBuff = aBytes;
|
//var xBuff = aBytes;
|
||||||
|
|
||||||
xFS.Write(aBytes, 0, aBytes.Length);
|
xFS.Write(aBytes, 0, aBytes.Length);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -414,7 +414,6 @@ namespace Cosmos.System.FileSystem.FAT
|
||||||
|
|
||||||
internal void Write(ulong aFirstCluster, byte[] aData, ulong aSize = 0, ulong aOffset = 0)
|
internal void Write(ulong aFirstCluster, byte[] aData, ulong aSize = 0, ulong aOffset = 0)
|
||||||
{
|
{
|
||||||
Global.mFileSystemDebugger.SendInternal("low level Write() called");
|
|
||||||
if (aSize == 0)
|
if (aSize == 0)
|
||||||
{
|
{
|
||||||
aSize = BytesPerCluster;
|
aSize = BytesPerCluster;
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace Cosmos.System.FileSystem.FAT
|
||||||
protected byte[] mReadBuffer;
|
protected byte[] mReadBuffer;
|
||||||
|
|
||||||
//TODO: In future we might read this in as needed rather than
|
//TODO: In future we might read this in as needed rather than
|
||||||
// all at once. This structure will also consume 2% of file size in RAM
|
// all at once. This structure will also consume 2% of file size in RAM
|
||||||
// (for default cluster size of 2kb, ie 4 bytes per cluster)
|
// (for default cluster size of 2kb, ie 4 bytes per cluster)
|
||||||
// so we might consider a way to flush it and only keep parts.
|
// so we might consider a way to flush it and only keep parts.
|
||||||
// Example, a 100 MB file will require 2MB for this structure. That is
|
// Example, a 100 MB file will require 2MB for this structure. That is
|
||||||
|
|
@ -30,20 +30,22 @@ namespace Cosmos.System.FileSystem.FAT
|
||||||
|
|
||||||
public FatStream(FatDirectoryEntry aEntry)
|
public FatStream(FatDirectoryEntry aEntry)
|
||||||
{
|
{
|
||||||
Global.mFileSystemDebugger.SendInternal("FatStream with entry " + aEntry);
|
Global.mFileSystemDebugger.SendInternal($"FatStream with entry {aEntry}");
|
||||||
|
|
||||||
mDirectoryEntry = aEntry;
|
mDirectoryEntry = aEntry;
|
||||||
mFS = mDirectoryEntry.GetFileSystem();
|
mFS = mDirectoryEntry.GetFileSystem();
|
||||||
mSize = mDirectoryEntry.mSize;
|
mSize = mDirectoryEntry.mSize;
|
||||||
|
|
||||||
Global.mFileSystemDebugger.SendInternal("FatStream with mSize " + mSize);
|
Global.mFileSystemDebugger.SendInternal("FatStream with mSize {mSize}");
|
||||||
|
|
||||||
Global.mFileSystemDebugger.SendInternal("Getting FatTable");
|
Global.mFileSystemDebugger.SendInternal("Getting FatTable");
|
||||||
// We get always the FatTable if the file is empty too
|
// We get always the FatTable if the file is empty too
|
||||||
mFatTable = mDirectoryEntry.GetFatTable();
|
mFatTable = mDirectoryEntry.GetFatTable();
|
||||||
// What to do if this should happen? Throw exception?
|
// What to do if this should happen? Throw exception?
|
||||||
if (mFatTable == null)
|
if (mFatTable == null)
|
||||||
|
{
|
||||||
Global.mFileSystemDebugger.SendInternal("FatTable got but it is null!");
|
Global.mFileSystemDebugger.SendInternal("FatTable got but it is null!");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool CanSeek
|
public override bool CanSeek
|
||||||
|
|
@ -197,7 +199,7 @@ namespace Cosmos.System.FileSystem.FAT
|
||||||
|
|
||||||
protected void Write(byte[] aBuffer, long aOffset, long aCount)
|
protected void Write(byte[] aBuffer, long aOffset, long aCount)
|
||||||
{
|
{
|
||||||
Global.mFileSystemDebugger.SendInternal($"FatStream.Write : aCount = {aCount}, aOffset = {aOffset}");
|
Global.mFileSystemDebugger.SendInternal($"Write() called aCount = {aCount}, aOffset = {aOffset}");
|
||||||
if (aCount < 0)
|
if (aCount < 0)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("aCount");
|
throw new ArgumentOutOfRangeException("aCount");
|
||||||
|
|
@ -255,4 +257,4 @@ namespace Cosmos.System.FileSystem.FAT
|
||||||
mPosition += (ulong)aOffset;
|
mPosition += (ulong)aOffset;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue