public void display_4_update(US.US_DM_LOP_MON ip_us_dm_lop_mon)
 {
     m_e_form_mode = DataEntryFormMode.UpdateDataState;
     m_us_dm_lop_mon = ip_us_dm_lop_mon;
     us_object_2_form();
     this.ShowDialog();
 }
示例#2
0
        public void NoUSTransferResponsibilityTest()
        {
            //Arrange
            CKIR  KIR  = new CKIR();
            CBank bank = new CBank(KIR);

            bank.AddCustomer("Ivan", "Pavlov", 1);
            bank.StoreAccount(1, 1);

            bank.AddCustomer("Rafal", "Swierczewsky", 2);
            bank.StoreAccount(2, 2);

            US us = new US();
            ITransferResposibility transferNormal = new CNormalTransfer();
            ITransferResposibility transferBig    = new CBigTransfer();

            transferNormal.setNextTransferResp(transferBig);
            transferBig.SetUS(us);

            bank.PayIn(bank.GetAccount(1), 30000m);
            Transfer test = bank.Transfer(bank.GetAccount(1), bank.GetAccount(2), 2500m);

            transferNormal.transfer(test);

            //Assert
            Assert.AreEqual(bank.GetAccount(2).GetSaldo(), 2500m);
            Assert.IsNotNull(bank.GetAccount(1).GetHistory());
            Assert.AreEqual(bank.GetAccount(1).GetSaldo(), 27500m);
            Assert.AreEqual(us.GetTransferList().Count, 0); //not logged in US, transfer < 20000
        }
示例#3
0
 public ucFindPerson(string nick)
 {
     InitializeComponent();
     us        = new US();
     ur        = new UR();
     this.Nick = nick;
 }
示例#4
0
 public ucChangePass(string nick)
 {
     us = new US();
     ur = new UR();
     InitializeComponent();
     this.Nick = nick;
 }
示例#5
0
        public ActionResult DeleteConfirmed(string id)
        {
            US uS = db.USES.Find(id);

            db.USES.Remove(uS);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
示例#6
0
 public ucEditProfile(string nick)
 {
     InitializeComponent();
     FillComboBox();
     uS        = new US();
     ur        = new UR();
     this.Nick = nick;
 }
 internal void DisplayForUpdate(US.US_DM_LOAI_NGAY_CONG v_us)
 {
     this.Text = "F105 - Sửa loại ngày công";
     m_e_form_mode = DataEntryFormMode.UpdateDataState;
     m_us = v_us;
     us_to_form(m_us);
     this.CenterToScreen();
     this.ShowDialog();
 }
示例#8
0
 public void UpdateStatus(string message)
 {
     if (StatusLabel.InvokeRequired)
     {
         US d = UpdateStatus;
         this.Invoke(d, new object[] { message });
     }
     else
     {
         StatusLabel.Text = message;
     }
 }
示例#9
0
 public ActionResult Edit([Bind(Include = "ProductID,MaterialID,GoesIntoQuantity,UsesID")] US uS)
 {
     if (ModelState.IsValid)
     {
         db.Entry(uS).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ProductID  = new SelectList(db.PRODUCTs, "ProductID", "ProductDescription", uS.ProductID);
     ViewBag.MaterialID = new SelectList(db.RAWMATERIALs, "MaterialID", "MaterialName", uS.MaterialID);
     return(View(uS));
 }
示例#10
0
        // GET: US/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            US uS = db.USES.Find(id);

            if (uS == null)
            {
                return(HttpNotFound());
            }
            return(View(uS));
        }
示例#11
0
        public ActionResult Create([Bind(Include = "ProductID,MaterialID,GoesIntoQuantity,UsesID")] US uS)
        {
            if (ModelState.IsValid)
            {
                uS.UsesID = GenerateID(uS.ProductID, uS.MaterialID);

                db.USES.Add(uS);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.ProductID  = new SelectList(db.PRODUCTs, "ProductID", "ProductDescription", uS.ProductID);
            ViewBag.MaterialID = new SelectList(db.RAWMATERIALs, "MaterialID", "MaterialName", uS.MaterialID);
            return(View(uS));
        }
示例#12
0
        // GET: US/Edit/5
        public ActionResult Edit(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            US uS = db.USES.Find(id);

            if (uS == null)
            {
                return(HttpNotFound());
            }
            ViewBag.ProductID  = new SelectList(db.PRODUCTs, "ProductID", "ProductDescription", uS.ProductID);
            ViewBag.MaterialID = new SelectList(db.RAWMATERIALs, "MaterialID", "MaterialName", uS.MaterialID);
            return(View(uS));
        }
示例#13
0
        /// <summary>
        /// Main
        /// </summary>
        unsafe public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;
            Debug   = ConsoleManager.Controller.Boot;

            Console.Clear();

            Console.ScrollRow = 23;

            IDT.SetInterruptHandler(ProcessInterrupt);

            Console.Color           = Colors.White;
            Console.BackgroundColor = Colors.Green;

            Console.Write(@"                   MOSA OS Version 1.4 - Compiler Version 1.4");
            FillLine();
            Console.Color           = Colors.White;
            Console.BackgroundColor = Colors.Black;

            Console.WriteLine("> Initializing hardware abstraction layer...");
            Setup.Initialize();

            Console.WriteLine("> Adding hardware devices...");
            Setup.Start();

            Console.Color = Colors.White;
            Console.WriteLine();

            Debug = ConsoleManager.Controller.Debug;

            // setup keymap
            var keymap = new US();

            // setup keyboard (state machine)
            var keyboard = new Mosa.DeviceSystem.Keyboard(Setup.StandardKeyboard, keymap);

            // setup app manager
            var manager = new AppManager(Console, keyboard);

            IDT.SetInterruptHandler(manager.ProcessInterrupt);

            manager.Start();
        }
示例#14
0
        public SearchWindow(string nick, string nick2)
        {
            InitializeComponent();
            PersonNickName  = nick;
            PersonNickName2 = nick2;
            //
            repository     = new UR();
            services       = new US();
            postServices   = new PS();
            postRepository = new PR();
            //
            user                = new User();
            user                = repository.GetUserByNick(PersonNickName);
            UserName.Content    = user.person.Name;
            UserSurname.Content = user.person.Surname;
            UserMail.Content    = user.person.Mail;
            //
            currentPost = new Posts();
            posts       = new List <Posts>();
            posts       = postRepository.GetPostsByUserId(repository.GetUserId(PersonNickName));
            if (posts != null && posts.Count > 0)
            {
                currentPost = posts[indexOfPost];

                DG1.ItemsSource = currentPost.comment;
                isAnyPosts      = true;
            }
            else
            {
                Main.Content = "No posts yet";
            }
            //
            if (tempLike)
            {
                btnLike.Background = Brushes.Green;
                tempLike           = true;
            }

            user = repository.GetUserByNick(PersonNickName2);
            if (services.CheckAlreadyFollow(user.Nick, PersonNickName))
            {
                btnFollow.Background = Brushes.Green;
            }
        }
示例#15
0
 public override VR CreateVR(string str, Rule rule, int length)
 {
     {
         VR vr = null;
         if (str == "SS")
         {
             vr = new SS(rule, length);
         }
         else if (str == "US")
         {
             vr = new US(rule, length);
         }
         else if (str == "UL")
         {
             vr = new UL(rule, length);
         }
         else if (str == "SL")
         {
             vr = new SL(rule, length);
         }
         else if (str == "IS")
         {
             vr = new IS(rule, length);
         }
         else if (str == "FS")
         {
             vr = new FS(rule, length);
         }
         else if (str == "AS")
         {
             vr = new AS(rule, length);
         }
         else if (str == "DA")
         {
             vr = new DA(rule, length);
         }
         else if (str == "UI")
         {
             vr = new TX(rule, length);
         }
         return(vr);
     }
 }
示例#16
0
    public VR GetVR(string key)
    {
        //如果对象存在,则直接从享元池获取
        if (VRs.ContainsKey(key))
        {
            return((VR)VRs[key]);
        }
        //如果对象不存在,先创建一个新的对象添加到享元池中,然后返回
        else
        {
            VR fw = null;
            switch (key)
            {
            case "SS": fw = new SS(isBE, false); break;

            case "US": fw = new US(isBE); break;

            case "SL": fw = new SL(isBE, false); break;

            case "UL": fw = new UL(isBE, false); break;

            case "FL": fw = new FL(isBE, false); break;

            case "FD": fw = new FD(isBE, false); break;

            case "DA": fw = new DA(isBE, false); break;

            case "TM": fw = new TM(isBE, false); break;

            case "DT": fw = new DT(isBE, false); break;

            case "AS": fw = new AS(isBE, false); break;

            case "OB": fw = new OB(isBE); break;

            case "OF": fw = new OF(isBE, true); break;

            case "OW": fw = new OW(isBE); break;

            case "SQ": fw = new SQ(isBE, true); break;

            case "LO": fw = new LO(isBE, true); break;

            case "UI": fw = new UI(isBE, true); break;

            case "SH": fw = new SH(isBE, true); break;

            case "AE": fw = new AE(isBE, true); break;

            case "CS": fw = new CS(isBE, true); break;

            case "PN": fw = new PN(isBE, true); break;

            case "DS": fw = new DS(isBE); break;

            case "IS": fw = new IS(isBE, true); break;
                //default for text
                //default: fw = new ST(isBE, false); break;
            }
            VRs.Add(key, fw);
            return(fw);
        }
    }
示例#17
0
 public Registr()
 {
     InitializeComponent();
     us = new US();
     Ur = new UR();
 }
示例#18
0
文件: InitHAL.cs 项目: djlw78/abanu
        public static void SetupDrivers()
        {
            PrimaryFS = null;

            Console.WriteLine("> Initializing services...");

            // Create Service manager and basic services
            var serviceManager = new ServiceManager();

            var deviceService        = new DeviceService();
            var diskDeviceService    = new DiskDeviceService();
            var partitionService     = new PartitionService();
            var pciControllerService = new PCIControllerService();
            var pciDeviceService     = new PCIDeviceService();

            serviceManager.AddService(deviceService);
            serviceManager.AddService(diskDeviceService);
            serviceManager.AddService(partitionService);
            serviceManager.AddService(pciControllerService);
            serviceManager.AddService(pciDeviceService);

            Console.WriteLine("> Initializing hardware abstraction layer...");

            // Set device driver system with the hardware HAL
            var hardware = new Hardware();

            Mosa.DeviceSystem.Setup.Initialize(hardware, deviceService.ProcessInterrupt);

            Console.WriteLine("> Registering device drivers...");
            deviceService.RegisterDeviceDriver(Mosa.DeviceDriver.Setup.GetDeviceDriverRegistryEntries());

            Console.WriteLine("> Starting devices...");
            deviceService.Initialize(new X86System(), null);

            Console.Write("> Probing for ISA devices...");
            var isaDevices = deviceService.GetChildrenOf(deviceService.GetFirstDevice <ISABus>());

            Console.WriteLine("[Completed: " + isaDevices.Count.ToString() + " found]");

            foreach (var device in isaDevices)
            {
                Console.Write("  ");
                //Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                //InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.Write(device.Name);
                Console.WriteLine();
            }

            Console.Write("> Probing for PCI devices...");
            var devices = deviceService.GetDevices <PCIDevice>();

            Console.WriteLine("[Completed: " + devices.Count.ToString() + " found]");

            foreach (var device in devices)
            {
                Console.Write("  ");
                //Bullet(ScreenColor.Yellow);
                Console.Write(" ");

                var pciDevice = device.DeviceDriver as PCIDevice;
                Console.Write(device.Name + ": " + pciDevice.VendorID.ToString("x") + ":" + pciDevice.DeviceID.ToString("x") + " " + pciDevice.SubSystemID.ToString("x") + ":" + pciDevice.SubSystemVendorID.ToString("x") + " (" + pciDevice.Function.ToString("x") + ":" + pciDevice.ClassCode.ToString("x") + ":" + pciDevice.SubClassCode.ToString("x") + ":" + pciDevice.ProgIF.ToString("x") + ":" + pciDevice.RevisionID.ToString("x") + ")");

                var children = deviceService.GetChildrenOf(device);

                if (children.Count != 0)
                {
                    var child = children[0];

                    Console.WriteLine();
                    Console.Write("    ");

                    var pciDevice2 = child.DeviceDriver as PCIDevice;
                    Console.Write(child.Name);
                }

                Console.WriteLine();
            }

            Console.Write("> Probing for disk controllers...");
            var diskcontrollers = deviceService.GetDevices <IDiskControllerDevice>();

            Console.WriteLine("[Completed: " + diskcontrollers.Count.ToString() + " found]");

            foreach (var device in diskcontrollers)
            {
                Console.Write("  ");
                //Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                Console.Write(device.Name);
                Console.WriteLine();
            }

            Console.Write("> Probing for disks...");
            var disks = deviceService.GetDevices <IDiskDevice>();

            Console.WriteLine("[Completed: " + disks.Count.ToString() + " found]");

            foreach (var disk in disks)
            {
                Console.Write("  ");
                Console.Write(" ");
                Console.Write(disk.Name);
                Console.Write(" " + (disk.DeviceDriver as IDiskDevice).TotalBlocks.ToString() + " blocks");
                Console.WriteLine();
            }

            if (disks.Count >= 3 && disks[2].DeviceDriver != null && disks[2].DeviceDriver is IDiskDevice)
            {
                HostCommunicator.Init(disks[2].DeviceDriver as IDiskDevice);
            }

            partitionService.CreatePartitionDevices();

            Console.Write("> Finding partitions...");
            var partitions = deviceService.GetDevices <IPartitionDevice>();

            Console.WriteLine("[Completed: " + partitions.Count.ToString() + " found]");

            //foreach (var partition in partitions)
            //{
            //  Console.Write("  ");
            //  Bullet(ScreenColor.Yellow);
            //  Console.Write(" ");
            //  InBrackets(partition.Name, ScreenColor.White, ScreenColor.Green);
            //  Console.Write(" " + (partition.DeviceDriver as IPartitionDevice).BlockCount.ToString() + " blocks");
            //  Console.WriteLine();
            //}

            Console.Write("> Finding file systems...");

            foreach (var partition in partitions)
            {
                var fat = new FatFileSystem(partition.DeviceDriver as IPartitionDevice);

                if (fat.IsValid)
                {
                    Console.WriteLine("Found a FAT file system!");
                    var fs = fat.CreateVFSMount();
                    PrimaryFS = fs;

                    const string filename = "TEST.TXT";

                    var node = fs.Root.Lookup(filename);

                    if (node != null)
                    {
                        Console.Write("Found: " + filename);

                        using (var fileStream = (Stream)node.Open(FileAccess.Read, FileShare.Read))
                        {
                            uint len = (uint)fileStream.Length;

                            Console.WriteLine(" - Length: " + len.ToString());

                            Console.Write("Reading File: ");

                            while (true)
                            {
                                int i = fileStream.ReadByte();

                                if (i < 0)
                                {
                                    break;
                                }

                                Console.Write((char)i);
                            }
                        }

                        Console.WriteLine();
                    }
                }
            }

            // Get StandardKeyboard
            var standardKeyboards = deviceService.GetDevices("StandardKeyboard");

            if (standardKeyboards.Count == 0)
            {
                Console.WriteLine("No Keyboard!");
                //ForeverLoop();
            }

            var standardKeyboard = standardKeyboards[0].DeviceDriver as IKeyboardDevice;

            //Debug = ConsoleManager.Controller.Debug;

            // setup keymap
            var keymap = new US();

            // setup keyboard (state machine)
            var keyboard = new Mosa.DeviceSystem.Keyboard(standardKeyboard, keymap);
        }
示例#19
0
 public MainWindow()
 {
     InitializeComponent();
     us = new US();
 }
示例#20
0
 /// <summary>
 /// Converts a <see cref="US.OpenServer.Level"/> enumeration to log4net.Core.Level object.
 /// </summary>
 /// <param name="level">The Level to convert.</param>
 /// <returns>A log4net.Core.Level object.</returns>
 private log4net.Core.Level GetLevelFromLevel(US.OpenServer.Level level)
 {
     switch (level)
     {
         case US.OpenServer.Level.Debug:
             return log4net.Core.Level.Debug;
         case US.OpenServer.Level.Info:
             return log4net.Core.Level.Info;
         case US.OpenServer.Level.Notice:
             return log4net.Core.Level.Notice;
         case US.OpenServer.Level.Critical:
             return log4net.Core.Level.Critical;
         case US.OpenServer.Level.Error:
             return log4net.Core.Level.Error;
         default:
             return log4net.Core.Level.Info;
     }
 }
示例#21
0
        /// <summary>
        /// Logs a message.
        /// </summary>
        /// <param name="level">The level of the message.</param>
        /// <param name="message">The message.</param>
        public override void Log(US.OpenServer.Level level, string message)
        {
            base.Log(level, message);

            if (level == US.OpenServer.Level.Debug && !LogDebug)
                return;

            if (log == null)
                return;

            LoggingEventData d = new LoggingEventData();
            d.TimeStamp = DateTime.Now;
            d.Level = GetLevelFromLevel(level);
            d.Message = message;
            LoggingEvent le = new LoggingEvent(d);
            log.Logger.Log(le);
        }
 public DataTable SaberSiTieneUsuario(int empleado)
 {
     return(US.GetDataSaberSiTieneUsuario(empleado));
 }
示例#23
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;

            Console.Clear();
            Console.Goto(0, 0);
            Console.ScrollRow       = 23;
            Console.Color           = ScreenColor.White;
            Console.BackgroundColor = ScreenColor.Green;

            Debug = ConsoleManager.Controller.Debug;

            Console.Write("                   MOSA OS Version 2.2 - Compiler Version 2.2");
            FillLine();
            Console.Color           = ScreenColor.White;
            Console.BackgroundColor = ScreenColor.Black;

            Console.WriteLine("> Initializing services...");

            // Create Service manager and basic services
            var serviceManager = new ServiceManager();

            DeviceService = new DeviceService();

            var diskDeviceService    = new DiskDeviceService();
            var partitionService     = new PartitionService();
            var pciControllerService = new PCIControllerService();
            var pciDeviceService     = new PCIDeviceService();
            var pcService            = new PCService();

            serviceManager.AddService(DeviceService);
            serviceManager.AddService(diskDeviceService);
            serviceManager.AddService(partitionService);
            serviceManager.AddService(pciControllerService);
            serviceManager.AddService(pciDeviceService);
            serviceManager.AddService(pcService);

            Console.WriteLine("> Initializing hardware abstraction layer...");

            // Set device driver system with the hardware HAL
            var hardware = new HAL.Hardware();

            DeviceSystem.Setup.Initialize(hardware, DeviceService.ProcessInterrupt);

            Console.WriteLine("> Registering device drivers...");
            DeviceService.RegisterDeviceDriver(DeviceDriver.Setup.GetDeviceDriverRegistryEntries());

            Console.WriteLine("> Starting devices...");

            DeviceService.Initialize(new X86System(), null);

            var acpi = DeviceService.GetFirstDevice <IACPI>().DeviceDriver as IACPI;

            // Setup APIC
            var localApic = Mosa.DeviceSystem.HAL.GetPhysicalMemory((Pointer)acpi.LocalApicAddress, 0xFFFF).Address;
            var ioApic    = Mosa.DeviceSystem.HAL.GetPhysicalMemory((Pointer)acpi.IOApicAddress, 0xFFFF).Address;

            APIC.Setup(localApic, ioApic);

            Console.Write("> Probing for ISA devices...");
            var isaDevices = DeviceService.GetChildrenOf(DeviceService.GetFirstDevice <ISABus>());

            Console.WriteLine("[Completed: " + isaDevices.Count.ToString() + " found]");

            foreach (var device in isaDevices)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for PCI devices...");
            var devices = DeviceService.GetDevices <PCIDevice>();

            Console.WriteLine("[Completed: " + devices.Count.ToString() + " found]");

            foreach (var device in devices)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");

                var pciDevice = device.DeviceDriver as PCIDevice;
                InBrackets(device.Name + ": " + pciDevice.VendorID.ToString("x") + ":" + pciDevice.DeviceID.ToString("x") + " " + pciDevice.SubSystemID.ToString("x") + ":" + pciDevice.SubSystemVendorID.ToString("x") + " (" + pciDevice.ClassCode.ToString("x") + ":" + pciDevice.SubClassCode.ToString("x") + ":" + pciDevice.ProgIF.ToString("x") + ":" + pciDevice.RevisionID.ToString("x") + ")", ScreenColor.White, ScreenColor.Green);

                var children = DeviceService.GetChildrenOf(device);

                if (children.Count != 0)
                {
                    var child = children[0];

                    Console.WriteLine();
                    Console.Write("    ");

                    var pciDevice2 = child.DeviceDriver as PCIDevice;
                    InBrackets(child.Name, ScreenColor.White, ScreenColor.Green);
                }

                Console.WriteLine();
            }

            Console.Write("> Probing for disk controllers...");
            var diskcontrollers = DeviceService.GetDevices <IDiskControllerDevice>();

            Console.WriteLine("[Completed: " + diskcontrollers.Count.ToString() + " found]");

            foreach (var device in diskcontrollers)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for disks...");
            var disks = DeviceService.GetDevices <IDiskDevice>();

            Console.WriteLine("[Completed: " + disks.Count.ToString() + " found]");

            foreach (var disk in disks)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(disk.Name, ScreenColor.White, ScreenColor.Green);
                Console.Write(" " + (disk.DeviceDriver as IDiskDevice).TotalBlocks.ToString() + " blocks");
                Console.WriteLine();
            }

            partitionService.CreatePartitionDevices();

            Console.Write("> Finding partitions...");
            var partitions = DeviceService.GetDevices <IPartitionDevice>();

            Console.WriteLine("[Completed: " + partitions.Count.ToString() + " found]");

            //foreach (var partition in partitions)
            //{
            //	Console.Write("  ");
            //	Bullet(ScreenColor.Yellow);
            //	Console.Write(" ");
            //	InBrackets(partition.Name, ScreenColor.White, ScreenColor.Green);
            //	Console.Write(" " + (partition.DeviceDriver as IPartitionDevice).BlockCount.ToString() + " blocks");
            //	Console.WriteLine();
            //}

            Console.Write("> Finding file systems...");

            foreach (var partition in partitions)
            {
                var fat = new FatFileSystem(partition.DeviceDriver as IPartitionDevice);

                if (fat.IsValid)
                {
                    Console.WriteLine("Found a FAT file system!");

                    const string filename = "TEST.TXT";

                    var location = fat.FindEntry(filename);

                    if (location.IsValid)
                    {
                        Console.Write("Found: " + filename);

                        var fatFileStream = new FatFileStream(fat, location);

                        uint len = (uint)fatFileStream.Length;

                        Console.WriteLine(" - Length: " + len.ToString() + " bytes");

                        Console.Write("Reading File: ");

                        for (; ;)
                        {
                            int i = fatFileStream.ReadByte();

                            if (i < 0)
                            {
                                break;
                            }

                            Console.Write((char)i);
                        }

                        Console.WriteLine();
                    }

                    const string bmpname = "WALLP.BMP";

                    var bmploc = fat.FindEntry(bmpname);

                    if (bmploc.IsValid)
                    {
                        Console.Write("Found: " + bmpname);

                        var fatFileStream = new FatFileStream(fat, bmploc);

                        uint len = (uint)fatFileStream.Length;

                        Console.WriteLine(" - Length: " + len.ToString() + " bytes");
                        Console.WriteLine();
                    }
                }
            }

            // Get StandardKeyboard
            var keyboards = DeviceService.GetDevices("StandardKeyboard");

            if (keyboards.Count == 0)
            {
                Console.WriteLine("No Keyboard!");
                ForeverLoop();
            }

            var stdKeyboard = keyboards[0].DeviceDriver as IKeyboardDevice;

            // setup keymap
            var keymap = new US();

            // setup keyboard (state machine)
            var keyboard = new DeviceSystem.Keyboard(stdKeyboard, keymap);

            // setup app manager
            var manager = new AppManager(Console, keyboard, serviceManager);

            IDT.SetInterruptHandler(manager.ProcessInterrupt);

            Logger.Log("<SELFTEST:PASSED>");

            manager.Start();
        }
示例#24
0
        /// <summary>
        /// Main
        /// </summary>
        public static void Main()
        {
            Kernel.x86.Kernel.Setup();

            Console = ConsoleManager.Controller.Boot;

            Console.Clear();
            Console.Goto(0, 0);

            //IDT.SetInterruptHandler(ProcessInterrupt);

            Console.ScrollRow       = 23;
            Console.Color           = ScreenColor.White;
            Console.BackgroundColor = ScreenColor.Green;

            Debug = ConsoleManager.Controller.Boot;

            Console.Write("                   MOSA OS Version 1.5 - Compiler Version 1.5");
            FillLine();
            Console.Color           = ScreenColor.White;
            Console.BackgroundColor = ScreenColor.Black;

            Console.WriteLine("> Initializing hardware abstraction layer...");
            var hardware = new HAL.Hardware();

            var DeviceManager = Setup.Initialize(PlatformArchitecture.X86, hardware);

            Console.WriteLine("> Registering device drivers...");
            DeviceDriver.Setup.Register(DeviceManager);

            Console.WriteLine("> Starting devices...");
            DeviceDriver.Setup.Start(DeviceManager);

            Console.Write("> Probing for ISA devices...");
            var isaDevices = DeviceManager.GetAllDevices();

            Console.WriteLine("[Completed: " + isaDevices.Count.ToString() + " found]");

            foreach (var device in isaDevices)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for PCI devices...");

            //Setup.StartPCIDevices();
            var pciDevices = DeviceManager.GetDevices <DeviceSystem.PCI.IPCIDevice>(DeviceStatus.Available);

            Console.WriteLine("[Completed: " + pciDevices.Count.ToString() + " found]");

            foreach (var device in pciDevices)
            {
                var pciDevice = device.DeviceDriver as DeviceSystem.PCI.IPCIDevice;

                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name + ": " + pciDevice.VendorID.ToString("x") + ":" + pciDevice.DeviceID.ToString("x") + " " + pciDevice.SubSystemID.ToString("x") + ":" + pciDevice.SubVendorID.ToString("x") + " (" + pciDevice.Function.ToString("x") + ":" + pciDevice.ClassCode.ToString("x") + ":" + pciDevice.SubClassCode.ToString("x") + ":" + pciDevice.ProgIF.ToString("x") + ":" + pciDevice.RevisionID.ToString("x") + ")", ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for disk controllers...");
            var diskcontrollers = DeviceManager.GetDevices <IDiskControllerDevice>();

            Console.WriteLine("[Completed: " + diskcontrollers.Count.ToString() + " found]");

            foreach (var device in diskcontrollers)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(device.Name, ScreenColor.White, ScreenColor.Green);
                Console.WriteLine();
            }

            Console.Write("> Probing for disks...");
            var disks = DeviceManager.GetDevices <IDiskDevice>();

            Console.WriteLine("[Completed: " + disks.Count.ToString() + " found]");

            foreach (var disk in disks)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(disk.Name, ScreenColor.White, ScreenColor.Green);
                Console.Write(" " + (disk.DeviceDriver as IDiskDevice).TotalBlocks.ToString() + " blocks");
                Console.WriteLine();
            }

            var partitionManager = new PartitionManager(DeviceManager);

            partitionManager.CreatePartitionDevices();

            Console.Write("> Finding partitions...");
            var partitions = DeviceManager.GetDevices <IPartitionDevice>();

            Console.WriteLine("[Completed: " + partitions.Count.ToString() + " found]");

            foreach (var partition in partitions)
            {
                Console.Write("  ");
                Bullet(ScreenColor.Yellow);
                Console.Write(" ");
                InBrackets(partition.Name, ScreenColor.White, ScreenColor.Green);
                Console.Write(" " + (partition.DeviceDriver as IPartitionDevice).BlockCount.ToString() + " blocks");
                Console.WriteLine();
            }

            Console.Write("> Finding file systems...");

            foreach (var partition in partitions)
            {
                var fat = new FatFileSystem(partition.DeviceDriver as IPartitionDevice);

                if (fat.IsValid)
                {
                    Console.WriteLine("Found a FAT file system!");

                    const string filename = "TEST.TXT";

                    var location = fat.FindEntry(filename);

                    if (location.IsValid)
                    {
                        Console.Write("Found: " + filename);

                        var fatFileStream = new FatFileStream(fat, location);

                        uint len = (uint)fatFileStream.Length;

                        Console.WriteLine(" - Length: " + len.ToString());

                        Console.Write("Reading File: ");

                        for (; ;)
                        {
                            int i = fatFileStream.ReadByte();

                            if (i < 0)
                            {
                                break;
                            }

                            Console.Write((char)i);
                        }

                        Console.WriteLine();
                    }
                }
            }

            // Get StandardKeyboard
            var standardKeyboards = DeviceManager.GetDevices("StandardKeyboard");

            if (standardKeyboards.Count == 0)
            {
                Console.WriteLine("No Keyboard!");
                ForeverLoop();
            }

            var standardKeyboard = standardKeyboards[0].DeviceDriver as IKeyboardDevice;

            Debug = ConsoleManager.Controller.Debug;

            // setup keymap
            var keymap = new US();

            // setup keyboard (state machine)
            var keyboard = new DeviceSystem.Keyboard(standardKeyboard, keymap);

            // setup app manager
            var manager = new AppManager(Console, keyboard);

            IDT.SetInterruptHandler(manager.ProcessInterrupt);

            Logger.Log("<SELFTEST:PASSED>");

            manager.Start();
        }