//--------------------------------------------------------- void Start() { netWorkInit = GetComponent <NetworkInit>(); learnManager = GetComponent <LearnManager>(); storeManager = GetComponent <StoreManager>(); sensorFields = new List <Field>(); hiddenFields = new List <Field>(); outputFields = new List <Field>(); int inputFieldNumb = netWorkInit.networkStructure[0]; edgeLength = Mathf.Sqrt(inputFieldNumb); edgeWidth = edgeLength; gridWidth = 1f; xOffset = gridWidth / 2f; Vector3 camPosition = new Vector3(edgeWidth * gridWidth * 1.3f, edgeLength * gridWidth * 1.5f, -edgeLength * gridWidth / 2f + 1f); cam.transform.position = camPosition; Vector3 camRotation = new Vector3(90, 0, 0); cam.transform.rotation = Quaternion.Euler(camRotation); }
/* * Method called to applied the differents options received in the DHCP packet ACK **/ /// <summary> /// Apply the new IP configuration received. /// </summary> /// <param name="Options">DHCPOption class using the packetData from the received dhcp packet.</param> /// <param name="message">Enable/Disable the displaying of messages about DHCP applying and conf. Disabled by default. /// </param> public static void Apply(DHCPOption Options, bool message = false) { NetworkStack.RemoveAllConfigIP(); //cf. Roadmap. (have to change this, because some network interfaces are not configured in dhcp mode) [have to be done in 0.5.x] foreach (NetworkDevice networkDevice in NetworkDevice.Devices) { if (message) { Console.WriteLine(); Console.WriteLine("[DHCP ACK][" + networkDevice.Name + "] Packet received, applying IP configuration..."); Console.WriteLine(" IP Address : " + Options.Address().ToString()); Console.WriteLine(" Subnet mask : " + Options.Subnet().ToString()); Console.WriteLine(" Gateway : " + Options.Gateway().ToString()); Console.WriteLine(" DNS server : " + Options.DNS01().ToString()); } Settings settings = new Settings(@"0:\" + networkDevice.Name + ".conf"); settings.EditValue("ipaddress", Options.Address().ToString()); settings.EditValue("subnet", Options.Subnet().ToString()); settings.EditValue("gateway", Options.Gateway().ToString()); settings.EditValue("dns01", Options.DNS01().ToString()); settings.EditValue("dhcp_server", Options.Server().ToString()); settings.PushValues(); NetworkInit.Enable(); if (message) { Console.WriteLine("[DHCP CONFIG][" + networkDevice.Name + "] IP configuration applied."); Console.WriteLine(); DHCPAsked = false; } } }
/// <summary> /// Start Aura after login. /// </summary> private static void Start(string username) { Console.Clear(); Kernel.SystemExists = true; Kernel.userLogged = username; Kernel.JustInstalled = true; Kernel.running = true; Console.Clear(); Utils.Settings config = new Utils.Settings(@"0:\System\settings.conf"); string debugger = config.GetValue("debugger"); if (debugger == "on") { Kernel.debugger.enabled = true; } NetworkInit.Enable(); WelcomeMessage.Display(); Text.Display("logged", username); Console.WriteLine(); Kernel.Logged = true; }
/// <summary> /// Send a packet to find the DHCP server and tell that we want a new IP address /// </summary> public static void SendDiscoverPacket() { NetworkStack.RemoveAllConfigIP(); foreach (NetworkDevice networkDevice in NetworkDevice.Devices) { NetworkInit.Enable(networkDevice, new Network.IPV4.Address(0, 0, 0, 0), new Network.IPV4.Address(0, 0, 0, 0), new Network.IPV4.Address(0, 0, 0, 0)); DHCPDiscover dhcp_discover = new DHCPDiscover(networkDevice.MACAddress); OutgoingBuffer.AddPacket(dhcp_discover); NetworkStack.Update(); DHCPAsked = true; } }
/* * Method called to applied the differents options received in the DHCP packet ACK **/ /// <summary> /// Apply the new IP configuration received. /// </summary> /// <param name="Options">DHCPOption class using the packetData from the received dhcp packet.</param> /// <param name="message">Enable/Disable the displaying of messages about DHCP applying and conf. Disabled by default. /// </param> public static void Apply(DHCPAck packet, bool message = false) { NetworkStack.RemoveAllConfigIP(); //cf. Roadmap. (have to change this, because some network interfaces are not configured in dhcp mode) [have to be done in 0.5.x] foreach (NetworkDevice networkDevice in NetworkDevice.Devices) { if (packet.Client.ToString() == null || packet.Client.ToString() == null || packet.Client.ToString() == null || packet.Client.ToString() == null) { CustomConsole.WriteLineError("Parsing DHCP ACK Packet failed, can't apply network configuration."); } else { if (message) { Console.WriteLine(); CustomConsole.WriteLineInfo("[DHCP ACK][" + networkDevice.Name + "] Packet received, applying IP configuration..."); CustomConsole.WriteLineInfo(" IP Address : " + packet.Client.ToString()); CustomConsole.WriteLineInfo(" Subnet mask : " + packet.Subnet.ToString()); CustomConsole.WriteLineInfo(" Gateway : " + packet.Server.ToString()); CustomConsole.WriteLineInfo(" DNS server : " + packet.DNS.ToString()); } Utils.Settings settings = new Utils.Settings(@"0:\System\" + networkDevice.Name + ".conf"); settings.EditValue("ipaddress", packet.Client.ToString()); settings.EditValue("subnet", packet.Subnet.ToString()); settings.EditValue("gateway", packet.Server.ToString()); settings.EditValue("dns01", packet.DNS.ToString()); settings.EditValue("dhcp_server", packet.Server.ToString()); settings.PushValues(); NetworkInit.Enable(networkDevice, packet.Client, packet.Subnet, packet.Server, packet.DNS); if (message) { CustomConsole.WriteLineOK("[DHCP CONFIG][" + networkDevice.Name + "] IP configuration applied."); Console.WriteLine(); DHCPAsked = false; } } } Kernel.BeforeCommand(); }
/// <summary> /// c = command, c_SystemInfomation /// </summary> public static void c_IPConfig(string cmd) { string[] args = cmd.Split(' '); if (args.Length == 1) { L.List_Translation.Ipconfig(); return; } if (args[1] == "/release") { System.Network.DHCP.Core.SendReleasePacket(); } else if (args[1] == "/set") { if (args.Length <= 3) { Console.WriteLine("Usage : " + args[0] + " /set {interface} {IPv4} {Subnet} -g {Gateway} -d {PrimaryDNS}"); //ipconfig /set PCNETII 192.168.1.32 255.255.255.0 -g 192.168.1.254 -d 8.8.8.8 } else { if (NetworkInterfaces.Interface(args[2]) != "null") { Utils.Settings settings = new Utils.Settings(@"0:\System\" + NetworkInterfaces.Interface(args[2]) + ".conf"); NetworkStack.RemoveAllConfigIP(); ApplyIP(args, settings); settings.Push(); NetworkInit.Enable(); } else { Console.WriteLine("This interface doesn't exists."); } } } else if (args[1] == "/renew") { System.Network.DHCP.Core.SendDiscoverPacket(); } else { L.List_Translation.Ipconfig(); } }
//--------------------------------------------- void Start() { patternArchiveList = new List <Archive>(); // streamingAssetsPath = Application.streamingAssetsPath + "/"; streamingAssetsPath = "http://jojo-studio.de/Projekte/NeuralNetwork/StreamingAssets/"; netWorkInit = GetComponent <NetworkInit>(); sensorField = GetComponent <SensorField>(); learnManager = GetComponent <LearnManager>(); StartCoroutine(LoadNetworkFromWeb()); ///StartCoroutine(LoadPatternArchive("ExercisePattern")); //StartCoroutine(LoadPatternArchive("TestPattern")); StartCoroutine(WaitForLoadingFiles()); }
// TODO: continue adding exceptions to the list, as HAL and Core would be documented. /// <summary> /// Init <see cref="Global"/> instance. /// </summary> /// <param name="textScreen">Text screen.</param> /// <exception cref="System.IO.IOException">Thrown on IO error.</exception> static public void Init(TextScreenBase textScreen) { if (textScreen != null) { TextScreen = textScreen; } mDebugger.Send("Before Core.Global.Init"); Core.Global.Init(); //TODO Redo this - Global init should be other. // Move PCI detection to hardware? Or leave it in core? Is Core PC specific, or deeper? // If we let hardware do it, we need to protect it from being used by System. // Probably belongs in hardware, and core is more specific stuff like CPU, memory, etc. //Core.PCI.OnPCIDeviceFound = PCIDeviceFound; //TODO: Since this is FCL, its "common". Otherwise it should be // system level and not accessible from Core. Need to think about this // for the future. Console.Clear(); Console.WriteLine("Finding PCI Devices"); mDebugger.Send("PCI Devices"); PCI.Setup(); Console.WriteLine("Starting ACPI"); mDebugger.Send("ACPI Init"); ACPI.Start(); // http://wiki.osdev.org/%228042%22_PS/2_Controller#Initialising_the_PS.2F2_Controller // TODO: USB should be initialized before the PS/2 controller // TODO: ACPI should be used to check if a PS/2 controller exists mDebugger.Send("PS/2 Controller Init"); PS2Controller.Initialize(); IDE.InitDriver(); AHCI.InitDriver(); //EHCI.InitDriver(); mDebugger.Send("Network Devices Init"); NetworkInit.Init(); mDebugger.Send("Done initializing Cosmos.HAL.Global"); }
/// <summary> /// Send a packet to the DHCP server to make the address available again /// </summary> public static void SendReleasePacket() { foreach (NetworkDevice networkDevice in NetworkDevice.Devices) { Address source = Config.FindNetwork(DHCPServerAddress(networkDevice)); DHCPRelease dhcp_release = new DHCPRelease(source, DHCPServerAddress(networkDevice)); OutgoingBuffer.AddPacket(dhcp_release); NetworkStack.Update(); NetworkStack.RemoveAllConfigIP(); Settings settings = new Settings(@"0:\" + networkDevice.Name + ".conf"); settings.EditValue("ipaddress", "0.0.0.0"); settings.EditValue("subnet", "0.0.0.0"); settings.EditValue("gateway", "0.0.0.0"); settings.EditValue("dns01", "0.0.0.0"); settings.PushValues(); NetworkInit.Enable(); } }
protected override void BeforeRun() { try { #region Console Encoding Provider Encoding.RegisterProvider(CosmosEncodingProvider.Instance); Console.InputEncoding = Encoding.Unicode; Console.OutputEncoding = Encoding.Unicode; #endregion #region Commmand Manager Init CommandManager.RegisterAllCommands(); #endregion System.CustomConsole.WriteLineInfo("Booting Aura Operating System..."); #region Filesystem Init Sys.FileSystem.VFS.VFSManager.RegisterVFS(vFS); if (ContainsVolumes()) { System.CustomConsole.WriteLineOK("FileSystem Registration"); } else { System.CustomConsole.WriteLineError("FileSystem Registration"); } #endregion #region Network Init NetworkInit.Init(); #endregion System.CustomConsole.WriteLineOK("Aura successfully started!"); #region Installation Init setup.InitSetup(); /*if (SystemExists) * { * if (!JustInstalled) * { * * Settings config = new Settings(@"0:\System\settings.conf"); * langSelected = config.GetValue("language"); * #region Language * * Lang.Keyboard.Init(); * #endregion * * Info.getComputerName(); * * System.Network.NetworkInterfaces.Init(); * * running = true; * * } * } * else * { * running = true; * }*/ running = true; #endregion boottime = Time.MonthString() + "/" + Time.DayString() + "/" + Time.YearString() + ", " + Time.TimeString(true, true, true); } catch (Exception ex) { running = false; Crash.StopKernel(ex); } }
void startupchecks() { Aura_OS.System.Setup SU = new Setup(); try { //New stuff //Sys.FileSystem.VFS.VFSManager.RegisterVFS(fs); if (ContainsVolumes()) { Aura_OS.System.CustomConsole.WriteLineOK("FileSystem Registration"); } else { Aura_OS.System.CustomConsole.WriteLineError("FileSystem Registration"); } NetworkInit.Init(); Aura_OS.System.CustomConsole.WriteLineOK("Uszka-OS successfully started!"); SU.InitSetup(); if (SystemExists) { if (!JustInstalled) { Settings config = new Settings(@"0:\System\settings.conf"); langSelected = config.GetValue("language"); #region Language Lang.Keyboard.Init(); #endregion Info.getComputerName(); Aura_OS.System.Network.NetworkInterfaces.Init(); running = true; } } else { running = true; } } catch (Exception ex) { CrashHandler CH = new CrashHandler(); CH.Whoops(ex); } #region Obsolete /*if (!File.Exists(@"0:\fs.cfg")) * { * printLogoConsole(); * * Console.WriteLine(@"The filesystem was not formatted with Uszka OS, so it cannot be used."); * Console.WriteLine(@"Would you like to format it? (y/n)"); * Console.WriteLine("WARNING: THIS WILL DELETE ALL DATA.\n"); * if (Console.ReadLine() == "y") * { * Console.WriteLine("\nFormatting..."); * try * { * fs.Format(@"0:\", "FAT32", true); * FileStream writeStream = File.Create(@"0:\fs.cfg"); * byte[] toWrite = Encoding.ASCII.GetBytes("true"); * writeStream.Write(toWrite, 0, toWrite.Length); * writeStream.Close(); * } * catch * { * deathScreen("0x0100 No Hard Drive to format!"); * } * } * else * { * Console.WriteLine("\nThe filesystem is being disabled as it was not formatted with Uszka OS."); * enableFs = false; * WaitSeconds(2); * } * * if (File.Exists("0:\\Flags.flg")) * { * Flags = new char[99]; * Flags = File.ReadAllText("0:\\Flags.flg").ToCharArray(); * Flags[1] = '1';//Force GFX mode * if (Flags[0] == '1') * { * Uszka.Installer.Installer inst = new Installer.Installer(); * inst.start_inst(fs); * } * else if (Flags[0] == '2') * { * Console.ReadKey(); * } * if (Flags[1] == '0')//GUI Mode * { * Console.WriteLine("Vga Driver Booting"); * try * { * GM = new GraphicsManager(); * } * catch (Exception ex) * { * CrashHandler CH = new CrashHandler(); * CH.Whoops(ex); * } * DD.Startup(); * //GM.start(); * } * else if (Flags[1] == '1')//Text Mode/Console Mode * { * * } * } * if (!File.Exists("0:\\Uszaka32\\System.cx") && !File.Exists("0:\\Flags.flg")) * { * // There is no SYSTEM directory yet, so we just shut the computer down there after setting flags * if (!File.Exists("0:\\Flags.flg")) * { * // Create a file to write to. * using (StreamWriter sw = File.CreateText("0:\\Flags.flg")) * { * sw.Write("1"); * } * } * Power.ACPIReboot(); * } * else * { * File.ReadAllText("0:\\Uszaka32\\System.cx"); * } * }*/ #endregion }
protected override void BeforeRun() { try { CommandManager.RegisterAllCommands(); //AConsole = new System.Shell.VGA.VGAConsole(null); Encoding.RegisterProvider(CosmosEncodingProvider.Instance); Console.InputEncoding = Encoding.GetEncoding(437); Console.OutputEncoding = Encoding.GetEncoding(437); System.CustomConsole.WriteLineInfo("Booting Aura Operating System..."); /*System.CustomConsole.WriteLineInfo("VBE Informations:"); * System.CustomConsole.WriteLineInfo("VBE Version: " + Graphics.VBEVersion); * System.CustomConsole.WriteLineInfo("VBE Signature: " + Graphics.VBESignature); * System.CustomConsole.WriteLineInfo("BPP: " + Graphics.ModeInfo.bpp); * System.CustomConsole.WriteLineInfo("Height: " + Graphics.ModeInfo.height); * System.CustomConsole.WriteLineInfo("Width: " + Graphics.ModeInfo.width);*/ #region Register Filesystem Sys.FileSystem.VFS.VFSManager.RegisterVFS(vFS); if (ContainsVolumes()) { System.CustomConsole.WriteLineOK("FileSystem Registration"); } else { System.CustomConsole.WriteLineError("FileSystem Registration"); } #endregion NetworkInit.Init(); System.CustomConsole.WriteLineOK("Aura successfully started!"); setup.InitSetup(); if (SystemExists) { if (!JustInstalled) { Settings config = new Settings(@"0:\System\settings.conf"); langSelected = config.GetValue("language"); #region Language Lang.Keyboard.Init(); #endregion Info.getComputerName(); System.Network.NetworkInterfaces.Init(); running = true; } } else { running = true; } boottime = Time.MonthString() + "/" + Time.DayString() + "/" + Time.YearString() + ", " + Time.TimeString(true, true, true); } catch (Exception ex) { running = false; Crash.StopKernel(ex); } }
/// <summary> /// CommandIPConfig /// </summary> /// <param name="arguments">Arguments</param> public override ReturnInfo Execute(List <string> arguments) { if (arguments[0] == "/release") { DHCPClient.SendReleasePacket(); } else if (arguments[0] == "/ask") { DHCPClient.SendDiscoverPacket(); } else if (arguments[0] == "/listnic") { foreach (var device in NetworkDevice.Devices) { switch (device.CardType) { case CardType.Ethernet: Console.WriteLine("Ethernet Card - " + device.NameID + " - " + device.Name + " (" + device.MACAddress + ")"); break; case CardType.Wireless: Console.WriteLine("Wireless Card - " + device.NameID + " - " + device.Name + " (" + device.MACAddress + ")"); break; } } } else if (arguments[0] == "/set") { if (arguments.Count < 5) { return(new ReturnInfo(this, ReturnCode.ERROR, "Usage : ipconfig /set {device} {IPv4} {Subnet} {Gateway}")); } else { Address ip = Address.Parse(arguments[2]); Address subnet = Address.Parse(arguments[3]); Address gw = Address.Parse(arguments[4]); NetworkDevice nic = NetworkDevice.GetDeviceByName(arguments[1]); if (nic == null) { return(new ReturnInfo(this, ReturnCode.ERROR, "Couldn't find network device: " + arguments[1])); } if (ip != null && subnet != null && gw != null) { NetworkInit.Enable(nic, ip, subnet, gw, gw); Console.WriteLine("Config OK!"); } else { return(new ReturnInfo(this, ReturnCode.ERROR, "Can't parse IP addresses (make sure they are well formated).")); } /*if (NetworkInterfaces.Interface(arguments[1]) != "null") * { * Utils.Settings settings = new Utils.Settings(@"0:\System\" + NetworkInterfaces.Interface(arguments[1]) + ".conf"); * NetworkStack.RemoveAllConfigIP(); * ApplyIP(arguments.ToArray(), settings); //TODO Fix that (arguments) * settings.Push(); * } * else * { * Console.WriteLine("This interface doesn't exists."); * } */ } } else { return(new ReturnInfo(this, ReturnCode.ERROR, "Wrong usage, please type: ipconfig /help")); } return(new ReturnInfo(this, ReturnCode.OK)); }
void Start() { networkInit = GetComponent <NetworkInit>(); sensorField = GetComponent <SensorField>(); storeManager = GetComponent <StoreManager>(); }