Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support OSX build for app #344

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
namespace DevilDaggersInfo.Web.ApiSpec.DdstatsRust;

public enum SupportedOperatingSystem

Check warning on line 3 in src/DevilDaggersInfo.Web.ApiSpec.DdstatsRust/SupportedOperatingSystem.cs

View workflow job for this annotation

GitHub Actions / build

Add a member to SupportedOperatingSystem that has a value of zero with a suggested name of 'None' (https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1008)
{
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;
}
Loading