Skip to content

Commit 5321659

Browse files
committed
up
1 parent 74a55dc commit 5321659

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

PersistentInofs.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ public class PersistentInofs
1515
string _persistentDataPath = "";
1616
string _digest = "";
1717

18+
string _lastloaded = "";
19+
1820
public PersistentInofs(string path)
1921
{
2022
_persistentDataPath = path;
@@ -38,6 +40,9 @@ string _getSuffix()
3840

3941
public bool loadAll()
4042
{
43+
if(_lastloaded == _getSuffix())
44+
return true;
45+
4146
byte[] loginapp_onImportClientMessages = loadFile (_persistentDataPath, "loginapp_clientMessages." + _getSuffix());
4247

4348
byte[] baseapp_onImportClientMessages = loadFile (_persistentDataPath, "baseapp_clientMessages." + _getSuffix());
@@ -64,11 +69,15 @@ public bool loadAll()
6469
}
6570
}
6671

72+
_lastloaded = _getSuffix();
6773
return true;
6874
}
6975

7076
public void onImportClientMessages(string currserver, byte[] stream)
7177
{
78+
if(_lastloaded == _getSuffix())
79+
return;
80+
7281
if(currserver == "loginapp")
7382
createFile (_persistentDataPath, "loginapp_clientMessages." + _getSuffix(), stream);
7483
else
@@ -77,11 +86,17 @@ public void onImportClientMessages(string currserver, byte[] stream)
7786

7887
public void onImportServerErrorsDescr(byte[] stream)
7988
{
89+
if(_lastloaded == _getSuffix())
90+
return;
91+
8092
createFile (_persistentDataPath, "serverErrorsDescr." + _getSuffix(), stream);
8193
}
8294

8395
public void onImportClientEntityDef(byte[] stream)
8496
{
97+
if(_lastloaded == _getSuffix())
98+
return;
99+
85100
createFile (_persistentDataPath, "clientEntityDef." + _getSuffix(), stream);
86101
}
87102

@@ -104,6 +119,10 @@ public void onServerDigest(string currserver, string serverProtocolMD5, string s
104119
}
105120

106121
_digest = serverProtocolMD5 + serverEntitydefMD5;
122+
123+
if(_lastloaded == _getSuffix())
124+
return;
125+
107126
if(loadFile(_persistentDataPath, serverProtocolMD5 + serverEntitydefMD5 + "." +
108127
KBEngineApp.app.getInitArgs().ip + "." + KBEngineApp.app.getInitArgs().port).Length == 0)
109128
{
@@ -124,6 +143,8 @@ public void clearMessageFiles()
124143
deleteFile(_persistentDataPath, "serverErrorsDescr." + _getSuffix());
125144
deleteFile(_persistentDataPath, "clientEntityDef." + _getSuffix());
126145
KBEngineApp.app.resetMessages();
146+
147+
_lastloaded = "";
127148
}
128149

129150
public void createFile(string path, string name, byte[] datas)

0 commit comments

Comments
 (0)