RestSharp Update

This commit is contained in:
2025-03-27 15:22:10 +01:00
parent 128bf22439
commit 1c7d654747
39 changed files with 4112 additions and 37199 deletions

View File

@@ -42,8 +42,8 @@
</Reference> </Reference>
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="RestSharp, Version=106.15.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\PrototypChat\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath> <HintPath>..\PrototypChat\packages\RestSharp.106.15.0\lib\net452\RestSharp.dll</HintPath>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
<Reference Include="System.Configuration" /> <Reference Include="System.Configuration" />

View File

@@ -183,6 +183,8 @@ namespace ChatController.HauptKlassen
}); });
} }
public void LoadMoreMessagesAsync(Contact contact, ChatMessage previousMessage, Action<List<ChatMessage>> callback) public void LoadMoreMessagesAsync(Contact contact, ChatMessage previousMessage, Action<List<ChatMessage>> callback)
{ {
LoadMoreMessagesFromServerAsync(contact.GroupId, _NextPage, () => LoadMoreMessagesFromServerAsync(contact.GroupId, _NextPage, () =>
@@ -856,12 +858,26 @@ namespace ChatController.HauptKlassen
}); });
} }
public void ReloadGroupsAsync(Action<ChatGruppenDaten> callback) public async Task ReloadGroupsAsync(Action<ChatGruppenDaten> callback)
{ {
var url = ChatDaten.ServerUrl + Constants.GetChatGroupsUrl; var url = ChatDaten.ServerUrl + Constants.GetChatGroupsUrl;
ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
// ToDo: Durch HttpClient ersetzen
using(var httpClient = new HttpClient())
{
httpClient.DefaultRequestHeaders.Add(Constants.Token, ChatDaten.AuthToken);
httpClient.DefaultRequestHeaders.Add(Constants.CustomerId, ChatDaten.Kundennummer);
var test = await httpClient.GetStringAsync(url);
var gruppen = JsonConvert.DeserializeObject<ChatGruppenDaten>(test);
}
var client = new RestClient(url); var client = new RestClient(url);
var request = new RestRequest(); var request = new RestRequest();

View File

@@ -3,8 +3,10 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Net.Http;
using System.Net.Security; using System.Net.Security;
using System.Security.Cryptography.X509Certificates; using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using System.Web; using System.Web;
using System.Windows; using System.Windows;
using ChatController.Core; using ChatController.Core;

View File

@@ -4,6 +4,7 @@ using System.ComponentModel;
using System.IO; using System.IO;
using System.Runtime.CompilerServices; using System.Runtime.CompilerServices;
using System.Text; using System.Text;
using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Threading; using System.Windows.Threading;
using ChatController.Annotations; using ChatController.Annotations;
@@ -33,7 +34,7 @@ namespace ChatController
} }
_Benutzername = value; _Benutzername = value;
OnPropertyChanged(nameof(UserName)); OnPropertyChanged();
} }
} }
@@ -56,7 +57,7 @@ namespace ChatController
} }
_ChatCode = value; _ChatCode = value;
OnPropertyChanged(nameof(ChatCode)); OnPropertyChanged();
} }
} }
@@ -72,7 +73,7 @@ namespace ChatController
} }
_Kundennummer = value; _Kundennummer = value;
OnPropertyChanged(nameof(Tenant)); OnPropertyChanged();
} }
} }
@@ -201,7 +202,7 @@ namespace ChatController
#if DEBUG #if DEBUG
//var debugFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "debug-info.txt"); //var debugFile = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "debug-info.txt");
if(Tenant == "1122334455" && Directory.Exists(@"C:\Users\Lyndon Jetten")) if(Tenant == "1122334455" && Directory.Exists(@"C:\Users\Lyndon"))
{ {
ChatCode = "HprNe -1MwMB"; ChatCode = "HprNe -1MwMB";
UserName = "MikeGahn"; UserName = "MikeGahn";
@@ -209,7 +210,7 @@ namespace ChatController
return; return;
} }
var debugFile = @"C:\Users\Lyndon Jetten\Desktop\debug-info.txt"; var debugFile = @"C:\Users\Lyndon\Documents\ownchat-desktop-debug-info.txt";
if (File.Exists(debugFile)) if (File.Exists(debugFile))
{ {
using(var streamReader2 = new StreamReader(debugFile, true)) using(var streamReader2 = new StreamReader(debugFile, true))

View File

@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="RestSharp" version="105.2.3" targetFramework="net45" requireReinstallation="true" /> <package id="RestSharp" version="106.15.0" targetFramework="net452" />
</packages> </packages>

View File

@@ -1,4 +1,5 @@
using System.Windows.Input; using System.Threading.Tasks;
using System.Windows.Input;
using ChatController.LoginKlassen; using ChatController.LoginKlassen;
namespace ownChat namespace ownChat
@@ -26,5 +27,13 @@ namespace ownChat
LoginControl.Login(); LoginControl.Login();
} }
} }
private async Task TestEvent(object sender, KeyEventArgs e)
{
if(e.Key is Key.Enter)
{
await LoginControl.AsyncLogin();
}
}
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,20 +0,0 @@
*** IMPORTANT CHANGE IN RESTSHARP VERSION 103 ***
In 103.0, JSON.NET was removed as a dependency.
If this is still installed in your project and no other libraries depend on
it you may remove it from your installed packages.
There is one breaking change: the default Json*Serializer* is no longer
compatible with Json.NET. To use Json.NET for serialization, copy the code
from https://github.com/restsharp/RestSharp/blob/86b31f9adf049d7fb821de8279154f41a17b36f7/RestSharp/Serializers/JsonSerializer.cs
and register it with your client:
var client = new RestClient();
client.JsonSerializer = new YourCustomSerializer();
The default Json*Deserializer* is mostly compatible, but it does not support
all features which Json.NET has (like the ability to support a custom [JsonConverter]
by decorating a certain property with an attribute). If you need these features, you
must take care of the deserialization yourself to get it working.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 KiB