Git Product home page Git Product logo

simple-disk-utils's Introduction

simple-disk-utils

Disk/storage capacity check helper methods for Windows, 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!

Available on Unity Asset Store: http://u3d.as/qF1

Copyright (c) 2016 M Dikra Prasetya

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, 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.

simple-disk-utils's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.