remove usless projects

This commit is contained in:
Фролов 2021-11-22 12:06:10 +05:00
parent 14bc1e12b4
commit f4f4974cdd
16 changed files with 3 additions and 3269 deletions

View File

@ -13,8 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConsoleApp1", "ConsoleApp1\
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDb", "AsbCloudDb\AsbCloudDb.csproj", "{40FBD29B-724B-4496-B5D9-1A5D14102456}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DataTable", "DataTable\DataTable.csproj", "{28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudWebApi.Tests", "AsbCloudWebApi.Tests\AsbCloudWebApi.Tests.csproj", "{9CF6FBB1-9AF5-45AB-A521-24F11A79B540}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AsbCloudDevOperations", "AsbCloudDbDemoData\AsbCloudDevOperations.csproj", "{1208822E-9099-4D13-B72F-8721E5758577}"
@ -45,10 +43,6 @@ Global
{40FBD29B-724B-4496-B5D9-1A5D14102456}.Debug|Any CPU.Build.0 = Debug|Any CPU
{40FBD29B-724B-4496-B5D9-1A5D14102456}.Release|Any CPU.ActiveCfg = Release|Any CPU
{40FBD29B-724B-4496-B5D9-1A5D14102456}.Release|Any CPU.Build.0 = Release|Any CPU
{28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}.Debug|Any CPU.Build.0 = Debug|Any CPU
{28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}.Release|Any CPU.ActiveCfg = Release|Any CPU
{28AD7CD5-17A0-448C-8C16-A34AE5DE40FB}.Release|Any CPU.Build.0 = Release|Any CPU
{9CF6FBB1-9AF5-45AB-A521-24F11A79B540}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{9CF6FBB1-9AF5-45AB-A521-24F11A79B540}.Debug|Any CPU.Build.0 = Debug|Any CPU
{9CF6FBB1-9AF5-45AB-A521-24F11A79B540}.Release|Any CPU.ActiveCfg = Release|Any CPU

View File

@ -42,5 +42,7 @@
<Folder Include="wwwroot\admin\" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>

View File

@ -7,7 +7,7 @@
}
},
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;",
"DefaultConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
"DebugConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True;Include Error Detail=True",
"ServerConnection": "Host=192.168.1.70;Database=postgres;Username=postgres;Password=q;Persist Security Info=True",
"LocalConnection": "Host=localhost;Database=postgres;Username=postgres;Password=q;Persist Security Info=True"

View File

@ -1,8 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
</Project>

View File

@ -1,13 +0,0 @@
using System;
namespace DataTable
{
[Serializable]
public class Header
{
public string Name { get; set; }
public string Desctiption { get; set; }
//public System.Type ColumnType { get; set; } = typeof(object);
public string ColumnType { get; set; }
}
}

View File

@ -1,83 +0,0 @@
namespace DataTable
{
class Program
{
static void Main(/*string[] args*/)
{
//var listDtos = new List<TestDto>(100);
/* *** Size of TestDto calc ***
*
* ** data binary size (Not implemented) **
* Date : DateTime : 4b
* Mode : int32? : 4b
* User : string : 2-64b
* WellDepth : double? : 8b
* TOTAL data size = 18-80b
*
* ** header binary size (Not implemented) **
*
*DateTime : len("DateTime") + 2 + len("Date") + 2 = 16b
* Mode : 14b
* User : 14b
* WellDepth : 20b
* columnsCount : 2b
* TOTAL header size = 66b
*
* ** json as tab **
*
* header size: 137b
* json row size: 63b
*
* total for 1 record : 200b
* total for 2 records : 263b
*
* ** json as list **
*
* Raw listItem size: 175b
* total for 2 records : 350b
*
* ** example 100 records **
* tabJsonBytes: 6602
* listJsonBytes: 9628
* tabBinBytes: 7765 (by dangerous BinaryFormatter)
* listBinBytes: 4366 (by dangerous BinaryFormatter)
*/
//for (int i = 0; i < 100; i++)
// listDtos.Add(new TestDto{
// Date = DateTime.Now.AddSeconds(i),
// Mode = 1,
// WellDepth = i * Math.PI
// });
//var tMapper = new TableMapper<TestDto>();
//var tab = tMapper.MakeTable(listDtos);
//var e = tMapper.AsEnumerable(tab);
//var tabJson = JsonSerializer.Serialize(tab);
//var listJson = JsonSerializer.Serialize(listDtos);
//var tabJsonBytes = JsonSerializer.SerializeToUtf8Bytes(tab);
//var listJsonBytes = JsonSerializer.SerializeToUtf8Bytes(listDtos);
//var formatter = new BinaryFormatter();
//var mem = new MemoryStream();
//formatter.Serialize(mem, tab);
//var tabBinBytes = new byte[mem.Length];
//Array.Copy(mem.GetBuffer(), tabBinBytes, mem.Length);
//mem = new MemoryStream();
//formatter.Serialize(mem, listDtos);
//var listBinBytes = new byte[mem.Length];
//Array.Copy(mem.GetBuffer(), listBinBytes, mem.Length);
//Console.WriteLine($"tabJsonBytes:{tabJsonBytes.Length}");
//Console.WriteLine($"listJsonBytes:{listJsonBytes.Length}");
//Console.WriteLine($"tabBinBytes:{tabBinBytes.Length}");
//Console.WriteLine($"listBinBytes:{listBinBytes.Length}");
}
}
}

View File

@ -1,62 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq.Expressions;
using System.Reflection;
namespace DataTable
{
/// <summary>
/// Ускоренный обработчик свойства
/// </summary>
class PropertyHelper
{
delegate void SetterDelegate(object instanse, object[] values);
delegate object GetterDelegate(object instanse);
public string PropertyName { get; }
public string PropertyDesctiption { get; }
public Type PropertyType { get; }
public string Id { get; }
SetterDelegate Setter { get; }
GetterDelegate Getter { get; }
public PropertyHelper(PropertyInfo property)
{
PropertyName = property.Name;
PropertyType = property.PropertyType;
Id = MakeIdentity(property.PropertyType.Name, property.Name);
PropertyDesctiption = GetDescription(property);
var setter = property.SetMethod;
var getter = property.GetMethod;
var instanceExpression = Expression.Parameter(typeof(object), "instance");
var argumentsExpression = Expression.Parameter(typeof(object[]), "arguments");
var argumentExpressions = new List<Expression> { Expression.Convert(Expression.ArrayIndex(argumentsExpression, Expression.Constant(0)), PropertyType) };
var callExpression = Expression.Call(Expression.Convert(instanceExpression, setter.ReflectedType), setter, argumentExpressions);
Setter = Expression.Lambda<SetterDelegate>(callExpression, instanceExpression, argumentsExpression).Compile();
callExpression = Expression.Call(Expression.Convert(instanceExpression, getter.ReflectedType), getter);
Getter = Expression.Lambda<GetterDelegate>(Expression.Convert(callExpression, typeof(object)), instanceExpression).Compile();
}
private string GetDescription(PropertyInfo property)
{
var descriptionAttr = property.GetCustomAttribute<DescriptionAttribute>();
return descriptionAttr?.Description ?? string.Empty;
}
void SetValues(object instance, params object[] values)
=> Setter(instance, values);
public void Set(object instance, object value)
=> SetValues(instance, value);
public object Get(object instance)
=> Getter(instance);
public static string MakeIdentity(string propertyTypeName, string propertyName)
=> $"{propertyTypeName}_{propertyName}".ToLower();
}
}

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
namespace DataTable
{
[Serializable]
public class Table
{
public IEnumerable<Header> Headers { get; set; }
public IEnumerable<IEnumerable<object>> Rows { get; set; }
}
}

View File

@ -1,87 +0,0 @@
using System.Collections.Generic;
using System.Linq;
namespace DataTable
{
public class TableMapper<T>
where T : new()
{
private readonly Dictionary<string, PropertyHelper> props;
public TableMapper()
{
var props = typeof(T).GetProperties();
this.props = new Dictionary<string, PropertyHelper>(props.Length);
foreach (var prop in props)
{
var helper = new PropertyHelper(prop);
this.props.Add(helper.Id, helper);
}
}
public IEnumerable<T> AsEnumerable(Table table)
{
if ((table?.Headers is null) ||
(table?.Rows is null) ||
(!table.Headers.Any()) ||
(!table.Rows.Any()) ||
(!props.Any()))
yield break;
var headerIdToProp = new Dictionary<int, PropertyHelper>(props.Count);
foreach (var (_, propHelper) in props)
for (var i = 0; i < table.Headers.Count(); i++)
{
var header = table.Headers.ElementAt(i);
var columnType = System.Type.GetType(header.ColumnType);
if (columnType.IsAssignableTo(propHelper.PropertyType) &&
((header.Name == propHelper.PropertyName) ||
(header.Name.ToLower() == propHelper.PropertyName.ToLower())))
headerIdToProp.Add(i, propHelper);
}
if (!headerIdToProp.Any())
yield break;
foreach (var row in table.Rows)
{
var obj = new T();
foreach (var (i, propHelper) in headerIdToProp)
propHelper.Set(obj, row.ElementAt(i));
yield return obj;
}
yield break;
}
public Table MakeTable(IEnumerable<T> data)
{
var table = new Table();
table.Headers = props.Select(pair => new Header
{
Name = pair.Value.PropertyName,
ColumnType = pair.Value.PropertyType.Name,
}).ToArray();
var rows = new List<List<object>>(data.Count());
foreach (var dataItem in data)
rows.Add(MakeRow(dataItem));
table.Rows = rows;
return table;
}
private List<object> MakeRow(T dataItem)
{
var colunms = new List<object>(props.Count);
foreach (var (_, propHelper) in props)
{
var propValue = propHelper.Get(dataItem);
colunms.Add(propValue);
}
return colunms;
}
}
}

View File

@ -1,20 +0,0 @@
using System;
using System.ComponentModel;
namespace DataTable
{
[Serializable]
public class TestDto
{
[Description("Дата")]
public DateTime Date { get; set; } = DateTime.Now;
public int? Mode { get; set; }
[Description("Пользователь")]
public string User { get; set; }
[Description("Глубина забоя")]
public double? WellDepth { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,99 +0,0 @@
{
"runtime": "NetCore21",
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
"url": "https://localhost:5001/swagger/v1/swagger.json",
"output": "AsbCloudApi.nswag.json",
"newLineBehavior": "Auto"
}
},
"codeGenerators": {
"openApiToCSharpClient": {
"clientBaseClass": null,
"configurationClass": null,
"generateClientClasses": true,
"generateClientInterfaces": false,
"clientBaseInterface": null,
"injectHttpClient": true,
"disposeHttpClient": true,
"protectedMethods": [],
"generateExceptionClasses": true,
"exceptionClass": "ApiException",
"wrapDtoExceptions": true,
"useHttpClientCreationMethod": false,
"httpClientType": "System.Net.Http.HttpClient",
"useHttpRequestMessageCreationMethod": false,
"useBaseUrl": true,
"generateBaseUrlProperty": true,
"generateSyncMethods": false,
"generatePrepareRequestAndProcessResponseAsAsyncMethods": false,
"exposeJsonSerializerSettings": false,
"clientClassAccessModifier": "public",
"typeAccessModifier": "public",
"generateContractsOutput": false,
"contractsNamespace": null,
"contractsOutputFilePath": null,
"parameterDateTimeFormat": "s",
"parameterDateFormat": "yyyy-MM-dd",
"generateUpdateJsonSerializerSettingsMethod": true,
"useRequestAndResponseSerializationSettings": false,
"serializeTypeInformation": false,
"queryNullValue": "",
"className": "{controller}Client",
"operationGenerationMode": "SingleClientFromPathSegments",
"additionalNamespaceUsages": [],
"additionalContractNamespaceUsages": [],
"generateOptionalParameters": false,
"generateJsonMethods": false,
"enforceFlagEnums": false,
"parameterArrayType": "System.Collections.Generic.IEnumerable",
"parameterDictionaryType": "System.Collections.Generic.IDictionary",
"responseArrayType": "System.Collections.Generic.ICollection",
"responseDictionaryType": "System.Collections.Generic.IDictionary",
"wrapResponses": false,
"wrapResponseMethods": [],
"generateResponseClasses": true,
"responseClass": "SwaggerResponse",
"namespace": "SyncDicts.AsbCloudApi",
"requiredPropertiesMustBeDefined": true,
"dateType": "System.DateTimeOffset",
"jsonConverters": null,
"anyType": "object",
"dateTimeType": "System.DateTimeOffset",
"timeType": "System.TimeSpan",
"timeSpanType": "System.TimeSpan",
"arrayType": "System.Collections.Generic.ICollection",
"arrayInstanceType": "System.Collections.ObjectModel.Collection",
"dictionaryType": "System.Collections.Generic.IDictionary",
"dictionaryInstanceType": "System.Collections.Generic.Dictionary",
"arrayBaseType": "System.Collections.ObjectModel.Collection",
"dictionaryBaseType": "System.Collections.Generic.Dictionary",
"classStyle": "Poco",
"jsonLibrary": "SystemTextJson",
"generateDefaultValues": true,
"generateDataAnnotations": true,
"excludedTypeNames": [],
"excludedParameterNames": [],
"handleReferences": false,
"generateImmutableArrayProperties": false,
"generateImmutableDictionaryProperties": false,
"jsonSerializerSettingsTransformationMethod": null,
"inlineNamedArrays": false,
"inlineNamedDictionaries": false,
"inlineNamedTuples": true,
"inlineNamedAny": false,
"generateDtoTypes": true,
"generateOptionalPropertiesAsNullable": false,
"generateNullableReferenceTypes": false,
"templateDirectory": null,
"typeNameGeneratorType": null,
"propertyNameGeneratorType": null,
"enumNameGeneratorType": null,
"serviceHost": null,
"serviceSchemes": null,
"output": "AsbCloudApi.cs",
"newLineBehavior": "Auto"
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,162 +0,0 @@
{
"ProviderId": "Unchase.OpenAPI.ConnectedService",
"Version": "1.5.20.0",
"GettingStartedDocument": {
"Uri": "https://github.com/unchase/Unchase.OpenAPI.Connectedservice/"
},
"ExtendedData": {
"ServiceName": "AsbCloudApi",
"GeneratedFileName": "AsbCloudApi",
"Endpoint": "https://localhost:5001/swagger/v1/swagger.json",
"GeneratedFileNamePrefix": null,
"GenerateCSharpClient": true,
"GenerateTypeScriptClient": false,
"GenerateCSharpController": false,
"OpenApiToCSharpClientCommand": {
"ClientBaseClass": null,
"ConfigurationClass": null,
"GenerateClientClasses": true,
"GenerateClientInterfaces": false,
"ClientBaseInterface": null,
"InjectHttpClient": true,
"DisposeHttpClient": true,
"ProtectedMethods": [],
"GenerateExceptionClasses": true,
"ExceptionClass": "ApiException",
"WrapDtoExceptions": true,
"UseHttpClientCreationMethod": false,
"HttpClientType": "System.Net.Http.HttpClient",
"UseHttpRequestMessageCreationMethod": false,
"UseBaseUrl": true,
"GenerateBaseUrlProperty": true,
"GenerateSyncMethods": false,
"GeneratePrepareRequestAndProcessResponseAsAsyncMethods": false,
"ExposeJsonSerializerSettings": false,
"ClientClassAccessModifier": "public",
"TypeAccessModifier": "public",
"GenerateContractsOutput": false,
"ContractsNamespace": null,
"ContractsOutputFilePath": null,
"ParameterDateTimeFormat": "s",
"ParameterDateFormat": "yyyy-MM-dd",
"GenerateUpdateJsonSerializerSettingsMethod": true,
"UseRequestAndResponseSerializationSettings": false,
"SerializeTypeInformation": false,
"QueryNullValue": "",
"ClassName": "{controller}Client",
"OperationGenerationMode": 5,
"AdditionalNamespaceUsages": [],
"AdditionalContractNamespaceUsages": [],
"GenerateOptionalParameters": false,
"GenerateJsonMethods": false,
"EnforceFlagEnums": false,
"ParameterArrayType": "System.Collections.Generic.IEnumerable",
"ParameterDictionaryType": "System.Collections.Generic.IDictionary",
"ResponseArrayType": "System.Collections.Generic.ICollection",
"ResponseDictionaryType": "System.Collections.Generic.IDictionary",
"WrapResponses": false,
"WrapResponseMethods": [],
"GenerateResponseClasses": true,
"ResponseClass": "SwaggerResponse",
"Namespace": "SyncDicts.AsbCloudApi",
"RequiredPropertiesMustBeDefined": true,
"DateType": "System.DateTimeOffset",
"JsonConverters": null,
"AnyType": "object",
"DateTimeType": "System.DateTimeOffset",
"TimeType": "System.TimeSpan",
"TimeSpanType": "System.TimeSpan",
"ArrayType": "System.Collections.Generic.ICollection",
"ArrayInstanceType": "System.Collections.ObjectModel.Collection",
"DictionaryType": "System.Collections.Generic.IDictionary",
"DictionaryInstanceType": "System.Collections.Generic.Dictionary",
"ArrayBaseType": "System.Collections.ObjectModel.Collection",
"DictionaryBaseType": "System.Collections.Generic.Dictionary",
"ClassStyle": 0,
"JsonLibrary": 1,
"GenerateDefaultValues": true,
"GenerateDataAnnotations": true,
"ExcludedTypeNames": [],
"ExcludedParameterNames": [],
"HandleReferences": false,
"GenerateImmutableArrayProperties": false,
"GenerateImmutableDictionaryProperties": false,
"JsonSerializerSettingsTransformationMethod": null,
"InlineNamedArrays": false,
"InlineNamedDictionaries": false,
"InlineNamedTuples": true,
"InlineNamedAny": false,
"GenerateDtoTypes": true,
"GenerateOptionalPropertiesAsNullable": false,
"GenerateNullableReferenceTypes": false,
"TemplateDirectory": null,
"TypeNameGeneratorType": null,
"PropertyNameGeneratorType": null,
"EnumNameGeneratorType": null,
"ServiceHost": null,
"ServiceSchemes": null,
"output": "AsbCloudApi.cs",
"newLineBehavior": 0
},
"ExcludeTypeNamesLater": false,
"OpenApiToTypeScriptClientCommand": null,
"OpenApiToCSharpControllerCommand": null,
"Variables": null,
"Runtime": 0,
"CopySpecification": false,
"OpenGeneratedFilesOnComplete": false,
"UseRelativePath": false,
"ConvertFromOdata": false,
"OpenApiConvertSettings": {
"ServiceRoot": "http://localhost",
"Version": {
"Major": 1,
"Minor": 0,
"Build": 1,
"Revision": -1,
"MajorRevision": -1,
"MinorRevision": -1
},
"EnableKeyAsSegment": null,
"EnableUnqualifiedCall": false,
"EnableOperationPath": true,
"EnableOperationImportPath": true,
"EnableNavigationPropertyPath": true,
"TagDepth": 4,
"PrefixEntityTypeNameBeforeKey": false,
"OpenApiSpecVersion": 1,
"EnableOperationId": true,
"EnableUriEscapeFunctionCall": false,
"VerifyEdmModel": false,
"IEEE754Compatible": false,
"TopExample": 50,
"EnablePagination": false,
"PageableOperationName": "listMore",
"EnableDiscriminatorValue": false,
"EnableDerivedTypesReferencesForResponses": false,
"EnableDerivedTypesReferencesForRequestBody": false,
"PathPrefix": "OData",
"RoutePathPrefixProvider": {
"PathPrefix": "OData",
"Parameters": null
},
"ShowLinks": false,
"ShowSchemaExamples": false,
"RequireDerivedTypesConstraintForBoundOperations": false,
"ShowRootPath": false,
"ShowMsDosGroupPath": true,
"PathProvider": null
},
"OpenApiSpecVersion": 0,
"UseNetworkCredentials": false,
"NetworkCredentialsUserName": null,
"NetworkCredentialsPassword": null,
"NetworkCredentialsDomain": null,
"WebProxyUri": null,
"UseWebProxy": false,
"UseWebProxyCredentials": false,
"WebProxyNetworkCredentialsUserName": null,
"WebProxyNetworkCredentialsPassword": null,
"WebProxyNetworkCredentialsDomain": null
}
}

View File

@ -1,120 +0,0 @@
using SyncDicts.AsbCloudApi;
using System.Collections.Generic;
using System.Net;
using System.Text;
using System.Text.Json;
namespace SyncDicts
{
class Program
{
/// <summary>
/// Описывает процесс синхронизации словарей БД
/// </summary>
/// <param name="args"></param>
static void Main(/*string[] args*/)
{
//bool res;
//var context = new ArchiveDbContext(@"c:\temp\default.sqlite3");
//// sync Events
//var events = context.EventsDictionary.ToList()
// .Select(e => new EventDto
// {
// EventType = e.EventType,
// Id = e.Id,
// IdCategory = e.CategoryId,
// IdSound = e.SoundId,
// Message = e.MessageTemplate,
// Tag = e.Tag,
// });
//var info = new TelemetryInfoDto
//{
// Caption = "скв 111",
// Deposit = "мр 111",
// Cluster = "куст 111",
// TimeZoneId = TimeZoneInfo.Local.Id,
// TimeZoneOffsetTotalHours = TimeZoneInfo.Local.BaseUtcOffset.TotalHours,
// Date = DateTime.Now,
//};
//var users = context.Users.ToList()
// .Select(u => new TelemetryUserDto
// {
// Id = u.Id,
// Level = u.Level,
// Name = u.Name,
// Patronymic = u.Patronymic,
// Surname = u.Surname,
// });
//var messages = context.Messages.Take(1024).ToList()
// .Select(m => new TelemetryMessageDto
// {
// Id = m.Id,
// Date = DateTime.UnixEpoch.AddSeconds(m.TimeStamp),
// IdEvent = m.EventItemId,
// IdTelemetryUser = m.UserId,
// State = m.State,
// Arg0 = m.Arg0,
// Arg1 = m.Arg1,
// Arg2 = m.Arg2,
// Arg3 = m.Arg3,
// });
var cli = new AsbCloudApi.Client("https://localhost:5001/", new System.Net.Http.HttpClient());
var fileName = @"C:\temp\default.sqlite3";
var fileStream = System.IO.File.OpenRead(fileName);
var file = new FileParameter(fileStream, System.IO.Path.GetFileName(fileName));
cli.ApiTelemetryDbAsync("1", new List<FileParameter> { file }).Wait();
//var cli = new swaggerClient("https://localhost:5001/", new System.Net.Http.HttpClient());
//cli.InfoAsync("aaa",info).Wait();
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/event", events);
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/info", info);
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/user", users);
//res = Send("http://127.0.0.1:5000/api/telemetry/asdasd/message", messages);
}
//private static bool Send<T>(string url, T obj)
//{
// // sending data
// var requestBodyJson = JsonSerializer.Serialize(obj);
// var data = Encoding.UTF8.GetBytes(requestBodyJson);
// var request = MakeRequest(url);
// using var streamWriter = request.GetRequestStream();
// streamWriter.Write(data);
// streamWriter.Close();
// // getting response
// if (request.GetResponse() is not HttpWebResponse response)
// {//FAILED
// return false;
// }
// if (response.StatusCode == HttpStatusCode.OK)
// {// sent succesfilly
// return true;
// }
// else
// {//failed
// return false;
// }
//}
private static HttpWebRequest MakeRequest(string url, string contentType = "application/json")
{
var request = WebRequest.CreateHttp(url);
request.Method = "POST";
request.Timeout = 4900;
request.ContentType = contentType;
request.AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip;
request.ServicePoint.Expect100Continue = false;
return request;
}
}
}

View File

@ -1,38 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.5" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="5.0.5" />
<PackageReference Include="Microsoft.Extensions.ApiDescription.Client" Version="3.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NSwag.ApiDescription.Client" Version="13.0.5">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\AsbCloudApp\AsbCloudApp.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="AsbSaubDbModel">
<HintPath>..\..\..\SAUB\asbsaub3\AsbSaubDbModel\bin\Release\netcoreapp3.1\AsbSaubDbModel.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<WCFMetadata Include="Connected Services" />
</ItemGroup>
</Project>