Skip to content

Commit

Permalink
🐛 Fix picture window not showing picture
Browse files Browse the repository at this point in the history
  • Loading branch information
valentinbreiz committed Mar 11, 2024
1 parent b0b2c63 commit fea9064
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 21 deletions.
2 changes: 1 addition & 1 deletion SRC/Aura_OS/Properties/VersionInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ namespace Aura_OS
{
public class VersionInfo
{
public static string revision = "110320241621";
public static string revision = "110320241632";
}
}
4 changes: 2 additions & 2 deletions SRC/Aura_OS/System/Processing/ApplicationManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -170,10 +170,10 @@ public void StartFileApplication(string fileName, string currentPath)

if (width < bitmap.Width)
{
width = (int)bitmap.Width + 1;
width = (int)bitmap.Width + 6;
}

var app = new PictureApp(name, bitmap, width, (int)bitmap.Height + 20);
var app = new PictureApp(name, bitmap, width, (int)bitmap.Height + 26, 40, 40);
app.Initialize();
app.MarkFocused();
app.Visible = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
* Valentin Charbonnier <[email protected]>
*/

using Aura_OS.System.Processing.Applications;
using Aura_OS.System.Processing.Processes;
using Cosmos.System.Graphics;
using System;
using System.Collections.Generic;
using System.IO;
using Cosmos.System.Graphics;
using Aura_OS.System.Processing.Applications;
using Aura_OS.System.Processing.Processes;

namespace Aura_OS.System.Processing.Interpreter.Commands.Filesystem
{
Expand All @@ -21,7 +21,7 @@ class CommandPicture : ICommand
/// </summary>
public CommandPicture(string[] commandvalues) : base(commandvalues, CommandType.Filesystem)
{
Description = "to display a bitmap in a new window.";
Description = "to display a bitmap in a new window";
}

public override ReturnInfo Execute(List<string> arguments)
Expand All @@ -41,10 +41,10 @@ public override ReturnInfo Execute(List<string> arguments)

if (width < bitmap.Width)
{
width = (int)bitmap.Width + 1;
width = (int)bitmap.Width + 6;
}

var app = new PictureApp(name, bitmap, width, (int)bitmap.Height + 20);
var app = new PictureApp(name, bitmap, width, (int)bitmap.Height + 26, 40, 40);
app.MarkFocused();
app.Initialize();
app.Visible = true;
Expand All @@ -67,7 +67,7 @@ public override ReturnInfo Execute(List<string> arguments)
public override void PrintHelp()
{
Console.WriteLine("Usage:");
Console.WriteLine(" - cp {source_file/directory} {destination_file/directory}");
Console.WriteLine(" - pic {source_file}");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,24 +66,31 @@ public override ReturnInfo Execute()

int versionComparisonResult = CompareVersions(Kernel.Version, latestVersion);

if (versionComparisonResult > 0)
if (string.IsNullOrEmpty(Kernel.Version) || string.IsNullOrEmpty(latestVersion) || string.IsNullOrEmpty(Kernel.Revision) || string.IsNullOrEmpty(latestRevision))
{
Console.WriteLine("Aura [version " + Kernel.Version + "-" + Kernel.Revision + "], you are on a dev version (last release is " + latestVersion + "-" + latestRevision + ").");
}
else if (versionComparisonResult < 0)
{
Console.WriteLine("Aura [version " + Kernel.Version + "-" + Kernel.Revision + "], your version is outdated (last release is " + latestVersion + "-" + latestRevision + ").");
Console.WriteLine("Aura [version " + Kernel.Version + "-" + Kernel.Revision + "]");
}
else
{
int revisionComparisonResult = string.Compare(Kernel.Revision, latestRevision);
if (revisionComparisonResult < 0)
if (versionComparisonResult > 0)
{
Console.WriteLine("Aura [version " + Kernel.Version + "-" + Kernel.Revision + "], you are on a dev version (last release is " + latestVersion + "-" + latestRevision + ").");
}
else if (versionComparisonResult < 0)
{
Console.WriteLine("Aura [version " + Kernel.Version + "-" + Kernel.Revision + "], your version is outdated (last release is " + latestVersion + "-" + latestRevision + ").");
}
else
{
Console.WriteLine("Aura [version " + Kernel.Version + "-" + Kernel.Revision + "], you are up to date.");
int revisionComparisonResult = string.Compare(Kernel.Revision, latestRevision);
if (revisionComparisonResult < 0)
{
Console.WriteLine("Aura [version " + Kernel.Version + "-" + Kernel.Revision + "], your version is outdated (last release is " + latestVersion + "-" + latestRevision + ").");
}
else
{
Console.WriteLine("Aura [version " + Kernel.Version + "-" + Kernel.Revision + "], you are up to date.");
}
}
}
}
Expand All @@ -100,8 +107,8 @@ public override ReturnInfo Execute()

int CompareVersions(string version1, string version2)
{
var version1Parts = version1.Split('.').Select(int.Parse).ToArray();
var version2Parts = version2.Split('.').Select(int.Parse).ToArray();
var version1Parts = version1.Split('.').Select(v => int.TryParse(v, out int val) ? val : 0).ToArray();
var version2Parts = version2.Split('.').Select(v => int.TryParse(v, out int val) ? val : 0).ToArray();

for (int i = 0; i < Math.Min(version1Parts.Length, version2Parts.Length); i++)
{
Expand Down

0 comments on commit fea9064

Please sign in to comment.