Exemplo n.º 1
0
        private static void RebuildFile(string filePath)
        {
            try
            {
                var source  = File.ReadAllText(filePath);
                var content = ShaderMixinCodeGen.GenerateCsharp(source, filePath);

                // Sometimes, we have a collision with the .cs file, so generated filename might be postfixed with 1
                var destPath = Path.Combine(Path.GetDirectoryName(filePath), Path.GetFileNameWithoutExtension(filePath) + "1.cs");
                if (!File.Exists(destPath))
                {
                    destPath = Path.ChangeExtension(filePath, ".cs");
                }
                if (!File.Exists(destPath))
                {
                    Console.WriteLine("Target file {0} doesn't exist", destPath);
                    return;
                }
                File.WriteAllText(destPath, content, Encoding.UTF8);
                Console.WriteLine("File generated {0}", filePath);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Unexpected error {0}: {1}", filePath, ex);
            }
        }
Exemplo n.º 2
0
        private static void ConvertXkfxToCSharp(string sdfxfile)
        {
            var sdfileContent = File.ReadAllText(sdfxfile);
            var result        = ShaderMixinCodeGen.GenerateCsharp(sdfileContent, sdfxfile);

            File.WriteAllText(Path.ChangeExtension(sdfxfile, ".cs"), result, Encoding.UTF8);
        }
Exemplo n.º 3
0
 private static void RebuildFile(string filePath)
 {
     try
     {
         var source   = File.ReadAllText(filePath);
         var content  = ShaderMixinCodeGen.GenerateCsharp(source, filePath.Replace("C:", "D:"));
         var destPath = Path.ChangeExtension(filePath, ".cs");
         File.WriteAllText(destPath, content, Encoding.UTF8);
         Console.WriteLine("File generated {0}", filePath);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Unexpected error {0}: {1}", filePath, ex);
     }
 }
Exemplo n.º 4
0
 //[Fact]
 public void Test()
 {
     var filePath = @"D:\Code\Xenko\sources\engine\Xenko.Shaders.Tests\GameAssets\Mixins\A.xksl";
     var source   = File.ReadAllText(filePath);
     var content  = ShaderMixinCodeGen.GenerateCsharp(source, filePath.Replace("C:", "D:"));
 }
Exemplo n.º 5
0
 //[Test]
 public void Test()
 {
     var filePath = @"D:\Code\Paradox\sources\engine\SiliconStudio.Paradox.Shaders.Tests\GameAssets\Mixins\A.pdxsl";
     var source   = File.ReadAllText(filePath);
     var content  = ShaderMixinCodeGen.GenerateCsharp(source, filePath.Replace("C:", "D:"));
 }