public static void DownloadAllCloudData() { bool cloudOnly = MonoMain.cloudOnly; bool cloud = Options.Data.cloud; MonoMain.cloudOnly = true; Options.Data.cloud = true; foreach (string file in DuckFile.GetFiles(DuckFile.profileDirectory, "*.*", SearchOption.AllDirectories)) { DuckFile.CreatePath(file); DuckFile.PrepareToLoadCloudFile(file); } foreach (string file in DuckFile.GetFiles(DuckFile.levelDirectory, "*.*", SearchOption.AllDirectories)) { DuckFile.CreatePath(file); DuckFile.PrepareToLoadCloudFile(file); } foreach (string file in DuckFile.GetFiles(DuckFile.optionsDirectory, "*.*", SearchOption.AllDirectories)) { DuckFile.CreatePath(file); DuckFile.PrepareToLoadCloudFile(file); } MonoMain.cloudOnly = cloudOnly; Options.Data.cloud = cloud; }
public static XDocument LoadXDocument(string path) { DuckFile.CreatePath(Path.GetDirectoryName(path)); DuckFile.PrepareToLoadCloudFile(path); if (!File.Exists(path)) { return((XDocument)null); } try { return(XDocument.Load(path)); } catch { return((XDocument)null); } }
public static T LoadChunk <T>(string path) where T : BinaryClassChunk { DuckFile.CreatePath(Path.GetDirectoryName(path)); DuckFile.PrepareToLoadCloudFile(path); return(!File.Exists(path) ? default(T) : BinaryClassChunk.FromData <T>(new BitBuffer(File.ReadAllBytes(path), 0, false))); }
public static LevelData LoadLevel(string path) { DuckFile.CreatePath(Path.GetDirectoryName(path)); DuckFile.PrepareToLoadCloudFile(path); return(!File.Exists(path) ? (LevelData)null : DuckFile.LoadLevel(File.ReadAllBytes(path))); }