Skip to content

Commit

Permalink
Update To NET8
Browse files Browse the repository at this point in the history
  • Loading branch information
LiorBanai committed Nov 15, 2023
1 parent ae0a9cb commit 72369a6
Show file tree
Hide file tree
Showing 32 changed files with 184 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<TargetFrameworks>net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="5.0.3" />
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="6.0.0.1" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Analogy.LogServer.Clients\Analogy.LogServer.Clients.csproj" />
Expand Down
8 changes: 4 additions & 4 deletions Analogy.LogServer.Clients.Test.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ namespace Analogy.LogServer.Clients.Test.Console
{
#if NETCOREAPP3_1 || NET
public class Program
{
{
public static TargetFrameworkAttribute CurrentFrameworkAttribute => (TargetFrameworkAttribute)Assembly.GetExecutingAssembly().GetCustomAttribute(typeof(TargetFrameworkAttribute));

static async Task Main(string[] args)
public static async Task Main(string[] args)
{
string ip = "localhost";
if (args.Length >= 2)
Expand All @@ -32,7 +32,7 @@ static async Task Main(string[] args)
public class Program
{
public static TargetFrameworkAttribute CurrentFrameworkAttribute => (TargetFrameworkAttribute)Assembly.GetExecutingAssembly().GetCustomAttribute(typeof(TargetFrameworkAttribute));
static async Task Main(string[] args)
public static async Task Main(string[] args)
{
string ip = "localhost";
if (args.Length >= 2)
Expand All @@ -50,4 +50,4 @@ static async Task Main(string[] args)
}
}
#endif
}
}
12 changes: 6 additions & 6 deletions Analogy.LogServer.Clients/Analogy.LogServer.Clients.csproj
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<TargetFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<OutputType>Library</OutputType>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Authors>Lior Banai</Authors>
<Company>Analogy.LogViewer</Company>
<Description>grpc client to send messages To Analogy Log Viewer with gRPC server running</Description>
<Copyright>Lior Banai @ 2020-2023</Copyright>
<Copyright>Lior Banai @ 2020-2024</Copyright>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>Analogy.gRPC.service.png</PackageIcon>
<VersionPrefix>5.0.3.1</VersionPrefix>
<VersionPrefix>6.0.0</VersionPrefix>
<VersionSuffix></VersionSuffix>
<PublishRepositoryUrl>true</PublishRepositoryUrl>
<IncludeSymbols>true</IncludeSymbols>
Expand All @@ -22,7 +22,7 @@
<PackageProjectUrl>https://github.com/Analogy-LogViewer/Analogy.LogViewer.gRPC</PackageProjectUrl>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>

<DebugType>portable</DebugType>
</PropertyGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net48' or '$(TargetFramework)' == 'net472' or '$(TargetFramework)' == 'net471' ">
Expand All @@ -39,15 +39,15 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="5.0.3" />
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="6.0.0.1" />
<PackageReference Include="Google.Protobuf" Version="3.25.0" />
<PackageReference Include="Grpc.Core" Version="2.46.6" />
<PackageReference Include="Grpc.Net.Client" Version="2.59.0" />
<PackageReference Include="Grpc.Tools" Version="2.59.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="7.0.0" />
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="Microsoft.Build.Tasks.Git" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
Expand Down
4 changes: 1 addition & 3 deletions Analogy.LogServer.Clients/NetCore/AnalogyMessageConsumer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ public AnalogyMessageConsumer(string address)
var token = _cts.Token;
Interfaces.AnalogyLogMessage msg = new Interfaces.AnalogyLogMessage()
{

Level = (AnalogyLogLevel)m.Level,
Class = (AnalogyLogClass)m.Class,
Date = m.Date.ToDateTime().ToLocalTime(),
Expand All @@ -54,7 +53,7 @@ public AnalogyMessageConsumer(string address)
Source = m.Source,
Text = m.Text,
ThreadId = m.ThreadId,
User = m.User
User = m.User,
};
if (!string.IsNullOrEmpty(m.Category))
{
Expand All @@ -74,7 +73,6 @@ public Task Stop()
{
_cts?.Cancel();
return channel.ShutdownAsync();

}

public void Dispose()
Expand Down
10 changes: 1 addition & 9 deletions Analogy.LogServer.Clients/NetCore/AnalogyMessageProducer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,7 @@ static AnalogyMessageProducer()
{
AppContext.SetSwitch("System.Net.Http.SocketsHttpHandler.Http2UnencryptedSupport", true);
}
/// <summary>
///
/// </summary>

/// <param name="address">The address. for example: http://localhost:6000</param>
public AnalogyMessageProducer(string address)
{
Expand All @@ -42,7 +40,6 @@ public AnalogyMessageProducer(string address)
{
OnError?.Invoke(this, $"Error creating gRPC Connection: {e}");
}

}

public async Task Log(string text, string source, AnalogyLogLevel level, string category = "",
Expand Down Expand Up @@ -83,7 +80,6 @@ public async Task Log(string text, string source, AnalogyLogLevel level, string
{
await _semaphoreSlim.WaitAsync();
await stream.RequestStream.WriteAsync(m);

}
catch (Exception e)
{
Expand Down Expand Up @@ -134,9 +130,7 @@ public void StopReceiving()
catch (Exception e)
{
OnError?.Invoke(this, $"Error closing gRPC connection to Server: {e}");

}

}
public async Task StopReceivingAsync()
{
Expand All @@ -147,9 +141,7 @@ public async Task StopReceivingAsync()
catch (Exception e)
{
OnError?.Invoke(this, $"Error closing gRPC connection to Server: {e}");

}

}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ private async Task GetMessages()
var token = _cts.Token;
Interfaces.AnalogyLogMessage msg = new Interfaces.AnalogyLogMessage()
{

Level = (AnalogyLogLevel)m.Level,
Class = (AnalogyLogClass)m.Class,
Date = m.Date.ToDateTime().ToLocalTime(),
Expand All @@ -56,7 +55,7 @@ private async Task GetMessages()
Source = m.Source,
Text = m.Text,
ThreadId = m.ThreadId,
User = m.User
User = m.User,
};
if (!string.IsNullOrEmpty(m.Category))
{
Expand All @@ -76,7 +75,6 @@ private async Task GetMessages()
{
OnError?.Invoke(this, e.Message);
}

}
public async Task Stop()
{
Expand All @@ -90,8 +88,7 @@ public void Dispose()
_cts?.Cancel();
_cts?.Dispose();
_stream?.Dispose();
channel?.ShutdownAsync();

_ = channel?.ShutdownAsync();
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public AnalogyMessageProducer(string address)
{
OnError?.Invoke(this, $"Error creating gRPC Connection: {e.Message}");
}

}

public async Task Log(string text, string source, AnalogyLogLevel level, string category = "",
Expand Down Expand Up @@ -80,7 +79,6 @@ public async Task Log(string text, string source, AnalogyLogLevel level, string
{
await _semaphoreSlim.WaitAsync();
await stream.RequestStream.WriteAsync(m);

}
catch (Exception e)
{
Expand Down Expand Up @@ -131,9 +129,7 @@ public void StopReceiving()
catch (Exception e)
{
OnError?.Invoke(this, $"Error closing gRPC connection to Server: {e.Message}");

}

}
public async Task StopReceivingAsync()
{
Expand All @@ -144,16 +140,14 @@ public async Task StopReceivingAsync()
catch (Exception e)
{
OnError?.Invoke(this, $"Error closing gRPC connection to Server: {e}");

}

}
public void Dispose()
{
try
{
_semaphoreSlim.Dispose();
channel?.ShutdownAsync();
_ = (channel?.ShutdownAsync());
stream?.Dispose();
}
catch (Exception e)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFrameworks>net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<TargetFrameworks>net8.0-windows;net7.0-windows;net6.0-windows;net48;net471</TargetFrameworks>
<UseWindowsForms>true</UseWindowsForms>
<IsPackable>true</IsPackable>
<Authors>Lior Banai</Authors>
Expand All @@ -16,13 +16,13 @@
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<Version>0.0.3</Version>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Copyright>Lior Banai @ 2020-2023</Copyright>
<Copyright>Lior Banai @ 2020-2024</Copyright>
<PackageIcon>Analogy.gRPC.service.png</PackageIcon>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="5.0.3" />
<PackageReference Include="Analogy.LogViewer.Interfaces" Version="6.0.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -32,7 +32,7 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="System.Resources.Extensions" Version="7.0.0" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>

<ItemGroup>
Expand Down
16 changes: 8 additions & 8 deletions Analogy.LogServer.Configurator/EventLogsSettings.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using System;
using Analogy.LogServer.Configurator;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Analogy.LogServer.Configurator;

namespace Analogy.LogViewer.WindowsEventLogs
{
Expand All @@ -16,10 +16,10 @@ public EventLogsSettings()
{
InitializeComponent();
}
public EventLogsSettings(ServerConfiguration configuration):this()
{
Configuration = configuration;
}
public EventLogsSettings(ServerConfiguration configuration) : this()
{
Configuration = configuration;
}
private void btnAdd_Click(object sender, EventArgs e)
{
List<string> selected = lstAvailable.SelectedItems.Cast<string>().ToList();
Expand All @@ -43,7 +43,7 @@ private void btnRemove_Click(object sender, EventArgs e)
}
private void UpdateUserSettingList()
{
Configuration.ServiceConfiguration.WindowsEventLogsConfiguration.LogsToMonitor= lstSelected.Items.Cast<string>().ToList();
Configuration.ServiceConfiguration.WindowsEventLogsConfiguration.LogsToMonitor = lstSelected.Items.Cast<string>().ToList();
}

private void EventLogsSettings_Load(object sender, EventArgs e)
Expand All @@ -61,4 +61,4 @@ private void EventLogsSettings_Load(object sender, EventArgs e)
}
}
}
}
}
20 changes: 10 additions & 10 deletions Analogy.LogServer.Configurator/MainForm.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
using Analogy.LogViewer.WindowsEventLogs;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
Expand All @@ -7,8 +9,6 @@
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Analogy.LogViewer.WindowsEventLogs;
using Newtonsoft.Json.Linq;

namespace Analogy.LogServer.Configurator
{
Expand All @@ -33,7 +33,7 @@ private void MainForm_Load(object sender, EventArgs e)
return;
}

EventLogsSettings els=new EventLogsSettings(ServiceConfiguration);
EventLogsSettings els = new EventLogsSettings(ServiceConfiguration);
gbWindowsEventsLog.Controls.Add(els);
els.Dock = DockStyle.Fill;
LoadSettings();
Expand All @@ -52,11 +52,11 @@ private void LoadSettings()
private void SaveSettings()
{
ServiceConfiguration.ServiceConfiguration.LogAlsoToLogFile = chLogToFile.Checked;
ServiceConfiguration.Serilog.WriteTo[1].Args.pathFormat=txtbLogFileLocation.Text;
ServiceConfiguration.ServiceConfiguration.HoursToKeepHistory =(int)nudHoursToKeepHistory.Value ;
ServiceConfiguration.ServiceConfiguration.MemoryUsageInMB =(int)nudMemoryUsageInMB.Value;
ServiceConfiguration.ServiceConfiguration.CleanUpIntervalMinutes =(int)nudCleanUpIntervalMinutes.Value;
ServiceConfiguration.ServiceConfiguration.WindowsEventLogsConfiguration.EnableMonitoring=chkbEnableWindowsEventLogs.Checked;
ServiceConfiguration.Serilog.WriteTo[1].Args.pathFormat = txtbLogFileLocation.Text;
ServiceConfiguration.ServiceConfiguration.HoursToKeepHistory = (int)nudHoursToKeepHistory.Value;
ServiceConfiguration.ServiceConfiguration.MemoryUsageInMB = (int)nudMemoryUsageInMB.Value;
ServiceConfiguration.ServiceConfiguration.CleanUpIntervalMinutes = (int)nudCleanUpIntervalMinutes.Value;
ServiceConfiguration.ServiceConfiguration.WindowsEventLogsConfiguration.EnableMonitoring = chkbEnableWindowsEventLogs.Checked;
}
}
}
}
6 changes: 3 additions & 3 deletions Analogy.LogServer.Configurator/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@

namespace Analogy.LogServer.Configurator
{
static class Program
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
public static void Main()
{
#if !NET471 && !NET48
Application.SetHighDpiMode(HighDpiMode.SystemAware);
Expand All @@ -22,4 +22,4 @@ static void Main()
Application.Run(new MainForm());
}
}
}
}
Loading

0 comments on commit 72369a6

Please sign in to comment.