-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Add exit command + network button context menu
- Loading branch information
1 parent
9d11866
commit 5ae8a09
Showing
7 changed files
with
123 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* PROJECT: Aura Operating System Development | ||
* CONTENT: Dhcp utils class | ||
* PROGRAMMER(S): Valentin Charbonnier <[email protected]> | ||
*/ | ||
|
||
using Cosmos.System.Network.Config; | ||
using Cosmos.System.Network.IPv4.UDP.DNS; | ||
using Cosmos.System.Network.IPv4; | ||
using CosmosHttp.Client; | ||
using System.Net; | ||
using System.Text; | ||
using Aura_OS.System.Processing.Processes; | ||
using Cosmos.System.Network.IPv4.UDP.DHCP; | ||
using Aura_OS.System.Processing.Interpreter.Commands; | ||
using System; | ||
|
||
namespace Aura_OS.System.Network | ||
{ | ||
public static class Dhcp | ||
{ | ||
public static void Release() | ||
{ | ||
var xClient = new DHCPClient(); | ||
xClient.SendReleasePacket(); | ||
xClient.Close(); | ||
|
||
NetworkConfiguration.ClearConfigs(); | ||
|
||
Kernel.NetworkConnected = false; | ||
Explorer.Taskbar.MarkDirty(); | ||
} | ||
|
||
public static bool Ask() | ||
{ | ||
var xClient = new DHCPClient(); | ||
if (xClient.SendDiscoverPacket() != -1) | ||
{ | ||
xClient.Close(); | ||
Console.WriteLine("Configuration applied! Your local IPv4 Address is " + NetworkConfiguration.CurrentAddress + "."); | ||
Kernel.NetworkConnected = true; | ||
return true; | ||
} | ||
else | ||
{ | ||
NetworkConfiguration.ClearConfigs(); | ||
|
||
xClient.Close(); | ||
return false; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* PROJECT: Aura Operating System Development | ||
* CONTENT: Command Interpreter - Clear | ||
* PROGRAMMER(S): John Welsh <[email protected]> | ||
* PROGRAMMER(S): John Welsh <[email protected]> | ||
*/ | ||
|
||
using Aura_OS.System.Graphics.UI.GUI; | ||
|
@@ -12,6 +12,7 @@ namespace Aura_OS.System.Processing.Interpreter.Commands.c_Console | |
class CommandClear : ICommand | ||
{ | ||
private TerminalApp _terminal; | ||
|
||
/// <summary> | ||
/// Empty constructor. | ||
/// </summary> | ||
|
@@ -30,6 +31,10 @@ public override ReturnInfo Execute() | |
{ | ||
_terminal.Console.ClearText(); | ||
} | ||
else | ||
{ | ||
Cosmos.System.Power.Shutdown(); | ||
} | ||
|
||
return new ReturnInfo(this, ReturnCode.OK); | ||
} | ||
|
39 changes: 39 additions & 0 deletions
39
SRC/Aura_OS/System/Processing/Interpreter/Commands/c_Console/Exit.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* PROJECT: Aura Operating System Development | ||
* CONTENT: Command Interpreter - Exit | ||
* PROGRAMMER(S): John Welsh <[email protected]> | ||
* Valentin Charbonnier <[email protected]> | ||
*/ | ||
|
||
using Aura_OS.System.Graphics.UI.GUI; | ||
using Aura_OS.System.Processing.Applications.Terminal; | ||
|
||
namespace Aura_OS.System.Processing.Interpreter.Commands.c_Console | ||
{ | ||
class CommandExit : ICommand | ||
{ | ||
private TerminalApp _terminal; | ||
|
||
/// <summary> | ||
/// Empty constructor. | ||
/// </summary> | ||
public CommandExit(string[] commandvalues, Application terminal) : base(commandvalues) | ||
{ | ||
Description = "to exit the console"; | ||
_terminal = terminal as TerminalApp; | ||
} | ||
|
||
/// <summary> | ||
/// CommandClear | ||
/// </summary> | ||
public override ReturnInfo Execute() | ||
{ | ||
if (_terminal != null) | ||
{ | ||
_terminal.Window.Close.Click(); | ||
} | ||
|
||
return new ReturnInfo(this, ReturnCode.OK); | ||
} | ||
} | ||
} |