RunningOnWindows() 공개 정적인 메소드

public static RunningOnWindows ( ) : bool
리턴 bool
예제 #1
0
        public static string GetDefaultHomeDir()
        {
            if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HOME", EnvironmentVariableTarget.User)))
            {
                return(Environment.GetEnvironmentVariable("HOME", EnvironmentVariableTarget.User));
            }

            if (Settings.RunningOnWindows())
            {
                string homePath;
                if (!string.IsNullOrEmpty(Environment.GetEnvironmentVariable("HOMEDRIVE")))
                {
                    homePath  = Environment.GetEnvironmentVariable("HOMEDRIVE");
                    homePath += Environment.GetEnvironmentVariable("HOMEPATH");
                }
                else
                {
                    homePath = Environment.GetEnvironmentVariable("USERPROFILE");
                }

                return(homePath);
            }
            else
            {
                return(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
            }
        }
예제 #2
0
        public static string GetDefaultHomeDir()
        {
            if (!string.IsNullOrEmpty(UserHomeDir))
            {
                return(UserHomeDir);
            }

            if (Settings.RunningOnWindows())
            {
                return(WindowsDefaultHomeDir);
            }
            return(Environment.GetFolderPath(Environment.SpecialFolder.Personal));
        }
예제 #3
0
        public static void TerminateTree(this Process process)
        {
#if !MONO
            if (Settings.RunningOnWindows())
            {
                // Send Ctrl+C
                AttachConsole(process.Id);
                SetConsoleCtrlHandler(IntPtr.Zero, true);
                GenerateConsoleCtrlEvent(0, 0);
                if (!process.HasExited)
                {
                    System.Threading.Thread.Sleep(500);
                }
                if (!process.HasExited)
                {
                    process.Kill();
                }
            }
#else
            process.Kill();
#endif
        }