private static void LoadNatives() { var libraryFileNames = NativeLibraryExtractor.ExtractAll() .Select(Path.GetFileName); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Platform = new WindowsPlatform(); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Platform = new LinuxPlatform(); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Console.WriteLine("Warning! Your platform support is currently *untested*.\n" + "Things can (and probably will) explode!"); Platform = new MacPlatform(); } foreach (var libraryFileName in libraryFileNames) { Console.WriteLine($"Now loading: {libraryFileName}"); Platform.Register(libraryFileName); } }
private static bool TryGetGVFSEnlistmentRootImplementation(string directory, out string enlistmentRoot, out string errorMessage) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { return(LinuxPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage)); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return(MacPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage)); } // Not able to use WindowsPlatform here - because of its dependency on WindowsIdentity (and also kernel32.dll). enlistmentRoot = null; string finalDirectory; if (!WindowsFileSystem.TryGetNormalizedPathImplementation(directory, out finalDirectory, out errorMessage)) { return(false); } const string dotGVFSRoot = ".gvfs"; enlistmentRoot = Paths.GetRoot(finalDirectory, dotGVFSRoot); if (enlistmentRoot == null) { errorMessage = $"Failed to find the root directory for {dotGVFSRoot} in {finalDirectory}"; return(false); } return(true); }
static void Main(string[] args) { Platform pf = new WindowsPlatform(); Mario2D mario2D = new Mario2D(pf); mario2D.Walk(); mario2D.Jump(); pf = new LinuxPlatform(); Mario3D mario3D = new Mario3D(pf); mario3D.Walk(); mario3D.Jump(); }
private static string GetNamedPipeNameImplementation(string enlistmentRoot) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { return(LinuxPlatform.GetNamedPipeNameImplementation(enlistmentRoot)); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { return(MacPlatform.GetNamedPipeNameImplementation(enlistmentRoot)); } // Not able to use WindowsPlatform here - because of its dependency on WindowsIdentity (and also kernel32.dll). return("GVFS_" + enlistmentRoot.ToUpper().Replace(':', '_')); }
private static void LoadNatives() { var libraryFileNames = NativeLibraryExtractor.ExtractAll() .Select(Path.GetFileName); if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { Platform = new WindowsPlatform(); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) { Platform = new LinuxPlatform(); } else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) { Platform = new MacPlatform(); } foreach (var libraryFileName in libraryFileNames) { Console.WriteLine($"Now loading: {libraryFileName}"); Platform.Register(libraryFileName); } }
public static string GetDataRootForGVFS() { return(LinuxPlatform.GetDataRootForGVFSImplementation()); }
public static string GetUpgradeReminderNotification() { return(LinuxPlatform.GetUpgradeReminderNotificationImplementation()); }
public static string GetNamedPipeName(string enlistmentRoot) { return(LinuxPlatform.GetNamedPipeNameImplementation(enlistmentRoot)); }
public static bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage) { return(LinuxPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage)); }
public static string GetUpgradeHighestAvailableVersionDirectory() { return(LinuxPlatform.GetUpgradeHighestAvailableVersionDirectoryImplementation()); }