|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
1
2
|
using TaleWorlds.Library;
|
|
2
3
|
|
|
3
4
|
namespace TaleWorlds.SaveSystem
|
|
@@ -6,7 +7,7 @@ namespace TaleWorlds.SaveSystem
|
|
|
6
7
|
{
|
|
7
8
|
public extern AsyncFileSaveDriver();
|
|
8
9
|
|
|
9
|
-
extern
|
|
10
|
+
extern Task<SaveResultWithMessage> ISaveDriver.Save(string saveName, int version, MetaData metaData, GameData gameData);
|
|
10
11
|
|
|
11
12
|
extern SaveGameFileInfo[] ISaveDriver.GetSaveGameFileInfos();
|
|
12
13
|
|
|
@@ -19,5 +20,7 @@ namespace TaleWorlds.SaveSystem
|
|
|
19
20
|
extern bool ISaveDriver.Delete(string saveName);
|
|
20
21
|
|
|
21
22
|
extern bool ISaveDriver.IsSaveGameFileExists(string saveName);
|
|
23
|
+
|
|
24
|
+
extern bool ISaveDriver.IsWorkingAsync();
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
using TaleWorlds.SaveSystem.Load;
|
|
2
|
-
|
|
3
|
-
namespace TaleWorlds.SaveSystem
|
|
4
|
-
{
|
|
5
|
-
public class DefaultObjectResolver : IObjectResolver
|
|
6
|
-
{
|
|
7
|
-
extern bool IObjectResolver.CheckIfRequiresAdvancedResolving(object originalObject);
|
|
8
|
-
|
|
9
|
-
extern object IObjectResolver.ResolveObject(object originalObject);
|
|
10
|
-
|
|
11
|
-
extern object IObjectResolver.AdvancedResolveObject(object originalObject, MetaData metaData, ObjectLoadData objectLoadData);
|
|
12
|
-
|
|
13
|
-
public extern DefaultObjectResolver();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
1
2
|
using TaleWorlds.Library;
|
|
2
3
|
|
|
3
4
|
namespace TaleWorlds.SaveSystem
|
|
4
5
|
{
|
|
5
6
|
public class FileDriver : ISaveDriver
|
|
6
7
|
{
|
|
7
|
-
public extern
|
|
8
|
+
public extern Task<SaveResultWithMessage> Save(string saveName, int version, MetaData metaData, GameData gameData);
|
|
8
9
|
|
|
9
10
|
public extern MetaData LoadMetaData(string saveName);
|
|
10
11
|
|
|
@@ -18,6 +19,8 @@ namespace TaleWorlds.SaveSystem
|
|
|
18
19
|
|
|
19
20
|
public extern bool IsSaveGameFileExists(string saveName);
|
|
20
21
|
|
|
22
|
+
public extern bool IsWorkingAsync();
|
|
23
|
+
|
|
21
24
|
public extern FileDriver();
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
1
2
|
using TaleWorlds.Library;
|
|
2
3
|
|
|
3
4
|
namespace TaleWorlds.SaveSystem
|
|
4
5
|
{
|
|
5
6
|
public interface ISaveDriver
|
|
6
7
|
{
|
|
7
|
-
|
|
8
|
+
Task<SaveResultWithMessage> Save(string saveName, int version, MetaData metaData, GameData gameData);
|
|
8
9
|
|
|
9
10
|
SaveGameFileInfo[] GetSaveGameFileInfos();
|
|
10
11
|
|
|
@@ -17,5 +18,7 @@ namespace TaleWorlds.SaveSystem
|
|
|
17
18
|
bool Delete(string saveName);
|
|
18
19
|
|
|
19
20
|
bool IsSaveGameFileExists(string saveName);
|
|
21
|
+
|
|
22
|
+
bool IsWorkingAsync();
|
|
20
23
|
}
|
|
21
24
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
using System.Threading.Tasks;
|
|
1
2
|
using TaleWorlds.Library;
|
|
2
3
|
|
|
3
4
|
namespace TaleWorlds.SaveSystem
|
|
4
5
|
{
|
|
5
6
|
public class InMemDriver : ISaveDriver
|
|
6
7
|
{
|
|
7
|
-
public extern
|
|
8
|
+
public extern Task<SaveResultWithMessage> Save(string saveName, int version, MetaData metaData, GameData gameData);
|
|
8
9
|
|
|
9
10
|
public extern MetaData LoadMetaData(string saveName);
|
|
10
11
|
|
|
@@ -18,6 +19,8 @@ namespace TaleWorlds.SaveSystem
|
|
|
18
19
|
|
|
19
20
|
public extern bool IsSaveGameFileExists(string saveName);
|
|
20
21
|
|
|
22
|
+
public extern bool IsWorkingAsync();
|
|
23
|
+
|
|
21
24
|
public extern InMemDriver();
|
|
22
25
|
}
|
|
23
26
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
using System;
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using TaleWorlds.SaveSystem.Definition;
|
|
4
|
+
using TaleWorlds.SaveSystem.Resolvers;
|
|
4
5
|
|
|
5
6
|
namespace TaleWorlds.SaveSystem
|
|
6
7
|
{
|
|
@@ -32,21 +33,19 @@ namespace TaleWorlds.SaveSystem
|
|
|
32
33
|
|
|
33
34
|
protected extern void AddBasicTypeDefinition(Type type, int saveId, IBasicTypeSerializer serializer);
|
|
34
35
|
|
|
35
|
-
protected extern void AddClassDefinition(Type type, int saveId);
|
|
36
|
+
protected extern void AddClassDefinition(Type type, int saveId, IObjectResolver resolver = null);
|
|
36
37
|
|
|
37
|
-
protected extern void
|
|
38
|
+
protected extern void AddClassDefinitionWithCustomFields(Type type, int saveId, IEnumerable<Tuple<string, short>> fields, IObjectResolver resolver = null);
|
|
38
39
|
|
|
39
|
-
protected extern void
|
|
40
|
+
protected extern void AddStructDefinitionWithCustomFields(Type type, int saveId, IEnumerable<Tuple<string, short>> fields, IObjectResolver resolver = null);
|
|
40
41
|
|
|
41
|
-
protected extern void
|
|
42
|
+
protected extern void AddRootClassDefinition(Type type, int saveId, IObjectResolver resolver = null);
|
|
42
43
|
|
|
43
|
-
protected extern void
|
|
44
|
-
|
|
45
|
-
protected extern void AddStructDefinition(Type type, int saveId);
|
|
44
|
+
protected extern void AddStructDefinition(Type type, int saveId, IObjectResolver resolver = null);
|
|
46
45
|
|
|
47
46
|
protected extern void AddInterfaceDefinition(Type type, int saveId);
|
|
48
47
|
|
|
49
|
-
protected extern void AddEnumDefinition(Type type, int saveId);
|
|
48
|
+
protected extern void AddEnumDefinition(Type type, int saveId, IEnumResolver enumResolver = null);
|
|
50
49
|
|
|
51
50
|
protected extern void ConstructContainerDefinition(Type type);
|
|
52
51
|
}
|
|
@@ -2,6 +2,8 @@ using System;
|
|
|
2
2
|
using System.Collections.Generic;
|
|
3
3
|
using System.Reflection;
|
|
4
4
|
using System.Runtime.CompilerServices;
|
|
5
|
+
using TaleWorlds.SaveSystem.Load;
|
|
6
|
+
using TaleWorlds.SaveSystem.Resolvers;
|
|
5
7
|
|
|
6
8
|
namespace TaleWorlds.SaveSystem.Definition
|
|
7
9
|
{
|
|
@@ -16,9 +18,6 @@ namespace TaleWorlds.SaveSystem.Definition
|
|
|
16
18
|
|
|
17
19
|
public bool IsClassDefinition { get; }
|
|
18
20
|
|
|
19
|
-
public IObjectResolver ObjectResolver { [CompilerGenerated]
|
|
20
|
-
get; }
|
|
21
|
-
|
|
22
21
|
public List<CustomField> CustomFields { [CompilerGenerated]
|
|
23
22
|
get; }
|
|
24
23
|
|
|
@@ -33,6 +32,12 @@ namespace TaleWorlds.SaveSystem.Definition
|
|
|
33
32
|
|
|
34
33
|
public extern TypeDefinition(Type type, int saveId, IObjectResolver objectResolver);
|
|
35
34
|
|
|
35
|
+
public extern bool CheckIfRequiresAdvancedResolving(object originalObject);
|
|
36
|
+
|
|
37
|
+
public extern object ResolveObject(object originalObject);
|
|
38
|
+
|
|
39
|
+
public extern object AdvancedResolveObject(object originalObject, MetaData metaData, ObjectLoadData objectLoadData);
|
|
40
|
+
|
|
36
41
|
public extern void CollectInitializationCallbacks();
|
|
37
42
|
|
|
38
43
|
public extern void CollectProperties();
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
namespace TaleWorlds.SaveSystem.Resolvers
|
|
2
|
+
{
|
|
3
|
+
public interface IEnumResolver
|
|
4
|
+
{
|
|
5
|
+
string ResolveObject(string originalObject);
|
|
6
|
+
}
|
|
7
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
using TaleWorlds.SaveSystem.Load;
|
|
2
2
|
|
|
3
|
-
namespace TaleWorlds.SaveSystem
|
|
3
|
+
namespace TaleWorlds.SaveSystem.Resolvers
|
|
4
4
|
{
|
|
5
5
|
public interface IObjectResolver
|
|
6
6
|
{
|
|
@@ -16,6 +16,8 @@ namespace TaleWorlds.SaveSystem.Save
|
|
|
16
16
|
|
|
17
17
|
public bool Successful { get; }
|
|
18
18
|
|
|
19
|
+
public bool IsContinuing { get; }
|
|
20
|
+
|
|
19
21
|
public extern void PrintStatus();
|
|
20
22
|
}
|
|
21
23
|
}
|