Ejemplo n.º 1
0
        public async void DeleteMap(ResourceData item)
        {
            ContentDialog deleteFileDialog = new ContentDialog
            {
                Title             = "Delete this world ?",
                Content           = "MESSAGE DE CONFIRMATION ENCORE BOURRE DE BUG MERDE",
                PrimaryButtonText = "Delete",
                CloseButtonText   = "Cancel"
            };

            ContentDialogResult result = await deleteFileDialog.ShowAsync();

            if (result == ContentDialogResult.Primary)
            {
                try
                {
                    StorageFolder mapsFolder = await StorageFolder.GetFolderFromPathAsync(folderPath);

                    IReadOnlyList <StorageFolder> maps = await mapsFolder.GetFoldersAsync();

                    StorageFolder MapToDelete = await StorageFolder.GetFolderFromPathAsync(folderPath + @"\" + item.DisplayName);

                    await MapToDelete.DeleteAsync();

                    MapsCollection.Remove(item);
                }
                catch (Exception ex)
                {
                    ShowBox("Can't delete this world \n Error: ", ex.Message);
                }
            }
        }
Ejemplo n.º 2
0
        public async void GetMaps()
        {
            try
            {
                StorageFolder mapsFolder = await StorageFolder.GetFolderFromPathAsync(folderPath);

                IReadOnlyList <StorageFolder> maps = await mapsFolder.GetFoldersAsync();

                foreach (var mapItem in maps)
                {
                    StorageFile MapName = await StorageFile.GetFileFromPathAsync(Path.Combine(folderPath + @"\" + mapItem.DisplayName + @"\levelname.txt"));

                    string name = await FileIO.ReadTextAsync(MapName);

                    MapsCollection.Add(new ResourceData()
                    {
                        Name = name, DisplayName = mapItem.DisplayName, Date = MapName.DateCreated.DateTime.ToString()
                    });
                }
            }
            catch (Exception ex)
            {
                ShowBox("Error", ex.Message + "\n\nPath: " + Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + @"\AppData\Local\Packages\Microsoft.MinecraftUWP_8wekyb3d8bbwe\LocalState\games\com.mojang\minecraftWorlds").ToString());
            }
        }