public void AreNotEqual_DifferentVersionCount()
        {
            var name1 = ".NETFramework";
            var platform = new TargetPlatform
            {
                Name = name1,
                Versions = new[] {
                    new TargetPlatformVersion { Version = new Version("1.0"), PlatformName = name1 },
                    new TargetPlatformVersion { Version = new Version("5.8.3"), PlatformName = name1 },
                }.OrderBy(x => x.Version).ToList()
            };

            var compared = new TargetPlatform
            {
                Name = name1,
                Versions = new[] {
                    new TargetPlatformVersion { Version = new Version("2.8"), PlatformName = name1 },
                    new TargetPlatformVersion { Version = new Version("1.0"), PlatformName = name1 },
                    new TargetPlatformVersion { Version = new Version("5.8.3"), PlatformName = name1 },
                }.OrderBy(x => x.Version).ToList()
            };

            Assert.NotEqual(platform, compared);

            // We are expecting that `platform` should come after `compared`
            // because the second version number is greater in `platform`
            Assert.True(platform.CompareTo(compared) == 1);
            Assert.True(compared.CompareTo(platform) == -1);
        }
        private static FileStreamInfo VCLibsFromResources(TargetPlatform platform, DependencyConfiguration configuration, SdkVersion sdkVersion)
        {
            var vclibVersion = "";
            switch (sdkVersion)
            {
                case SdkVersion.SDK_10_0_10586_0: vclibVersion = "14.00"; break;
                default:
                    return null;
            }

            var platformString = "";
            switch (platform)
            {
                case TargetPlatform.X86: platformString = "x86"; break;
                case TargetPlatform.ARM: platformString = "ARM"; break;
                default:
                    return null;
            }

            var appxFilename = string.Format(CultureInfo.InvariantCulture, "Microsoft.VCLibs.{0}.{1}.{2}.appx", platformString, configuration.ToString(), vclibVersion);
            var assemblyName = typeof(CPlusPlusUwpDependency).Assembly.GetName().Name;
            var convertedPath = assemblyName + @".Resources.VCLibs." + platformString + "." + appxFilename;
            return new FileStreamInfo()
            {
                AppxRelativePath = appxFilename,
                Stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(convertedPath)
            };
        }
        public void TestAreEqual()
        {
            const string frameworkName = ".NETFramework";

            var platform = new TargetPlatform
            {
                Name = frameworkName,
                Versions = new[] {
                    new TargetPlatformVersion { Version = new Version("1.0"), PlatformName = frameworkName },
                    new TargetPlatformVersion { Version = new Version("5.8.3"), PlatformName = frameworkName },
                }.OrderBy(x => x.Version).ToList()
            };

            var compared = new TargetPlatform
            {
                Name = frameworkName,
                Versions = new[] {
                    new TargetPlatformVersion { Version = new Version("1.0"), PlatformName = frameworkName },
                    new TargetPlatformVersion { Version = new Version("5.8.3"), PlatformName = frameworkName },
                }.OrderBy(x => x.Version).ToList()
            };

            Assert.Equal(platform, compared);

            Assert.True(platform.CompareTo(compared) == 0);
            Assert.True(compared.CompareTo(platform) == 0);
        }
Beispiel #4
0
        public static string GetPlatformStaticLibraryExtension(TargetPlatform Platform)
        {
            if (Target.IsWinAPIPlatform(Platform))
                return ".lib";

            return ".a";
        }
        public void AreNotEqual_DifferentName()
        {
            var name1 = ".NETFramework";
            var platform = new TargetPlatform
            {
                Name = name1,
                Versions = new[] {
                    new TargetPlatformVersion { Version = new Version("1.0"), PlatformName = name1 },
                    new TargetPlatformVersion { Version = new Version("5.8.3"), PlatformName = name1 },
                }.OrderBy(x => x.Version).ToList()
            };

            var name2 = ".NETFramework_Not";
            var compared = new TargetPlatform
            {
                Name = name2,
                Versions = new[] {
                    new TargetPlatformVersion { Version = new Version("1.0"), PlatformName = name2 },
                    new TargetPlatformVersion { Version = new Version("5.8.3"), PlatformName = name2 },
                }.OrderBy(x => x.Version).ToList()
            };

            Assert.NotEqual(platform, compared);

            Assert.Equal(string.CompareOrdinal(name1, name2), platform.CompareTo(compared));
            Assert.Equal(string.CompareOrdinal(name2, name1), compared.CompareTo(platform));

        }
 public TestAttributionHandler(DeviceUtil deviceUtil, IAssert assert, TargetPlatform targetPlatform)
     : base(deviceUtil, assert)
 {
     TargetPlatform = targetPlatform;
     TestActivityPackage.Assert = Assert;
     TestActivityPackage.TargetPlatform = TargetPlatform;
 }
Beispiel #7
0
        /// <summary>
        /// Generate a DPWSHostedService source file from a Wsdl service description.
        /// </summary>
        /// <param name="serviceDesc">A valid wsdl service description.</param>
        public void GenerateHostedService(ServiceDescription serviceDesc, TargetPlatform platform)
        {
            // Well here's a nasty used in an attempt to make up a name
            string hostedServiceClassName = serviceDesc.Name;
            string hostedServiceNs = CodeGenUtils.GenerateDotNetNamespace(serviceDesc.TargetNamespace);
            string filename = serviceDesc.Name + "HostedService.cs";

            HostedServices hostedServices = new HostedServices(hostedServiceNs);

            foreach (PortType portType in serviceDesc.PortTypes)
            {
                HostedService hostedService = new HostedService(portType.Name, hostedServiceNs, platform);
                foreach (Operation operation in portType.Operations)
                {
                    // Create action names
                    // Apply special naming rules if this is a notification (event) operation
                    string inAction = serviceDesc.TargetNamespace + "/" + operation.Name + "Request";
                    string outAction = serviceDesc.TargetNamespace + "/" + operation.Name + ((operation.Messages.Flow == OperationFlow.Notification) ? "" : "Response");
                    hostedService.AddOperation(operation, inAction, outAction);
                }

                foreach (Message message in serviceDesc.Messages)
                {
                    hostedService.Messages.Add(message);
                }
            }

            HostedServiceGenerator hostedServiceGen = new HostedServiceGenerator();
            hostedServiceGen.GenerateCode(filename, hostedServices);
        }
        internal WinRTSolutionWriter(AssemblyDefinition assembly, TargetPlatform targetPlatform, string targetDir, string solutionFileName, 
			Dictionary<ModuleDefinition, string> modulesProjectsRelativePaths, Dictionary<ModuleDefinition, Guid> modulesProjectsGuids,
            VisualStudioVersion visualStudioVersion, ILanguage language, IEnumerable<string> platforms)
            : base(assembly, targetPlatform, targetDir, solutionFileName, modulesProjectsRelativePaths, modulesProjectsGuids, visualStudioVersion, language)
        {
            this.platforms = platforms;
        }
Beispiel #9
0
        /// <summary>
        /// Generate a DPWSClientProxy source file from a wsdl service description.
        /// </summary>
        /// <param name="serviceDesc">A valid wsdl service description.</param>
        public void GenerateClientProxy(ServiceDescription serviceDesc, TargetPlatform platform)
        {
            // Well here's a nasty used in an attempt to make up a name
            string clientProxyClassName = serviceDesc.Name;
            string clientProxyNs = CodeGenUtils.GenerateDotNetNamespace(serviceDesc.TargetNamespace);
            string filename = serviceDesc.Name + "ClientProxy.cs";

            ClientProxies clientProxies = new ClientProxies(clientProxyNs);

            foreach (PortType portType in serviceDesc.PortTypes)
            {
                ClientProxy clientProxy = new ClientProxy(portType.Name, platform);
                foreach (Operation operation in portType.Operations)
                {
                    // Create action names
                    // Apply special naming rules if this is a notification (event) operation
                    string inAction = serviceDesc.TargetNamespace + "/" + operation.Name + "Request";
                    string outAction = serviceDesc.TargetNamespace + "/" + operation.Name + ((operation.Messages.Flow == OperationFlow.Notification) ? "" : "Response");
                    clientProxy.AddOperation(operation, inAction, outAction);
                }

                foreach (Message message in serviceDesc.Messages)
                {
                    clientProxy.Messages.Add(message);
                }

                if (clientProxy.ServiceOperations.Count > 0)
                    clientProxies.Add(clientProxy);
            }

            ClientProxyGenerator clientProxyGen = new ClientProxyGenerator();
            clientProxyGen.GenerateCode(filename, clientProxies);
        }
 /// <summary>
 /// The to mono game platform.
 /// </summary>
 /// <param name="platform">
 /// The platform.
 /// </param>
 /// <returns>
 /// The <see cref="TargetPlatform"/>.
 /// </returns>
 /// <exception cref="NotSupportedException">
 /// </exception>
 public static MonoGamePlatform ToMonoGamePlatform(TargetPlatform platform)
 {
     switch (platform)
     {
         case TargetPlatform.Windows:
             return MonoGamePlatform.Windows;
         case TargetPlatform.Xbox360:
             return MonoGamePlatform.Xbox360;
         case TargetPlatform.WindowsPhone:
             return MonoGamePlatform.WindowsPhone;
         case TargetPlatform.iOS:
             return MonoGamePlatform.iOS;
         case TargetPlatform.Android:
             return MonoGamePlatform.Android;
         case TargetPlatform.Linux:
             return MonoGamePlatform.DesktopGL;
         case TargetPlatform.MacOSX:
             return MonoGamePlatform.MacOSX;
         case TargetPlatform.WindowsStoreApp:
             return MonoGamePlatform.WindowsStoreApp;
         case TargetPlatform.NativeClient:
             return MonoGamePlatform.NativeClient;
         case TargetPlatform.Ouya:
             return MonoGamePlatform.Android;
         case TargetPlatform.WindowsPhone8:
             return MonoGamePlatform.WindowsPhone8;
         case TargetPlatform.RaspberryPi:
             return MonoGamePlatform.RaspberryPi;
         default:
             throw new NotSupportedException();
     }
 }
Beispiel #11
0
        internal QueryableModule(ModuleDefinition moduleDefinition, QueryableAssembly assembly)
        {
            _assembly = assembly;
            _name = Utility.ToString(_getName(moduleDefinition));
            _fullPath = Utility.ToString(moduleDefinition.FullyQualifiedName);
            _moduleType = _getModuleType(moduleDefinition);
            _targetRuntimeVersion = Utility.ToString(_getTargetRuntimeVersion(moduleDefinition));
            _targetPlatform = _getTargetPlatform(moduleDefinition);
            _hasNativeCode = _getHasNativeCode(moduleDefinition);
            _isStrongNameSigned = _getIsStrongNameSigned(moduleDefinition);

            if (moduleDefinition.Assembly != null && moduleDefinition == moduleDefinition.Assembly.MainModule)
            {
                _assembly.MainModule = this;
            }

            foreach (Resource resource in moduleDefinition.Resources)
            {
                _resources.Add(new QueryableResource(resource, this));
            }

            foreach (TypeDefinition typeDefinition in moduleDefinition.Types)
            {
                QueryableType type = new QueryableType(typeDefinition, this, null);
                _addTypesAndMethods(type);
            }
        }
        internal SolutionWriter(AssemblyDefinition assembly, TargetPlatform targetPlatform, string targetDir, string solutionFileName, 
			Dictionary<ModuleDefinition, string> modulesProjectsRelativePaths, Dictionary<ModuleDefinition, Guid> modulesProjectsGuids,
            VisualStudioVersion visualStudioVersion, ILanguage language)
        {
            this.assembly = assembly;
            this.targetPlatform = targetPlatform;
            this.targetDir = targetDir;
            this.solutionFileName = solutionFileName;
            this.modulesProjectsRelativePaths = modulesProjectsRelativePaths;
            this.modulesProjectsGuids = modulesProjectsGuids;
            if (language is ICSharp)
            {
                this.languageGuid = new Guid(WinRTProjectBuilder.CSharpGUID);
            }
            else if (language is IVisualBasic)
            {
                this.languageGuid = new Guid(WinRTProjectBuilder.VisualBasicGUID);
            }
            else
            {
                throw new NotSupportedException();
            }

            this.visualStudioVersion = visualStudioVersion;
        }
 public RuntimeEnvironment GetRuntimeEnvironment(
     IUnitTestElement element,
     RuntimeEnvironment projectRuntimeEnvironment,
     TargetPlatform targetPlatform,
     IUnitTestLaunch launch)
 {
     return new RuntimeEnvironment { PlatformType = PlatformType.x86, PlatformVersion = PlatformVersion.v4_0 };
 }
 public ReadOnlyCollection<FileStreamInfo> GetDependencies(TargetPlatform platform, DependencyConfiguration configuration, SdkVersion sdkVersion)
 {
     var dependencies = new List<FileStreamInfo>();
     var dependency = VCLibsFromResources(platform, configuration, sdkVersion);
     if (null != dependency)
     {
         dependencies.Add(dependency);
     }
     return new ReadOnlyCollection<FileStreamInfo>(dependencies);
 }
Beispiel #15
0
        /// <summary> Returns true if specified platform`s native API is Cocoa</summary>
        public static bool IsCocoaPlatform(TargetPlatform Platform)
        {
            switch (Platform)
            {
                case TargetPlatform.iOS: return true;
                case TargetPlatform.OSX: return true;
            }

            return false;
        }
 public static CompiledEffectContent Compile(EffectContent output, string tempOutputPath, TargetPlatform platform, bool isDebug, string defines)
 {
     var processor = new EffectProcessor();
     var context = new DummyContentProcessorContext(TargetPlatformCast.ToMonoGamePlatform(platform));
     context.ActualOutputFilename = tempOutputPath;
     processor.DebugMode = isDebug
         ? EffectProcessorDebugMode.Debug
         : EffectProcessorDebugMode.Optimize;
     processor.Defines = defines + ";" + GetPlatformDefineForEffect(platform) + ";" +
                         (isDebug ? "CONFIGURATION_DEBUG" : "CONFIGURATION_RELEASE");
     return processor.Process(output, context);
 }
 internal string ParentDirectory(TargetPlatform runtime)
 {
     if (runtime == TargetPlatform.CLR_4)
     {
         return string.Format("v4.0_{0}__{1}", Version.ToString(), PublicKeyTokenAsString());
     }
     else if (runtime == TargetPlatform.CLR_2_3)
     {
         return string.Format("{0}__{1}", Version.ToString(), PublicKeyTokenAsString());
     }
     return string.Empty;
 }
Beispiel #18
0
		internal static string GetAssemblyPublicKey(TargetPlatform targetPlatform) {
			string str = "PublicKeyToken=";
			TargetPlatform targetPlatform1 = targetPlatform;
			if (targetPlatform1 == TargetPlatform.Windows) {
				str = string.Concat(str, AssemblyHelper.mWindowsPublicKeyTokens);
			} else if (targetPlatform1 == TargetPlatform.Xbox360) {
				str = string.Concat(str, AssemblyHelper.mXboxPublicKeyTokens);
			} else {
				throw new ArgumentException("targetPlatform");
			}
			return str;
		}
Beispiel #19
0
        internal static string GetRuntimeReader(Type type, TargetPlatform targetPlatform)
        {
            // Type full name
            string typeFullName = type.FullName;

            // Assembly name tokenized
            string fullAssemblyName = type.Assembly.FullName;
            string[] assemblyTokens = fullAssemblyName.Split(assemblySplitter, StringSplitOptions.None);

            return
                typeFullName + ", " + assemblyTokens[0] + ", " + assemblyTokens[1] + ", " +
                    assemblyTokens[2] + ", " + GetAssemblyPublicKey(targetPlatform);
        }
Beispiel #20
0
        /// <summary>
        /// Returns a path string normalized to the current platform standard.
        /// </summary>
        /// <param name="path">Path to normalize</param>
        /// <param name="targetPlatform">The platform to normalize for</param>
        /// <returns>The normalized path</returns>
        public static string NormalizeOS(string path, TargetPlatform targetPlatform)
        {
            switch (targetPlatform)
            {
                case TargetPlatform.Windows:
                case TargetPlatform.WindowsPhone8:
                case TargetPlatform.WindowsStoreApp:
                    return NormalizeWindows(path);

                default:
                    return Normalize(path);
            }
        }
        private void BuildEffect(string effectFile, TargetPlatform targetPlatform, string defines = null)
        {
            var importerContext = new ImporterContext();
            var importer = new EffectImporter();
            var input = importer.Import(effectFile, importerContext);

            Assert.NotNull(input);

            var processorContext = new TestProcessorContext(targetPlatform, Path.ChangeExtension(effectFile, ".xnb"));
            var processor = new EffectProcessor { Defines = defines };
            var output = processor.Process(input, processorContext);

            Assert.NotNull(output);

            // TODO: Should we test the writer?
        }
Beispiel #22
0
 public static ProcessedContent LoadContent(string file, ContentBuildLogger logger, ContentTypes desiredType, bool process = true, TargetPlatform plat = TargetPlatform.Windows)
 {
     Content content = new SGDEImport().Import(file, new FakeContentImporterContext(Path.GetFullPath(file), logger));
     if (content.Type != desiredType)
     {
         logger.LogImportantMessage(Resources.DATA_UTIL_LOAD_BADTYPE, content.Type, desiredType);
         return null;
     }
     if (process)
     {
         FakeContentProcessorContext context = new FakeContentProcessorContext(logger);
         context.TPalt = plat;
         return new SGDEProcessor().Process(content, context);
     }
     return new TempProcessedContent(); //Just to prevent a null outptu
 }
Beispiel #23
0
		internal static string GetRuntimeReader(Type type, TargetPlatform targetPlatform) {
			string fullName = type.FullName;
			string str = type.Assembly.FullName;
			string[] strArrays = str.Split(AssemblyHelper.mAssemblySplitter, StringSplitOptions.None);
			string[] assemblyPublicKey = new string[9];
			assemblyPublicKey[0] = fullName;
			assemblyPublicKey[1] = ", ";
			assemblyPublicKey[2] = strArrays[0];
			assemblyPublicKey[3] = ", ";
			assemblyPublicKey[4] = strArrays[1];
			assemblyPublicKey[5] = ", ";
			assemblyPublicKey[6] = strArrays[2];
			assemblyPublicKey[7] = ", ";
			assemblyPublicKey[8] = AssemblyHelper.GetAssemblyPublicKey(targetPlatform);
			return string.Concat(assemblyPublicKey);
		}
Beispiel #24
0
        public static string GetPlatformCodeName(TargetPlatform Platform)
        {
            switch(Platform)
            {
                case TargetPlatform.XBoxOne: return "XBox";
                case TargetPlatform.PlayStation4: return "PS4";
                case TargetPlatform.Windows: return "Win64";
                case TargetPlatform.OSX: return "OSX";
                case TargetPlatform.Linux: return "Linux";
                case TargetPlatform.WindowsPhone: return "WP";
                case TargetPlatform.iOS: return "iOS";
                case TargetPlatform.Android: return "Android";
                case TargetPlatform.HTML5: return "js";
            }

            throw new ArgumentException();
        }
        internal static string GetAssemblyPublicKey(TargetPlatform targetPlatform)
        {
            string publicKey = "PublicKeyToken=";

            switch (targetPlatform)
            {
                case TargetPlatform.Windows:
                    publicKey += windowsPublicKeyTokens;
                    break;

                case TargetPlatform.Xbox360:
                    publicKey += xboxPublicKeyTokens;
                    break;

                default:
                    throw new ArgumentException("targetPlatform");
            }

            return publicKey;
        }
        internal string[] SupportedVersions(TargetPlatform runtime)
        {
            switch (runtime)
            {
                case TargetPlatform.CLR_2_3:
                case TargetPlatform.CLR_4:
                    return SystemInformation.CLR_GAC_VERSIONS;

                case TargetPlatform.WindowsPhone:
                    return SystemInformation.WINDOWS_PHONE_VERSIONS;

                case TargetPlatform.WindowsCE:
                    return SystemInformation.WINDOWS_CE_VERSIONS;

                case TargetPlatform.Silverlight:
                    return SystemInformation.SILVERLIGHT_VERSIONS;

                default:
                    return new string[0];
            }
        }
        internal static string GetRuntimeReader(Type type, TargetPlatform targetPlatform)
        {
            // Type full name
            string typeFullName = type.FullName;

            // Assembly name tokenized
            string fullAssemblyName = type.Assembly.FullName;
            string[] assemblyTokens = fullAssemblyName.Split(assemblySplitter, StringSplitOptions.None);
#if DEBUG
            return
                //typeFullName + ", " + assemblyTokens[0] + ", " + assemblyTokens[1] + ", " +
                    //assemblyTokens[2] + ", " + GetAssemblyPublicKey(targetPlatform);
                typeFullName + ", " + "PloobsEngineDebug" + ", " + assemblyTokens[1] + ", " +
                    assemblyTokens[2] + ", " + GetAssemblyPublicKey(targetPlatform);
#else                  
                //typeFullName + ", " + "PloobsEngine" + ", " + assemblyTokens[1] + ", " +
                //    assemblyTokens[2] + ", " + GetAssemblyPublicKey(targetPlatform);
            typeFullName + ", " + "PloobsEngineDebug" + ", " + assemblyTokens[1] + ", " +
                    assemblyTokens[2] + ", " + GetAssemblyPublicKey(targetPlatform);

#endif

        }
Beispiel #28
0
 public ContentBuilder(string contentProjectFile, GraphicsProfile graphicsProfile = GraphicsProfile.HiDef, TargetPlatform targetPlatform = TargetPlatform.Windows, bool compressContent = true, LoggerVerbosity loggerVerbosity = LoggerVerbosity.Normal, bool rebuildContent = false)
 {
     FileInfo fileInfo = new FileInfo(contentProjectFile);
     _contentProjectFile = Path.GetFullPath(fileInfo.FullName);
     if (fileInfo.Extension != ".contentproj")
         throw new NotSupportedException(string.Format("The file '{0}' is not a XNA content project.", _contentProjectFile));
     if (!fileInfo.Exists)
         throw new FileNotFoundException(String.Format("The file '{0}' does not exist.", _contentProjectFile, _contentProjectFile));
     GraphicsProfile = graphicsProfile;
     TargetPlatform = targetPlatform;
     CompressContent = compressContent;
     LoggerVerbosity = loggerVerbosity;
     RebuildContent = rebuildContent;
     if (!_globalProperties.ContainsKey("XnaProfile"))
         _globalProperties.Add("XnaProfile", GraphicsProfile.ToString());
     if (!_globalProperties.ContainsKey("XNAContentPipelineTargetPlatform"))
         _globalProperties.Add("XNAContentPipelineTargetPlatform", TargetPlatform.ToString());
     if (!_globalProperties.ContainsKey("XnaCompressContent"))
         _globalProperties.Add("XnaCompressContent", CompressContent.ToString());
     if (!_globalProperties.ContainsKey("OutputhPath"))
         _globalProperties.Add("OutputPath", OutputPath);
     if (!_globalProperties.ContainsKey("ContentRootDirectory"))
         _globalProperties.Add("ContentRootDirectory", ContentRootDirectory);
 }
 private static string GetPlatformDefineForEffect(TargetPlatform platform)
 {
     switch (platform)
     {
         case TargetPlatform.Windows:
             return "PLATFORM_WINDOWS";
         case TargetPlatform.Xbox360:
             return "PLATFORM_XBOX360";
         case TargetPlatform.WindowsPhone:
             return "PLATFORM_WINDOWSPHONE";
         case TargetPlatform.iOS:
             return "PLATFORM_IOS";
         case TargetPlatform.Android:
             return "PLATFORM_ANDROID";
         case TargetPlatform.Linux:
             return "PLATFORM_LINUX";
         case TargetPlatform.MacOSX:
             return "PLATFORM_MACOSX";
         case TargetPlatform.WindowsStoreApp:
             return "PLATFORM_WINDOWSSTOREAPP";
         case TargetPlatform.NativeClient:
             return "PLATFORM_NATIVECLIENT";
         case TargetPlatform.Ouya:
             return "PLATFORM_OUYA";
         case TargetPlatform.PlayStationMobile:
             return "PLATFORM_PSMOBILE";
         case TargetPlatform.WindowsPhone8:
             return "PLATFORM_WINDOWSPHONE8";
         case TargetPlatform.RaspberryPi:
             return "PLATFORM_RASPBERRYPI";
         case TargetPlatform.Web:
             return "PLATFORM_WEB";
         default:
             return String.Empty;
     }
 }
Beispiel #30
0
 /// <summary>
 /// Tells the content pipeline what worker type
 /// will be used to load the sky data.
 /// </summary>
 public override string GetRuntimeReader(TargetPlatform targetPlatform)
 {
     return("EGGEngine.Rendering.SkyReader, " +
            "EGGEngine, Version=1.0.0.0, Culture=neutral");
 }
Beispiel #31
0
 public override string GetRuntimeReader(TargetPlatform targetPlatform)
 {
     return("GeonBit.Extend.Animation.Content.ClipReader, " +
            typeof(GeonBit.Extend.Animation.Content.ClipReader).Assembly.FullName);
 }
 /// <summary>
 /// Gets the assembly qualified name of the runtime target type.
 /// </summary>
 /// <param name="targetPlatform">The target platform.</param>
 /// <returns>The qualified name.</returns>
 public override string GetRuntimeType(TargetPlatform targetPlatform)
 {
     return(typeof(TriangleShape).AssemblyQualifiedName);
 }
        public TargetPlatform GetTargetPlatform(string assemblyFilePath, ModuleDefinition moduleDef)
        {
            TargetPlatform targetPlatform = this.DefaultTargetPlatform;

            if (string.IsNullOrEmpty(assemblyFilePath))
            {
                return(targetPlatform);
            }

            if (this.assemblyFrameworkResolverCache.AssemblyPathToTargetPlatform.ContainsKey(assemblyFilePath))
            {
                return(this.assemblyFrameworkResolverCache.AssemblyPathToTargetPlatform[assemblyFilePath]);
            }
            else
            {
                Task <TargetPlatform> targetPlatformFromDepsJson = null;

                string moduleLocation   = moduleDef.FullyQualifiedName ?? moduleDef.FilePath;
                string depsJsonLocation = Directory.GetFiles(Path.GetDirectoryName(moduleLocation), "*.deps.json").FirstOrDefault();

                if (File.Exists(depsJsonLocation))
                {
                    targetPlatformFromDepsJson = Task.Factory.StartNew(() =>
                    {
                        return(this.GetPlatformTargetFromDepsJson(moduleLocation));
                    });
                }

                ///*Telerik Authorship*/
                if (moduleDef.Assembly != null)
                {
                    targetPlatform = this.GetTargetPlatform(moduleDef);

                    if (targetPlatform != this.DefaultTargetPlatform)
                    {
                        this.assemblyFrameworkResolverCache.AddAssemblyTargetPlatformToCache(assemblyFilePath, targetPlatform);
                        return(targetPlatform);
                    }
                }

                AssemblyNameReference msCorlib = moduleDef.AssemblyReferences.FirstOrDefault(a => a.Name == "mscorlib");

                if (msCorlib == null)
                {
                    AssemblyNameReference systemRuntimeReference = moduleDef.AssemblyReferences.FirstOrDefault(x => x.Name == "System.Runtime");
                    targetPlatform = this.GetTargetPlatform(systemRuntimeReference);

                    if (targetPlatform != this.DefaultTargetPlatform)
                    {
                        this.assemblyFrameworkResolverCache.AddAssemblyTargetPlatformToCache(assemblyFilePath, targetPlatform);
                        this.assemblyFrameworkResolverCache.AddAssemblySystemRuntimeReference(assemblyFilePath, systemRuntimeReference);

                        return(targetPlatform);
                    }

                    // the next line is only to keep the old functionality
                    msCorlib = moduleDef.Assembly.Name;
                }

                if (moduleDef.Assembly != null && moduleDef.Assembly.Name.IsWindowsRuntime || msCorlib.IsFakeMscorlibReference())
                {
                    this.assemblyFrameworkResolverCache.AddAssemblyTargetPlatformToCache(assemblyFilePath, TargetPlatform.WinRT);
                    return(TargetPlatform.WinRT);
                }

                /*AssemblyName assemblyName = new AssemblyName(msCorlib.Name,
                 *                                  msCorlib.FullName,
                 *                                  msCorlib.Version,
                 *                                  msCorlib.PublicKeyToken,
                 *                                  Path.GetDirectoryName(assemliyFilePath)) { TargetArchitecture = moduleDef.GetModuleArchitecture() };
                 * IEnumerable<string> foundPaths = GetAssemblyPaths(assemblyName);
                 *
                 * return GetTargetPlatform(foundPaths.FirstOrDefault());*/

                /*Telerik Authorship*/
                if (targetPlatformFromDepsJson != null)
                {
                    targetPlatformFromDepsJson.Wait();
                    targetPlatform = targetPlatformFromDepsJson.Result;

                    if (targetPlatform != this.DefaultTargetPlatform)
                    {
                        this.assemblyFrameworkResolverCache.AddAssemblyTargetPlatformToCache(assemblyFilePath, targetPlatform);
                        return(targetPlatform);
                    }
                }

                /*Telerik Authorship*/
                TargetArchitecture moduleArchitecture = moduleDef.GetModuleArchitecture();
                /*Telerik Authorship*/
                foreach (KeyValuePair <AssemblyName, TargetPlatform> pair in Mscorlibs)
                {
                    if (AssemblyNameComparer.AreVersionEquals(pair.Key.Version, msCorlib.Version) &&
                        AssemblyNameComparer.ArePublicKeyEquals(pair.Key.PublicKeyToken, msCorlib.PublicKeyToken) &&
                        moduleArchitecture.CanReference(pair.Key.TargetArchitecture))
                    {
                        this.assemblyFrameworkResolverCache.AddAssemblyTargetPlatformToCache(assemblyFilePath, pair.Value);
                        return(pair.Value);
                    }
                }

                /*Telerik Authorship*/
                this.assemblyFrameworkResolverCache.AddAssemblyTargetPlatformToCache(assemblyFilePath, this.DefaultTargetPlatform);
                return(this.DefaultTargetPlatform);
            }
        }
        public async Task CompileAsync(IAssetFsFile assetFile, IAssetDependencies assetDependencies, TargetPlatform platform, IWritableSerializedAsset output)
        {
            var code = string.Empty;

            using (var reader = new StreamReader(await assetFile.GetContentStream().ConfigureAwait(false)))
            {
                code = await reader.ReadToEndAsync().ConfigureAwait(false);
            }

            if (!code.Contains("// uber"))
            {
                // Do nothing with this file.
                return;
            }

            var dirName = Path.GetDirectoryName(assetFile.Name.Replace(".", "/"));

            code = await ResolveIncludes(assetDependencies, dirName.Replace(Path.DirectorySeparatorChar, '.'), code).ConfigureAwait(false);

            var allPassed   = true;
            var effectCodes = new Dictionary <string, Tuple <string, byte[], byte[]> >();

            foreach (var rawLine in code.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))
            {
                var line = rawLine.Trim();
                if (line.StartsWith("#line"))
                {
                    continue;
                }
                if (!line.StartsWith("// uber "))
                {
                    break;
                }

                var components = line.Substring("// uber ".Length).Split(':');
                var name       = components[0].Trim();
                var defines    = components[1].Trim();

                Console.WriteLine();
                Console.Write("Compiling uber shader variant " + name + "... ");

                var effectOutput = new EffectContent();
                effectOutput.EffectCode = this.GetEffectPrefixCode() + code;

                string tempPath = null, tempOutputPath = null;
                try
                {
                    tempPath       = Path.GetTempFileName();
                    tempOutputPath = Path.GetTempFileName();

                    using (var writer = new StreamWriter(tempPath))
                    {
                        writer.Write(effectOutput.EffectCode);
                    }

                    effectOutput.Identity = new ContentIdentity(tempPath);

                    var debugContent = EffectCompilerHelper.Compile(
                        effectOutput,
                        tempOutputPath,
                        platform,
                        true,
                        defines);
                    var releaseContent = EffectCompilerHelper.Compile(
                        effectOutput,
                        tempOutputPath,
                        platform,
                        false,
                        defines);

                    effectCodes[name] = new Tuple <string, byte[], byte[]>(defines, debugContent.GetEffectCode(), releaseContent.GetEffectCode());
                    Console.Write("done.");
                }
                catch (InvalidContentException ex)
                {
                    Console.WriteLine("failed.");
                    Console.Write(ex.Message.Trim());
                    allPassed = false;
                }
                finally
                {
                    if (tempOutputPath != null)
                    {
                        File.Delete(tempOutputPath);
                    }

                    if (tempOutputPath != null)
                    {
                        File.Delete(tempPath);
                    }
                }
            }

            Console.WriteLine();
            Console.Write("Finalizing uber shader compilation... ");

            if (!allPassed)
            {
                throw new Exception("One or more uber shader variants failed to compile (see above!)");
            }

            using (var memory = new MemoryStream())
            {
                using (var writer = new BinaryWriter(memory))
                {
                    writer.Write((uint)2);
                    writer.Write((uint)effectCodes.Count);
                    foreach (var kv in effectCodes)
                    {
                        writer.Write(kv.Key);
                        writer.Write(kv.Value.Item1);
                        writer.Write(kv.Value.Item2.Length);
                        writer.Write(kv.Value.Item2);
                        writer.Write(kv.Value.Item3.Length);
                        writer.Write(kv.Value.Item3);
                    }

                    var len  = memory.Position;
                    var data = new byte[len];
                    memory.Seek(0, SeekOrigin.Begin);
                    memory.Read(data, 0, data.Length);

                    output.SetLoader <IAssetLoader <UberEffectAsset> >();
                    output.SetPlatform(platform);
                    output.SetByteArray("Data", data);
                }
            }
        }
 private void OnUpload(TargetPlatform targetPlatform)
 {
     OVRPlatformTool.log = string.Empty;
     SetDirtyOnGUIChange();
     ExecuteCommand(targetPlatform);
 }
 /// <summary>
 /// Returns true if this profile supports audio processing for this platform.
 /// </summary>
 public abstract bool Supports(TargetPlatform platform);
 public UnityRuntimeEnvironment(TargetPlatform targetPlatform)
 {
     TargetPlatform = targetPlatform;
 }
Beispiel #38
0
 /// <summary>
 /// Gets the dependency packages binaries folder.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="platform">The target platform.</param>
 /// <returns>The absolute path to the deps folder for the given platform and architecture configuration.</returns>
 public static string GetBinariesFolder(BuildOptions options, TargetPlatform platform)
 {
     return(Path.Combine(options.PlatformsFolder, platform.ToString(), "Binaries"));
 }
Beispiel #39
0
 /// <summary>
 /// Gets the dependency third-party packages binaries folder.
 /// </summary>
 /// <param name="options">The options.</param>
 /// <param name="platform">The target platform.</param>
 /// <param name="architecture">The target architecture.</param>
 /// <returns>The absolute path to the deps folder for the given platform and architecture configuration.</returns>
 public static string GetThirdPartyFolder(BuildOptions options, TargetPlatform platform, TargetArchitecture architecture)
 {
     return(Path.Combine(options.PlatformsFolder, platform.ToString(), "Binaries", "ThirdParty", architecture.ToString()));
 }
Beispiel #40
0
        /// <summary>
        /// Runs the cmake tool.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="platform">The output platform.</param>
        /// <param name="architecture">The output architecture.</param>
        /// <param name="customArgs">The custom arguments for the CMake.</param>
        /// <param name="envVars">Custom environment variables to pass to the child process.</param>
        public static void RunCmake(string path, TargetPlatform platform, TargetArchitecture architecture, string customArgs = null, Dictionary <string, string> envVars = null)
        {
            string cmdLine;

            switch (platform)
            {
            case TargetPlatform.Windows:
            case TargetPlatform.XboxOne:
            case TargetPlatform.XboxScarlett:
            case TargetPlatform.UWP:
            {
                string arch;
                switch (architecture)
                {
                case TargetArchitecture.x86:
                    arch = string.Empty;
                    break;

                case TargetArchitecture.x64:
                    arch = " Win64";
                    break;

                case TargetArchitecture.ARM:
                    arch = " ARM";
                    break;

                case TargetArchitecture.ARM64:
                    arch = " ARM64";
                    break;

                default: throw new InvalidArchitectureException(architecture);
                }
                cmdLine = string.Format("CMakeLists.txt -G \"Visual Studio 14 2015{0}\"", arch);
                break;
            }

            case TargetPlatform.Linux:
            case TargetPlatform.PS4:
            {
                cmdLine = "CMakeLists.txt";
                break;
            }

            case TargetPlatform.Switch:
            {
                cmdLine = string.Format("-DCMAKE_TOOLCHAIN_FILE=\"{1}\\Source\\Platforms\\Switch\\Data\\Switch.cmake\" -G \"NMake Makefiles\" -DCMAKE_MAKE_PROGRAM=\"{0}..\\..\\VC\\bin\\nmake.exe\"", Environment.GetEnvironmentVariable("VS140COMNTOOLS"), Globals.EngineRoot);
                break;
            }

            case TargetPlatform.Android:
            {
                var ndk      = AndroidNdk.Instance.RootPath;
                var abi      = AndroidToolchain.GetAbiName(architecture);
                var hostName = AndroidSdk.GetHostName();
                cmdLine = string.Format("-DCMAKE_TOOLCHAIN_FILE=\"{0}/build/cmake/android.toolchain.cmake\" -DANDROID_NDK=\"{0}\" -DANDROID_STL=c++_shared -DANDROID_ABI={1} -DANDROID_PLATFORM=android-{2} -G \"MinGW Makefiles\" -DCMAKE_MAKE_PROGRAM=\"{0}/prebuilt/{3}/bin/make.exe\"", ndk, abi, Configuration.AndroidPlatformApi, hostName);
                break;
            }

            default: throw new InvalidPlatformException(platform);
            }

            if (customArgs != null)
            {
                cmdLine += " " + customArgs;
            }

            Utilities.Run("cmake", cmdLine, null, path, Utilities.RunOptions.None, envVars);
        }
Beispiel #41
0
 public override string GetRuntimeReader(TargetPlatform targetPlatform)
 {
     //TiledMapProcessor.logger.LogMessage( "--- GetRuntimeReader: {0}", typeof( Nez.Tiled.TiledMapReader ).AssemblyQualifiedName );
     return(typeof(Nez.Tiled.TiledMapReader).AssemblyQualifiedName);
 }
Beispiel #42
0
 /// <summary>
 /// Gets the assembly qualified name of the runtime loader for this type.
 /// </summary>
 /// <param name="targetPlatform">Name of the platform.</param>
 /// <returns>Name of the runtime loader.</returns>
 public override string GetRuntimeReader(TargetPlatform targetPlatform)
 {
     return(typeof(Path3FReader).AssemblyQualifiedName);
 }
Beispiel #43
0
 public override string GetRuntimeType(TargetPlatform targetPlatform)
 {
     return("GeonBit.Extend.Animation.Clip, " +
            typeof(GeonBit.Extend.Animation.Clip).Assembly.FullName);
 }
Beispiel #44
0
 /// <summary>
 /// Tells the content pipeline what CLR type the sky
 /// data will be loaded into at runtime.
 /// </summary>
 public override string GetRuntimeType(TargetPlatform targetPlatform)
 {
     return("EGGEngine.Rendering.Sky, " +
            "TRA_Game, Version=1.0.0.0, Culture=neutral");
 }
 public override string GetRuntimeReader(TargetPlatform targetPlatform)
 {
     // TODO: change this to the name of your ContentTypeReader
     // class which will be used to load this data.
     return(typeof(WeaponContentReader).AssemblyQualifiedName);
 }
Beispiel #46
0
        ///////////////////////////////////////////////////////////////////////////

        ////////////////////////////////////////////////////////////////////////////
        public override string GetRuntimeType(TargetPlatform targetPlatform)
        {
            return(typeof(SkinXmlDocument).AssemblyQualifiedName);
        }
        private static bool genUploadCommand(TargetPlatform targetPlatform, out string command)
        {
            bool success = true;

            command = "";

            switch (targetPlatform)
            {
            case TargetPlatform.Rift:
                command = "upload-rift-build";
                break;

            case TargetPlatform.OculusGoGearVR:
                command = "upload-mobile-build";
                break;

            case TargetPlatform.Quest:
                command = "upload-quest-build";
                break;

            default:
                OVRPlatformTool.log += "ERROR: Invalid target platform selected";
                success              = false;
                break;
            }

            // Add App ID
            ValidateTextField(AppIDFieldValidator, OVRPlatformToolSettings.AppID, "App ID", ref success);
            command += " --app-id \"" + OVRPlatformToolSettings.AppID + "\"";

            // Add App Token
            ValidateTextField(GenericFieldValidator, OVRPlatformToolSettings.AppToken, "App Token", ref success);
            command += " --app-secret \"" + OVRPlatformToolSettings.AppToken + "\"";

            // Add Platform specific fields
            if (targetPlatform == TargetPlatform.Rift)
            {
                // Add Rift Build Directory
                ValidateTextField(DirectoryValidator, OVRPlatformToolSettings.RiftBuildDirectory, "Rift Build Directory", ref success);
                command += " --build-dir \"" + OVRPlatformToolSettings.RiftBuildDirectory + "\"";

                // Add Rift Launch File
                ValidateTextField(FileValidator, OVRPlatformToolSettings.RiftLaunchFile, "Rift Launch File Path", ref success);
                command += " --launch-file \"" + OVRPlatformToolSettings.RiftLaunchFile + "\"";

                // Add Rift Build Version
                ValidateTextField(GenericFieldValidator, OVRPlatformToolSettings.RiftBuildVersion, "Build Version", ref success);
                command += " --version \"" + OVRPlatformToolSettings.RiftBuildVersion + "\"";

                // Add Rift Launch Parameters
                if (!string.IsNullOrEmpty(OVRPlatformToolSettings.RiftLaunchParams))
                {
                    ValidateTextField(LaunchParameterValidator, OVRPlatformToolSettings.RiftLaunchParams, "Launch Parameters", ref success);
                    command += " --launch_params \"" + OVRPlatformToolSettings.RiftLaunchParams + "\"";
                }

                // Add 2D Launch File
                if (!string.IsNullOrEmpty(OVRPlatformToolSettings.Rift2DLaunchFile))
                {
                    ValidateTextField(FileValidator, OVRPlatformToolSettings.Rift2DLaunchFile, "2D Launch File", ref success);
                    command += " --launch_file_2d \"" + OVRPlatformToolSettings.Rift2DLaunchFile + "\"";

                    if (!string.IsNullOrEmpty(OVRPlatformToolSettings.Rift2DLaunchParams))
                    {
                        ValidateTextField(LaunchParameterValidator, OVRPlatformToolSettings.Rift2DLaunchParams, "2D Launch Parameters", ref success);
                        command += " --launch_params_2d \"" + OVRPlatformToolSettings.Rift2DLaunchParams + "\"";
                    }
                }

                // Add Firewall Exception
                if (OVRPlatformToolSettings.RiftFirewallException)
                {
                    command += " --firewall_exceptions true";
                }

                // Add Redistributable Packages
                List <string> redistCommandIds = new List <string>();
                for (int i = 0; i < OVRPlatformToolSettings.RiftRedistPackages.Count; i++)
                {
                    if (OVRPlatformToolSettings.RiftRedistPackages[i].include)
                    {
                        redistCommandIds.Add(OVRPlatformToolSettings.RiftRedistPackages[i].id);
                    }
                }
                if (redistCommandIds.Count > 0)
                {
                    command += " --redistributables \"" + string.Join(",", redistCommandIds.ToArray()) + "\"";
                }

                // Add Gamepad Emulation
                if (OVRPlatformToolSettings.RiftGamepadEmulation > OVRPlatformToolSettings.GamepadType.OFF &&
                    OVRPlatformToolSettings.RiftGamepadEmulation <= OVRPlatformToolSettings.GamepadType.LEFT_D_PAD)
                {
                    command += " --gamepad-emulation ";
                    switch (OVRPlatformToolSettings.RiftGamepadEmulation)
                    {
                    case OVRPlatformToolSettings.GamepadType.TWINSTICK:             command += "TWINSTICK";         break;

                    case OVRPlatformToolSettings.GamepadType.RIGHT_D_PAD:   command += "RIGHT_D_PAD";       break;

                    case OVRPlatformToolSettings.GamepadType.LEFT_D_PAD:    command += "LEFT_D_PAD";        break;

                    default:                                                                                                command += "OFF";                       break;
                    }
                }

                // Add Rift Language Pack Directory
                if (!string.IsNullOrEmpty(OVRPlatformToolSettings.LanguagePackDirectory))
                {
                    ValidateTextField(DirectoryValidator, OVRPlatformToolSettings.LanguagePackDirectory, "Language Pack Directory", ref success);
                    command += " --language_packs_dir \"" + OVRPlatformToolSettings.LanguagePackDirectory + "\"";
                }
            }
            else
            {
                // Add APK Build Path
                ValidateTextField(FileValidator, OVRPlatformToolSettings.ApkBuildPath, "APK Build Path", ref success);
                command += " --apk \"" + OVRPlatformToolSettings.ApkBuildPath + "\"";

                // Add OBB File Path
                if (!string.IsNullOrEmpty(OVRPlatformToolSettings.ObbFilePath))
                {
                    ValidateTextField(FileValidator, OVRPlatformToolSettings.ObbFilePath, "OBB File Path", ref success);
                    command += " --obb \"" + OVRPlatformToolSettings.ObbFilePath + "\"";
                }

                if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.OculusGoGearVR)
                {
                    // Go and Gear VR specific commands
                }
                else if (OVRPlatformToolSettings.TargetPlatform == TargetPlatform.Quest)
                {
                    // Quest specific commands
                }
            }

            // Add Assets Directory
            if (!string.IsNullOrEmpty(OVRPlatformToolSettings.AssetsDirectory))
            {
                ValidateTextField(DirectoryValidator, OVRPlatformToolSettings.AssetsDirectory, "Assets Directory", ref success);
                command += " --assets-dir \"" + OVRPlatformToolSettings.AssetsDirectory + "\"";

                // Add Asset Configurations
                if (OVRPlatformToolSettings.AssetConfigs.Count > 0)
                {
                    List <string> assetConfigs = new List <string>();
                    for (int i = 0; i < OVRPlatformToolSettings.AssetConfigs.Count; i++)
                    {
                        List <string> configParameters = new List <string>();
                        AssetConfig   config           = OVRPlatformToolSettings.AssetConfigs[i];

                        if (config.required)
                        {
                            configParameters.Add("\"required\": true");
                        }
                        if (config.type > AssetConfig.AssetType.DEFAULT)
                        {
                            string typeCommand = "\"type\": ";
                            switch (config.type)
                            {
                            case AssetConfig.AssetType.LANGUAGE_PACK:
                                configParameters.Add(typeCommand + "LANGUAGE_PACK");
                                break;

                            case AssetConfig.AssetType.STORE:
                                configParameters.Add(typeCommand + "STORE");
                                break;

                            default:
                                configParameters.Add(typeCommand + "DEFAULT");
                                break;
                            }
                        }
                        if (!string.IsNullOrEmpty(config.sku))
                        {
                            configParameters.Add("\"sku\": " + config.sku);
                        }

                        if (configParameters.Count > 0)
                        {
                            string configString = "\"" + config.name + "\": {" + string.Join(",", configParameters.ToArray()) + "}";
                            assetConfigs.Add(configString);
                        }
                    }

                    if (assetConfigs.Count > 0)
                    {
                        command += " --asset_files_config='{" + string.Join(",", assetConfigs.ToArray()) + "}'";
                    }
                }
            }

            // Add Release Channel
            ValidateTextField(GenericFieldValidator, OVRPlatformToolSettings.ReleaseChannel, "Release Channel", ref success);
            command += " --channel \"" + OVRPlatformToolSettings.ReleaseChannel + "\"";

            // Add Notes
            if (!string.IsNullOrEmpty(OVRPlatformToolSettings.ReleaseNote))
            {
                string sanatizedReleaseNote = OVRPlatformToolSettings.ReleaseNote;
                sanatizedReleaseNote = sanatizedReleaseNote.Replace("\"", "\"\"");
                command += " --notes \"" + sanatizedReleaseNote + "\"";
            }

            return(success);
        }
 /// <summary>
 /// Gets the assembly qualified name of the runtime target type.
 /// </summary>
 /// <param name="targetPlatform">The target platform.</param>
 /// <returns>The qualified name.</returns>
 public override string GetRuntimeType(TargetPlatform targetPlatform)
 {
     return(typeof(BlendGroup).AssemblyQualifiedName);
 }
Beispiel #49
0
        public static ParticleSystemCompiledShaderData BuildGpuLogicPixelShader(IEnumerable <ParticleSystemLogicStep> steps, LogicType logicType, bool useUserValues, bool useColours, bool storeLifeData, TargetPlatform targetPlatform, bool useUserDataPositionBuffer)
        {
            if (steps == null)
            {
                throw new ArgumentNullException();
            }

            StringBuilder output = new StringBuilder();
            Random        random = new Random();

            foreach (ParticleSystemLogicStep step in steps)
            {
                BuildStep(step, output, 1, random);
            }

            string psCode = GpuParticleShaderBuilder.BasePixelShader.Replace(GpuParticleShaderBuilder.replaceMarker, output.ToString()).Replace("_#", "#");

            //build the shader header and main method.

            string headerPS       = "";
            string methodHeaderPS = "";
            string methodPS       = "void PS(float4 texRandIndex : TEXCOORD0";

            if (logicType != LogicType.Frame)
            {
                methodPS += ", float4 lifeIndex : TEXCOORD1";
            }
            else
            {
                methodHeaderPS += "float4 lifeIndex = 0;";
            }

            if (logicType == LogicType.Once)
            {
                methodPS += ", float4 defaultPosition : TEXCOORD2";
                methodPS += ", float4 defaultVelocity : TEXCOORD3";
                methodPS += ", float4 defaultColour   : TEXCOORD4";
                methodPS += ", float4 defaultUserData : TEXCOORD5";
            }
            else
            {
                methodHeaderPS += "float4 defaultPosition = 0, defaultVelocity = 0;";
                methodHeaderPS += "float4 defaultColour = 1, defaultUserData = 0;";
            }

            int colIndex = 2;

            methodPS += ", out float4 posOut : COLOR0, out float4 velOut : COLOR1";


            if (useColours)
            {
                methodPS += string.Format(", out float4 colOut : COLOR{0}", colIndex++);
            }
            else
            {
                methodHeaderPS += "float4 colOut = 1;";
            }

            if (useUserValues)
            {
                methodPS += string.Format(", out float4 userOut : COLOR{0}", colIndex++);
            }
            else
            {
                methodHeaderPS += "float4 userOut = 0;";
            }

            methodPS += ")\n{\n\t" + methodHeaderPS;

            methodPS += "\n\t" + @"PS_Method(texRandIndex,  
				lifeIndex, defaultPosition, defaultVelocity, defaultColour, defaultUserData, 
				posOut, velOut, colOut, userOut);"                ;
            methodPS += "\n}";

            int colourIndex = -1, userIndex = -1, lifeIndex = -1;

            if (logicType != LogicType.Once)
            {
                int samplerIndex = 3;
                headerPS = Environment.NewLine + "#define TEXTURE_PARTICLE_METHOD" + Environment.NewLine;
                if (useColours)
                {
                    colourIndex = samplerIndex;
                    headerPS   += Environment.NewLine + "#define USER_COLOUR_TEX" + Environment.NewLine;
                    headerPS   += Environment.NewLine + string.Format(@"sampler2D ColourSampler : register(s{0});", samplerIndex++) + Environment.NewLine;
                }
                if (useUserValues)
                {
                    userIndex = samplerIndex;
                    headerPS += Environment.NewLine + "#define USER_USER_TEX" + Environment.NewLine;
                    headerPS += Environment.NewLine + string.Format(@"sampler2D UserSampler : register(s{0});", samplerIndex++) + Environment.NewLine;
                }
                if (storeLifeData && logicType == LogicType.Frame)
                {
                    lifeIndex = samplerIndex;
                    headerPS += Environment.NewLine + "#define USER_LIFE_TEX" + Environment.NewLine;
                    headerPS += Environment.NewLine + string.Format(@"sampler2D LifeSampler : register(s{0});", samplerIndex++) + Environment.NewLine;
                }

                if (logicType == LogicType.Frame || logicType == LogicType.FrameMove)
                {
                    headerPS += Environment.NewLine + "#define ADD_VELOCITY" + Environment.NewLine;
                }
            }

            if ((logicType == LogicType.OnceClone || logicType == LogicType.Once) &&
                useUserDataPositionBuffer)
            {
                headerPS += Environment.NewLine + "#define WRITE_POS_TO_USER" + Environment.NewLine;
            }

            psCode = headerPS + Environment.NewLine + psCode + Environment.NewLine + methodPS;


            CompiledShader pscs = ShaderCompiler.CompileFromSource(psCode, null, null, CompilerOptions.None, "PS", ShaderProfile.PS_3_0, targetPlatform);

            if (!pscs.Success)
            {
                throw new InvalidOperationException("GPU Particle System Pixel Shader failed to compile:" + Environment.NewLine + pscs.ErrorsAndWarnings);
            }

            return(new ParticleSystemCompiledShaderData(pscs.GetShaderCode(), colourIndex, userIndex, lifeIndex));
        }
Beispiel #50
0
 public override string GetRuntimeReader(TargetPlatform targetPlatform)
 {
     return("TiledLib.MapReader, TiledLib");
 }
 /// <summary>
 /// Converts the audio content to work on targeted platform.
 /// </summary>
 /// <param name="platform">The platform to build the audio content for.</param>
 /// <param name="quality">The suggested audio quality level.</param>
 /// <param name="content">The audio content to convert.</param>
 /// <returns>The quality used for conversion which could be different from the suggested quality.</returns>
 public abstract ConversionQuality ConvertAudio(TargetPlatform platform, ConversionQuality quality, AudioContent content);
Beispiel #52
0
 public override string GetRuntimeReader(TargetPlatform targetPlatform)
 {
     return(typeof(OctreeNodeReader <T>).AssemblyQualifiedName);
 }
        public bool IsCLR4Assembly(ModuleDefinition module)
        {
            TargetPlatform targetPlatform = this.GetTargetPlatform(module.FilePath, module);

            return(targetPlatform == TargetPlatform.CLR_4 ? true : false);
        }
Beispiel #54
0
 public InputProfileDescriptionAttribute(string displayName, TargetPlatform platform)
 {
     this.DisplayName = displayName;
     this.Platform    = platform;
 }
Beispiel #55
0
 public override string GetRuntimeType(TargetPlatform targetPlatform)
 {
     return("TiledLib.Map, TiledLib");
 }
 /// <summary>
 /// Converts the audio content to a streaming format that works on targeted platform.
 /// </summary>
 /// <param name="platform">The platform to build the audio content for.</param>
 /// <param name="quality">The suggested audio quality level.</param>
 /// <param name="content">he audio content to convert.</param>
 /// <param name="outputFileName"></param>
 /// <returns>The quality used for conversion which could be different from the suggested quality.</returns>
 public abstract ConversionQuality ConvertStreamingAudio(TargetPlatform platform, ConversionQuality quality, AudioContent content, ref string outputFileName);
 public override string GetRuntimeReader(TargetPlatform targetPlatform)
 {
     return(typeof(Nez.Tiled.TiledMapReader).AssemblyQualifiedName);
 }
Beispiel #58
0
 public override string GetRuntimeType(TargetPlatform targetPlatform)
 {
     return(typeof(QuadTreeNode <T>).AssemblyQualifiedName);
 }
		public DecompiledCodeResult(IDecompiledDocument[] documents, CompilerMetadataReference[] assemblyReferences, IAssemblyReferenceResolver assemblyReferenceResolver, TargetPlatform platform) {
			Documents = documents;
			AssemblyReferences = assemblyReferences;
			AssemblyReferenceResolver = assemblyReferenceResolver;
			Platform = platform;
		}
Beispiel #60
0
 public override string GetRuntimeType(TargetPlatform targetPlatform)
 {
     return(typeof(TextureAtlasFile).AssemblyQualifiedName);
 }