mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 17:26:01 +08:00
Fixed file loading for XNA on Windows Phone 7.
This commit is contained in:
parent
f3be613429
commit
b51a110c54
@ -34,6 +34,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
|
||||
#if WINDOWS_STOREAPP
|
||||
using System.Threading.Tasks;
|
||||
@ -64,7 +65,14 @@ namespace Spine {
|
||||
}
|
||||
#else
|
||||
public Atlas (String path, TextureLoader textureLoader) {
|
||||
using (StreamReader reader = new StreamReader(path)) {
|
||||
|
||||
#if WINDOWS_PHONE
|
||||
Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
#else
|
||||
using (StreamReader reader = new StreamReader(path)) {
|
||||
#endif
|
||||
try {
|
||||
Load(reader, Path.GetDirectoryName(path), textureLoader);
|
||||
} catch (Exception ex) {
|
||||
|
||||
@ -80,8 +80,14 @@ namespace Spine {
|
||||
}
|
||||
#else
|
||||
public SkeletonData ReadSkeletonData (String path) {
|
||||
using (StreamReader reader = new StreamReader(path)) {
|
||||
SkeletonData skeletonData = ReadSkeletonData(reader);
|
||||
#if WINDOWS_PHONE
|
||||
Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
|
||||
using (StreamReader reader = new StreamReader(stream))
|
||||
{
|
||||
#else
|
||||
using (StreamReader reader = new StreamReader(path)) {
|
||||
#endif
|
||||
SkeletonData skeletonData = ReadSkeletonData(reader);
|
||||
skeletonData.name = Path.GetFileNameWithoutExtension(path);
|
||||
return skeletonData;
|
||||
}
|
||||
|
||||
@ -60,7 +60,14 @@ namespace Spine {
|
||||
}
|
||||
#else
|
||||
static public Texture2D LoadTexture (GraphicsDevice device, String path) {
|
||||
using (Stream input = new FileStream(path, FileMode.Open, FileAccess.Read)) {
|
||||
|
||||
#if WINDOWS_PHONE
|
||||
Stream stream = Microsoft.Xna.Framework.TitleContainer.OpenStream(path);
|
||||
using (Stream input = stream)
|
||||
{
|
||||
#else
|
||||
using (Stream input = new FileStream(path, FileMode.Open, FileAccess.Read)) {
|
||||
#endif
|
||||
try {
|
||||
return Util.LoadTexture(device, input);
|
||||
} catch (Exception ex) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user