-
Notifications
You must be signed in to change notification settings - Fork 2
/
FreightSaveManager.cs
62 lines (48 loc) · 1.72 KB
/
FreightSaveManager.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System.IO;
using UnityEngine;
using System.Linq;
public class FreightSaveManager
{
public static IFCFileHandler ListFile;
public const string SUBDIR = "steveman0.FreightCarts";
public static string SavePath;
public static FreightSaveManager instance;
public FreightSaveManager()
{
if (WorldScript.mbIsServer)
{
SavePath = DiskWorld.GetWorldsDir() + Path.DirectorySeparatorChar + WorldScript.instance.mWorldData.mPath + Path.DirectorySeparatorChar + SUBDIR + Path.DirectorySeparatorChar;
if (Directory.Exists(SavePath) == false)
Directory.CreateDirectory(SavePath);
}
instance = this;
this.ListFileHandler();
}
public void ListFileHandler()
{
if (WorldScript.mbIsServer)
{
string baseFileName = SavePath + "FreightData.dat";
ListFile = WorldScript.instance.mDiskThread.RegisterManagedFile(new ManagedFileSaveMethod(this.WriteListData), new ManagedFileLoadMethod(this.ReadListData), new ManagedFileConversionMethod(this.ListDataConversion), baseFileName);
ListFile.MarkReady();
ListFile.MarkDirty();
}
else if (!WorldScript.mbIsServer)
Debug.LogWarning("SaveBlueprint should only be called by the server!");
}
public bool WriteListData(BinaryWriter writer)
{
return true;
}
public FCFileLoadAttemptResult ReadListData(BinaryReader reader, bool isbackup)
{
return FCFileLoadAttemptResult.Successful;
}
public void ListDataConversion()
{
}
public void MarkListDataDirty()
{
ListFile.MarkDirty();
}
}