27.09.2020
~ Moved Default-Shader to 2D to provied 2D-specific feature ~ Fixed UVs in Polygon
This commit is contained in:
parent
617a7ef044
commit
2aa12f8d25
19 changed files with 166 additions and 83 deletions
29
SMCode/SM.Base/Utility/Assembly.cs
Normal file
29
SMCode/SM.Base/Utility/Assembly.cs
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
namespace SM.Utility
|
||||
{
|
||||
public class AssemblyUtility
|
||||
{
|
||||
/// <summary>
|
||||
/// Read a file that is saved in a assembly
|
||||
/// </summary>
|
||||
/// <param name="ass">The assembly that contains the file</param>
|
||||
/// <param name="path">The path to the file inside the assembly</param>
|
||||
/// <returns></returns>
|
||||
public static string ReadAssemblyFile(Assembly ass, string path) { return new StreamReader(GetAssemblyStream(ass, path)).ReadToEnd(); }
|
||||
|
||||
/// <summary>
|
||||
/// Read a file that is saved in the calling assembly
|
||||
/// </summary>
|
||||
/// <param name="path">The path to the file inside the assembly</param>
|
||||
/// <returns></returns>
|
||||
public static string ReadAssemblyFile(string path) { return ReadAssemblyFile(Assembly.GetCallingAssembly(), path); }
|
||||
|
||||
|
||||
public static Stream GetAssemblyStream(Assembly ass, string path) { return ass.GetManifestResourceStream(ass.GetName().Name + "." + path) ?? throw new InvalidOperationException("Assembly couldn't find resource at path '" + path + "'."); }
|
||||
|
||||
public static Stream GetAssemblyStream(string path) { return GetAssemblyStream(Assembly.GetCallingAssembly(), path); }
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue