-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from SerGreen/mi-a2-crashes
Fix #16 crashes on some devices after puzzle skip
- Loading branch information
Showing
13 changed files
with
270 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sergreen.thewitnesspuzzles" android:versionName="1.0.9" android:installLocation="preferExternal" android:versionCode="9"> | ||
<uses-sdk android:targetSdkVersion="28" /> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.sergreen.thewitnesspuzzles" android:versionName="1.0.10" android:installLocation="preferExternal" android:versionCode="11"> | ||
<uses-sdk android:targetSdkVersion="29" /> | ||
<application android:label="The Witness Puzzles" android:icon="@drawable/Icon"></application> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<packages> | ||
<package id="Xamarin.Legacy.OpenTK" version="1.0.0" targetFramework="monoandroid10.0" /> | ||
</packages> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Security; | ||
using System.Security.Permissions; | ||
using System.Text; | ||
|
||
namespace TWP_Shared | ||
{ | ||
public class ExternalStorage : IStorageProvider | ||
{ | ||
private readonly string BASE_DIR; | ||
|
||
public ExternalStorage() | ||
{ | ||
#if WINDOWS | ||
BASE_DIR = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "My Games", "TWP"); | ||
#else | ||
//BASE_DIR = Path.Combine(Android.OS.Environment.ExternalStorageDirectory.Path, "TWP"); | ||
BASE_DIR = Android.App.Application.Context.GetExternalFilesDir(null).AbsolutePath; | ||
#endif | ||
} | ||
|
||
public bool FileExists(string path) => File.Exists(Path.Combine(BASE_DIR, path)); | ||
public bool DirectoryExists(string path) => Directory.Exists(Path.Combine(BASE_DIR, path)); | ||
public void CreateDirectory(string path) => Directory.CreateDirectory(Path.Combine(BASE_DIR, path)); | ||
|
||
public FileStream OpenFile(string path, FileMode mode) => File.Open(Path.Combine(BASE_DIR, path), mode); | ||
public void MoveFile(string sourcePath, string destinationPath) => File.Move(Path.Combine(BASE_DIR, sourcePath), Path.Combine(BASE_DIR, destinationPath)); | ||
public void DeleteFile(string path) => File.Delete(Path.Combine(BASE_DIR, path)); | ||
|
||
public string[] GetFileNames(string searchPattern) | ||
{ | ||
string[] files = Directory.GetFiles(BASE_DIR, searchPattern); | ||
Array.Sort<string>(files, (a, b) => File.GetLastWriteTimeUtc(b).CompareTo(File.GetLastWriteTimeUtc(a))); | ||
return files.Select(x => Path.GetFileName(x)).ToArray(); | ||
} | ||
} | ||
} |
Oops, something went wrong.