Last active
December 23, 2019 23:03
-
-
Save g33kChris/e386d018443d604288c114154e99e416 to your computer and use it in GitHub Desktop.
GameDex Snippets
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
public async static Task NewLibraryInApp() | |
{ | |
StorageFolder rootFolder = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFolderAsync("GameDex", CreationCollisionOption.ReplaceExisting); | |
await rootFolder.CreateFolderAsync("Media"); | |
if (await StorageHelper.WriteFileAsync("gdex.json", App.GameDexModel, rootFolder)) | |
{ | |
StorageHelper.SetSetting("GameDexLocation", "Local", StorageHelper.StorageStrategies.Roaming); | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} |
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
public async static Task NewLibraryInDocuments() | |
{ | |
FolderPicker installDirectoryPicker = new FolderPicker(); | |
installDirectoryPicker.ViewMode = PickerViewMode.Thumbnail; | |
installDirectoryPicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary; | |
installDirectoryPicker.FileTypeFilter.Add("*"); | |
installDirectoryPicker.CommitButtonText = "Install Here"; | |
var folderSelection = await installDirectoryPicker.PickSingleFolderAsync(); | |
StorageFolder rootFolder = await folderSelection.CreateFolderAsync("GameDex", CreationCollisionOption.ReplaceExisting); | |
string path = rootFolder.Path; | |
await rootFolder.CreateFolderAsync("Media"); | |
if (await StorageHelper.WriteFileAsync("gdex.json", App.GameDexModel, rootFolder)) | |
{ | |
StorageHelper.SetSetting("GameDexLocation", "Documents", StorageHelper.StorageStrategies.Roaming); | |
StorageHelper.SetSetting("Path", path, StorageHelper.StorageStrategies.Roaming); | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} |
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
public async static Task NewLibraryInSkyDrive() | |
{ | |
if (await SkyDriveController.InitAuth()) | |
{ | |
await AzureMobileController.Authenticate(); | |
if (await AzureMobileController.AddNewAppModel()) | |
{ | |
//Setup Local Environment to Sync Against | |
StorageFolder rootFolder = await Windows.Storage.ApplicationData.Current.LocalFolder.CreateFolderAsync("GameDex", CreationCollisionOption.ReplaceExisting); | |
string path = rootFolder.Path; | |
await rootFolder.CreateFolderAsync("Media"); | |
if (await SkyDriveController.setupNewSkyDriveEnvironment()) | |
{ | |
StorageHelper.SetSetting("GameDexLocation", "SkyDrive", StorageHelper.StorageStrategies.Roaming); | |
return true; | |
} | |
else | |
{ | |
return false; | |
} | |
} | |
else | |
{ | |
return false; | |
} | |
} | |
else | |
{ | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment