private async Task Save(bool advanced)
        {
            if (this.Actor == null)
            {
                return;
            }

            CharacterFile.SaveModes mode = CharacterFile.SaveModes.All;

            if (advanced)
            {
                CharacterFile.SaveModes newMode = await ViewService.ShowDialog <AppearanceModeSelectorDialog, CharacterFile.SaveModes>("Save Character...", lastSaveMode);

                if (newMode == CharacterFile.SaveModes.None)
                {
                    return;
                }

                mode = newMode;
            }

            CharacterFile file = new CharacterFile();

            file.WriteToFile(this.Actor, mode);

            await FileService.Save(file);
        }
        private async Task <CharacterFile?> Save(bool useAdvancedSave)
        {
            if (this.Actor == null)
            {
                return(null);
            }

            CharacterFile.SaveModes mode = CharacterFile.SaveModes.All;

            if (useAdvancedSave)
            {
                mode = await ViewService.ShowDialog <AppearanceModeSelectorDialog, CharacterFile.SaveModes>("Save Character...");
            }

            CharacterFile file = new CharacterFile();

            if (mode == CharacterFile.SaveModes.None)
            {
                return(null);
            }

            file.WriteToFile(this.Actor, mode);

            return(file);
        }
Exemple #3
0
        private async Task Load()
        {
            if (this.Actor == null)
            {
                return;
            }

            CharacterFileOptions.Result = lastLoadMode;
            OpenResult result = await FileService.Open <LegacyCharacterFile, DatCharacterFile, CharacterFile>();

            if (result.File == null)
            {
                return;
            }

            lastLoadMode = CharacterFileOptions.Result;

            if (result.File is LegacyCharacterFile legacyFile)
            {
                result.File = legacyFile.Upgrade();
            }

            if (result.File is DatCharacterFile datFile)
            {
                result.File = datFile.Upgrade();
            }

            if (result.File is CharacterFile apFile)
            {
                await apFile.Apply(this.Actor, lastLoadMode);
            }
        }
Exemple #4
0
        private async Task Save()
        {
            if (this.Actor == null)
            {
                return;
            }

            lastSaveMode = await CharacterFile.Save(this.Actor, lastSaveMode);
        }
        private async Task Load(bool advanced)
        {
            if (this.Actor == null)
            {
                return;
            }

            OpenResult result = await FileService.Open <LegacyEquipmentSetFile, LegacyCharacterFile, DatCharacterFile, CharacterFile>();

            if (result.File == null)
            {
                return;
            }

            if (result.File is LegacyCharacterFile legacyAllFile)
            {
                result.File = legacyAllFile.Upgrade();
            }

            if (result.File is LegacyEquipmentSetFile legacyEquipmentFile)
            {
                result.File = legacyEquipmentFile.Upgrade();
            }

            if (result.File is DatCharacterFile datFile)
            {
                result.File = datFile.Upgrade();
            }

            if (result.File is CharacterFile apFile)
            {
                CharacterFile.SaveModes mode = CharacterFile.SaveModes.All;

                if (advanced)
                {
                    CharacterFile.SaveModes newmode = await ViewService.ShowDialog <AppearanceModeSelectorDialog, CharacterFile.SaveModes>("Load Character...", lastLoadMode);

                    if (newmode == CharacterFile.SaveModes.None)
                    {
                        return;
                    }

                    lastLoadMode = newmode;
                    mode         = lastLoadMode;
                }

                await apFile.Apply(this.Actor, mode);
            }
        }