Exemplo n.º 1
0
        public void ApplyParameters()
        {
            CryEngineParameters = new CryEngineParameters(Project);

            var engineDirectory = GetEngineDirectoryName(CryEngineParameters);

            if (engineDirectory == null)
            {
                LoggingService.LogError("Unable to set the correct mono-runtime! Make sure the launcher path is set in the project's settings.");
                return;
            }

            var engineRoot = (FilePath)engineDirectory;
            var monoRoot   = engineRoot.Combine("bin", "common", "Mono").FullPath;

            if (!Directory.Exists(monoRoot))
            {
                LoggingService.LogError("Unable to locate the mono-runtime at {0}! Make sure the launcher path is set to the correct launcher in the project's settings.", monoRoot);
                return;
            }

            var currentRuntime = Runtime.SystemAssemblyService.CurrentRuntime as MonoTargetRuntime;

            if (currentRuntime != null && ((FilePath)currentRuntime.Prefix).CanonicalPath.CompareTo(monoRoot.CanonicalPath) == 0)
            {
                // The right runtime is already set, so our job is done here.
                return;
            }

            // Apply proper mono runtime for CryEngine
            foreach (TargetRuntime runtime in Runtime.SystemAssemblyService.GetTargetRuntimes())
            {
                var monoRuntime = runtime as MonoTargetRuntime;
                if (monoRuntime == null)
                {
                    continue;
                }

                var monoRuntimePath = (FilePath)monoRuntime.Prefix;
                if (monoRuntimePath.CanonicalPath.CompareTo(monoRoot.CanonicalPath) == 0)
                {
                    CryEngineRuntime = monoRuntime;
                }
            }

            if (CryEngineRuntime == null)
            {
                var mri = new MonoRuntimeInfo(monoRoot.FullPath);
                CryEngineRuntime = MonoTargetRuntime.RegisterRuntime(mri);
            }

            Runtime.SystemAssemblyService.DefaultRuntime = CryEngineRuntime;

            Project.NotifyModified("RunTime");
        }
Exemplo n.º 2
0
        public void Store()
        {
            object          ob             = store.GetValue(defaultIter, 1);
            MonoRuntimeInfo newDefaultInfo = ob as MonoRuntimeInfo;

            if (ob is TargetRuntime)
            {
                IdeApp.Preferences.DefaultTargetRuntime = (TargetRuntime)ob;
            }

            foreach (MonoRuntimeInfo rinfo in newInfos)
            {
                TargetRuntime tr = MonoTargetRuntime.RegisterRuntime(rinfo);
                if (rinfo == newDefaultInfo)
                {
                    IdeApp.Preferences.DefaultTargetRuntime = tr;
                }
            }
            foreach (MonoTargetRuntime tr in removedRuntimes)
            {
                MonoTargetRuntime.UnregisterRuntime(tr);
            }
        }