Make ContentCompilerGui compatible to recent changes in pipeline and did some usability changes. Make the Visual Studio Extension work even if the ANX Framework is not installed additionally.. Improve that the path for assembly refernces in a content project doesn't get automatically updated, only if the reference is actually saved, this is so you can specify a relative path yourself. Fix missing icon for ContentProject when it was opened with Visual Studio. Made create_shaders.bat directly executable under windows by fixing the directory separators.
44 lines
1.3 KiB
C#
44 lines
1.3 KiB
C#
using ANX.Framework.Content;
|
|
using ANX.Framework.Content.Pipeline.Tasks;
|
|
using Microsoft.Win32;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
|
|
namespace ContentBuilder
|
|
{
|
|
public static class BuildHelper
|
|
{
|
|
public static Uri GetAnxFrameworkPath()
|
|
{
|
|
#if WINDOWS
|
|
var hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
|
|
var key = hklm.OpenSubKey(@"SOFTWARE\Microsoft\.NETFramework\AssemblyFolders\ANX.Framework", false);
|
|
var value = key.GetValue(null) as string;
|
|
if (value == null)
|
|
throw new KeyNotFoundException(Resources.AnxFrameworkRegistryNotFound);
|
|
else
|
|
return new Uri(value);
|
|
|
|
#else
|
|
return null;
|
|
#endif
|
|
}
|
|
|
|
public static string GetOutputFileName(string outputDirectory, BuildItem buildItem)
|
|
{
|
|
return Path.Combine(outputDirectory, Path.GetDirectoryName(buildItem.AssetName), Path.GetFileNameWithoutExtension(buildItem.AssetName) + ContentManager.Extension);
|
|
}
|
|
|
|
internal static string CreateSafeFileName(string text)
|
|
{
|
|
foreach (var invalidChar in Path.GetInvalidFileNameChars())
|
|
text = text.Replace(invalidChar, '_');
|
|
|
|
return text;
|
|
}
|
|
}
|
|
}
|