示例#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;
        }
示例#2
0
        public string Import([FromBody] DataRequest <string> request)
        {
            JSONCharakter x         = JSONCharakter.DeSerializeJson(request.Data, out string errorstring);
            var           charakter = new SQLCharakterRepository(Context).CreateDSACharakter(Context, "New Charakter");

            var abstractcharakter = GetDSASQLCharakter(charakter.Id);

            abstractcharakter.Import(x);

            return(CreateResponse(charakter));
        }