Пример #1
0
        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);
            }
        }
Пример #2
0
        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);
        }
Пример #3
0
        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();
        }
Пример #4
0
        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(':', '_'));
        }
Пример #5
0
        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);
            }
        }
Пример #6
0
 public static string GetDataRootForGVFS()
 {
     return(LinuxPlatform.GetDataRootForGVFSImplementation());
 }
Пример #7
0
 public static string GetUpgradeReminderNotification()
 {
     return(LinuxPlatform.GetUpgradeReminderNotificationImplementation());
 }
Пример #8
0
 public static string GetNamedPipeName(string enlistmentRoot)
 {
     return(LinuxPlatform.GetNamedPipeNameImplementation(enlistmentRoot));
 }
Пример #9
0
 public static bool TryGetGVFSEnlistmentRoot(string directory, out string enlistmentRoot, out string errorMessage)
 {
     return(LinuxPlatform.TryGetGVFSEnlistmentRootImplementation(directory, out enlistmentRoot, out errorMessage));
 }
Пример #10
0
 public static string GetUpgradeHighestAvailableVersionDirectory()
 {
     return(LinuxPlatform.GetUpgradeHighestAvailableVersionDirectoryImplementation());
 }