public OSFilterAttribute(FilterActions action, PlatformID osType, FilterRules rule, string osVersion)
 {
     Action = action;
     OSType = osType;
     Rule = rule;
     Version = osVersion;
 }
Esempio n. 2
0
 public ShellCmdAttribute(PlatformID platformID, String program, String arguments, String regex)
 {
     this.PlatformID = platformID;
     this.Program = program;
     this.Arguments = arguments;
     this.Regex = new Regex(regex);
 }
Esempio n. 3
0
 public ReadFileAttribute(PlatformID platformID,String file, String regex = null)
 {
     this.PlatformID = platformID;
     File = file;
     if (regex != null)
         Regex = new Regex(regex);
 }
Esempio n. 4
0
		Assembly GetPlatformAssembly(PlatformID platformId)
		{
			var assemblyName = string.Empty;
			var currentAssembly = Assembly.GetExecutingAssembly();
			
			var uri = new Uri(currentAssembly.CodeBase);
			var directory = Path.GetDirectoryName(uri.AbsolutePath);
			
			
			switch( platformId )
			{
			case PlatformID.Unix: 
				assemblyName = "Forseti.OSX";
				break;
			case PlatformID.Win32NT:
				assemblyName = "Forseti.Windows";
				break;
			}
			assemblyName = string.Format ("{0}/{1}.dll",directory,assemblyName);
			
			if( System.IO.File.Exists(assemblyName) ) 
				return Assembly.LoadFile (assemblyName);
			
			return typeof(MainRegistry).Assembly;
		}
		public OperatingSystem(PlatformID platformID, Version version) {
			if (version == null) {
				throw new ArgumentNullException("version");
			}
			this.platformID = platformID;
			this.version = version;
		}
Esempio n. 6
0
        /// <summary>
        /// Create a global instance of this panel
        /// </summary>>
        public static OperatingSystem CreateInstance()
        {
            if (panelInstance == null)
            {
                panelInstance = new OperatingSystem();

                OSShortVersion = info.OSShortVersion;
                OSPlatform = info.OSPlatform;
                OSFullName = info.OSFullName;
                OSVersion = info.OSVersion;
                OSServicePack = info.OSServicePack;
                OSType = info.OSType;
                OSCodeName = info.OSCodeName;
                OSMachineName = info.OSMachineName;
                OSUserName = info.OSUserName;
                UserIsAdministrator = info.UserIsAdministrator;
                OSProductID = info.OSProductID;
                OSProductKey = info.OSProductKey;
                OSInstallDate = info.OSInstallDate;
                FrameworkShortVersion = info.FrameworkShortVersion;
                FrameworkVersion = info.FrameworkVersion;
                FrameworkServicePack = info.FrameworkServicePack;
            }
            return panelInstance;
        }
 public void Platform_Unsupported(PlatformID platform)
 {
     // Arrange
     // Act
     // Assert
     Assert.Catch<PlatformNotSupportedException>(() => LibraryLoaderFactory.Create(platform));
 }
Esempio n. 8
0
        public static string LocalAppData(PlatformID platform, string organization, string product)
        {
            if (organization == null)
                throw new ArgumentNullException(nameof(organization));
            if (product == null)
                throw new ArgumentNullException(nameof(product));
            if (product.Length == 0)
                throw new ArgumentException(nameof(product) + " may not have zero length");

            switch (platform)
            {
                case PlatformID.Win32NT:
                    return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
                        ToUpper(organization), ToUpper(product));
                case PlatformID.MacOSX:
                    return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                        "Library", "Application Support", ToUpper(organization), ToUpper(product));
                case PlatformID.Unix:
                    var homeDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                    if (organization == "")
                    {
                        return Path.Combine(homeDirectory, ToDotLower(product));
                    }
                    else
                    {
                        return Path.Combine(homeDirectory, ToDotLower(organization), product.ToLower());
                    }
                default:
                    throw new PlatformNotSupportedException($"PlatformID={platform}");
            }
        }
 public OperatingSystem(PlatformID platform, Version version)
 {
   Contract.Requires(platform >= PlatformID.Win32S)
   Contract.Requires(platform <= PlatformID.MacOSX)
   Contract.Requires(version != null);
   Contract.EnsuresOnThrow<ArgumentException>(true, "platform is not a PlatformID enumeration value.")
   Contract.EnsuresOnThrow<ArgumentNullException>(true, "version is null.")
 }
Esempio n. 10
0
 public static void Ctor(PlatformID id, string versionString)
 {
     var os = new OperatingSystem(id, new Version(versionString));
     Assert.Equal(id, os.Platform);
     Assert.Equal(new Version(versionString), os.Version);
     Assert.Equal(string.Empty, os.ServicePack);
     Assert.NotEmpty(os.VersionString);
     Assert.Equal(os.VersionString, os.ToString());
 }
		public OperatingSystem (PlatformID platform, Version version)
		{
			if (version == null) {
				throw new ArgumentNullException ("version");
			}

			_platform = platform;
			_version = version;
		}
        private static void CreateSilverlightSequence(IList<UnitTestTask> sequence, IUnitTestLaunch launch, UnitTestManager manager, PlatformID silverlightPlatform)
        {
            var silverlightRun = launch.GetOrCreateSilverlightRun(silverlightPlatform);

            sequence.AddSilverlightUnitTestTask(silverlightPlatform, manager);
            sequence.RemoveAssemblyLoadTasks();

            silverlightRun.AddTaskSequence(sequence);
        }
        protected override IEnumerable<string> GetReferencedAssemblies(PlatformID platformId)
        {
            foreach (var assembly in base.GetReferencedAssemblies(platformId) ?? Enumerable.Empty<string>())
            {
                yield return assembly;
            }

            yield return typeof(NotNullAttribute).Assembly.Location; // add reference to the annotations assembly
        }
        public static ILibraryLoader Create(PlatformID platform)
        {
            if(platform == PlatformID.Win32NT)
                return new WindowsLibraryLoader();

            if(platform == PlatformID.MacOSX || platform == PlatformID.Unix)
                return new UnixLibraryLoader();

            throw new PlatformNotSupportedException();
        }
Esempio n. 15
0
    //google has been removed as we cannot get the picture without authenticating ourselves first.

    public static void GetProfilePicture(Action<Texture2D> callback, PlatformID platformID, string platformUserID)
    {
        GameObject profilePicPacket = new GameObject("ProfilePicPacket");

        ProfilePic pic = profilePicPacket.AddComponent<ProfilePic>();

        pic.callback = callback;

        pic.GetProfilePicture(platformID, platformUserID);
    }
Esempio n. 16
0
        public void Initialize()
        {
			if (KeyHandler == null)
			{
				KeyHandler = new KeyHandler(Application.Current.RootVisual as FrameworkElement);
			}
            mHostHardwarePlatform = Environment.OSVersion.Platform;
            PopulateKeyDictionaries();
            KeysDown = new List<Keys>();
        }
Esempio n. 17
0
        private static string GetOSName(PlatformID platformId)
        {
            switch (platformId)
            {
                case PlatformID.Win32Windows:
                    return "Windows";

                case PlatformID.Win32NT:
                    return "Windows NT";
            }
            return platformId.ToString();
        }
Esempio n. 18
0
    IEnumerator GetProfilePic(PlatformID platformID, string platformUserID)
    {
        string url = urlSocialPlay + "?PID=" + (int)platformID + "&PUID=" + platformUserID;

        WWW www = new WWW(url);
        yield return www;

        if (callback != null)
            callback(www.texture);

        //Event sent, lets destroy it.
        Destroy(gameObject);
    }
Esempio n. 19
0
        public Proxy(string path)
        {
            _PlatformID = Environment.OSVersion.Platform;

            if (_PlatformID == PlatformID.Unix)
            {
                _Invoke = new SoInvoke(path);
            }
            else
            {
                _Invoke = new DllInvoke(path);
            }
        }
        public static UnitTestRun GetOrCreateSilverlightRun(this IUnitTestLaunch launch, PlatformID silverlightPlatform)
        {
            var runs = launch.GetRuns();
            var silverlightRun = runs.Values.FirstOrDefault(run => run.GetSilverlightPlatformVersion() == silverlightPlatform.Version);

            if (silverlightRun == null)
            {
                var runtimeEnvironment = new RuntimeEnvironment { PlatformType = PlatformType.x86, PlatformVersion = PlatformVersion.v4_0 };
                silverlightRun = new UnitTestRun((UnitTestLaunch)launch, runtimeEnvironment);
                runs.Add(silverlightRun.ID, silverlightRun);
            }

            return silverlightRun;
        }
        internal OperatingSystem(PlatformID platform, Version version, string servicePack) {
            if( platform < PlatformID.Win32S || platform > PlatformID.Unix) {
                throw new ArgumentException(
                    String.Format(CultureInfo.CurrentCulture, Environment.GetResourceString("Arg_EnumIllegalVal"), (int)platform),
                    "platform");
            }

            if ((Object) version == null)
                throw new ArgumentNullException("version");

            _platform = platform;
            _version = (Version) version.Clone();
            _servicePack = servicePack;
        }
 internal OperatingSystem(PlatformID platform, System.Version version, string servicePack)
 {
     if ((platform < PlatformID.Win32S) || (platform > PlatformID.MacOSX))
     {
         throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", new object[] { (int) platform }), "platform");
     }
     if (version == null)
     {
         throw new ArgumentNullException("version");
     }
     this._platform = platform;
     this._version = (System.Version) version.Clone();
     this._servicePack = servicePack;
 }
Esempio n. 23
0
		public OperatingSystem (PlatformID platform, Version version)
		{
			if (version == null) {
				throw new ArgumentNullException ("version");
			}

			_platform = platform;
			_version = version;

			if (platform == PlatformID.Win32NT) {
				// The service pack is encoded in the upper bits of the revision
				if (version.Revision != 0)
					_servicePack = "Service Pack " + (version.Revision >> 16);
			}
		}
Esempio n. 24
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        c_current_platform = Environment.OSVersion.Platform;

        build_popups ();
        Gtk.Rc.Parse (CUtil.CUTIL_GetRCFile(0));

        Build ();

        //set_widget_colors ();
        hide_tab_labels (true);
        set_general_widget_properties ();
        set_widget_events ();
    }
Esempio n. 25
0
        internal OperatingSystem(PlatformID platform, Version version, string servicePack) {
            if( platform < PlatformID.Win32S || platform > PlatformID.MacOSX) {
                throw new ArgumentException(
                    Environment.GetResourceString("Arg_EnumIllegalVal", (int)platform),
                    nameof(platform));
            }

            if ((Object) version == null)
                throw new ArgumentNullException(nameof(version));
            Contract.EndContractBlock();

            _platform = platform;
            _version = (Version) version.Clone();
            _servicePack = servicePack;
        }
Esempio n. 26
0
        internal OperatingSystem(PlatformID platform, Version version, string servicePack)
        {
            if (platform < PlatformID.Win32S || platform > PlatformID.MacOSX)
            {
                throw new ArgumentOutOfRangeException(nameof(platform), platform, SR.Arg_EnumIllegalVal);
            }

            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }

            _platform = platform;
            _version = version;
            _servicePack = servicePack;
        }
Esempio n. 27
0
 public static string ExecutableInstallationPath(PlatformID platform, string organization, string executableName)
 {
     // Unix and Mac: Unsure where the expected installation paths are or would be.
     // These are staying unimplemeted until it actually matters.
     switch (platform)
     {
         case PlatformID.Win32NT:
             return Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles),
                 ToUpper(organization), "Paymetheus", executableName.ToLower() + ".exe");
         case PlatformID.Unix:
             throw new NotImplementedException();
         case PlatformID.MacOSX:
             throw new NotImplementedException();
         default:
             throw PlatformNotSupported(platform);
     }
 }
Esempio n. 28
0
 /// <summary>
 /// Converts a set of arguments to a command line string to be used by <see cref="ProcessStartInfo"/> on the specified platform.
 /// </summary>
 /// <param name="platform">The platform to execute on.</param>
 /// <param name="args">The arguments to pass to the process.</param>
 /// <returns>The argument string to use with <see cref="ProcessStartInfo"/>.</returns>
 public static string ArgsToCommandLinePlatform(PlatformID platform, IEnumerable<string> args)
 {
     switch(platform)
     {
         case PlatformID.Win32NT:
         case PlatformID.Win32S:
         case PlatformID.Win32Windows:
         case PlatformID.WinCE:
         case PlatformID.Xbox:
             return ArgsToCommandLineWindows(args);
         case PlatformID.MacOSX:
         case PlatformID.Unix:
             return ArgsToCommandLineUnix(args);
         default:
             throw new ArgumentException($"Unknown platform value {platform}", "platform");
     }
 }
Esempio n. 29
0
        public Game()
        {
            graphics = new GraphicsDeviceManager(this);
            graphics.PreferredBackBufferWidth = 1280;
            graphics.PreferredBackBufferHeight = 720;

            Content.RootDirectory = "Content";

            hud = new HudOverlay(this);
            tank = new Tank(this, new Vector3(0,0,0));
            floor = new Floor(this, new Vector3(0, 0, 0), 512, 40, 40);

            camera = new CombinedCamera(tank, CameraMode.ThirdPerson, new Vector3(0,10000,-10000f));

            randomObjects = new List<RandomObject>();

            OperatingSystem os = Environment.OSVersion;
            platform = os.Platform;
        }
Esempio n. 30
0
        static void Main()
        {
            //Platform = Environment.OSVersion.Platform;
            if (Environment.OSVersion.Platform == PlatformID.Win32NT)
            {
                Platform = PlatformID.Win32NT;
            }
            else if (Environment.OSVersion.Platform == PlatformID.Unix)
            {
                if (Directory.Exists("/System"))
                    Platform = PlatformID.MacOSX;
                else
                    Platform = PlatformID.Unix;
            }
            Log.Info("Detected OS: " + Platform.ToString());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FormMain());
        }
 // This is a positional argument
 public ProviderPlatformAttribute(PlatformID platform, int major, int minor)
 {
     this._platformID   = platform;
     this._majorVersion = major;
     this._minorVersion = minor;
 }
Esempio n. 32
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            if (FSOEnvironment.DPIScaleFactor != 1 || FSOEnvironment.SoftwareDepth)
            {
                GlobalSettings.Default.GraphicsWidth  = GraphicsDevice.Viewport.Width / FSOEnvironment.DPIScaleFactor;
                GlobalSettings.Default.GraphicsHeight = GraphicsDevice.Viewport.Height / FSOEnvironment.DPIScaleFactor;
            }

            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            GameFacade.Linux = (pid == PlatformID.MacOSX || pid == PlatformID.Unix);

            FSO.Content.Content.Init(GlobalSettings.Default.StartupPath, GraphicsDevice);
            base.Initialize();

            GameFacade.GameThread = Thread.CurrentThread;

            SceneMgr = new _3DLayer();
            SceneMgr.Initialize(GraphicsDevice);

            GameFacade.Controller            = new GameController();
            GameFacade.Screens               = uiLayer;
            GameFacade.Scenes                = SceneMgr;
            GameFacade.GraphicsDevice        = GraphicsDevice;
            GameFacade.GraphicsDeviceManager = Graphics;
            GameFacade.Cursor                = new CursorManager(this.Window);
            if (!GameFacade.Linux)
            {
                GameFacade.Cursor.Init(FSO.Content.Content.Get().GetPath(""));
            }

            /** Init any computed values **/
            GameFacade.Init();

            //init audio now
            HITVM.Init();

            GameFacade.Strings = new ContentStrings();
            GameFacade.Controller.StartLoading();

            GraphicsDevice.RasterizerState = new RasterizerState()
            {
                CullMode = CullMode.None
            };

            try {
                var audioTest = new SoundEffect(new byte[2], 44100, AudioChannels.Mono); //initialises XAudio.
                audioTest.CreateInstance().Play();
            } catch (Exception e)
            {
                //MessageBox.Show("Failed to initialize audio: \r\n\r\n" + e.StackTrace);
            }

            this.IsMouseVisible  = true;
            this.IsFixedTimeStep = true;

            WorldContent.Init(this.Services, Content.RootDirectory);
            if (!FSOEnvironment.SoftwareKeyboard)
            {
                AddTextInput();
            }
            base.Screen.Layers.Add(SceneMgr);
            base.Screen.Layers.Add(uiLayer);
            GameFacade.LastUpdateState = base.Screen.State;

            this.Window.Title = "FreeSO";

            if (!GlobalSettings.Default.Windowed && !GameFacade.GraphicsDeviceManager.IsFullScreen)
            {
                GameFacade.GraphicsDeviceManager.ToggleFullScreen();
            }
        }
Esempio n. 33
0
        static DirectoryScanner()
        {
            PlatformID pid = Environment.OSVersion.Platform;

            _runningOnWindows = ((int)pid != 128 && (int)pid != 4 && (int)pid != 6);
        }
Esempio n. 34
0
        static Platform()
        {
#if __IOS__ || UNITY_IPHONE
            _os      = OS.IOS;
            _runtime = ClrType.Mono;
#elif __ANDROID__ || UNITY_ANDROID
            _os      = OS.Android;
            _runtime = ClrType.Mono;
#elif WINDOWS_PHONE_APP
            _os      = OS.WindowsPhone;
            _runtime = ClrType.NetFxCore;
#elif NETFX_CORE
            _os      = OS.Windows;
            _runtime = ClrType.NetFxCore;
#elif NETSTANDARD1_4
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                _os = OS.Windows;
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
            {
                _os = OS.Linux;
            }
            else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
            {
                _os = OS.MacOSX;
            }
            else
            {
                //unknown
            }
            //how???
            _runtime = ClrType.NetFxCore;
#else
            PlatformID pid = Environment.OSVersion.Platform;
            if (pid == PlatformID.MacOSX)
            {
                //This never works, it is a bug in Mono
                _os = OS.MacOSX;
            }
            else
            {
                int p = (int)pid;
                _os = ((p == 4) || (p == 128)) ? OS.Linux : OS.Windows;

                if (_os == OS.Linux)
                { //Check if the OS is Mac OSX
                    IntPtr buf = IntPtr.Zero;
                    try
                    {
                        buf = Marshal.AllocHGlobal(8192);
                        // This is a hacktastic way of getting sysname from uname ()
                        if (uname(buf) == 0)
                        {
                            string os = Marshal.PtrToStringAnsi(buf);
                            if (os == "Darwin")
                            {
                                _os = OS.MacOSX;
                            }
                        }
                    }
                    catch
                    {
                        //Some unix system may not be able to call "libc"
                        //such as Ubuntu 13.04, we provide a safe catch here
                    }
                    finally
                    {
                        if (buf != IntPtr.Zero)
                        {
                            Marshal.FreeHGlobal(buf);
                        }
                    }
                }
            }
            _runtime = (Type.GetType("System.MonoType", false) != null) ? ClrType.Mono : ClrType.DotNet;
#endif
        }
Esempio n. 35
0
 public void Unsupported(PlatformID platformID, string baseFolder, string fmuName)
 {
     Assert.Throws <ArgumentException>(() => Platform.GetLibraryPath(platformID, true, baseFolder, fmuName));
 }
Esempio n. 36
0
        public bool InitWithArguments(string[] args)
        {
            string baseDir = AppDomain.CurrentDomain.BaseDirectory;

            Directory.SetCurrentDirectory(baseDir);
            AppDomain.CurrentDomain.AssemblyResolve    += OnAssemblyResolve;
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);

            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            ILocator gameLocator;
            bool     linux = pid == PlatformID.MacOSX || pid == PlatformID.Unix;

            if (linux && Directory.Exists("/Users"))
            {
                gameLocator = new MacOSLocator();
            }
            else if (linux)
            {
                gameLocator = new LinuxLocator();
            }
            else
            {
                gameLocator = new WindowsLocator();
            }

            bool useDX = false;

            #region User resolution parmeters

            foreach (var arg in args)
            {
                if (char.IsDigit(arg[0]))
                {
                    //attempt parsing resoulution
                    try
                    {
                        var split        = arg.Split("x".ToCharArray());
                        int ScreenWidth  = int.Parse(split[0]);
                        int ScreenHeight = int.Parse(split[1]);

                        GlobalSettings.Default.GraphicsWidth  = ScreenWidth;
                        GlobalSettings.Default.GraphicsHeight = ScreenHeight;
                    }
                    catch (Exception) { }
                }
                else if (arg[0] == '-')
                {
                    var cmd = arg.Substring(1);
                    if (cmd.StartsWith("lang"))
                    {
                        GlobalSettings.Default.LanguageCode = byte.Parse(cmd.Substring(4));
                    }
                    else if (cmd.StartsWith("hz"))
                    {
                        GlobalSettings.Default.TargetRefreshRate = int.Parse(cmd.Substring(2));
                    }
                    else
                    {
                        //normal style param
                        switch (cmd)
                        {
                        case "dx11":
                        case "dx":
                            useDX = true;
                            break;

                        case "gl":
                        case "ogl":
                            useDX = false;
                            break;

                        case "ts1":
                            GlobalSettings.Default.TS1HybridEnable = true;
                            break;

                        case "tso":
                            GlobalSettings.Default.TS1HybridEnable = false;
                            break;

                        case "3d":
                            FSOEnvironment.Enable3D = true;
                            break;

                        case "touch":
                            FSOEnvironment.SoftwareKeyboard = true;
                            break;

                        case "nosound":
                            FSOEnvironment.NoSound = true;
                            break;
                        }
                    }
                }
                else
                {
                    if (arg.Equals("w", StringComparison.InvariantCultureIgnoreCase))
                    {
                        GlobalSettings.Default.Windowed = true;
                    }
                    else if (arg.Equals("f", StringComparison.InvariantCultureIgnoreCase))
                    {
                        GlobalSettings.Default.Windowed = false;
                    }
                }
            }

            #endregion

            UseDX = MonogameLinker.Link(useDX);

            var path = gameLocator.FindTheSimsOnline();

            if (path != null)
            {
                //check if this path has tso in it. tuning.dat should be a good indication.
                if (!File.Exists(Path.Combine(path, "tuning.dat")))
                {
                    ShowDialog("The Sims Online appears to be missing. The game expects TSO at '" + path + "', but some core files are missing from that folder. If you know you installed TSO into a different directory, please move it into the directory specified.");
                    return(false);
                }

                FSOEnvironment.Args          = string.Join(" ", args);
                FSOEnvironment.ContentDir    = "Content/";
                FSOEnvironment.GFXContentDir = "Content/" + (UseDX ? "DX/" : "OGL/");
                FSOEnvironment.Linux         = linux;
                FSOEnvironment.DirectX       = UseDX;
                FSOEnvironment.GameThread    = Thread.CurrentThread;
                if (GlobalSettings.Default.LanguageCode == 0)
                {
                    GlobalSettings.Default.LanguageCode = 1;
                }
                Files.Formats.IFF.Chunks.STR.DefaultLangCode = (Files.Formats.IFF.Chunks.STRLangCode)GlobalSettings.Default.LanguageCode;

                GlobalSettings.Default.StartupPath   = path;
                GlobalSettings.Default.ClientVersion = GetClientVersion();
                return(true);
            }
            else
            {
                ShowDialog("The Sims Online was not found on your system. FreeSO will not be able to run without access to the original game files.");
                return(false);
            }
        }
Esempio n. 37
0
    private string GetHFSPath()
    {
        string HoudiniVersion = "16.5.587";
        bool   bIsRelease     = true;
        string HFSPath        = "";
        string Log;

        if (!bIsRelease)
        {
            // Only use the preset build folder
            Console.WriteLine("Using HFS:" + HFSPath);
            return(HFSPath);
        }

        // Look for the Houdini install folder for this platform
        PlatformID BuildPlatformId = Environment.OSVersion.Platform;

        if (BuildPlatformId == PlatformID.Win32NT)
        {
            // Look for the HEngine install path in the registry
            var HEngineRegistry = string.Format(@"HKEY_LOCAL_MACHINE\SOFTWARE\Side Effects Software\Houdini Engine {0}", HoudiniVersion);
            var HPath           = Microsoft.Win32.Registry.GetValue(HEngineRegistry, "InstallPath", null) as string;
            if (HPath != null)
            {
                Log = string.Format("Houdini Engine : Looking for Houdini Engine {0} in {1}", HoudiniVersion, HPath);
                Console.WriteLine(Log);
                if (Directory.Exists(HPath))
                {
                    return(HPath);
                }
            }

            // If we couldn't find the Houdini Engine registry path, try the default one
            string DefaultHPath = "C:/Program Files/Side Effects Software/Houdini Engine " + HoudiniVersion;
            if (DefaultHPath != HPath)
            {
                Log = string.Format("Houdini Engine : Looking for Houdini Engine {0} in {1}", HoudiniVersion, DefaultHPath);
                Console.WriteLine(Log);
                if (Directory.Exists(DefaultHPath))
                {
                    return(DefaultHPath);
                }
            }

            // Look for the Houdini registry install path for the version the plug-in was compiled for
            var HoudiniRegistry = string.Format(@"HKEY_LOCAL_MACHINE\SOFTWARE\Side Effects Software\Houdini {0}", HoudiniVersion);
            HPath = Microsoft.Win32.Registry.GetValue(HoudiniRegistry, "InstallPath", null) as string;
            if (HPath != null)
            {
                Log = string.Format("Houdini Engine : Looking for Houdini {0} in {1}", HoudiniVersion, HPath);
                Console.WriteLine(Log);
                if (Directory.Exists(HPath))
                {
                    return(HPath);
                }
            }

            // If we couldn't find the Houdini registry path, try the default one
            DefaultHPath = "C:/Program Files/Side Effects Software/Houdini " + HoudiniVersion;
            if (DefaultHPath != HPath)
            {
                Log = string.Format("Houdini Engine : Looking for Houdini {0} in {1}", HoudiniVersion, DefaultHPath);
                Console.WriteLine(Log);
                if (Directory.Exists(DefaultHPath))
                {
                    return(DefaultHPath);
                }
            }

            // See if the preset build HFS exists
            if (Directory.Exists(HFSPath))
            {
                return(HFSPath);
            }

            Log = string.Format("Houdini Engine : Failed to find Houdini {0}, will attempt to build using the latest installed version", HoudiniVersion);
            Console.WriteLine(Log);

            // We couldn't find the exact version the plug-in was built for, we can still try with the active version in the registry
            HEngineRegistry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Side Effects Software";
            string ActiveHEngine = Microsoft.Win32.Registry.GetValue(HEngineRegistry, "ActiveEngineVersion", null) as string;
            if (ActiveHEngine != null)
            {
                // See if the latest active HEngine version has the proper major/minor version
                if (ActiveHEngine.Substring(0, 4) == HoudiniVersion.Substring(0, 4))
                {
                    Log = string.Format("Houdini Engine : Found Active Houdini Engine version: {0}", ActiveHEngine);
                    Console.WriteLine(Log);

                    HEngineRegistry = string.Format(@"HKEY_LOCAL_MACHINE\SOFTWARE\Side Effects Software\Houdini Engine {0}", ActiveHEngine);
                    HPath           = Microsoft.Win32.Registry.GetValue(HEngineRegistry, "InstallPath", null) as string;
                    if (HPath != null)
                    {
                        Log = string.Format("Houdini Engine : Looking for Houdini Engine {0} in {1}", ActiveHEngine, HPath);
                        Console.WriteLine(Log);
                        if (Directory.Exists(HPath))
                        {
                            return(HPath);
                        }
                    }
                }
            }

            // Active HEngine version didn't match, so try with the active Houdini version
            HoudiniRegistry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\Side Effects Software";
            var ActiveHoudini = Microsoft.Win32.Registry.GetValue(HoudiniRegistry, "ActiveVersion", null) as string;
            if (ActiveHoudini != null)
            {
                // See if the latest active Houdini version has the proper major/minor version
                if (ActiveHoudini.Substring(0, 4) == HoudiniVersion.Substring(0, 4))
                {
                    Log = string.Format("Houdini Engine : Found Active Houdini version: {0}", ActiveHoudini);
                    Console.WriteLine(Log);

                    HoudiniRegistry = string.Format(@"HKEY_LOCAL_MACHINE\SOFTWARE\Side Effects Software\Houdini {0}", ActiveHoudini);
                    HPath           = Microsoft.Win32.Registry.GetValue(HoudiniRegistry, "InstallPath", null) as string;
                    if (HPath != null)
                    {
                        Log = string.Format("Houdini Engine : Looking for Houdini {0} in {1}", ActiveHoudini, HPath);
                        Console.WriteLine(Log);

                        if (Directory.Exists(HPath))
                        {
                            return(HPath);
                        }
                    }
                }
            }
        }
        else if (BuildPlatformId == PlatformID.MacOSX)
        {
            // Check for Houdini installation.
            var HPath = "/Applications/Houdini/Houdini" + HoudiniVersion + "/Frameworks/Houdini.framework/Versions/Current/Resources";
            if (Directory.Exists(HPath))
            {
                return(HPath);
            }

            if (Directory.Exists(HFSPath))
            {
                return(HFSPath);
            }
        }
        else if (BuildPlatformId == PlatformID.Unix)
        {
            HFSPath = System.Environment.GetEnvironmentVariable("HFS");
            if (Directory.Exists(HFSPath))
            {
                Console.WriteLine("Linux - found HFS:" + HFSPath);
                return(HFSPath);
            }
        }
        else
        {
            Console.WriteLine(string.Format("Building on an unknown environment!"));
        }

        var Error = string.Format("Houdini Engine : Please install Houdini or Houdini Engine {0}", HoudiniVersion);

        Console.WriteLine(Error);

        return(string.Empty);
    }
Esempio n. 38
0
 public string HD()
 {
     OperatingSystem os  = Environment.OSVersion;
     PlatformID      pid = os.Platform;
Esempio n. 39
0
        private static string GetAppEnvID()
        {
            if (m_strAppEnvID != null)
            {
                return(m_strAppEnvID);
            }

            StringBuilder sb = new StringBuilder();

            Assembly     asm     = null;
            AssemblyName asmName = null;

            try
            {
                asm     = Assembly.GetExecutingAssembly();
                asmName = asm.GetName();
            }
            catch (Exception) { Debug.Assert(false); }

            try { sb.Append(asmName.Version.ToString(4)); }
            catch (Exception) { Debug.Assert(false); sb.Append(PwDefs.VersionString); }

#if DEBUG
            sb.Append("d");
#endif

            sb.Append(",PK=");
            try
            {
                byte[] pk = asmName.GetPublicKeyToken();
                sb.Append(Convert.ToBase64String(pk, Base64FormattingOptions.None));
            }
            catch (Exception) { Debug.Assert(false); sb.Append('?'); }

            sb.Append(",CLR=");
            sb.Append(Environment.Version.ToString(4));
            sb.Append(",Ptr=");
            sb.Append(IntPtr.Size.ToString());

            sb.Append(",OS=");
            PlatformID p = NativeLib.GetPlatformID();
            if ((p == PlatformID.Win32NT) || (p == PlatformID.Win32S) ||
                (p == PlatformID.Win32Windows))
            {
                sb.Append("Win");
            }
            else if (p == PlatformID.WinCE)
            {
                sb.Append("WinCE");
            }
            else if (p == PlatformID.Xbox)
            {
                sb.Append("Xbox");
            }
            else if (p == PlatformID.Unix)
            {
                sb.Append("Unix");
            }
            else if (p == PlatformID.MacOSX)
            {
                sb.Append("MacOSX");
            }
            else
            {
                sb.Append('?');
            }

            m_strAppEnvID = sb.ToString();
            return(m_strAppEnvID);
        }
Esempio n. 40
0
 public OperatingSystem(PlatformID platform, Version version) : this(platform, version, null)
 {
 }
Esempio n. 41
0
 public PlatformUnsupportedException(PlatformID platformID) : base("The current platform is not supported: " + platformID.ToString())
 {
     PlatFormID = platformID;
 }
Esempio n. 42
0
    public HoudiniEngineEditor(ReadOnlyTargetRules Target) : base(Target)
    {
        bPrecompile          = true;
        PCHUsage             = PCHUsageMode.NoSharedPCHs;
        PrivatePCHHeaderFile = "Private/HoudiniEngineEditorPrivatePCH.h";

        // Check if we are compiling on unsupported platforms.
        if (Target.Platform != UnrealTargetPlatform.Win64 &&
            Target.Platform != UnrealTargetPlatform.Mac &&
            Target.Platform != UnrealTargetPlatform.Linux)
        {
            string Err = string.Format("Houdini Engine Editor: Compiling for unsupported platform.");
            System.Console.WriteLine(Err);
            throw new BuildException(Err);
        }

        // Find HFS
        string HFSPath = GetHFSPath();

        HFSPath = HFSPath.Replace("\\", "/");
        if (HFSPath != "")
        {
            PlatformID buildPlatformId = Environment.OSVersion.Platform;
            if (buildPlatformId == PlatformID.Win32NT)
            {
                PublicDefinitions.Add("HOUDINI_ENGINE_HFS_PATH_DEFINE=" + HFSPath);
            }
        }

        // Find the HAPI include directory
        string HAPIIncludePath = HFSPath + "/toolkit/include/HAPI";

        if (!Directory.Exists(HAPIIncludePath))
        {
            // Try the custom include path as well in case the toolkit path doesn't exist yet.
            HAPIIncludePath = HFSPath + "/custom/houdini/include/HAPI";

            if (!Directory.Exists(HAPIIncludePath))
            {
                System.Console.WriteLine(string.Format("Couldnt find the HAPI include folder!"));
                HAPIIncludePath = "";
            }
        }

        if (HAPIIncludePath != "")
        {
            PublicIncludePaths.Add(HAPIIncludePath);
        }

        // Get the plugin path
        string PluginPath = Path.Combine(ModuleDirectory, "../../");

        PluginPath = Utils.MakePathRelativeTo(PluginPath, Target.RelativeEnginePath);

        PublicIncludePaths.AddRange(
            new string[] {
            Path.Combine(ModuleDirectory, "Public")
        }
            );

        PrivateIncludePaths.AddRange(
            new string[] {
            "HoudiniEngineEditor/Private",
            "HoudiniEngineRuntime/Private"
        }
            );

        PrivateIncludePathModuleNames.AddRange(
            new string[] {
            "PlacementMode"
        }
            );

        // Add common dependencies.
        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            "CoreUObject",
            "HoudiniEngineRuntime",
            "Slate",
            "SlateCore",
            "Landscape"
        }
            );

        PrivateDependencyModuleNames.AddRange(
            new string[]
        {
            "AppFramework",
            "AssetTools",
            "ContentBrowser",
            "DesktopWidgets",
            "EditorStyle",
            "EditorWidgets",
            "Engine",
            "InputCore",
            "LevelEditor",
            "MainFrame",
            "Projects",
            "PropertyEditor",
            "RHI",
            "RawMesh",
            "RenderCore",
            "TargetPlatform",
            "UnrealEd",
            "ApplicationCore",
            "CurveEditor",
            "Json",
            "SceneOutliner"
        }
            );

        DynamicallyLoadedModuleNames.AddRange(
            new string[]
        {
            "PlacementMode",
        }
            );
    }
Esempio n. 43
0
    private string GetHFSPath()
    {
        string HoudiniVersion = "17.5.385";
        bool   bIsRelease     = true;
        string HFSPath        = "";
        string RegistryPath   = "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\Side Effects Software";

        if (!bIsRelease)
        {
            // Only use the preset build folder
            System.Console.WriteLine("Using stamped HFSPath:" + HFSPath);
            return(HFSPath);
        }

        // Look for the Houdini install folder for this platform
        PlatformID buildPlatformId = Environment.OSVersion.Platform;

        if (buildPlatformId == PlatformID.Win32NT)
        {
            // Look for the HEngine install path in the registry
            string HEngineRegistry = RegistryPath + string.Format(@"\Houdini Engine {0}", HoudiniVersion);
            string HPath           = Microsoft.Win32.Registry.GetValue(HEngineRegistry, "InstallPath", null) as string;
            if (HPath != null)
            {
                if (Directory.Exists(HPath))
                {
                    return(HPath);
                }
            }

            // If we couldn't find the Houdini Engine registry path, try the default one
            string DefaultHPath = "C:/Program Files/Side Effects Software/Houdini Engine " + HoudiniVersion;
            if (DefaultHPath != HPath)
            {
                if (Directory.Exists(DefaultHPath))
                {
                    return(DefaultHPath);
                }
            }

            // Look for the Houdini registry install path for the version the plug-in was compiled for
            string HoudiniRegistry = RegistryPath + string.Format(@"\Houdini {0}", HoudiniVersion);
            HPath = Microsoft.Win32.Registry.GetValue(HoudiniRegistry, "InstallPath", null) as string;
            if (HPath != null)
            {
                if (Directory.Exists(HPath))
                {
                    return(HPath);
                }
            }

            // If we couldn't find the Houdini registry path, try the default one
            DefaultHPath = "C:/Program Files/Side Effects Software/Houdini " + HoudiniVersion;
            if (DefaultHPath != HPath)
            {
                if (Directory.Exists(DefaultHPath))
                {
                    return(DefaultHPath);
                }
            }

            // See if the preset build HFS exists
            if (Directory.Exists(HFSPath))
            {
                return(HFSPath);
            }

            // We couldn't find the exact version the plug-in was built for, we can still try with the active version in the registry
            string ActiveHEngine = Microsoft.Win32.Registry.GetValue(RegistryPath, "ActiveEngineVersion", null) as string;
            if (ActiveHEngine != null)
            {
                // See if the latest active HEngine version has the proper major/minor version
                if (ActiveHEngine.Substring(0, 4) == HoudiniVersion.Substring(0, 4))
                {
                    HEngineRegistry = RegistryPath + string.Format(@"\Houdini Engine {0}", ActiveHEngine);
                    HPath           = Microsoft.Win32.Registry.GetValue(HEngineRegistry, "InstallPath", null) as string;
                    if (HPath != null)
                    {
                        if (Directory.Exists(HPath))
                        {
                            return(HPath);
                        }
                    }
                }
            }

            // Active HEngine version didn't match, so try with the active Houdini version
            string ActiveHoudini = Microsoft.Win32.Registry.GetValue(RegistryPath, "ActiveVersion", null) as string;
            if (ActiveHoudini != null)
            {
                // See if the latest active Houdini version has the proper major/minor version
                if (ActiveHoudini.Substring(0, 4) == HoudiniVersion.Substring(0, 4))
                {
                    HoudiniRegistry = RegistryPath + string.Format(@"\Houdini {0}", ActiveHoudini);
                    HPath           = Microsoft.Win32.Registry.GetValue(HoudiniRegistry, "InstallPath", null) as string;
                    if (HPath != null)
                    {
                        if (Directory.Exists(HPath))
                        {
                            return(HPath);
                        }
                    }
                }
            }
        }
        else if (buildPlatformId == PlatformID.MacOSX ||
                 (buildPlatformId == PlatformID.Unix && File.Exists("/System/Library/CoreServices/SystemVersion.plist")))
        {
            // Check for Houdini installation.
            string HPath = "/Applications/Houdini/Houdini" + HoudiniVersion + "/Frameworks/Houdini.framework/Versions/Current/Resources";
            if (Directory.Exists(HPath))
            {
                return(HPath);
            }

            if (Directory.Exists(HFSPath))
            {
                return(HFSPath);
            }
        }
        else if (buildPlatformId == PlatformID.Unix)
        {
            HFSPath = System.Environment.GetEnvironmentVariable("HFS");
            if (Directory.Exists(HFSPath))
            {
                System.Console.WriteLine("Unix using $HFS: " + HFSPath);
                return(HFSPath);
            }
        }
        else
        {
            System.Console.WriteLine(string.Format("Building on an unknown environment!"));
        }

        string Err = string.Format("Houdini Engine : Please install Houdini or Houdini Engine {0}", HoudiniVersion);

        System.Console.WriteLine(Err);

        return("");
    }
Esempio n. 44
0
        /// <summary>
        /// creates a new instance of the MATLAB connector.
        /// </summary>
        /// <param name="Flav">
        /// octave or MATLAB
        /// </param>
        /// <param name="ExecutablePath">
        /// Where to find the executable on the current system.
        /// If NULL, the standard installation path is assumed.
        /// In the case of Cygwin/octave, the path to the Cygwin bash.exe;
        /// </param>
        /// <param name="WorkingPath">
        /// working directory of the MATLAB instance;
        /// if NULL, a temporary directory is created.
        /// </param>
        public BatchmodeConnector(string WorkingPath = null)
        {
            ilPSP.MPICollectiveWatchDog.Watch(csMPI.Raw._COMM.WORLD);
            this.m_Flav = Flav;

            // create/check working path
            // =========================

            if (Rank == 0)
            {
                if (WorkingPath == null)
                {
                    var  rnd    = new Random();
                    bool Exists = false;
                    do
                    {
                        var tempPath = Path.GetTempPath();
                        var tempDir  = rnd.Next().ToString();
                        WorkingDirectory = new DirectoryInfo(Path.Combine(tempPath, tempDir));
                        Exists           = WorkingDirectory.Exists;
                        if (!Exists)
                        {
                            WorkingDirectory.Create();
                            DelWorkingDir = true;
                        }
                    } while (Exists == true);
                }
                else
                {
                    WorkingDirectory = new DirectoryInfo(WorkingPath);
                    if (!WorkingDirectory.Exists)
                    {
                        throw new ArgumentException("Given working directory is inexistent.");
                    }
                }
            }

            MPIEnviroment.Broadcast(this.WorkingDirectory, 0, csMPI.Raw._COMM.WORLD);

            // more checks
            // ===========
            if (MatlabExecuteable != null)
            {
                if (!File.Exists(MatlabExecuteable))
                {
                    throw new ArgumentException("Unable to find file '" + MatlabExecuteable + "' on this system.");
                }
            }


            // setup MATLAB process
            // ====================

            if (Rank == 0)
            {
                psi = new ProcessStartInfo();
                psi.WorkingDirectory = WorkingDirectory.FullName;
                psi.UseShellExecute  = false;
                //psi.RedirectStandardOutput = true;
                //psi.RedirectStandardError = true;
                //psi.RedirectStandardInput = true;


                PlatformID CurrentSys = System.Environment.OSVersion.Platform;
                switch (CurrentSys)
                {
                case PlatformID.Win32NT:
                case PlatformID.Win32S:
                case PlatformID.Win32Windows: {
                    if (m_Flav == Flavor.Matlab)
                    {
                        if (MatlabExecuteable == null)
                        {
                            MatlabExecuteable = get_program_path("matlab.exe");
                            if (MatlabExecuteable == null)
                            {
                                throw new ApplicationException("Unable to find 'matlab.exe' in your PATH environment; please provide path to 'matlab.exe'.");
                            }
                        }

                        psi.FileName  = MatlabExecuteable;
                        psi.Arguments = "-nosplash -nodesktop -minimize -wait -r " + CMDFILE + " -logfile " + LOGFILE;
                    }
                    else if (m_Flav == Flavor.Octave)
                    {
                        if (MatlabExecuteable == null)
                        {
                            MatlabExecuteable = get_program_path("octave-cli.exe");
                            if (MatlabExecuteable == null)
                            {
                                throw new ApplicationException("Unable to find 'octave-cli.exe' in your PATH environment; please provide path to 'octave-cli.exe'.");
                            }
                        }

                        psi.FileName  = MatlabExecuteable;
                        psi.Arguments = " --no-gui " + CMDFILE + ".m > " + LOGFILE;
                        //psi.UseShellExecute = false;
                    }
                    else if (m_Flav == Flavor.Octave_cygwin)
                    {
                        this.Cygwin = true;

                        if (MatlabExecuteable == null)
                        {
                            if (File.Exists("c:\\cygwin64\\bin\\octave"))
                            {
                                psi.FileName = "c:\\cygwin64\\bin\\bash.exe";
                            }
                            else if (File.Exists("c:\\cygwin\\bin\\octave"))
                            {
                                psi.FileName = "c:\\cygwin\\bin\\bash.exe";
                            }
                            else
                            {
                                throw new NotSupportedException("Cygwin/Octave are expected to be in the default path: C:\\cygwin or c:\\cygwin64");
                            }
                        }
                        else
                        {
                            //throw new NotSupportedException("Cygwin/Octave are expected to be in the default path: C:\\cygwin or c:\\cygwin64");
                            if (!MatlabExecuteable.EndsWith("bash.exe"))
                            {
                                throw new NotSupportedException("For Cygwin/Octave, the 'MatlabExecuteable' is expected to point to 'bash.exe'.");
                            }

                            psi.FileName = MatlabExecuteable;
                        }
                        psi.Arguments = "--login -c \"cd " + TranslatePath(WorkingDirectory.FullName) + " "
                                        + "&& octave --no-gui " + CMDFILE + ".m" + " > " + LOGFILE + "  \"";
                        //+ "pwd && ls - l && pwd";
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }

                    break;
                }



                case PlatformID.Unix:
                    // if (this.m_Flav != Flavor.Octave){
                    //     throw new NotImplementedException("Use Octave instead");
                    // }
                    if (m_Flav == Flavor.Octave)
                    {
                        if (MatlabExecuteable == null)
                        {
                            MatlabExecuteable = get_program_path("octave-cli");
                            if (MatlabExecuteable == null)
                            {
                                throw new ApplicationException("Unable to find 'octave-cli' in your PATH environment");
                            }
                        }

                        psi.FileName  = MatlabExecuteable;
                        psi.Arguments = " --no-gui " + CMDFILE + ".m > " + LOGFILE;
                        //psi.UseShellExecute = false;
                    }
                    else if (m_Flav == Flavor.Matlab)
                    {
                        if (MatlabExecuteable == null)
                        {
                            MatlabExecuteable = get_program_path("matlab");
                            if (MatlabExecuteable == null)
                            {
                                throw new ApplicationException("Unable to find 'matlab' in your PATH environment");
                            }
                        }

                        psi.FileName  = MatlabExecuteable;
                        psi.Arguments = "-nosplash -nodesktop -minimize -wait -r " + CMDFILE + " -logfile " + LOGFILE;
                    }
                    else
                    {
                        throw new NotImplementedException();
                    }
                    break;

                case PlatformID.MacOSX: {
                    throw new NotImplementedException("will implement on request");
                }

                default:
                    throw new NotSupportedException("unable to use MATLAB on " + CurrentSys.ToString());
                }


                CreatedFiles.Add(Path.Combine(WorkingDirectory.FullName, LOGFILE));


                var ScriptsToWrite = new List <Tuple <string, string> >();
                ScriptsToWrite.Add(new Tuple <string, string>("ReadMsr.m", Resource1.ReadMsr));
                ScriptsToWrite.Add(new Tuple <string, string>("SaveVoronoi.m", Resource1.SaveVoronoi));

                foreach (var t in ScriptsToWrite)
                {
                    string name   = t.Item1;
                    string script = t.Item2;
                    var    rmPath = Path.Combine(WorkingDirectory.FullName, name);
                    CreatedFiles.Add(rmPath);
                    File.WriteAllText(rmPath, script);
                }
            }

            // create command file
            // ===================
            if (Rank == 0)
            {
                var p = Path.Combine(WorkingDirectory.FullName, CMDFILE + ".m");
                CommandFile = new StreamWriter(p, false);
                CreatedFiles.Add(p);
            }
        }
Esempio n. 45
0
        public static System.Drawing.Graphics FromDrawable(Gdk.Window drawable, bool double_buffered)
        {
#if FIXME30
            IntPtr x_drawable;
            int    x_off = 0, y_off = 0;

            PlatformID osversion = Environment.OSVersion.Platform;

            if (osversion == PlatformID.Win32Windows || osversion == PlatformID.Win32NT ||
                osversion == PlatformID.Win32S || osversion == PlatformID.WinCE)
            {
                if (drawable is Gdk.Window && double_buffered)
                {
                    ((Gdk.Window)drawable).GetInternalPaintInfo(out drawable, out x_off, out y_off);
                }

                Cairo.Context gcc = new Gdk.GC(drawable);

                IntPtr windc = gdk_win32_hdc_get(drawable.Handle, gcc.Handle, 0);

                System.Drawing.Graphics g = System.Drawing.Graphics.FromHdc(windc);

                if (double_buffered)
                {
                    gdk_win32_hdc_release(drawable.Handle, gcc.Handle, 0);
                }

                g.TranslateTransform(-x_off, -y_off);

                return(g);
            }
            else
            {
                if (drawable is Gdk.Window && double_buffered)
                {
                    ((Gdk.Window)drawable).GetInternalPaintInfo(out drawable, out x_off, out y_off);
                }

                x_drawable = drawable.Handle;

                IntPtr display = gdk_x11_drawable_get_xdisplay(x_drawable);

                Type       graphics = typeof(System.Drawing.Graphics);
                MethodInfo mi       = graphics.GetMethod("FromXDrawable", BindingFlags.Static | BindingFlags.NonPublic);
                if (mi == null)
                {
                    throw new NotImplementedException("In this implementation I can not get a graphics from a drawable");
                }
                object [] args = new object [2] {
                    (IntPtr)gdk_x11_drawable_get_xid(drawable.Handle), (IntPtr)display
                };
                object r = mi.Invoke(null, args);
                System.Drawing.Graphics g = (System.Drawing.Graphics)r;

                g.TranslateTransform(-x_off, -y_off);

                return(g);
            }
#else
            throw new NotSupportedException();
#endif
        }
Esempio n. 46
0
        static void Main(string[] args)
        {
            FSO.Windows.Program.InitWindows();
            TimedReferenceController.SetMode(CacheType.PERMANENT);

            Console.WriteLine("Loading Config...");
            try
            {
                var configString = File.ReadAllText("facadeconfig.json");
                Config = Newtonsoft.Json.JsonConvert.DeserializeObject <FacadeConfig>(configString);
            }
            catch (Exception e)
            {
                Console.WriteLine("Could not find configuration file 'facadeconfig.json'. Please ensure it is valid and present in the same folder as this executable.");
                return;
            }

            Console.WriteLine("Locating The Sims Online...");
            string baseDir = AppDomain.CurrentDomain.BaseDirectory;

            Directory.SetCurrentDirectory(baseDir);
            //Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException);

            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            ILocator gameLocator;
            bool     linux = pid == PlatformID.MacOSX || pid == PlatformID.Unix;

            if (linux && Directory.Exists("/Users"))
            {
                gameLocator = new MacOSLocator();
            }
            else if (linux)
            {
                gameLocator = new LinuxLocator();
            }
            else
            {
                gameLocator = new WindowsLocator();
            }

            bool useDX = true;

            FSOEnvironment.Enable3D = true;
            GraphicsModeControl.ChangeMode(FSO.LotView.Model.GlobalGraphicsMode.Full3D);
            GameThread.NoGame          = true;
            GameThread.UpdateExecuting = true;

            var path = gameLocator.FindTheSimsOnline();

            if (path != null)
            {
                FSOEnvironment.ContentDir    = "Content/";
                FSOEnvironment.GFXContentDir = "Content/" + (useDX ? "DX/" : "OGL/");
                FSOEnvironment.Linux         = linux;
                FSOEnvironment.DirectX       = useDX;
                FSOEnvironment.TexCompress   = FSOEnvironment.TexCompressSupport;
                FSOEnvironment.GameThread    = Thread.CurrentThread;

                FSO.HIT.HITVM.Init();
                FSO.HIT.HITVM.Get().SetMasterVolume(FSO.HIT.Model.HITVolumeGroup.AMBIENCE, 0);
                FSO.HIT.HITVM.Get().SetMasterVolume(FSO.HIT.Model.HITVolumeGroup.FX, 0);
                FSO.HIT.HITVM.Get().SetMasterVolume(FSO.HIT.Model.HITVolumeGroup.MUSIC, 0);
                FSO.HIT.HITVM.Get().SetMasterVolume(FSO.HIT.Model.HITVolumeGroup.VOX, 0);
                FSO.Files.Formats.IFF.Chunks.STR.DefaultLangCode = FSO.Files.Formats.IFF.Chunks.STRLangCode.EnglishUS;
            }

            Console.WriteLine("Creating Graphics Device...");
            var gds = new GraphicsDeviceServiceMock();
            var gd  = gds.GraphicsDevice;

            //set up some extra stuff like the content manager
            var services = new GameServiceContainer();
            var content  = new ContentManager(services);

            content.RootDirectory = FSOEnvironment.GFXContentDir;
            services.AddService <IGraphicsDeviceService>(gds);

            var vitaboyEffect = content.Load <Effect>("Effects/Vitaboy");

            FSO.Vitaboy.Avatar.setVitaboyEffect(vitaboyEffect);

            WorldConfig.Current = new WorldConfig()
            {
                LightingMode    = 3,
                SmoothZoom      = true,
                SurroundingLots = 0
            };
            DGRP3DMesh.Sync = true;

            Console.WriteLine("Looks like that worked. Loading FSO Content!");
            VMContext.InitVMConfig(false);
            Content.Init(path, gd);
            WorldContent.Init(services, content.RootDirectory);
            VMAmbientSound.ForceDisable = true;
            Layer = new _3DLayer();
            Layer.Initialize(gd);
            GD = gd;

            if (args.FirstOrDefault() == "debug")
            {
                DebugLot = uint.Parse(args[1]);
            }
            Console.WriteLine("Starting Worker Loop!");
            WorkerLoop();

            Console.WriteLine("Exiting.");
            GameThread.SetKilled();
            gds.Release();
        }
Esempio n. 47
0
        public static string GetOperateName()
        {
            OperatingSystem oSVersion = Environment.OSVersion;
            PlatformID      platform  = oSVersion.Platform;
            int             major     = oSVersion.Version.Major;
            int             minor     = oSVersion.Version.Minor;
            string          str       = string.Empty;

            switch (platform)
            {
            case PlatformID.Win32Windows:
            {
                if (major != 4)
                {
                    return(str);
                }
                int num3 = minor;
                switch (num3)
                {
                case 0:
                    return("Windows95");

                case 10:
                    return("Windows98");
                }
                if (num3 != 90)
                {
                    return("未知");
                }
                return("WindowsMe");
            }

            case PlatformID.Win32NT:
                switch (major)
                {
                case 3:
                    return("WindowsNT3.5");

                case 4:
                    return("WindowsNT4.0");

                case 5:
                    if (minor != 0)
                    {
                        switch (minor)
                        {
                        case 1:
                            return("WindowsXP");

                        case 2:
                            return("Windows2003");
                        }
                        return("未知");
                    }
                    return("Windows2000");

                case 6:
                    if (minor != 0)
                    {
                        switch (minor)
                        {
                        case 1:
                            return("Windows7");

                        case 2:
                            return("Windows8");
                        }
                        return("未知");
                    }
                    return("WindowsVista");
                }
                str = "未知";
                break;
            }
            return(str);
        }
Esempio n. 48
0
        static void Main(string[] args)
        {
            try
            {
                string geojsonHeader = "{\"type\":\"FeatureCollection\",\"features\":[";
                string geojsonFooter = Environment.NewLine + "{}]}";

                // создать выходную директорию (если отсутствует)
                //
                OperatingSystem os  = Environment.OSVersion;
                PlatformID      pid = os.Platform;

                if (pid == PlatformID.Unix || pid == PlatformID.MacOSX) // 0 - Win32S, 1 - Win32Windows, 2 - Win32NT, 3 - WinCE, 4 - Unix, 5 - Xbox, 6 - MacOSX
                {
                    dirIn  = dirIn.Replace(@"\", @"/");
                    dirOut = dirOut.Replace(@"\", @"/");
                }

                if (!Directory.Exists(dirOut)) // Создать выходную директорию (если отсутствует)
                {
                    Directory.CreateDirectory(dirOut);
                }

                // пересоздать выходные файлы
                //
                OSM_RecreateFile(fileLog);                      // пересоздать журнал
                OSM_RecreateFile(fileOutWayCsvNpark_WayToNode); // пересоздать итоговый файл
                OSM_RecreateFile(fileOutWayCsvNpark_WayAttrs);
                OSM_RecreateFile(fileOutWayCsvNpark_NodeAttrs);
                OSM_RecreateFile(fileOutWayGeojsonNpark);

                // Контроль дубликатов
                //
                if (useIndexedCheck)
                {
                    wayIdx   = new byte[wayIdxSize + 1];
                    nodeIdx1 = new byte[nodeIdxSize + 1];
                    nodeIdx2 = new byte[nodeIdxSize + 1];
                }

                // Старт
                //
                OSM_WriteLog(fileLog, "===========================");
                OSM_WriteLog(fileLog, String.Format("== Start (check dupls: {0})", useIndexedCheck));
                OSM_WriteLog(fileLog, "== Find: Deserts");
                OSM_WriteLog(fileLog, "===========================");

                OSM_WriteFile(fileOutWayGeojsonNpark, geojsonHeader); // заголовок GEOJSON

                foreach (string fileFullName in Directory.GetFiles(dirIn, "*.osm.bz2"))
                {
                    OSM_WriteLog(fileLog, String.Format("Start File: {0}", fileFullName));

                    FileInfo fileInfo = new FileInfo(fileFullName);

                    for (int numCycle = 0; numCycle < 2; numCycle++) // два прохода по XML (сперва WAY, потом NODE)
                    {
                        using (FileStream fileStream = fileInfo.OpenRead())
                        {
                            using (Stream unzipStream = new ICSharpCode.SharpZipLib.BZip2.BZip2InputStream(fileStream))
                            {
                                XmlReader xmlReader = XmlReader.Create(unzipStream);

                                while (xmlReader.Read())
                                {
                                    if (numCycle == 0 && xmlReader.Name == "way")
                                    {
                                        OSM_ProcessWay(xmlReader.ReadOuterXml());
                                    }
                                    else if (numCycle == 1 && xmlReader.Name == "node")
                                    {
                                        OSM_ProcessNode(xmlReader.ReadOuterXml());
                                    }
                                }
                            }
                        }
                    }

                    // Записать данные
                    //
                    OSM_WriteLog(fileLog, "Start write CSV and GEOJSON data");

                    OSM_WriteResultToFilesCsv();
                    OSM_WriteResultToFilesGeojson();

                    nodeAttrList.Clear(); // Очистить массивы перед обработкой следующего файла
                    wayAttrList.Clear();
                    wayToNodeList.Clear();

                    OSM_WriteLog(fileLog, "End write CSV and GEOJSON data");

                    cntFileTotal++;

                    OSM_WriteLog(fileLog, String.Format("End File: {0}", fileFullName));
                    OSM_WriteLog(fileLog, "==");
                }

                OSM_WriteFile(fileOutWayGeojsonNpark, geojsonFooter); // завершение GEOJSON

                if (useIndexedCheck)
                {
                    OSM_WriteLog(fileLog, "Count dupls");

                    cntNodeDupl = OSM_NodeIdxDuplCount();
                    cntWayDupl  = OSM_WayIdxDuplCount();
                }
            }
            catch (Exception ex)
            {
                OSM_WriteLog(fileLog, "ERROR: " + ex.Message);
            }
            finally
            {
                OSM_WriteLog(fileLog, "===========================");
                OSM_WriteLog(fileLog, String.Format("== Total Files (*.bz2): {0} ; Total Nodes: {1} ; Total Ways: {2}", cntFileTotal, cntNodeTotal, cntWayTotal));
                OSM_WriteLog(fileLog, String.Format("== National Parks: Attrs Nodes: {0} ; Attrs Ways: {1} ", cntNodeNpark, cntWayNpark));
                OSM_WriteLog(fileLog, String.Format("== Min Node: {0} ; Max Node: {1}", minNode, maxNode));
                OSM_WriteLog(fileLog, String.Format("== Min Way: {0} ; Max Way: {1}", minWay, maxWay));

                if (useIndexedCheck)
                {
                    OSM_WriteLog(fileLog, String.Format("== Node dupls: {0} ; Way dupls: {1}", cntNodeDupl, cntWayDupl));
                }

                OSM_WriteLog(fileLog, "===========================");
                OSM_WriteLog(fileLog, "== End");
                OSM_WriteLog(fileLog, "===========================");
            }
        }
Esempio n. 49
0
 /// <summary>Returns well-known locations of Composer directories for a given platform:
 /// 1. Check for Windows. Return $APPDATA/Composer
 /// 2. Return $HOME/.composer if it exists and is a directory
 /// 3. Check if XDG_ environment variables exist, return $(XDG_CONFIG_HOME ?? HOME/.config)/composer
 /// 4. Return $HOME/.composer
 /// </summary>
 public static IEnumerable <string> For(PlatformID platform)
 {
     return(For(platform, Directory.Exists));
 }
Esempio n. 50
0
        // Opens the file when clicked
        public void OpenFile()
        {
            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;

            string file = String.Empty;

            bool hasOpenedAnything = false;

            switch (pid)
            {
            case PlatformID.Win32S:
            case PlatformID.Win32Windows:
            case PlatformID.WinCE:
            case PlatformID.Win32NT:     // <- if one, this is the one we really need
            {
                var filechooser = new System.Windows.Forms.OpenFileDialog();

                filechooser.InitialDirectory = "c:\\";
                filechooser.Filter           = "cas files (*.cas)|*.cas";
                filechooser.FilterIndex      = 2;
                filechooser.RestoreDirectory = true;

                if (filechooser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    file = System.IO.File.ReadAllText(filechooser.FileName);
                    hasOpenedAnything = true;
                }

                break;
            }

            case PlatformID.Unix:
            case PlatformID.MacOSX:
            {
                Object[]          parameters  = { "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept };
                FileChooserDialog filechooser = new FileChooserDialog("Open file...", null, FileChooserAction.Open, parameters);

                filechooser.Filter = new FileFilter();
                filechooser.Filter.AddPattern("*.cas");

                if (filechooser.Run() == (int)ResponseType.Accept)
                {
                    file = System.IO.File.ReadAllText(filechooser.Filename);
                    hasOpenedAnything = true;
                }

                filechooser.Destroy();

                break;
            }

            default:
                break;
            }

            // If anything has been opened, deserializes the content, and rebuilds the workspace with the opened widgets
            if (hasOpenedAnything == true)
            {
                List <MetaType> metaTypeList = new List <MetaType>();

                metaTypeList = ImEx.Import.DeserializeString <List <MetaType> >(file);

                textviews.castextviews.Clear();

                foreach (var item in metaTypeList)
                {
                    if (item.type == typeof(MovableCasTextView) && user.privilege == 1)
                    {
                        textviews.InsertTextView(item.metastring, item.locked, -1);
                    }
                    else if (item.type == typeof(MovableCasCalcView))
                    {
                        textviews.InsertCalcView(item.metastring, item.locked);
                    }
                    else if (item.type == typeof(MovableCasResult))
                    {
                        CasResult.FacitContainer container = new CasResult.FacitContainer();
                        container = Import.DeserializeString <CasResult.FacitContainer>(item.metastring);

                        textviews.InsertResult(container.answer, container.facit);
                    }
                    else if (item.type == typeof(MovableCasCalcMulitlineView))
                    {
                        textviews.InsertCalcMultilineView(item.metastring, item.locked);
                    }
                    else if (item.type == typeof(MovableCasTextView))
                    {
                        textviews.InsertTextView(item.metastring, item.locked, -1);
                    }
                }

                textviews.castextviews.Reverse();

                textviews.Clear();
                textviews.Redraw();
                textviews.Reevaluate();
                textviews.ShowAll();
            }
        }
 protected override IEnumerable <string> GetReferencedAssemblies(PlatformID platformID)
 {
     return(XunitEnvironment.GetReferences(platformID, TestDataPath2));
 }
Esempio n. 52
0
    public HoudiniEngineRuntime(ReadOnlyTargetRules Target) : base(Target)
    {
        bPrecompile          = true;
        PCHUsage             = PCHUsageMode.UseSharedPCHs;
        PrivatePCHHeaderFile = "Private/HoudiniEngineRuntimePrivatePCH.h";

        // Check if we are compiling for unsupported platforms.
        if (Target.Platform != UnrealTargetPlatform.Win64 &&
            Target.Platform != UnrealTargetPlatform.Mac &&
            Target.Platform != UnrealTargetPlatform.Linux &&
            Target.Platform != UnrealTargetPlatform.Switch)
        {
            System.Console.WriteLine(string.Format("Houdini Engine: Compiling for untested target platform.  Please let us know how it goes!"));
        }

        // Find HFS
        string HFSPath = GetHFSPath();

        HFSPath = HFSPath.Replace("\\", "/");

        if (HFSPath != "")
        {
            string Log = string.Format("Houdini Engine: Found Houdini in {0}", HFSPath);
            System.Console.WriteLine(Log);

            PlatformID buildPlatformId = Environment.OSVersion.Platform;
            if (buildPlatformId == PlatformID.Win32NT)
            {
                PublicDefinitions.Add("HOUDINI_ENGINE_HFS_PATH_DEFINE=" + HFSPath);
            }
        }

        // Find the HAPI include directory
        string HAPIIncludePath = HFSPath + "/toolkit/include/HAPI";

        if (!Directory.Exists(HAPIIncludePath))
        {
            // Add the custom include path as well in case the toolkit path doesn't exist yet.
            HAPIIncludePath = HFSPath + "/custom/houdini/include/HAPI";

            if (!Directory.Exists(HAPIIncludePath))
            {
                System.Console.WriteLine(string.Format("Couldn't find the HAPI include folder!"));
                HAPIIncludePath = "";
            }
        }

        if (HAPIIncludePath != "")
        {
            PublicIncludePaths.Add(HAPIIncludePath);
        }

        PublicIncludePaths.AddRange(
            new string[] {
            Path.Combine(ModuleDirectory, "Public/HAPI"),
            Path.Combine(ModuleDirectory, "Public")
        }
            );

        PrivateIncludePaths.AddRange(
            new string[] {
            "HoudiniEngineRuntime/Private"
        }
            );

        // Add common dependencies.
        PublicDependencyModuleNames.AddRange(
            new string[]
        {
            "Core",
            "CoreUObject",
            "Engine",
            "RenderCore",
            "InputCore",
            "RHI",
            "Foliage",
            "Landscape"
        }
            );

        PrivateDependencyModuleNames.AddRange(
            new string[]
        {
            // ... add private dependencies that you statically link with here ...
        }
            );

        if (Target.bBuildEditor == true)
        {
            PrivateDependencyModuleNames.AddRange(
                new string[]
            {
                "AppFramework",
                "AssetTools",
                "EditorStyle",
                "EditorWidgets",
                "LevelEditor",
                "MainFrame",
                "MeshPaint",
                "Projects",
                "PropertyEditor",
                "RawMesh",
                "Settings",
                "Slate",
                "SlateCore",
                "TargetPlatform",
                "UnrealEd",
                "ApplicationCore",
                "Landscape",
                "LandscapeEditor"
            }
                );
        }

        DynamicallyLoadedModuleNames.AddRange(
            new string[]
        {
            // ... add any modules that your module loads dynamically here ...
        }
            );
    }
Esempio n. 53
0
            /// <summary>
            /// <para>
            /// Retrieves the Windows version name.
            /// </para>
            /// <para>
            /// Currently the result can be one of:
            /// <list type="bullet">
            /// <item>Windows 95</item>
            /// <item>Windows 98</item>
            /// <item>Windows ME</item>
            /// <item>Windows Vista</item>
            /// <item>Windows Server 2008</item>
            /// <item>Windows 7</item>
            /// <item>Windows Server 2003, Storage</item>
            /// <item>Windows Server 2003, Compute Cluster Edition</item>
            /// <item>Windows Server 2003, Datacenter Edition</item>
            /// <item>Windows Server 2003, Enterprise Edition</item>
            /// <item>Windows Server 2003, Web Edition</item>
            /// <item>Windows Server 2003, Standard Edition</item>
            /// <item>Windows XP Home Edition</item>
            /// <item>Windows XP Professional</item>
            /// <item>Windows 2000 Professional</item>
            /// <item>Windows 2000 Datacenter Server</item>
            /// <item>Windows 2000 Advanced Server</item>
            /// <item>Windows 2000 Server</item>
            /// <item>Windows NT 4.0</item>
            /// <item>Windows CE</item>
            /// <item>Unknown</item>
            /// </list>
            /// </para>
            /// </summary>
            ///
            /// <returns>
            /// The Windows version name (e.g. "Windows Vista"), can not be null or empty.
            /// </returns>
            ///
            /// <exception cref="PrerequisiteSoftwareValidationException">
            /// If an error occurred while getting the version.
            /// </exception>
            public static string GetVersion()
            {
                try
                {
                    // Get platform
                    PlatformID platform = Environment.OSVersion.Platform;

                    // Get Windows major version
                    int majorVersion = Environment.OSVersion.Version.Major;

                    // Get Windows minor version
                    int minorVersion = Environment.OSVersion.Version.Minor;

                    // Get OS Version Info
                    OSVersionInfoEx os = new OSVersionInfoEx();

                    if (platform == PlatformID.Win32NT)
                    {
                        os.dwOSVersionInfoSize = Marshal.SizeOf(os);

                        // Call GetVersionEx
                        if (GetVersionEx(ref os) == 0)
                        {
                            throw new Exception("GetVersionEx API failed.");
                        }
                    }

                    // Default is Unknown
                    string versionName = Unknown;

                    // Handle Win95, 98, ME
                    if ((platform == PlatformID.Win32Windows) && (majorVersion == 4))
                    {
                        switch (minorVersion)
                        {
                        case 0:
                            versionName = Windows95;
                            break;

                        case 10:
                            versionName = Windows98;
                            break;

                        case 90:
                            versionName = WindowsME;
                            break;
                        }
                    }
                    else if (platform == PlatformID.Win32NT)
                    {
                        switch (majorVersion)
                        {
                        //Handle Windows 10,
                        //add below support Win10 info to IPSClient.exe->IPS.manifest
                        //http://www.itdadao.com/article/227158/
                        //https://msdn.microsoft.com/en-us/library/dn481241(v=vs.85).aspx
                        //<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/>
                        case 10:
                            if (minorVersion == 0)
                            {
                                if (os.wProductType == VER_NT_WORKSTATION)
                                {
                                    versionName = Windows10;
                                }
                                else
                                {
                                    versionName = WindowsServer2016TP;
                                }
                            }
                            break;

                        // Handle Vista, Win2008,Windows 7,Windows 8/8.1, windows server 2012/2012R2
                        //https://msdn.microsoft.com/en-us/library/windows/desktop/ms724832(v=vs.85).aspx

                        case 6:
                            #region Handle Windows8, 8.1, server 2012, server 2012 R2  #CJF 11/06/2013
                            if (minorVersion == 2)
                            {
                                if (os.wProductType == VER_NT_WORKSTATION)
                                {
                                    versionName = Windows8;
                                }
                                else
                                {
                                    versionName = WindowsServer2012;
                                }
                            }

                            if (minorVersion == 3)
                            {
                                if (os.wProductType == VER_NT_WORKSTATION)
                                {
                                    versionName = Windows8_1;
                                }
                                else
                                {
                                    versionName = WindowsServer2012R2;
                                }
                            }
                            #endregion

                            if (minorVersion == 1)
                            {      // Windows 7 or windows Server 2008 R2
                                if (os.wProductType == VER_NT_WORKSTATION)
                                {
                                    versionName = Windows7;
                                }
                                else
                                {
                                    versionName = WindowsServer2008R2;
                                }
                            }
                            else
                            if (minorVersion == 0)
                            {           // Vista or windows server 2008
                                if (os.wProductType == VER_NT_WORKSTATION)
                                {
                                    versionName = WindowsVista;
                                }
                                else
                                {
                                    versionName = WindowsServer2008;
                                }
                            }

                            break;

                        // Handle Win2003, XP, Win2000
                        case 5:
                            switch (minorVersion)
                            {
                            case 2:
                                if ((os.wSuiteMask & VER_SUITE_STORAGE_SERVER) == VER_SUITE_STORAGE_SERVER)
                                {
                                    versionName = WindowsServer2003Storage;
                                }
                                else if ((os.wSuiteMask & VER_SUITE_COMPUTE_SERVER) == VER_SUITE_COMPUTE_SERVER)
                                {
                                    versionName = WindowsServer2003ComputeClusterEdition;
                                }
                                else if ((os.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
                                {
                                    versionName = WindowsServer2003DatacenterEdition;
                                }
                                else if ((os.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
                                {
                                    versionName = WindowsServer2003EnterpriseEdition;
                                }
                                else if ((os.wSuiteMask & VER_SUITE_BLADE) == VER_SUITE_BLADE)
                                {
                                    versionName = WindowsServer2003WebEdition;
                                }
                                else
                                {
                                    versionName = WindowsServer2003StandardEdition;
                                }
                                break;

                            case 1:
                                if ((os.wSuiteMask & VER_SUITE_PERSONAL) == VER_SUITE_PERSONAL)
                                {
                                    versionName = WindowsXPHomeEdition;
                                }
                                else
                                {
                                    versionName = WindowsXPProfessional;
                                }
                                break;

                            case 0:
                                if ((os.wProductType & VER_NT_WORKSTATION) == VER_NT_WORKSTATION)
                                {
                                    versionName = Windows2000Professional;
                                }
                                else if ((os.wSuiteMask & VER_SUITE_DATACENTER) == VER_SUITE_DATACENTER)
                                {
                                    versionName = Windows2000DatacenterServer;
                                }
                                else if ((os.wSuiteMask & VER_SUITE_ENTERPRISE) == VER_SUITE_ENTERPRISE)
                                {
                                    versionName = Windows2000AdvancedServer;
                                }
                                else
                                {
                                    versionName = Windows2000Server;
                                }
                                break;
                            }
                            break;

                        // Handle WinNT
                        case 4:
                            if (majorVersion == 0)
                            {
                                versionName = WindowsNT40;
                            }
                            break;
                        }
                    }
                    // Handle WinCE
                    else if (platform == PlatformID.WinCE)
                    {
                        versionName = WindowsCE;
                    }

                    return(versionName);
                }
                catch (Exception ex)
                {
                    // Wrap the exception into PrerequisiteSoftwareValidationException
                    throw new Exception(
                              "An error occurred while getting the version.", ex);
                }
            }
Esempio n. 54
0
 public OSPlatform(PlatformID platform, Version version, ProductType product)
     : this(platform, version)
 {
     this.product = product;
 }
Esempio n. 55
0
 public void GetLibraryPath(PlatformID platformID, bool is64bits, string baseFolder, string fmuName,
                            string expectedLibraryPath)
 {
     Assert.That(Platform.GetLibraryPath(platformID, is64bits, baseFolder, fmuName),
                 Is.EqualTo(expectedLibraryPath));
 }
Esempio n. 56
0
 public OSPlatform(PlatformID platform, Version version)
 {
     this.platform = platform;
     this.version  = version;
 }
Esempio n. 57
0
        static RuntimeHelpers()
        {
            PlatformID pid = Environment.OSVersion.Platform;

            RunningOnWindows = ((int)pid != 128 && pid != PlatformID.Unix
#if !NETCF
                                && pid != PlatformID.MacOSX
#endif
                                );

            if (RunningOnWindows)
            {
                CaseInsensitive = true;
#if SSHARP
                string appDomainAppPath = Path.Combine(InitialParametersClass.ProgramDirectory.ToString(), "wwwroot").Replace('\\', '/');
#else
                string appDomainAppPath = AppDomain.CurrentDomain.GetData(".appPath") as string;
#endif
                if (!String.IsNullOrEmpty(appDomainAppPath))
                {
                    try
                    {
                        IsUncShare = new Uri(appDomainAppPath).IsUnc;
                    }
                    catch
                    {
                        // ignore
                    }
                }
            }
#if !NETCF
            else
            {
                string mono_iomap = Environment.GetEnvironmentVariable("MONO_IOMAP");
                if (!String.IsNullOrEmpty(mono_iomap))
                {
                    if (mono_iomap == "all")
                    {
                        CaseInsensitive = true;
                    }
                    else
                    {
                        string[] parts = mono_iomap.Split(':');
                        foreach (string p in parts)
                        {
                            if (p == "all" || p == "case")
                            {
                                CaseInsensitive = true;
                                break;
                            }
                        }
                    }
                }
            }
#endif
            if (CaseInsensitive)
            {
                StringEqualityComparer        = StringComparer.OrdinalIgnoreCase;
                StringEqualityComparerCulture = StringComparer.CurrentCultureIgnoreCase;
                StringComparison        = StringComparison.OrdinalIgnoreCase;
                StringComparisonCulture = StringComparison.CurrentCultureIgnoreCase;
            }
            else
            {
                StringEqualityComparer        = StringComparer.Ordinal;
                StringEqualityComparerCulture = StringComparer.CurrentCulture;
                StringComparison        = StringComparison.Ordinal;
                StringComparisonCulture = StringComparison.CurrentCulture;
            }

            string monoVersion = null;
#if !NETCF
            try
            {
                Type monoRuntime = Type.GetType("Mono.Runtime", false);
                if (monoRuntime != null)
                {
                    MethodInfo mi = monoRuntime.GetMethod("GetDisplayName", BindingFlags.Static | BindingFlags.NonPublic);
                    if (mi != null)
                    {
                        monoVersion = mi.Invoke(null, new object[0]) as string;
                    }
                }
            }
            catch
            {
                // ignore
            }
#endif
            if (monoVersion == null)
            {
                monoVersion = Environment.Version.ToString();
            }

            MonoVersion = monoVersion;
        }
Esempio n. 58
0
        string GetPath()
        {
            OperatingSystem os  = Environment.OSVersion;
            PlatformID      pid = os.Platform;
            string          path;

            switch (pid)
            {
            case PlatformID.WinCE:
            case PlatformID.Win32S:
            case PlatformID.Win32NT:
            case PlatformID.Win32Windows:
                path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
                                    "SuperPong");
                break;

            case PlatformID.MacOSX:
            case PlatformID.Unix:
            {
                IntPtr buf = IntPtr.Zero;
                try
                {
                    buf = Marshal.AllocHGlobal(8192);
                    if (uname(buf) == 0)
                    {
                        string un = Marshal.PtrToStringAnsi(buf);
                        if (un == "Darwin")
                        {
                            path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile),
                                                "Library", "Application Support", "com.philiprader.superpong");
                        }
                        else
                        {
                            path = Directory.GetCurrentDirectory();
                        }
                    }
                    else
                    {
                        path = Directory.GetCurrentDirectory();
                    }
                }
                catch
                {
                    path = Directory.GetCurrentDirectory();
                }
                finally
                {
                    if (buf != IntPtr.Zero)
                    {
                        Marshal.FreeHGlobal(buf);
                    }
                }
            }
            break;

            default:
                path = Directory.GetCurrentDirectory();
                break;
            }
            path = Path.Combine(path, "Settings.xml");

            return(path);
        }
Esempio n. 59
0
        /// <summary>From a platform ID and version returns a human-readable version</summary>
        /// <param name="id">Platform ID</param>
        /// <param name="version">Version number</param>
        /// <returns>Operating system name</returns>
        public static string GetPlatformName(PlatformID id, string version = null)
        {
            switch (id)
            {
            case PlatformID.AIX:       return("AIX");

            case PlatformID.Android:   return("Android");

            case PlatformID.DragonFly: return("DragonFly BSD");

            case PlatformID.FreeBSD:   return("FreeBSD");

            case PlatformID.Haiku:     return("Haiku");

            case PlatformID.HPUX:      return("HP/UX");

            case PlatformID.Hurd:      return("Hurd");

            case PlatformID.iOS:       return("iOS");

            case PlatformID.IRIX:      return("IRIX");

            case PlatformID.Linux:
                if (!File.Exists("/proc/version"))
                {
                    return("Linux");
                }

                string s = File.ReadAllText("/proc/version");

                return(s.Contains("Microsoft") || s.Contains("WSL") ? "Windows Subsystem for Linux" : "Linux");

            case PlatformID.MacOSX:
                if (string.IsNullOrEmpty(version))
                {
                    return("macOS");
                }

                string[] pieces = version.Split('.');

                if (pieces.Length < 2 ||
                    !int.TryParse(pieces[1], out int minor))
                {
                    return("macOS");
                }

                if (minor >= 12)
                {
                    return("macOS");
                }

                if (minor >= 8)
                {
                    return("OS X");
                }

                return("Mac OS X");

            case PlatformID.Minix:        return("MINIX");

            case PlatformID.NetBSD:       return("NetBSD");

            case PlatformID.NonStop:      return("NonStop OS");

            case PlatformID.OpenBSD:      return("OpenBSD");

            case PlatformID.OpenServer:   return("SCO OpenServer");

            case PlatformID.OS400:        return("OS/400");

            case PlatformID.PlayStation3: return("Sony CellOS");

            case PlatformID.PlayStation4: return("Sony Orbis OS");

            case PlatformID.QNX:          return("QNX");

            case PlatformID.SINIX:        return("SINIX");

            case PlatformID.Solaris:      return("Sun Solaris");

            case PlatformID.Tizen:        return("Samsung Tizen");

            case PlatformID.Tru64:        return("Tru64 UNIX");

            case PlatformID.Ultrix:       return("Ultrix");

            case PlatformID.Unix:         return("UNIX");

            case PlatformID.UnixWare:     return("SCO UnixWare");

            case PlatformID.Wii:          return("Nintendo Wii");

            case PlatformID.WiiU:         return("Nintendo Wii U");

            case PlatformID.Win32NT:
                if (string.IsNullOrEmpty(version))
                {
                    return("Windows NT/2000/XP/Vista/7/10");
                }

                if (version.StartsWith("3.", StringComparison.Ordinal) ||
                    version.StartsWith("4.", StringComparison.Ordinal))
                {
                    return("Windows NT");
                }

                if (version.StartsWith("5.0", StringComparison.Ordinal))
                {
                    return("Windows 2000");
                }

                if (version.StartsWith("5.1", StringComparison.Ordinal))
                {
                    return("Windows XP");
                }

                if (version.StartsWith("5.2", StringComparison.Ordinal))
                {
                    return("Windows 2003");
                }

                if (version.StartsWith("6.0", StringComparison.Ordinal))
                {
                    return("Windows Vista");
                }

                if (version.StartsWith("6.1", StringComparison.Ordinal))
                {
                    return("Windows 7");
                }

                if (version.StartsWith("6.2", StringComparison.Ordinal))
                {
                    return("Windows 8");
                }

                if (version.StartsWith("6.3", StringComparison.Ordinal))
                {
                    return("Windows 8.1");
                }

                if (version.StartsWith("10.0", StringComparison.Ordinal))
                {
                    return("Windows 10");
                }

                return("Windows NT/2000/XP/Vista/7/10");

            case PlatformID.Win32S: return("Windows 3.x with win32s");

            case PlatformID.Win32Windows:
                if (string.IsNullOrEmpty(version))
                {
                    return("Windows 9x/Me");
                }

                if (version.StartsWith("4.0", StringComparison.Ordinal))
                {
                    return("Windows 95");
                }

                if (version.StartsWith("4.10.2222", StringComparison.Ordinal))
                {
                    return("Windows 98 SE");
                }

                if (version.StartsWith("4.1", StringComparison.Ordinal))
                {
                    return("Windows 98");
                }

                if (version.StartsWith("4.9", StringComparison.Ordinal))
                {
                    return("Windows Me");
                }

                return("Windows 9x/Me");

            case PlatformID.WinCE:        return("Windows CE/Mobile");

            case PlatformID.WindowsPhone: return("Windows Phone");

            case PlatformID.Xbox:         return("Xbox OS");

            case PlatformID.zOS:          return("z/OS");

            default:                      return(id.ToString());
            }
        }
Esempio n. 60
0
        public Settings GetSettings()
        {
            Settings settings = new Settings();

            bool UseDefaultResolution = false;

            bool.TryParse(ConfigurationManager.AppSettings ["AlwaysUseDefaultResolution"], out UseDefaultResolution);

            bool RedirectClipboard = false;

            bool.TryParse(ConfigurationManager.AppSettings ["AlwaysRedirectClipboard"], out RedirectClipboard);

            bool UseAero = false;

            bool.TryParse(ConfigurationManager.AppSettings ["AlwaysUseAero"], out UseAero);

            int ResolutionWidth = 0;

            int.TryParse(ConfigurationManager.AppSettings ["DefaultResolution"].Split('x')[0], out ResolutionWidth);

            int ResolutionHeight = 0;

            int.TryParse(ConfigurationManager.AppSettings ["DefaultResolution"].Split('x')[1], out ResolutionHeight);

            string     path            = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            PlatformID CurrentPlatform = Environment.OSVersion.Platform;

            if (CurrentPlatform == PlatformID.MacOSX || CurrentPlatform == PlatformID.Unix)
            {
                path = path + "/";
            }
            else
            {
                path = path + "\\";
            }

            bool AlwaysUseFonts = false;

            bool.TryParse(ConfigurationManager.AppSettings ["AlwaysUseFonts"], out AlwaysUseFonts);

            bool AlwaysUseWindowDrag = false;

            bool.TryParse(ConfigurationManager.AppSettings ["AlwaysUseWindowDrag"], out AlwaysUseWindowDrag);

            bool AlwaysUseMenuAnims = false;

            bool.TryParse(ConfigurationManager.AppSettings ["AlwaysUseMenuAnims"], out AlwaysUseMenuAnims);

            bool AlwaysUseRFX = false;

            bool.TryParse(ConfigurationManager.AppSettings ["AlwaysUseRFX"], out AlwaysUseRFX);

            settings.AlwaysUseRFX               = AlwaysUseRFX;
            settings.AlwaysUseWindowDrag        = AlwaysUseWindowDrag;
            settings.AlwaysUseMenuAnims         = AlwaysUseMenuAnims;
            settings.AlwaysUseFonts             = AlwaysUseFonts;
            settings.CurrentPlatform            = CurrentPlatform;
            settings.ExecutingPath              = path;
            settings.AlwaysUseDefaultResolution = UseDefaultResolution;
            settings.AlwaysUseAero              = UseAero;
            settings.ResolutionWidth            = ResolutionWidth;
            settings.ResolutionHeight           = ResolutionHeight;
            settings.AlwaysRedirectClipboard    = RedirectClipboard;

            return(settings);
        }