Пример #1
0
        public static T OSPlatformSwitch <T>(Func <T> windows, Func <T> osx, Func <T> linux)
        {
            var osPlatform = OSHelper.GetOSPlatform();

            var output = OSHelper.OSPlatformSwitch(osPlatform, windows, osx, linux);

            return(output);
        }
Пример #2
0
 public static void DisplayOSName(StreamWriter writer)
 {
     OSHelper.OSPlatformSwitch(
         () =>
     {
         writer.WriteLine(@"OS: Windows");
     },
         () =>
     {
         writer.WriteLine(@"OS: OSX (Mac)");
     },
         () =>
     {
         writer.WriteLine(@"OS: Linux");
     });
 }
Пример #3
0
        public static Platform GetPlatform(OSPlatform osPlatform)
        {
            var platform = OSHelper.OSPlatformSwitch(osPlatform,
                                                     () =>
            {
                return(Platform.Windows);
            },
                                                     () =>
            {
                return(Platform.NonWindows);
            },
                                                     () =>
            {
                return(Platform.NonWindows);
            });

            return(platform);
        }
Пример #4
0
        public static T OSPlatformSwitch <T>(OSPlatform osPlatform, Func <T> windows, Func <T> osx, Func <T> linux)
        {
            T output = default;

            OSHelper.OSPlatformSwitch(osPlatform,
                                      () =>
            {
                output = windows();
            },
                                      () =>
            {
                output = osx();
            },
                                      () =>
            {
                output = linux();
            });

            return(output);
        }
Пример #5
0
        public static void OSPlatformSwitch(Action windows, Action osx, Action linux)
        {
            var osPlatform = OSHelper.GetOSPlatform();

            OSHelper.OSPlatformSwitch(osPlatform, windows, osx, linux);
        }