-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a9f997d
commit d2fae75
Showing
89 changed files
with
7,039 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: .NET | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [windows-2022, ubuntu-22.04, macos-12] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Setup .NET 8 | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Install dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build GrpcDotNetNamedPipes.Tests --configuration Release --no-restore | ||
- name: Test | ||
run: dotnet test GrpcDotNetNamedPipes.Tests --no-restore -l "console;verbosity=normal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Changelog | ||
|
||
## 2.1.0 | ||
- Improve streaming performance | ||
- Improve connection reliability in some cases | ||
- Implement ServerCallContext.Peer ([#37](https://github.com/cyanfish/grpc-dotnet-namedpipes/issues/37)) | ||
- Set cancellation token on client disconnect ([#30](https://github.com/cyanfish/grpc-dotnet-namedpipes/issues/30)) | ||
- The [readme](https://github.com/cyanfish/grpc-dotnet-namedpipes) now has a comparison matrix for ASP.NET gRPC | ||
|
||
## 2.0.0 | ||
- Add macOS and Linux support | ||
- Change build targets to: net462, net6, netstandard2.0 | ||
- Bump assembly version | ||
- Set a default connection timeout of 30s (instead of unlimited) | ||
- Add NamedPipeServer.Error event for previously unlogged errors | ||
|
||
## 1.4.4 | ||
- Add strong naming to the assembly | ||
|
||
## 1.4.2 | ||
- Throw an exception when starting an already-killed server | ||
|
||
## 1.4.1 | ||
- Fix server cleanup issues | ||
|
||
## 1.4.0 | ||
- Fix cancellation issues | ||
|
||
## 1.3.0 | ||
- Add a .NET 5 build with support for pipe security options | ||
|
||
## 1.2.0 | ||
- Update to newer gRPC API (2.32) | ||
|
||
## 1.1.2 | ||
- Fix gRPC dependency version range to <2.32 | ||
|
||
## 1.1.1 | ||
- Update project metadata | ||
|
||
## 1.1.0 | ||
- Add a ConnectionTimeout client option (defaults to infinite) | ||
|
||
## 1.0.2 | ||
- Improve server connection error handling | ||
|
||
## 1.0.1 | ||
- Initial public release with core functionality |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# How to Contribute | ||
|
||
We'd love to accept your patches and contributions to this project. There are | ||
just a few small guidelines you need to follow. | ||
|
||
## Contributor License Agreement | ||
|
||
Contributions to this project must be accompanied by a Contributor License | ||
Agreement. You (or your employer) retain the copyright to your contribution; | ||
this simply gives us permission to use and redistribute your contributions as | ||
part of the project. Head over to <https://cla.developers.google.com/> to see | ||
your current agreements on file or to sign a new one. | ||
|
||
You generally only need to submit a CLA once, so if you've already submitted one | ||
(even if it was for a different project), you probably don't need to do it | ||
again. | ||
|
||
## Code reviews | ||
|
||
All submissions, including submissions by project members, require review. We | ||
use GitHub pull requests for this purpose. Consult | ||
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more | ||
information on using pull requests. | ||
|
||
## Community Guidelines | ||
|
||
This project follows [Google's Open Source Community | ||
Guidelines](https://opensource.google/conduct/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<Application | ||
x:Class="DemoClient.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<materialDesign:BundledTheme | ||
BaseTheme="Inherit" | ||
ColorAdjustment="{materialDesign:ColorAdjustment}" | ||
PrimaryColor="DeepPurple" | ||
SecondaryColor="Lime" /> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Button.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.PopupBox.xaml" /> | ||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.TextBlock.xaml" /> | ||
</ResourceDictionary.MergedDictionaries> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using DemoClient.Common; | ||
using MaterialDesignThemes.Wpf; | ||
using System; | ||
using System.Windows; | ||
|
||
namespace DemoClient | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
internal string? StartupPage { get; set; } | ||
internal FlowDirection InitialFlowDirection { get; set; } | ||
internal BaseTheme InitialTheme { get; set; } | ||
|
||
public App() | ||
{ | ||
var consoleWriter = new ConsoleOutputWriter((content) | ||
=> Global.Singleton.ConsoleOutPut += content); | ||
Console.SetOut(consoleWriter); | ||
} | ||
protected override void OnStartup(StartupEventArgs e) | ||
{ | ||
(StartupPage, InitialFlowDirection, InitialTheme) = CommandLineOptions.ParseCommandLine(e.Args); | ||
|
||
//This is an alternate way to initialize MaterialDesignInXAML if you don't use the MaterialDesignResourceDictionary in App.xaml | ||
//Color primaryColor = SwatchHelper.Lookup[MaterialDesignColor.DeepPurple]; | ||
//Color accentColor = SwatchHelper.Lookup[MaterialDesignColor.Lime]; | ||
//ITheme theme = Theme.Create(new MaterialDesignLightTheme(), primaryColor, accentColor); | ||
//Resources.SetTheme(theme); | ||
|
||
|
||
//Illustration of setting culture info fully in WPF: | ||
/* | ||
Thread.CurrentThread.CurrentCulture = new CultureInfo("fr-FR"); | ||
Thread.CurrentThread.CurrentUICulture = new CultureInfo("fr-FR"); | ||
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata( | ||
XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag))); | ||
*/ | ||
|
||
//XamlDisplay.Init(); | ||
|
||
// test setup for Persian culture settings | ||
/*System.Threading.Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo("fa-Ir"); | ||
System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("fa-Ir"); | ||
FrameworkElement.LanguageProperty.OverrideMetadata(typeof(FrameworkElement), new FrameworkPropertyMetadata( | ||
System.Windows.Markup.XmlLanguage.GetLanguage(System.Globalization.CultureInfo.CurrentCulture.IetfLanguageTag)));*/ | ||
|
||
base.OnStartup(e); | ||
Console.WriteLine("OnStartup"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
using DemoClient.Common; | ||
using DemoClient.gRPC; | ||
using DemoClient.ServiceFacades; | ||
using ReactiveUI; | ||
using ReactiveUI.Fody.Helpers; | ||
using System; | ||
using System.Reactive; | ||
using System.Threading.Tasks; | ||
|
||
namespace DemoClient | ||
{ | ||
public class AppViewModel: ReactiveObject,IDisposable | ||
{ | ||
private readonly IDisposable? _disposable; | ||
private readonly BeepServiceProvider _beepProvider; | ||
|
||
public AppViewModel() | ||
{ | ||
_beepProvider = new BeepServiceProvider(Global.Singleton.ChannelName); | ||
|
||
#region unary | ||
UnaryOnceCommand = ReactiveCommand.CreateFromTask<string, string>(message => Task.FromResult(message)); | ||
UnaryClearCommand = ReactiveCommand.Create(()=> | ||
{ | ||
Console.WriteLine(nameof(UnaryClearCommand)); | ||
}); | ||
UnaryFacade = new UnaryServiceFacade(_beepProvider, UnaryOnceCommand, UnaryClearCommand); | ||
#endregion | ||
|
||
#region ServerStreaming | ||
StartServerStreamingCommand = ReactiveCommand.CreateFromTask<string, string>(message => | ||
{ | ||
if (string.IsNullOrEmpty(message)) | ||
{ | ||
message = nameof(StartServerStreamingCommand); | ||
} | ||
return Task.FromResult(message); | ||
}); | ||
StopServerStreamingCommand = ReactiveCommand.CreateFromTask(() => Task.FromResult(nameof(StopServerStreamingCommand))); | ||
ServerStreamingClearCommand = ReactiveCommand.CreateFromTask(() => Task.Delay(0)); | ||
ServerStreamingFacade = new ServerStreamingServiceFacade(_beepProvider, | ||
StartServerStreamingCommand, | ||
StopServerStreamingCommand, | ||
ServerStreamingClearCommand); | ||
#endregion | ||
|
||
#region ClientStreaming | ||
PushOnceCommand = ReactiveCommand.Create<string, string>(p => $"{DateTime.Now.ToLongTimeString()}:{p}"); | ||
StartClientStreamingCommand = ReactiveCommand.CreateFromTask(() => Task.FromResult(nameof(StartClientStreamingCommand))); | ||
StopClientStreamingCommand = ReactiveCommand.CreateFromTask(() => Task.FromResult(nameof(StopClientStreamingCommand))); | ||
ClientStreamingClearCommand = ReactiveCommand.CreateFromTask(() => Task.Delay(0)); | ||
|
||
ClientStreamingFacade = new ClientStreamingServiceFacade(_beepProvider, | ||
PushOnceCommand, | ||
StartClientStreamingCommand, | ||
StopClientStreamingCommand, | ||
ClientStreamingClearCommand); | ||
#endregion | ||
} | ||
|
||
public UnaryServiceFacade UnaryFacade | ||
{ | ||
get; | ||
private set; | ||
} | ||
public ClientStreamingServiceFacade ClientStreamingFacade | ||
{ | ||
get; | ||
private set; | ||
} | ||
|
||
public ServerStreamingServiceFacade ServerStreamingFacade | ||
{ | ||
get; | ||
private set; | ||
} | ||
|
||
[Reactive] | ||
public bool IsChecked | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
[Reactive] | ||
public string ClientMessage | ||
{ | ||
get; | ||
set; | ||
} = "I am a clientstreaming message!"; | ||
|
||
[Reactive] | ||
public string UnaryMessage | ||
{ | ||
get; | ||
set; | ||
} = "I am an unary message!"; | ||
|
||
private bool _isCheckedInternal; | ||
public bool IsCheckedInternal | ||
{ | ||
get => _isCheckedInternal; | ||
set | ||
{ | ||
_isCheckedInternal = value; | ||
IsChecked = _isCheckedInternal; | ||
} | ||
} | ||
public ReactiveCommand<string, string> UnaryOnceCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
public ReactiveCommand<string, string> PushOnceCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
public ReactiveCommand<Unit, string> StartClientStreamingCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
public ReactiveCommand<Unit, string> StopClientStreamingCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
public ReactiveCommand<string, string> StartServerStreamingCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
public ReactiveCommand<Unit, string> StopServerStreamingCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
public ReactiveCommand<Unit, Unit> UnaryClearCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
public ReactiveCommand<Unit, Unit> ClientStreamingClearCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
public ReactiveCommand<Unit, Unit> ServerStreamingClearCommand | ||
{ | ||
get; | ||
set; | ||
} | ||
|
||
public void Dispose() | ||
{ | ||
_disposable?.Dispose(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.CommandLine; | ||
using System.CommandLine.Parsing; | ||
using System.Windows; | ||
using MaterialDesignThemes.Wpf; | ||
|
||
namespace DemoClient; | ||
|
||
internal static class CommandLineOptions | ||
{ | ||
private static readonly Option<string> PageOption = | ||
new(aliases: new[] { "--page", "-p" }, | ||
getDefaultValue: () => "Home", | ||
description: "Sets the startup page of the Demo app."); | ||
|
||
private static readonly Option<FlowDirection> FlowDirectionOption = | ||
new(aliases: new[] { "--flowDirection", "-f" }, | ||
getDefaultValue: () => FlowDirection.LeftToRight, | ||
description: "Sets the startup flow direction of the Demo app."); | ||
|
||
private static readonly Option<BaseTheme> ThemeOption = | ||
new(aliases: new[] { "--theme", "-t" }, | ||
getDefaultValue: () => BaseTheme.Inherit, | ||
description: "Sets the startup theme of the Demo app."); | ||
|
||
private static readonly RootCommand RootCommand = | ||
new(description: "MaterialDesignInXamlToolkit Demo app command line options.") | ||
{ | ||
PageOption, | ||
FlowDirectionOption, | ||
ThemeOption | ||
}; | ||
|
||
public static (string? StartPage, FlowDirection FlowDirection, BaseTheme BaseTheme) ParseCommandLine(string[] args) | ||
{ | ||
ParseResult parseResult = RootCommand.Parse(args); | ||
|
||
return new( | ||
parseResult.GetValueForOption(PageOption), | ||
parseResult.GetValueForOption(FlowDirectionOption), | ||
parseResult.GetValueForOption(ThemeOption) | ||
); | ||
} | ||
} |
Oops, something went wrong.