1
0
mirror of https://github.com/Memorix101/UnityXNA/ synced 2024-12-30 15:25:35 +01:00

37 lines
858 B
C#
Raw Normal View History

#define ALT_MODE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
using System.IO;
namespace Microsoft.Xna.Framework
{
public class TitleContainer
{
internal static System.IO.Stream OpenStream(string path)
{
// TODO: Improve
#if ALT_MODE
path = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path));
path = path.Replace("\\","/");
TextAsset textAsset = (TextAsset)Resources.Load(path);
MemoryStream ms = new MemoryStream();
System.Text.UTF8Encoding encoding =new System.Text.UTF8Encoding();
byte[] bytes = encoding.GetBytes(textAsset.text);
ms.Write(bytes, 0, bytes.Length);
ms.Position = 0;
return ms;
#else
return new FileStream(path, FileMode.Open);
#endif
}
}
}