Added Renaming
This commit is contained in:
parent
62595f612e
commit
eb4e4201c7
4 changed files with 27 additions and 4 deletions
|
@ -44,6 +44,15 @@ public class Game
|
|||
}
|
||||
}
|
||||
|
||||
public void ChangeName(string newName)
|
||||
{
|
||||
this.Name = newName;
|
||||
string targetDirectory = settings.library_path.GetValue<string>();
|
||||
string newFileName = $"{this.GameID}.{this.Name}.iso";
|
||||
string destPath = Path.Combine(Path.Combine(targetDirectory, "DVD"), newFileName);
|
||||
File.Move(this.GamePath, destPath);
|
||||
}
|
||||
|
||||
public string GetGameTitle()
|
||||
{
|
||||
string url = $"http://localhost:3000/search/{this.GameID}";
|
||||
|
|
|
@ -21,8 +21,10 @@
|
|||
</StackPanel>
|
||||
</ScrollViewer>
|
||||
<Grid Grid.Row="1" ColumnDefinitions="*,*">
|
||||
<Button Content="Undo" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Button Content="Save" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"/>
|
||||
<Button Content="Undo" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Click="Edit_OnClick"/>
|
||||
<Button Content="Save" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center"
|
||||
Click="Save_OnClick"/>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
|
|
|
@ -39,8 +39,7 @@ public partial class EditGame : UserControl
|
|||
|
||||
private void DisplayNameBox_OnTextChanged(object? sender, TextChangedEventArgs e)
|
||||
{
|
||||
this.game.Name = DisplayNameBox.Text;
|
||||
MainWindow.RefreshGamesListTrigger.Invoke(null, EventArgs.Empty);
|
||||
|
||||
}
|
||||
|
||||
private void ChecksumButtonOnClick(object? sender, RoutedEventArgs e)
|
||||
|
@ -74,4 +73,15 @@ public partial class EditGame : UserControl
|
|||
|
||||
Console.WriteLine("Hashing started...");
|
||||
}
|
||||
|
||||
private void Save_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
this.game.ChangeName(DisplayNameBox.Text);
|
||||
MainWindow.RefreshGamesListTrigger?.Invoke(null, EventArgs.Empty);
|
||||
}
|
||||
|
||||
private void Edit_OnClick(object? sender, RoutedEventArgs e)
|
||||
{
|
||||
DisplayNameBox.Text = game.Name;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
using Avalonia.Interactivity;
|
||||
|
@ -81,6 +82,7 @@ public partial class MainWindow : Window
|
|||
new Game(file, true);
|
||||
Games.Add(newGame);
|
||||
}
|
||||
Games = Games.OrderBy(game => game.Name).ToList();
|
||||
GamesList.ItemsSource = Games;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue