Skip to content

Commit

Permalink
Test Mac build
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStolk committed Mar 3, 2024
1 parent c7088a0 commit f1c6a9b
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ public enum SupportedOperatingSystem
{
Windows = 1,
Linux = 2,
Osx = 3,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
namespace DevilDaggersInfo.App.Core.NativeInterface.Services.Osx;

public class OsxDialogService : INativeDialogService
{
public void ReportError(string message, Exception? exception = null)
{
ReportError("Error", message, exception);
}

public void ReportError(string title, string message, Exception? exception = null)
{
if (exception != null)
message += Environment.NewLine + exception.Message;

Console.WriteLine($"{title}: {message}");
}

public void ReportMessage(string title, string message)
{
Console.WriteLine($"{title}{Environment.NewLine}{message}");
}

public bool? PromptYesNo(string title, string message)
{
Console.WriteLine($"{title}{Environment.NewLine}{message}");
Console.WriteLine("Y/N");
ConsoleKeyInfo key = Console.ReadKey();
return key.Key switch
{
ConsoleKey.Y => true,
ConsoleKey.N => false,
_ => null,
};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
using NativeFileDialogSharp;

namespace DevilDaggersInfo.App.Core.NativeInterface.Services.Osx;

/// <summary>
/// Platform-specific code for interacting with the Linux file system.
/// </summary>
public class OsxFileSystemService : INativeFileSystemService
{
public string? CreateOpenFileDialog(string dialogTitle, string? extensionFilter)
{
return Dialog.FileOpen().Path;
}

public string? CreateSaveFileDialog(string dialogTitle, string? extensionFilter)
{
return Dialog.FileSave().Path;
}

public string? SelectDirectory()
{
return Dialog.FolderPicker().Path;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
using System.Diagnostics;

namespace DevilDaggersInfo.App.Core.NativeInterface.Services.Osx;

public class OsxMemoryService : INativeMemoryService
{
public void WriteMemory(Process process, long address, byte[] bytes, int offset, int size)
{
// TODO: Implement.
}

public void ReadMemory(Process process, long address, byte[] bytes, int offset, int size)
{
// TODO: Implement.
}

public Process? GetDevilDaggersProcess()
{
return Array.Find(Process.GetProcesses(), p => p.ProcessName.StartsWith("devildaggers"));
}
}
13 changes: 13 additions & 0 deletions src/app/DevilDaggersInfo.App.Ui.Base/Platforms/OsxValues.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using DevilDaggersInfo.Api.App.ProcessMemory;
using DevilDaggersInfo.Types.Web;

namespace DevilDaggersInfo.App.Ui.Base.Platforms;

public class OsxValues : IPlatformSpecificValues
{
public ToolBuildType BuildType => ToolBuildType.OsxWarp;

public SupportedOperatingSystem OperatingSystem => SupportedOperatingSystem.Osx;

public string DefaultInstallationPath => string.Empty;
}

0 comments on commit f1c6a9b

Please sign in to comment.