BytesToString()

This commit is contained in:
2021-10-26 18:43:58 +03:00
parent e2d0fb8a03
commit dcc1ad3e17
4 changed files with 25 additions and 6 deletions

View File

@@ -67,7 +67,7 @@ namespace DTLib.Network
Mutex.Execute(() =>
{
BytesDownloaded=0;
Filesize=FrameworkFix.ToString(MainSocket.GetPackage()).ToUInt();
Filesize=MainSocket.GetPackage().BytesToString().ToUInt();
MainSocket.SendPackage("ready".ToBytes());
int packagesCount = 0;
byte[] buffer = new byte[5120];
@@ -144,7 +144,7 @@ namespace DTLib.Network
if(!dirOnServer.EndsWith("\\"))
dirOnServer+="\\";
Debug("b", "downloading manifest <", "c", dirOnServer+"manifest.dtsod", "b", ">\n");
var manifest = new Dtsod.DtsodV22(FrameworkFix.ToString(DownloadFileToMemory(dirOnServer+"manifest.dtsod")));
var manifest = new Dtsod.DtsodV22(DownloadFileToMemory(dirOnServer+"manifest.dtsod").BytesToString());
Debug("g", $"found {manifest.Values.Count} files in manifest\n");
var hasher = new Hasher();
foreach(string fileOnServer in manifest.Keys)

View File

@@ -55,7 +55,7 @@ namespace DTLib.Network
// получает пакет и выбрасывает исключение, если пакет не соответствует образцу
public static void GetAnswer(this Socket socket, string answer)
{
string rec = FrameworkFix.ToString(socket.GetPackage());
string rec = socket.GetPackage().BytesToString();
if(rec!=answer)
throw new Exception($"GetAnswer() error: invalid answer: <{rec}>");
}