Skip to content

Unity plugin for disk/storage capacity check helper methods

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

FemLolStudio/simple-disk-utils

 
 

Repository files navigation

simple-disk-utils

Disk/storage capacity check helper methods for Windows, Linux, OSX, iOS, and Android platform.

Simply checks available, busy, and total storage space of your platform. File managing functions like save and delete to text or binary file with special cases handling are also provided.

The implementation for each platforms are also can be found in this repository.

If you have any idea on improvement or anything, please feel free to contribute!

Implemented Methods

///////////////////////////////////////////////////////////////////////
/// For all platforms. These methods return space size in Mega Bytes.

int CheckAvailableSpace(); 
int CheckBusySpace();
int CheckTotalSpace();

///////////////////////////////////////////////////////////////////////
/// Additional space check methods for Android
/// The default storage for Android, the one that is usually used when saving file, etc., is External.

int CheckAvailableSpace(bool isExternalStorage = true); 
int CheckBusySpace(bool isExternalStorage = true);
int CheckTotalSpace(bool isExternalStorage = true);

///////////////////////////////////////////////////////////////////////
/// Additional methods for Windows

int CheckAvailableSpace(string drive = "C:/"); 
int CheckBusySpace(string drive = "C:/");
int CheckTotalSpace(string drive = "C:/");
string[] GetDriveNames();

///////////////////////////////////////////////////////////////////////
/// File helper. Handled directory availability check, iOS special case on deleting files, etc.

void DeleteFile (string filePath);
void SaveFile (object obj, string filePath);
void SaveFile (object obj, string dirPath, string fileName);
void SaveTextFile (string str, string filePath);
void SaveTextFile (string str, string dirPath, string fileName);
string LoadTextFile<T> (string filePath);
byte[] ObjectToByteArray (object obj);
T ByteArrayToObject<T> (byte[] bytes);

If the definitions are not clear enough, please see the included sample scene in the project.

Notes

  1. Tested on Windows, Linux, OSX, iOS, and Android platform.
  2. Implemented file handling methods are not including methods that are already covered in standard library (most likely on System.IO).

License

MIT License

About

Unity plugin for disk/storage capacity check helper methods

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Languages

  • C# 41.3%
  • Java 21.0%
  • Objective-C++ 20.9%
  • C++ 14.4%
  • C 1.5%
  • Shell 0.9%