- Started Windows, Metro and Linux Platform-Plugins - Moved the RecordingSample to the Samples folder - Started two samples for using the graphics device in a WinForms and Wpf Editor - Refactorings in the AddIn-System - Moved the Window initialization-code to the Platform modules - Changed the License text in all code files which is now way smaller - Started ProjectConverter tool which converts all the projects and solution to the target configuration - Changed the SupportedPlatform names in the Resource files - Changed the WIN8 define to WINDOWSMETRO which is actually meant - Removed NLog and started our own Logger class - Many more stuff...
101 lines
2.0 KiB
C#
101 lines
2.0 KiB
C#
using System;
|
|
using System.IO;
|
|
using ANX.Framework;
|
|
using ANX.Framework.NonXNA.PlatformSystem;
|
|
using ANX.Framework.Storage;
|
|
|
|
// This file is part of the ANX.Framework created by the
|
|
// "ANX.Framework developer group" and released under the Ms-PL license.
|
|
// For details see: http://anxframework.codeplex.com/license
|
|
|
|
namespace ANX.PlatformSystem.Windows
|
|
{
|
|
public class WindowsStorageDevice : INativeStorageDevice
|
|
{
|
|
private string storagePath;
|
|
private StorageDevice parent;
|
|
private DriveInfo storageDrive;
|
|
|
|
#region Public
|
|
public long FreeSpace
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return storageDrive.AvailableFreeSpace;
|
|
}
|
|
catch (IOException)
|
|
{
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
|
|
public long TotalSpace
|
|
{
|
|
get
|
|
{
|
|
try
|
|
{
|
|
return storageDrive.TotalSize;
|
|
}
|
|
catch (IOException)
|
|
{
|
|
return -1;
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool IsConnected
|
|
{
|
|
get
|
|
{
|
|
return storageDrive.IsReady;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Constructor
|
|
public WindowsStorageDevice(StorageDevice setParent, PlayerIndex player,
|
|
int sizeInBytes, int directoryCount)
|
|
{
|
|
parent = setParent;
|
|
|
|
string playerPath;
|
|
switch (player)
|
|
{
|
|
case PlayerIndex.One:
|
|
playerPath = "Player1";
|
|
break;
|
|
case PlayerIndex.Two:
|
|
playerPath = "Player2";
|
|
break;
|
|
case PlayerIndex.Three:
|
|
playerPath = "Player3";
|
|
break;
|
|
case PlayerIndex.Four:
|
|
playerPath = "Player4";
|
|
break;
|
|
default:
|
|
playerPath = "AllPlayers";
|
|
break;
|
|
}
|
|
|
|
string myDocsPath = Environment.GetFolderPath(
|
|
Environment.SpecialFolder.MyDocuments);
|
|
storagePath = Path.Combine(myDocsPath, "SavedGames", playerPath);
|
|
storagePath = Path.GetFullPath(storagePath);
|
|
storageDrive = new DriveInfo(Path.GetPathRoot(myDocsPath).Substring(0, 1));
|
|
}
|
|
#endregion
|
|
|
|
#region DeleteContainer
|
|
public void DeleteContainer(string titleName)
|
|
{
|
|
Directory.Delete(Path.Combine(parent.StoragePath, titleName), true);
|
|
}
|
|
#endregion
|
|
}
|
|
}
|