mirror of
https://github.com/tribufu/ServerManagers
synced 2026-05-06 15:17:34 +00:00
GameData Changes
- when changing the gamedata files (add, delete, reload) it will reload all the gamedata files and repopulate the server managers. - updated the viewmodels to check for valid class names.
This commit is contained in:
parent
1bf04ed33e
commit
479e4a64dc
33 changed files with 427 additions and 305 deletions
|
|
@ -1,7 +1,7 @@
|
|||
using Microsoft.WindowsAPICodePack.Dialogs;
|
||||
using ServerManagerTool.Common.Model;
|
||||
using ServerManagerTool.Common.Utils;
|
||||
using ServerManagerTool.Lib;
|
||||
using ServerManagerTool.Lib.ViewModel;
|
||||
using ServerManagerTool.Utils;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
|
@ -19,60 +19,6 @@ namespace ServerManagerTool
|
|||
/// </summary>
|
||||
public partial class GameDataWindow : Window
|
||||
{
|
||||
public class GameDataFileList : SortableObservableCollection<GameDataFile>
|
||||
{
|
||||
public override string ToString()
|
||||
{
|
||||
return $"{nameof(GameDataFile)} - {Count}";
|
||||
}
|
||||
}
|
||||
|
||||
public class GameDataFile : DependencyObject
|
||||
{
|
||||
public static readonly DependencyProperty CreatedDateProperty = DependencyProperty.Register(nameof(CreatedDate), typeof(DateTime), typeof(GameDataFile), new PropertyMetadata(DateTime.MinValue));
|
||||
public static readonly DependencyProperty FileProperty = DependencyProperty.Register(nameof(File), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty));
|
||||
public static readonly DependencyProperty FileNameProperty = DependencyProperty.Register(nameof(FileName), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty));
|
||||
public static readonly DependencyProperty IsUserDataProperty = DependencyProperty.Register(nameof(IsUserData), typeof(bool), typeof(GameDataFile), new PropertyMetadata(true));
|
||||
public static readonly DependencyProperty VersionProperty = DependencyProperty.Register(nameof(Version), typeof(string), typeof(GameDataFile), new PropertyMetadata(string.Empty));
|
||||
public static readonly DependencyProperty HasErrorProperty = DependencyProperty.Register(nameof(HasError), typeof(bool), typeof(GameDataFile), new PropertyMetadata(false));
|
||||
|
||||
public DateTime CreatedDate
|
||||
{
|
||||
get { return (DateTime)GetValue(CreatedDateProperty); }
|
||||
set { SetValue(CreatedDateProperty, value); }
|
||||
}
|
||||
|
||||
public string File
|
||||
{
|
||||
get { return (string)GetValue(FileProperty); }
|
||||
set { SetValue(FileProperty, value); }
|
||||
}
|
||||
|
||||
public string FileName
|
||||
{
|
||||
get { return (string)GetValue(FileNameProperty); }
|
||||
set { SetValue(FileNameProperty, value); }
|
||||
}
|
||||
|
||||
public bool IsUserData
|
||||
{
|
||||
get { return (bool)GetValue(IsUserDataProperty); }
|
||||
set { SetValue(IsUserDataProperty, value); }
|
||||
}
|
||||
|
||||
public string Version
|
||||
{
|
||||
get { return (string)GetValue(VersionProperty); }
|
||||
set { SetValue(VersionProperty, value); }
|
||||
}
|
||||
|
||||
public bool HasError
|
||||
{
|
||||
get { return (bool)GetValue(HasErrorProperty); }
|
||||
set { SetValue(HasErrorProperty, value); }
|
||||
}
|
||||
}
|
||||
|
||||
private readonly GlobalizedApplication _globalizer = GlobalizedApplication.Instance;
|
||||
|
||||
public static readonly DependencyProperty GameDataFilesProperty = DependencyProperty.Register(nameof(GameDataFiles), typeof(GameDataFileList), typeof(GameDataWindow), new PropertyMetadata(null));
|
||||
|
|
@ -117,6 +63,7 @@ namespace ServerManagerTool
|
|||
try
|
||||
{
|
||||
AddGameDataFile(GameData.UserDataFolder, dialog.FileName);
|
||||
GameData.Reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -135,6 +82,7 @@ namespace ServerManagerTool
|
|||
{
|
||||
DeleteAllGameDataFiles(GameData.UserDataFolder);
|
||||
}
|
||||
GameData.Reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -166,6 +114,7 @@ namespace ServerManagerTool
|
|||
try
|
||||
{
|
||||
ReloadGameDataFiles();
|
||||
GameData.Reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
@ -182,6 +131,7 @@ namespace ServerManagerTool
|
|||
{
|
||||
var gameDataItem = ((GameDataFile)((Button)e.Source).DataContext);
|
||||
DeleteGameDataFile(gameDataItem.File, true);
|
||||
GameData.Reload();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue