test per fase caricamento file
This commit is contained in:
@@ -91,6 +91,10 @@
|
||||
<assemblyIdentity name="ICSharpCode.SharpZipLib" publicKeyToken="1b03e6acf1164f73" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-1.3.3.11" newVersion="1.3.3.11" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="RestSharp" publicKeyToken="598062e77f915f75" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-106.15.0.0" newVersion="106.15.0.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.web>
|
||||
|
||||
@@ -78,6 +78,9 @@
|
||||
<Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp.Serializers.NewtonsoftJson, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.Serializers.NewtonsoftJson.106.15.0\lib\net452\RestSharp.Serializers.NewtonsoftJson.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="SharpCompress, Version=0.30.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\SharpCompress.0.30.0\lib\net461\SharpCompress.dll</HintPath>
|
||||
</Reference>
|
||||
|
||||
+20
-4
@@ -1,6 +1,7 @@
|
||||
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using RestSharp.Serializers.NewtonsoftJson;
|
||||
using Steamware.Scheduler;
|
||||
using SteamWare.IO;
|
||||
using SteamWare.Logger;
|
||||
@@ -1281,8 +1282,9 @@ namespace IOB_MAN
|
||||
private async void btnSendLog_Click(object sender, EventArgs e)
|
||||
{
|
||||
// svuoto area temp...
|
||||
string fileName = "LogFiles.zip";
|
||||
string tempDir = Path.Combine(Application.StartupPath, "temp", "logs");
|
||||
string zipPath = Path.Combine(Application.StartupPath, "temp", "files.zip");
|
||||
string zipPath = Path.Combine(Application.StartupPath, "temp", fileName);
|
||||
if (Directory.Exists(tempDir))
|
||||
{
|
||||
Directory.Delete(tempDir, true);
|
||||
@@ -1326,6 +1328,7 @@ namespace IOB_MAN
|
||||
|
||||
// client chiamate rest
|
||||
var client = new RestClient(ApiUrl);
|
||||
client.UseNewtonsoftJson();
|
||||
|
||||
// genero il ticket
|
||||
var newSuppReq = new SupportRequest()
|
||||
@@ -1341,11 +1344,24 @@ namespace IOB_MAN
|
||||
Tipo = TipologiaTicket.FileUpload,
|
||||
idxSubLic = 0
|
||||
};
|
||||
string jsonBody = JsonConvert.SerializeObject(newSuppReq);
|
||||
var ticketReq = new RestRequest("/api/ticket/sendReq", DataFormat.Json).AddJsonBody(jsonBody);
|
||||
var ticketResp = await client.PostAsync<List<TicketDTO>>(ticketReq);
|
||||
var ticketReq = new RestRequest("/api/ticket/sendReq", DataFormat.Json).AddJsonBody(newSuppReq);
|
||||
//string jsonTicketBody = JsonConvert.SerializeObject(newSuppReq);
|
||||
//var ticketReq = new RestRequest("/api/ticket/sendReq", DataFormat.Json).AddJsonBody(jsonTicketBody);
|
||||
var ticketResp = await client.PostAsync<TicketDTO>(ticketReq);
|
||||
|
||||
// preparo richeista x upload file
|
||||
var fileUploadReq = new RestRequest("/api/filesave");
|
||||
fileUploadReq.AddParameter("ticketId", 1);
|
||||
fileUploadReq.AddFile("files", zipPath);
|
||||
// ... infine INVIA file zip che li contiene...
|
||||
try
|
||||
{
|
||||
var fileUploadResp = await client.PostAsync<string>(fileUploadReq);
|
||||
}
|
||||
catch(Exception exc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// elimino folder temporanea
|
||||
if (Directory.Exists(tempDir))
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<package id="Pipelines.Sockets.Unofficial" version="2.2.0" targetFramework="net462" />
|
||||
<package id="PrettyBin" version="1.1.0" targetFramework="net461" />
|
||||
<package id="RestSharp" version="106.15.0" targetFramework="net462" />
|
||||
<package id="RestSharp.Serializers.NewtonsoftJson" version="106.15.0" targetFramework="net462" />
|
||||
<package id="SharpCompress" version="0.30.0" targetFramework="net462" />
|
||||
<package id="SharpZipLib" version="1.3.3" targetFramework="net462" />
|
||||
<package id="Snappy.NET" version="1.1.1.8" targetFramework="net461" />
|
||||
|
||||
Reference in New Issue
Block a user