Skip to content

Instantly share code, notes, and snippets.

View yallie's full-sized avatar

Alexey Yakovlev yallie

View GitHub Profile
// Compile: "c:\Program Files (x86)\MSBuild\14.0\Bin\csc.exe" ParseCsv.cs /r:CsvHelper.dll
// Depends on: https://www.nuget.org/packages/CsvHelper/
// Source code: http://joshclose.github.io/CsvHelper/#change-log
using System;
using System.IO;
using System.Xml;
using System.Xml.Linq;
using CsvHelper;
@yallie
yallie / ipctest.cs
Created February 24, 2016 12:28
Sample IPC server for wrapping around the static class
// Compile this code using: csc ipctest.cs /r:Zyan.Communication.dll
// First run — starts server.
// Second run — starts client.
using System;
using System.Linq;
using System.Text;
using Zyan.Communication;
using Zyan.Communication.Protocols.Ipc;
@yallie
yallie / service.cs
Last active October 16, 2018 09:08
Topshelf-based service using Zyan Communication Framework
// Compile: csc service.cs /r:Zyan.Communication.dll /r:Topshelf.dll
//
// Usage:
// service.exe Run the console server
// service.exe install Install the service (requires admin rights)
// service.exe start Start the installed service (admin)
// service.exe stop Stops the service (admin)
// service.exe uninstall Uninstall the service (admin)
// service.exe client Run the console client
@yallie
yallie / example.cs
Created May 20, 2015 12:45
Async/await example for Zyan Communication Framework
// Compile this code using: csc example.cs /r:Zyan.Communication.dll
// First run — starts server.
// Second run — starts client.
using System;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Zyan.Communication;
using Zyan.Communication.Protocols.Tcp;
@yallie
yallie / test.cs
Created March 5, 2015 23:02
TcpEx bug #2414: disposing the host doesn't release the tcp port
// Tcp version works properly
// TcpEx version (commented lines) crashes
using System;
using System.Linq;
using Zyan.Communication;
using Zyan.Communication.Protocols.Tcp;
using Zyan.Communication.Security;
using Zyan.Communication.SessionMgmt;
@yallie
yallie / test.cs
Last active May 30, 2017 20:29
Zyan.com.de demo: using Disconnected and Reconnected events
// http://zyan.com.de
//
// Compile using: csc test.cs /r:Zyan.Communication.dll
//
// Disconnected/Reconnected events demo usage scenario.
//
// Start up test.exe several times.
// The first process is the server, the rest are clients.
// The server prints polling events to the console once in a second.
//
@yallie
yallie / mono-windows-output.txt
Last active August 29, 2015 13:56
LogicalCallContext bug in Mono 3.2.x
Original thread: 1
Current thread: 3
Value is null
Current thread: 5
Value is null
Current thread: 5
Value is null
@yallie
yallie / eftest3.cs
Last active December 31, 2015 23:59
Zyan+EF6+SqlCe4 concurrent data access example. Application source code (make sure you create a configuration file).
// Zyan + EF6 concurrent data access example.
// Written by Alexey Yakovlev <yallie@yandex.ru>
// Compile this code using:
//
// csc eftest3.cs /r:Zyan.Communication.dll /r:EntityFramework.dll /r:EntityFramework.SqlServerCompact.dll /r:System.ComponentModel.DataAnnotations.dll
//
// First run — starts server.
// Second run — starts client.
using System;
@yallie
yallie / eftest3.exe.config
Created December 20, 2013 23:38
Zyan+EF6+SqlCe4 concurrent data access example. Configuration file.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<entityFramework>
<providers>
<provider invariantName="System.Data.SqlServerCe.4.0" type="System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact" />
</providers>
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework">
@yallie
yallie / streams.cs
Created December 3, 2013 10:51
Demonstrating the usage of streams in Zyan Communication Framework.
// Compile this code using:
//
// csc streams.cs /r:Zyan.Communication.dll
//
// First run — starts server.
// Second run — starts client.
using System;
using System.IO;
using System.Net.Sockets;