Esempio n. 1
0
        private static Stream InitializeStream(string aPath, FileMode aMode)
        {
            Global.mFileSystemDebugger.SendInternal($"-- FileStream.InitializeStream --");
            Global.mFileSystemDebugger.SendInternal($"aPath = {aPath}");
            if (aPath == null)
            {
                Global.mFileSystemDebugger.SendInternal("In FileStream.Ctor: Path == null is true");
                throw new ArgumentNullException("The file path cannot be null.");
            }
            if (aPath.Length == 0)
            {
                Global.mFileSystemDebugger.SendInternal("In FileStream.Ctor: Path.Length == 0 is true");
                throw new ArgumentException("The file path cannot be empty.");
            }

            // Before let's see if aPath already exists
            bool aPathExists = VFSManager.FileExists(aPath);

            switch (aMode)
            {
            case FileMode.Append:
                return(AppendToFile(aPath, aPathExists));

            case FileMode.Create:
                return(CreateFile(aPath, aPathExists));

            case FileMode.CreateNew:
                return(CreateNewFile(aPath, aPathExists));

            case FileMode.Open:
                return(OpenFile(aPath, aPathExists));

            case FileMode.OpenOrCreate:
                return(OpenOrCreateFile(aPath, aPathExists));

            case FileMode.Truncate:
                return(TruncateFile(aPath, aPathExists));

            default:
                Global.mFileSystemDebugger.SendInternal("The mode " + aMode + "is out of range");
                throw new ArgumentOutOfRangeException("The file mode is invalid");
            }
        }
Esempio n. 2
0
        public static FileStream Create(string aFile)
        {
            Global.mFileSystemDebugger.SendInternal("File.Create:");

            if (string.IsNullOrEmpty(aFile))
            {
                throw new ArgumentException("Argument is null or empty", nameof(aFile));
            }


            var xEntry = VFSManager.CreateFile(aFile);

            if (xEntry == null)
            {
                return(null);
            }

            return(new FileStream(aFile, FileMode.Open));
        }
Esempio n. 3
0
 public static void Cctor(
     //[FieldAccess(Name = "System.Char[] System.IO.Path.InvalidFileNameChars")] ref char[] aInvalidFileNameChars,
     [FieldAccess(Name = "System.Char[] System.IO.Path.InvalidPathCharsWithAdditionalChecks")] ref char[] aInvalidPathCharsWithAdditionalChecks,
     //[FieldAccess(Name = "System.Char System.IO.Path.PathSeparator")] ref char aPathSeparator,
     [FieldAccess(Name = "System.Char[] System.IO.Path.RealInvalidPathChars")] ref char[] aRealInvalidPathChars,
     //[FieldAccess(Name = "System.Int32 System.IO.Path.MaxPath")] ref int aMaxPath
     [FieldAccess(Name = "System.Char System.IO.Path.AltDirectorySeparatorChar")] ref char aAltDirectorySeparatorChar,
     [FieldAccess(Name = "System.Char System.IO.Path.DirectorySeparatorChar")] ref char aDirectorySeparatorChar,
     [FieldAccess(Name = "System.Char System.IO.Path.VolumeSeparatorChar")] ref char aVolumeSeparatorChar)
 {
     //aInvalidFileNameChars = VFSManager.GetInvalidFileNameChars();
     aInvalidPathCharsWithAdditionalChecks = VFSManager.GetInvalidPathCharsWithAdditionalChecks();
     //aPathSeparator = VFSManager.GetPathSeparator();
     aRealInvalidPathChars = VFSManager.GetRealInvalidPathChars();
     //aMaxPath = VFSManager.GetMaxPath();
     aAltDirectorySeparatorChar = VFSManager.GetAltDirectorySeparatorChar()[0];
     aDirectorySeparatorChar    = VFSManager.GetDirectorySeparatorChar()[0];
     aVolumeSeparatorChar       = VFSManager.GetVolumeSeparatorChar();
 }
        /* The real implementation uses IEnumerable and do a conversion ToArray that crashes IL2CPU */
        public static FileInfo[] GetFiles(DirectoryInfo aThis)
        {
            Global.mFileSystemDebugger.SendInternal($"DirectoryInfo.GetFiles() on path {aThis.FullName}");
            var xEntries = VFSManager.GetDirectoryListing(aThis.FullName);

            var result = new List <FileInfo>();

            for (int i = 0; i < xEntries.Count; i++)
            {
                Global.mFileSystemDebugger.SendInternal($"Found entry of type {(int)xEntries[i].mEntryType} and name {xEntries[i].mFullPath}");
                if (xEntries[i].mEntryType == DirectoryEntryTypeEnum.File)
                {
                    //result[i] = new FileInfo(xEntries[i].mFullPath);
                    result.Add(new FileInfo(xEntries[i].mFullPath));
                }
            }

            return(result.ToArray());
        }
Esempio n. 5
0
        private static Stream AppendToFile(string aPath, bool aPathExists)
        {
            Global.mFileSystemDebugger.SendInternal($"In FileStream.AppendToFile aPath {aPath} existing? {aPathExists}");

            if (aPathExists)
            {
                Global.mFileSystemDebugger.SendInternal("Append mode with aPath already existing let's seek to end of the file");
                var aStream = VFSManager.GetFileStream(aPath);
                Global.mFileSystemDebugger.SendInternal("Actual aStream Lenght: " + aStream.Length);

                aStream.Seek(0, SeekOrigin.End);
                return(aStream);
            }
            else
            {
                Global.mFileSystemDebugger.SendInternal("Append mode with aPath not existing let's create a new the file");
                return(CreateNewFile(aPath, aPathExists));
            }
        }
Esempio n. 6
0
        public static void Create_file()
        {
            Console.WriteLine("File name without an extension: ");
            var nameCreateFile = Console.ReadLine();

            VFSManager.CreateFile($@"0:\{nameCreateFile}.txt");

            var checkCreate = File.Exists($@"0:\{nameCreateFile}.txt");

            if (checkCreate == true)
            {
                WriteLine("File created.",
                          ConsoleColor.DarkGreen);
            }
            else if (checkCreate == false)
            {
                WriteLine($"Unknown error\nFile '{nameCreateFile}' was not created",
                          ConsoleColor.Red);
            }
        }
Esempio n. 7
0
        /* Other bug of IL2CPU that does not permit to use this, IEnumerableToArray() does not work :-( */
        public static IEnumerable <FileSystemInfo> EnumerateFileSystemInfos(object aThis, string aPath, string searchPattern,
                                                                            SearchOption searchOption, [FieldType(Name = "System.IO.SearchTarget, System.IO.FileSystem")] int searchTarget)
        {
            // TODO only for directories for now, searchPath is ignored for now
            Global.mFileSystemDebugger.SendInternal("EnumerateFileSystemInfos");
            if (aPath == null)
            {
                throw new ArgumentNullException(aPath);
            }

            var xEntries = VFSManager.GetDirectoryListing(aPath);

            for (int i = 0; i < xEntries.Count; i++)
            {
                if (xEntries[i].mEntryType == DirectoryEntryTypeEnum.Directory)
                {
                    yield return(new DirectoryInfo(xEntries[i].mName));
                }
            }
        }
Esempio n. 8
0
        public void Test_Disk_Manager()
        {
            var disks = VFSManager.GetDisks();

            Assert.IsTrue(disks.Count != 0);
            foreach (var item in disks)
            {
                Assert.IsTrue(item.Size != 0);
                Assert.IsTrue(item.Partitions.Count != 0);
            }

            const string root        = @"0:\";
            long         initialSize = VFSManager.GetTotalSize(root);

            ourDisk.FormatPartition(0, "FAT32", true);
            Assert.AreEqual(initialSize, VFSManager.GetAvailableFreeSpace(root));
            Assert.AreEqual(0, VFSManager.GetDirectoryListing(root).Count);
            VFSManager.CreateFile(root + "test.txt");
            Assert.IsNotNull(VFSManager.GetFile(root + "test.txt"));
        }
Esempio n. 9
0
        private static Stream CreateNewFile(string aPath, bool aPathExists)
        {
            Global.mFileSystemDebugger.SendInternal($"In FileStream.CreateNewFile aPath {aPath} existing? {aPathExists}");

            if (aPathExists)
            {
                Global.mFileSystemDebugger.SendInternal("CreateNew Mode with aPath already existing");
                throw new IOException("File already existing but CreateNew Requested");
            }

            DirectoryEntry xEntry;

            xEntry = VFSManager.CreateFile(aPath);
            if (xEntry == null)
            {
                return(null);
            }

            return(VFSManager.GetFileStream(aPath));
        }
Esempio n. 10
0
        protected override void BeforeRun()
        {
            CosmosVFS cosmosVFS = new CosmosVFS();

            VFSManager.RegisterVFS(cosmosVFS);

            bootBitmap = new Bitmap(@"0:\boot.bmp");

            vMWareSVGAII = new DoubleBufferedVMWareSVGAII();
            vMWareSVGAII.SetMode(screenWidth, screenHeight);

            vMWareSVGAII.DoubleBuffer_DrawImage(bootBitmap, screenWidth / 2 - bootBitmap.Width / 2, screenHeight / 2 - bootBitmap.Height / 2);
            vMWareSVGAII.DoubleBuffer_Update();

            //bitmap = new Bitmap(@"0:\timg.bmp"); Wallpaper

            programlogo = new Bitmap(@"0:\program.bmp");

            /*
             * uint r = 0;
             * uint g = 0;
             * uint b = 0;
             * for (uint i = 0; i < bitmap.rawData.Length; i++)
             * {
             *  Color color = Color.FromArgb(bitmap.rawData[i]);
             *  r += color.R;
             *  g += color.G;
             *  b += color.B;
             * }
             * avgCol = Color.FromArgb((int)(r / bitmap.rawData.Length), (int)(g / bitmap.rawData.Length), (int)(b / bitmap.rawData.Length));
             */
            avgCol = Color.DimGray;

            MouseManager.ScreenWidth  = screenWidth;
            MouseManager.ScreenHeight = screenHeight;

            console = new Console(400, 300, 40, 40);
            dock    = new Dock();

            apps.Add(console);
        }
Esempio n. 11
0
        public static string[] GetFiles(string aPath)
        {
            FileSystemHelpers.Debug("Directory.GetFiles");
            if (aPath == null)
            {
                throw new ArgumentNullException(aPath);
            }

            var xFiles   = new List <string>();
            var xEntries = VFSManager.GetDirectoryListing(aPath);

            for (int i = 0; i < xEntries.Count; i++)
            {
                if (xEntries[i].mEntryType == DirectoryEntryTypeEnum.File)
                {
                    xFiles.Add(xEntries[i].mName);
                }
            }

            return(xFiles.ToArray());
        }
Esempio n. 12
0
        protected override void OnStart(string[] args)
        {
            if (_vfsManager == null)
            {
                var hybridFileSystem = new FileSystemProviderStack(
                    new WebServiceFileSystemProvider(new Uri(ConfigurationManager.AppSettings["httpclienturi"])),
                    new FileSystemProviderStack(
                        new DirectoryProxyFileSystemProvider(ConfigurationManager.AppSettings["dirtoproxy"]),
                        null));

                try
                {
                    _vfsManager = new VFSManager(ConfigurationManager.AppSettings["mountpoint"], hybridFileSystem);
                }
                catch (Exception e)
                {
                    log.Error(e);
                    _vfsManager = null;
                }
            }
        }
Esempio n. 13
0
 public static bool HasExtension(string aPath)
 {
     if (aPath != null)
     {
         CheckInvalidPathChars(aPath, false);
         int xNum = aPath.Length;
         while (--xNum >= 0)
         {
             char xC = aPath[xNum];
             if (xC == '.')
             {
                 return(xNum != aPath.Length - 1);
             }
             if (xC == VFSManager.GetDirectorySeparatorChar() || xC == VFSManager.GetAltDirectorySeparatorChar() || xC == VFSManager.GetVolumeSeparatorChar())
             {
                 break;
             }
         }
     }
     return(false);
 }
Esempio n. 14
0
        //[PlugMethod(Signature = "System_Void__System_IO_FileInfo__ctor_System_String_")]
        public static void Ctor(FileInfo aThis, [FieldAccess(Name = "$$Storage$$")] ref FileSystem.Listing.Directory aStorage, string aFile)
        {
            //Determine if aFile is relative or absolute
            string xFile;

            if (aFile.IsRelativePath())
            {
                xFile = Directory.GetCurrentDirectory() + aFile;
            }
            else
            {
                xFile = aFile;
            }

            var xEntry = VFSManager.GetDirectory(xFile);

            if (xEntry is FileSystem.Listing.Directory)
            {
                aStorage = xEntry as FileSystem.Listing.Directory;
            }
        }
Esempio n. 15
0
        public static void Ctor(
            DirectoryInfo aThis,
            string aPath,
            [FieldAccess(Name = "$$Storage$$")] ref DirectoryEntry aStorage,
            [FieldAccess(Name = "$$FullPath$$")] ref string aFullPath,
            [FieldAccess(Name = "$$Name$$")] ref string aName)
        {
            Global.mFileSystemDebugger.SendInternal("DirectoryInfo.ctor:");

            if (string.IsNullOrEmpty(aPath))
            {
                throw new ArgumentNullException(nameof(aPath));
            }

            Global.mFileSystemDebugger.SendInternal("aPath =");
            Global.mFileSystemDebugger.SendInternal(aPath);

            aStorage  = VFSManager.GetDirectory(aPath);
            aFullPath = aStorage.mFullPath;
            aName     = aStorage.mName;
        }
Esempio n. 16
0
        public static string[] GetDirectories(string aPath)
        {
            Global.mFileSystemDebugger.SendInternal("Directory.GetDirectories");
            if (aPath == null)
            {
                throw new ArgumentNullException(aPath);
            }

            var xDirectories = new List <string>();
            var xEntries     = VFSManager.GetDirectoryListing(aPath);

            for (int i = 0; i < xEntries.Count; i++)
            {
                if (xEntries[i].mEntryType == DirectoryEntryTypeEnum.Directory)
                {
                    xDirectories.Add(xEntries[i].mName);
                }
            }

            return(xDirectories.ToArray());
        }
Esempio n. 17
0
        public static int GetRootLength(string aPath)
        {
            FatHelpers.Debug("In PathImpl.GetRootLength");
            CheckInvalidPathChars(aPath, false);
            FatHelpers.Debug("Checked for invalid path characters");
            FatHelpers.Debug("String length = " + aPath.Length);
            int i      = 0;
            int length = aPath.Length;

            if (length >= 1 && IsDirectorySeparator(aPath[0]))
            {
                i = 1;
                if (length >= 2 && IsDirectorySeparator(aPath[1]))
                {
                    i = 2;
                    int num = 2;
                    while (i < length)
                    {
                        if ((aPath[i] == VFSManager.GetDirectorySeparatorChar() || aPath[i] == VFSManager.GetAltDirectorySeparatorChar()) && --num <= 0)
                        {
                            break;
                        }
                        i++;
                    }
                }
            }
            else
            {
                if (length >= 2 && aPath[1] == VFSManager.GetVolumeSeparatorChar())
                {
                    FatHelpers.Debug("Taking the '2' path");
                    i = 2;
                    if (length >= 3 && IsDirectorySeparator(aPath[2]))
                    {
                        i++;
                    }
                }
            }
            return(i);
        }
Esempio n. 18
0
        public static void Ctor(
            DirectoryInfo aThis,
            string aPath,
            [FieldAccess(Name = "$$Storage$$")] ref DirectoryEntry aStorage,
            [FieldAccess(Name = "$$FullPath$$")] ref string aFullPath,
            [FieldAccess(Name = "$$Name$$")] ref string aName)
        {
            FileSystemHelpers.Debug("DirectoryInfo.ctor", "aPath =", aPath);
            if (aPath == null)
            {
                throw new ArgumentNullException("aPath is null in DirectoryInfo ctor");
            }

            if (!VFSManager.DirectoryExists(aPath))
            {
                throw new DirectoryNotFoundException("Unable to find directory " + aPath);
            }

            aStorage  = VFSManager.GetDirectory(aPath);
            aFullPath = VFSManager.GetFullPath(aStorage);
            aName     = Path.GetDirectoryName(aFullPath);
        }
Esempio n. 19
0
        private DirectoryEntry DoGetDirectoryEntry(string aPath, FileSystem aFS)
        {
            if (aFS == null)
            {
                throw new ArgumentNullException("aFS");
            }
            string[] xPathParts = VFSManager.SplitPath(aPath);

            if (xPathParts.Length == 1)
            {
                return(GetVolume(aFS));
            }

            DirectoryEntry xBaseDirectory = null;

            // start at index 1, because 0 is the volume
            for (int i = 1; i < xPathParts.Length; i++)
            {
                var xPathPart  = xPathParts[i];
                var xPartFound = false;
                var xListing   = aFS.GetDirectoryListing(xBaseDirectory);

                for (int j = 0; j < xListing.Count; j++)
                {
                    var xListingItem = xListing[j];
                    if (string.Equals(xListingItem.mName, xPathPart, StringComparison.OrdinalIgnoreCase))
                    {
                        xBaseDirectory = xListingItem;
                        xPartFound     = true;
                    }
                }

                if (!xPartFound)
                {
                    throw new Exception("Path part '" + xPathPart + "' not found!");
                }
            }
            return(xBaseDirectory);
        }
Esempio n. 20
0
        public static FileStream Create(string aFile)
        {
            if (aFile == null)
            {
                throw new ArgumentNullException("aFile");
            }

            if (aFile.Length == 0)
            {
                throw new ArgumentException("File path must not be empty.", "aFile");
            }

            Global.mFileSystemDebugger.SendInternal($"File.Create : aFile = {aFile}");
            var xEntry = VFSManager.CreateFile(aFile);

            if (xEntry == null)
            {
                return(null);
            }

            return(new FileStream(aFile, FileMode.Open));
        }
Esempio n. 21
0
        private static void Main()
        {
            // to stack file systems, the next item is another FileSystemProviderStack
            var hybridFileSystem = new FileSystemProviderStack(
                new WebServiceFileSystemProvider(new Uri(ConfigurationManager.AppSettings["httpclienturi"])),
                new FileSystemProviderStack(
                    new DirectoryProxyFileSystemProvider(ConfigurationManager.AppSettings["dirtoproxy"]),
                    null));

            try
            {
                using (var vfsManager = new VFSManager(ConfigurationManager.AppSettings["mountpoint"], hybridFileSystem))
                {
                    Console.WriteLine("Mounted, press any key to unmount and exit...");
                    Console.ReadKey(false);
                }
            }
            catch (Exception e)
            {
                log.Error(e);
            }
        }
Esempio n. 22
0
        public static DirectoryInfo CreateDirectory(string aPath)
        {
            if (aPath == null)
            {
                throw new ArgumentNullException("aPath");
            }

            if (aPath.Length == 0)
            {
                throw new ArgumentException("Path must not be empty.", "aPath");
            }

            Global.mFileSystemDebugger.SendInternal($"Directory.CreateDirectory : aPath = {aPath}");
            var xEntry = VFSManager.CreateDirectory(aPath);

            if (xEntry == null)
            {
                return(null);
            }

            return(new DirectoryInfo(aPath));
        }
Esempio n. 23
0
        public static FileInfo[] GetFiles(DirectoryInfo aThis, [FieldAccess(Name = "$$Storage$$")] ref FilesystemEntry aStorage)
        {
            List <FileInfo> xFiles   = new List <FileInfo>();
            var             xEntries = VFSManager.GetFiles(aStorage);

            foreach (FilesystemEntry xEntry in xEntries)
            {
                xFiles.Add(new FileInfo(xEntry.Name));
            }

            return(xFiles.ToArray());

            //Alternative implementation
            //var xEntries = VFSManager.GetFiles(aStorage);
            //FileInfo[] files = new FileInfo[xEntries.Length];
            //for (int i = 0; i < xEntries.Length; i++)
            //{
            //    files[i] = new FileInfo(xEntries[i].Name);
            //}

            //return files;
        }
Esempio n. 24
0
        internal static void CheckInvalidPathChars(string aPath, bool aCheckAdditional = false)
        {
            Global.mFileSystemDebugger.SendInternal("Path.CheckInvalidPathChars");

            if (aPath == null)
            {
                throw new ArgumentNullException("aPath");
            }

            Global.mFileSystemDebugger.SendInternal("aPath =");
            Global.mFileSystemDebugger.SendInternal(aPath);

            var xChars = VFSManager.GetRealInvalidPathChars();

            for (int i = 0; i < xChars.Length; i++)
            {
                if (aPath.IndexOf(xChars[i]) >= 0)
                {
                    throw new ArgumentException("The path contains invalid characters.", aPath);
                }
            }
        }
Esempio n. 25
0
        public static string CombineNoChecks(string aPath1, string aPath2)
        {
            if (aPath2.Length == 0)
            {
                return(aPath1);
            }
            if (aPath1.Length == 0)
            {
                return(aPath2);
            }
            if (Path.IsPathRooted(aPath2))
            {
                return(aPath2);
            }
            char xC = aPath1[aPath1.Length - 1];

            if (xC != VFSManager.GetDirectorySeparatorChar() && xC != VFSManager.GetAltDirectorySeparatorChar() && xC != VFSManager.GetVolumeSeparatorChar())
            {
                return(aPath1 + "\\" + aPath2);
            }
            return(aPath1 + aPath2);
        }
Esempio n. 26
0
        public static FileStream Create(string aFile)
        {
            if (aFile == null)
            {
                throw new ArgumentNullException("aFile");
            }

            if (aFile.Length == 0)
            {
                throw new ArgumentException("File path must not be empty.", "aFile");
            }

            FileSystemHelpers.Debug("File.Create", "aFile =", aFile);
            var xEntry = VFSManager.CreateFile(aFile);

            if (xEntry == null)
            {
                return(null);
            }

            return(new FileStream(aFile, FileMode.Open));
        }
Esempio n. 27
0
 /// <summary>
 /// Starts the INIT method, creating filesystem, registering the filesystem
 /// </summary>
 public static void Start()
 {
     VFSManager.RegisterVFS(fs);
     Console.WriteLine("Initializing filesystem...");
     fs.Initialize();
     Console.Clear();
     AConsole.WriteLineEx("    Welcome to Apollo OS    ", ConsoleColor.White, ConsoleColor.Black, true, false);
     AConsole.WriteLineEx("Press any key to continue...", ConsoleColor.White, ConsoleColor.Black, true, false);
     AConsole.ReadKey(true);
     if (IntegrityCheck() == false)
     {
         Console.Clear();
         Console.WriteLine("Filesystem integrity checks completed!");
         Console.WriteLine("Not all directories were present however, so they have been recreated.");
         Console.WriteLine("Data loss is to be expected.");
         Environment_variables.PressAnyKey();
         Console.Clear();
     }
     else
     {
         Console.Clear();
         Console.WriteLine("Filesystem integrity checks completed!");
         Console.WriteLine("All filesystem checks passed successfully, but be sure to check files in case.");
         Environment_variables.PressAnyKey();
         Console.Clear();
     }
     UserInit();
     if (!File.Exists(usr_vars.varsfile))
     {
         File.Create(KernelVariables.bindir + "vars.sys").Dispose();
     }
     else
     {
         usr_vars.ReadVars();
     }
     Console.WriteLine("SysGuard Checks proceeded.");
     Environment_variables.PressAnyKey("Press any key to continue boot...");
     Console.Clear();
 }
Esempio n. 28
0
        public static DirectoryInfo CreateDirectory(string aPath)
        {
            if (aPath == null)
            {
                throw new ArgumentNullException("aPath");
            }

            if (aPath.Length == 0)
            {
                throw new ArgumentException("Path must not be empty.", "aPath");
            }

            FileSystemHelpers.Debug("Directory.CreateDirectory", "aPath =", aPath);
            var xEntry = VFSManager.CreateDirectory(aPath);

            if (xEntry == null)
            {
                return(null);
            }

            return(new DirectoryInfo(aPath));
        }
Esempio n. 29
0
        protected override void BeforeRun()
        {
            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Registering Extended ASCII encoding...");
            Encoding.RegisterProvider(CosmosEncodingProvider.Instance);
            Console.InputEncoding  = Encoding.GetEncoding(437);
            Console.OutputEncoding = Encoding.GetEncoding(437);

            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Loading virtual FS...");
            VFSManager.RegisterVFS(Reference.FAT);
            if (Reference.FAT.GetVolumes().Count > 0)
            {
                ColorConsole.WriteLine(ConsoleColor.Green, "Sucessfully loaded the virtual FS!");
            }
            else
            {
                ColorConsole.WriteLine(ConsoleColor.Red, "Uh-oh, couldn't load the virtual FS...");
            }

            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Initializing SSE...");
            Global.CPU.InitSSE();
            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Initializing Float...");
            Global.CPU.InitFloat();

            ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Creating live account...");
            Acc acc = new Acc("Sartox", "123");

            acc.Create();

            Reference.Installed = File.Exists(Reference.RootPath + "Installed.txt");
            if (!Reference.Installed)
            {
                ColorConsole.WriteLine(ConsoleColor.Yellow, "=> Loading setup...");
                Setup.Init();
            }

            Console.Clear();
            ColorConsole.WriteLine(ConsoleColor.Green, "Welcome to Sartox OS v" + Reference.Version + "!");
        }
Esempio n. 30
0
 public static string GetDirectoryName(string aPath)
 {
     if (aPath != null)
     {
         CheckInvalidPathChars(aPath, false);
         string xPath       = NormalizePath(aPath, false);
         int    xRootLength = GetRootLength(xPath);
         int    xNum        = xPath.Length;
         if (xNum > xRootLength)
         {
             xNum = xPath.Length;
             if (xNum == xRootLength)
             {
                 return(null);
             }
             while (xNum > xRootLength && xPath[--xNum] != VFSManager.GetDirectorySeparatorChar() && xPath[xNum] != VFSManager.GetAltDirectorySeparatorChar())
             {
             }
             return(xPath.Substring(0, xNum));
         }
     }
     return(null);
 }