Fixing axios log flag detection
Adding dispose methods to AxiosFile objects Adding extended log to AxiosLog Fixing issue in CommandConsole where the first line would not be displayed Adding commands to commandconsole
This commit is contained in:
@@ -9,6 +9,8 @@ namespace Axios.Engine.File
|
||||
{
|
||||
protected string _content;
|
||||
|
||||
protected bool disposed = false;
|
||||
|
||||
public String Content
|
||||
{
|
||||
get { return _content; }
|
||||
|
@@ -1,12 +1,13 @@
|
||||
using System.IO;
|
||||
using System.IO.IsolatedStorage;
|
||||
using Axios.Engine.Interfaces;
|
||||
using System;
|
||||
|
||||
namespace Axios.Engine.File
|
||||
{
|
||||
public class AxiosIsolatedFile : AxiosFile, IAxiosFile
|
||||
{
|
||||
|
||||
protected IsolatedStorageFileStream _fs;
|
||||
public AxiosIsolatedFile(string filename)
|
||||
{
|
||||
this._filename = filename;
|
||||
@@ -58,9 +59,29 @@ namespace Axios.Engine.File
|
||||
#else
|
||||
IsolatedStorageFile savegameStorage = IsolatedStorageFile.GetUserStoreForApplication();
|
||||
#endif
|
||||
IsolatedStorageFileStream fs = null;
|
||||
fs = savegameStorage.OpenFile(_filename, mode);
|
||||
return (Stream)fs;
|
||||
_fs = null;
|
||||
_fs = savegameStorage.OpenFile(_filename, mode);
|
||||
return (Stream)_fs;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// http://msdn.microsoft.com/en-us/library/system.idisposable%28v=vs.110%29.aspx
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
if (disposing && _fs != null)
|
||||
{
|
||||
_fs.Close();
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,11 +1,13 @@
|
||||
using System.IO;
|
||||
using System;
|
||||
|
||||
using Axios.Engine.Interfaces;
|
||||
|
||||
namespace Axios.Engine.File
|
||||
{
|
||||
public class AxiosRegularFile : AxiosFile, IAxiosFile
|
||||
public class AxiosRegularFile : AxiosFile, IAxiosFile, IDisposable
|
||||
{
|
||||
protected FileStream _fs;
|
||||
public AxiosRegularFile(string file)
|
||||
{
|
||||
_filename = file;
|
||||
@@ -39,8 +41,29 @@ namespace Axios.Engine.File
|
||||
|
||||
public override Stream GetStream(FileMode mode)
|
||||
{
|
||||
FileStream fs = new FileStream(_filename, mode);
|
||||
return (Stream)fs;
|
||||
_fs = new FileStream(_filename, mode);
|
||||
return (Stream)_fs;
|
||||
}
|
||||
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// http://msdn.microsoft.com/en-us/library/system.idisposable%28v=vs.110%29.aspx
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
if (disposing && _fs != null)
|
||||
{
|
||||
_fs.Close();
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -5,8 +5,9 @@ using Microsoft.Xna.Framework;
|
||||
|
||||
namespace Axios.Engine.File
|
||||
{
|
||||
public class AxiosTitleFile : AxiosFile, IAxiosFile
|
||||
public class AxiosTitleFile : AxiosFile, IAxiosFile, IDisposable
|
||||
{
|
||||
protected Stream _fs;
|
||||
public AxiosTitleFile(string filename)
|
||||
{
|
||||
//Title Files can only be opened for reading!
|
||||
@@ -30,7 +31,28 @@ namespace Axios.Engine.File
|
||||
|
||||
public override Stream GetStream(FileMode mode)
|
||||
{
|
||||
return (Stream)TitleContainer.OpenStream(_filename);;
|
||||
_fs = (Stream)TitleContainer.OpenStream(_filename);
|
||||
return _fs;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// http://msdn.microsoft.com/en-us/library/system.idisposable%28v=vs.110%29.aspx
|
||||
Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed)
|
||||
return;
|
||||
|
||||
if (disposing && _fs != null)
|
||||
{
|
||||
_fs.Close();
|
||||
}
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user