Skip to content

Commit

Permalink
Beans
Browse files Browse the repository at this point in the history
  • Loading branch information
Owen2k6 committed Mar 21, 2024
1 parent 37c0997 commit 5712d50
Show file tree
Hide file tree
Showing 15 changed files with 979 additions and 1,027 deletions.
3 changes: 2 additions & 1 deletion GoOS/BetterConsole/BetterConsole.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using GoOS.GUI;
using GoOS.Themes;
using GoGL.Graphics;
using GoOS.GUI.Apps.Settings;
using static GoOS.Resources;

/// <summary>
Expand Down Expand Up @@ -330,7 +331,7 @@ public static string ReadLine()

case ConsoleKeyEx.Enter:
if (MenuOptions[selected] == MenuOptions[0])
GoOS.ControlPanel.Launch();
WindowManager.AddWindow(new Frame());
else if (MenuOptions[selected] == MenuOptions[1])
Power.Reboot();
break;
Expand Down
1 change: 1 addition & 0 deletions GoOS/GUI/Apps/GoStore/MainFrame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class MainFrame : Window
Button[] catagoryButtons;
Button[] _repoFilesButtons;
string[] Catagories;
public static string Version = "1.0";

private int catagory = 0;
private int page = 0;
Expand Down
1 change: 1 addition & 0 deletions GoOS/GUI/Apps/GoWeb/GoWebWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace GoOS.GUI.Apps.GoWeb
{
public class GoWebWindow : Window
{
public static string Version = "0.1.0";
readonly Input AddressBar;

readonly Button HomeButton;
Expand Down
669 changes: 648 additions & 21 deletions GoOS/GUI/Apps/Settings/Frame.cs

Large diffs are not rendered by default.

282 changes: 282 additions & 0 deletions GoOS/GoOS - Backup.csproj

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion GoOS/GoOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,6 @@
<EmbeddedResource Include="Resources\OOBE\setupwelcome.bmp" />
<EmbeddedResource Include="Resources\GUI\question.bmp" />
<EmbeddedResource Include="Resources\GUI\closebutton_hover.bmp" />
<EmbeddedResource Include="Resources\MSUIGothicCustomCharset16.btf" />
<EmbeddedResource Include="Resources\Welcome.bmp" />
<EmbeddedResource Include="Resources\GUI\warning.bmp" />
<None Remove="Resources\GUI\TaskStart\startmenuBG.bmp" />
Expand All @@ -228,10 +227,21 @@
<EmbeddedResource Include="Resources\GUI\Settings\Background.bmp" />
<None Remove="Resources\GUI\Settings\Unknown.bmp" />
<EmbeddedResource Include="Resources\GUI\Settings\Unknown.bmp" />
<None Remove="Resources\GUI\Settings\BackgroundMenu.bmp" />
<EmbeddedResource Include="Resources\GUI\Settings\BackgroundMenu.bmp" />
<None Remove="Resources\GUI\Settings\ButtonSelection.bmp" />
<EmbeddedResource Include="Resources\GUI\Settings\ButtonSelection.bmp" />
<None Remove="Resources\GUI\Settings\Back.bmp" />
<EmbeddedResource Include="Resources\GUI\Settings\Back.bmp" />
<None Remove="Resources\MicrosoftSansSerif16.btf" />
<EmbeddedResource Include="Resources\MicrosoftSansSerif16.btf" />
<None Remove="Resources\MSUIGothic16.btf" />
<EmbeddedResource Include="Resources\MSUIGothic16.btf" />
</ItemGroup>

<PropertyGroup>
<DefineConstants>BUILD_GOWEB</DefineConstants>
<UseUEFI>True</UseUEFI>
</PropertyGroup>

<ItemGroup Condition="'$(DefineConstants.Contains(BUILD_GOWEB))' != 'true'">
Expand Down
174 changes: 4 additions & 170 deletions GoOS/Kernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ public class Kernel : Sys.Kernel
//Vars for OS
public const string version = "1.5.3";
public const string edition = "1.5"; // This is the current edition of GoOS. Used for UPDATER.
public const string editiontitle = "Scafell"; // This is the current edition name of GoOS.
public const string editionnext = "1.6"; // This is the next edition of GoOS. Used for UPDATER.
public const string BuildType = "R";
public const string Copyright = "2021-2024";
Expand All @@ -68,7 +69,7 @@ protected override void BeforeRun()
System.Console.ForegroundColor = System.ConsoleColor.Cyan;
System.Console.WriteLine("GoOS - Starting GoOS...");
System.Console.ForegroundColor = System.ConsoleColor.White;
System.Console.WriteLine("Initialising memory.");
System.Console.WriteLine("Initialising Memory.");

if (Cosmos.Core.CPU.GetAmountOfRAM() < 256)
{
Expand Down Expand Up @@ -118,13 +119,9 @@ protected override void BeforeRun()
WindowManager.Canvas.DrawImage(0, 0, Resources.bootbackground, false);
WindowManager.Canvas.DrawImage(ControlPanel.videoModes[screenRes[0]].Item2.Width / 2 - 37,
ControlPanel.videoModes[screenRes[0]].Item2.Height / 2 - 37, Resources.bootlogo, true);
Console.Init(ControlPanel.terminalModes[termRes[0]].Item2.Width,
ControlPanel.terminalModes[termRes[0]].Item2.Height);

Console.Init(800,
600);
Cosmos.System.PCSpeaker.Beep(600, 100);


//WindowManager.AddWindow(new LoadingDialogue("GoOS is starting\nPlease wait..."));
WindowManager.Update();

Resources.Generate(ResourceType.Normal);
Expand Down Expand Up @@ -207,169 +204,6 @@ protected override void BeforeRun()
Sys.MouseManager.X = 0;
Sys.MouseManager.Y = 0;

#region GoOS Update Check

try
{
using (TcpClient tcpClient = new TcpClient())
{
var dnsClient = new DnsClient();

// DNS
dnsClient.Connect(DNSConfig.DNSNameservers[0]);
dnsClient.SendAsk("api.goos.owen2k6.com");

// Address from IP
Address address = dnsClient.Receive();
dnsClient.Close();
string serverIP = address.ToString();

tcpClient.Connect(serverIP, 80);
NetworkStream stream = tcpClient.GetStream();
string httpget = "GET /GoOS/" + edition + ".goos HTTP/1.1\r\n" +
"User-Agent: GoOS\r\n" +
"Accept: */*\r\n" +
"Accept-Encoding: identity\r\n" +
"Host: api.goos.owen2k6.com\r\n" +
"Connection: Keep-Alive\r\n\r\n";
byte[] dataToSend = Encoding.ASCII.GetBytes(httpget);
stream.Write(dataToSend, 0, dataToSend.Length);

// Receive data
byte[] receivedData = new byte[tcpClient.ReceiveBufferSize];
int bytesRead = stream.Read(receivedData, 0, receivedData.Length);
string receivedMessage = Encoding.ASCII.GetString(receivedData, 0, bytesRead);

string[] responseParts = receivedMessage.Split(new[] { "\r\n\r\n" }, 2, StringSplitOptions.None);

if (responseParts.Length < 2 || responseParts.Length > 2)
Dialogue.Show("GoOS Update", "Invalid HTTP response!", default, WindowManager.errorIcon);

string content = responseParts[1];

if (content != version && content != editionnext)
{
if (BuildType == "INTERNAL TEST BUILD")
{

Dialogue.Show("It's time to move on...",
"The Internal Test Version for this edition of GoOS has ended\nThis build of GoOS can no longer access GoOS Online Services.\nPlease check with your INTERNAL TEST Group to see if a new version has been issued.");
}
else
{
Dialogue.Show("GoOS Update",
"A newer version of GoOS is available on Github.\nWe recommend you update to the latest version for stability and security reasons.\nhttps://github.com/Owen2k6/GoOS/releases\nCurrent Version: " +
version + "\nLatest Version: " + content);
}
}
else if (content == editionnext)
{
if (BuildType == "INTERNAL TEST BUILD")
{

Dialogue.Show("It's time to move on...",
"The Internal Test Version for this edition of GoOS has ended\nThis build of GoOS can no longer access GoOS Online Services.\nPlease check with your INTERNAL TEST Group to see if a new version has been issued.");
}
else
{

Dialogue.Show("GoOS Update",
"The next GoOS has been released.\nWe don't want to force you to update but at least check out whats new in GoOS " +
editionnext + "!\nhttps://github.com/Owen2k6/GoOS/releases/tag/" + editionnext);
}
}
else if (content == "404")
{
Dialogue.Show("GoOS Update", "Your Version of GoOS does not support GoOS Update.");
}
else
{
WindowManager.AddWindow(new Welcome());
}
}
}
catch (Exception ex)
{
ErrorSound();
Dialogue.Show("GoOS Update", "Failed to connect to Owen2k6 Api. Error: " + ex);
}

#endregion

#region GoOS Support Checker

try
{
using (TcpClient tcpClient = new TcpClient())
{
var dnsClient = new DnsClient();

// DNS
dnsClient.Connect(DNSConfig.DNSNameservers[0]);
dnsClient.SendAsk("api.goos.owen2k6.com");

// Address from IP
Address address = dnsClient.Receive();
dnsClient.Close();
string serverIP = address.ToString();

tcpClient.Connect(serverIP, 80);
NetworkStream stream = tcpClient.GetStream();
string httpget = "GET /GoOS/" + edition + "-support.goos HTTP/1.1\r\n" +
"User-Agent: GoOS\r\n" +
"Accept: */*\r\n" +
"Accept-Encoding: identity\r\n" +
"Host: api.goos.owen2k6.com\r\n" +
"Connection: Keep-Alive\r\n\r\n";
byte[] dataToSend = Encoding.ASCII.GetBytes(httpget);
stream.Write(dataToSend, 0, dataToSend.Length);

// Receive data
byte[] receivedData = new byte[tcpClient.ReceiveBufferSize];
int bytesRead = stream.Read(receivedData, 0, receivedData.Length);
string receivedMessage = Encoding.ASCII.GetString(receivedData, 0, bytesRead);

string[] responseParts = receivedMessage.Split(new[] { "\r\n\r\n" }, 2, StringSplitOptions.None);

if (responseParts.Length < 2 || responseParts.Length > 2)
Dialogue.Show("GoOS Update", "Invalid HTTP response!", default, WindowManager.errorIcon);

string content = responseParts[1];

if (content == "true")
{
}
else if (content == "false")
{
Dialogue.Show("GoOS Security Notice",
"GoOS Support for this edition has ended. Please update to the latest version of GoOS for the latest security patches.\nThere will no more security patches released for GoOS " +
edition +
".\nDownload the latest edition from \nhttps://github.com/Owen2k6/GoOS/releases/tag/");
}
else
{
if (BuildType == "INTERNAL TEST BUILD")
{
Dialogue.Show("It's time to move on...",
"The Internal Test Version for this edition of GoOS has ended\nThis build of GoOS can no longer access GoOS Online Services.\nPlease check with your INTERNAL TEST Group to see if a new version has been issued.");
}
else
{
Dialogue.Show("GoOS Security",
"You seem to be sporting some funky version of GoOS. Your edition doesnt exist on our servers (" +
edition + ")");
}
}
}
}
catch (Exception ex)
{
ErrorSound();
Dialogue.Show("GoOS Security", "Failed to connect to Owen2k6 Api. Error: " + ex);
}

#endregion

Console.Clear();

Canvas cv = Image.FromBitmap(rawBootLogo, false);
Expand Down
29 changes: 27 additions & 2 deletions GoOS/Resources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,12 @@ public class Resources
[ManifestResourceStream(ResourceName = "GoOS.Resources.Font_2x.btf")]
static byte[] font_2x_raw;

[ManifestResourceStream(ResourceName = "GoOS.Resources.MicrosoftSansSerif16.btf")]
static byte[] SansSerif16Raw;

[ManifestResourceStream(ResourceName = "GoOS.Resources.MSUIGothic16.btf")]
static byte[] UIGothic16Raw;

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.GoIDE.run.bmp")]
static byte[] runRaw;

Expand Down Expand Up @@ -227,13 +233,22 @@ public class Resources

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.GoWeb.bmp")]
static byte[] goWebIconRaw;

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.Settings.Background.bmp")]
static byte[] SBGRaw;

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.Settings.Unknown.bmp")]
static byte[] UnknownRaw;

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.Settings.BackgroundMenu.bmp")]
static byte[] SBGMRaw;

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.Settings.ButtonSelection.bmp")]
static byte[] SBGBSRaw;

[ManifestResourceStream(ResourceName = "GoOS.Resources.GUI.Settings.Back.bmp")]
static byte[] SBBBRaw;

public static Canvas easterEgg;
public static Canvas RunImage;
public static Canvas gtermIcon;
Expand Down Expand Up @@ -305,8 +320,13 @@ public class Resources
public static Canvas goWebIcon;
public static Canvas SBG;
public static Canvas Unknown;
public static Canvas SBGM;
public static Canvas SBGBS;
public static Canvas SBBB;
public static Font Font_1x = Font.Fallback;
public static Font Font_2x = Font.Fallback;
public static Font SansSerif16 = Font.Fallback;
public static Font UIGothic16 = Font.Fallback;

public static void Generate(ResourceType type)
{
Expand Down Expand Up @@ -375,6 +395,9 @@ public static void Generate(ResourceType type)
goWebIcon = Image.FromBitmap(goWebIconRaw, false);
SBG = Image.FromBitmap(SBGRaw, false);
Unknown = Image.FromBitmap(UnknownRaw, false);
SBGM = Image.FromBitmap(SBGMRaw, false);
SBGBS = Image.FromBitmap(SBGBSRaw, false);
SBBB = Image.FromBitmap(SBBBRaw, false);
break;

case ResourceType.Priority:
Expand All @@ -396,6 +419,8 @@ public static void Generate(ResourceType type)
case ResourceType.Fonts:
Font_1x = new Font(font_1x_raw, 16);
Font_2x = new Font(font_2x_raw, 32);
SansSerif16 = new Font(SansSerif16Raw, 32);
UIGothic16 = new Font(UIGothic16Raw, 32);
break;

case ResourceType.OOBE:
Expand Down
Binary file added GoOS/Resources/GUI/Settings/Back.bmp
Binary file not shown.
Binary file modified GoOS/Resources/GUI/Settings/Background.bmp
Binary file not shown.
Binary file added GoOS/Resources/GUI/Settings/BackgroundMenu.bmp
Binary file not shown.
Binary file added GoOS/Resources/GUI/Settings/ButtonSelection.bmp
Binary file not shown.
File renamed without changes.
Binary file added GoOS/Resources/MicrosoftSansSerif16.btf
Binary file not shown.
Loading

0 comments on commit 5712d50

Please sign in to comment.