Пример #1
0
        public LoadPage()
        {
            this.InitializeComponent();

            var items     = new ObservableCollection <JSONCharakter>();
            var cFileList = FileManagment.GetFilesDictionary(Game.CharakterSaveFolder, out DSAError error);

            foreach (var item in cFileList)
            {
                var file           = Path.Combine(Game.CharakterSaveFolder, item);
                var fileContent    = FileManagment.LoadTextFile(file, out error);
                var json_charakter = JSONCharakter.DeSerializeJson(fileContent, out string errorstring);
                if (string.IsNullOrEmpty(json_charakter.Name))
                {
                    json_charakter.Name = CHARNAME;
                    charGivenName.Add(json_charakter, true);
                }
                else
                {
                    charGivenName.Add(json_charakter, false);
                }

                items.Add(json_charakter);
            }
            items.OrderBy(x => x.Name).ThenBy(x => x.SaveTime);
            Items = items;
        }