Added NightAlert project for travel kit

This commit is contained in:
2021-06-10 14:39:06 -04:00
commit d38d9e3b7e
308 changed files with 35922 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
node_modules
test.xml

View File

@@ -0,0 +1,16 @@
{
"node": true,
"devel": true,
"indent": 2,
"maxerr": 50,
"newcap": true,
"nomen": true,
"plusplus": false,
"regexp": true,
"white": false,
"curly": true,
"eqnull": true,
"eqeqeq": true,
"undef": true
}

View File

@@ -0,0 +1,85 @@
module.exports = function (grunt) {
var
node_os = require('os'),
fs = require('fs'),
strip_json = require('strip-json-comments'),
config = JSON.parse(strip_json(String(fs.readFileSync('./config.json')))),
util = require('util'),
os = node_os.platform() === 'win32' ? 'win' : 'linux',
nuget_builds = [
{ "Name": "EngineIoClientDotNet.net35", "NuGetDir": "net35", "SourceDir": "net35", copyOnly: true },
{ "Name": "EngineIoClientDotNet.net40", "NuGetDir": "net40", "SourceDir": "net40", copyOnly: true },
{ "Name": "EngineIoClientDotNet.net45", "NuGetDir": "net45", "SourceDir": "net45", copyOnly: true },
{ "Name": "EngineIoClientDotNet.netstandard1.3", "NuGetDir": "netstandard1.3", "SourceDir": "netstandard1.3", copyOnly: true },
];
grunt.log.writeln(util.inspect(config));
grunt.log.writeln( 'os = "%s"', os );
grunt.loadTasks('./tasks');
grunt.initConfig({
os: os,
config: config,
//msbuild_configuration: 'Debug',
msbuild_configuration: 'Release',
nuget_builds: nuget_builds,
release_path: './../Releases/<%= config.version %>/',
working_path: './../Working/',
server_path: '../TestServer/',
shell: {
exec: {
options: {
stdout: true,
stderr: true
}
}
},
jshint: {
options: {
jshintrc: true,
},
target: [
'Gruntfile.js',
'<%= server_path %>server.js',
'tasks/**/*.js'
]
},
clean: {
release: ['<%= release_path %>/*'],
working: ['<%= working_path %>/*'],
options: { force: true }
},
copy: {
release: {
files: [
{
expand: true,
cwd: './../EngineIoClientDotNet/bin/Release',
src: '*',
dest: '<%= release_path %>/net45'
}
]
},
release_mono: {
files: [
{
expand: true,
cwd: './../EngineIoClientDotNet_Mono/bin/Release',
src: '*',
dest: '<%= release_path %>/mono'
}
]
},
}
});
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.registerTask('default', ['jshint', 'installNpm', 'nuget', 'buildClient', 'buildTest', 'startServer', 'testClient']);
grunt.registerTask('test', ['jshint', 'buildClient', 'buildTest', 'testClient']);
grunt.registerTask('makeNuget', ['jshint','clean:working','createNugetPackage']);
};

View File

@@ -0,0 +1,13 @@
{
"version": "1.0.5",
"server": {
"port": 80,
"ssl_port": 443,
"hostname": "testme.quobject.com"
},
"win": {
"powershell": "C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe",
"msbuild": "C:/Windows/Microsoft.NET/Framework/v4.0.30319/msbuild.exe",
"nuget": "C:/ProgramData/chocolatey/bin/nuget.exe"
}
}

View File

@@ -0,0 +1,24 @@
{
"name": "EngineIoClientDotNet",
"version": "0.1.0",
"author": "Matthias Ludwig",
"description": "Engine.IO Client Library for .Net",
"repository": {
"type": "git",
"url": ""
},
"readme": "This is the Engine.IO Client Library for C#, which is ported from the [JavaScript client](https://github.com/LearnBoost/engine.io-client).",
"devDependencies": {
"grunt": "^1.0.1",
"grunt-shell": "^2.1.0",
"grunt-contrib-jshint": "^1.1.0"
},
"dependencies": {
"string": "^3.3.3",
"string-formatter": "^0.2.5",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-copy": "^1.0.0",
"rimraf": "^2.6.1",
"strip-json-comments": "^2.0.1"
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="xunit.runner.visualstudio" version="2.0.0" targetFramework="net40" />
</packages>

View File

@@ -0,0 +1,70 @@
module.exports = function (grunt) {
grunt.registerTask('buildClient',
'build cs modules', function () {
var
fs = require('fs'),
S = require('string'),
string = require('string-formatter'),
os = grunt.config('os'),
config = grunt.config('config'),
configuration = grunt.config('msbuild_configuration'),
output_path_base = 'bin\\'+ configuration +'\\',
nuget_builds = grunt.config('nuget_builds'),
tasks = [],
clean_format = os === 'win' ? '{0} start-process ' +
'-NoNewWindow ' +
//'-WindowStyle Normal ' + //-WindowStyle (Hidden | Normal) | -NoNewWindow
'-FilePath {1} ' +
'-ArgumentList \' {2} /t:clean;Rebuild /p:Configuration={3} /p:OutputPath={4} \' ' :
'{0} {1} /t:Rebuild /p:Configuration={2} ',
//build_format = os === 'win' ? '{0} start-process ' +
// '-NoNewWindow ' +
// //'-WindowStyle Normal ' + //-WindowStyle (Hidden | Normal) | -NoNewWindow
// '-FilePath {1} ' +
// '-ArgumentList \' {2} /p:Configuration={3} \' ' :
// '{0} {1} /p:Configuration={2}',
i;
function addBuildWithTitle(title, dir, copyOnly) {
var
dir_path = string.format('{0}/../../Src/{1}/', __dirname, title),
csproj = string.format('{0}{1}.csproj', dir_path, title),
output_path = output_path_base + dir +'\\',
clean = os === 'win' ? string.format(clean_format, config.win.powershell, config.win.msbuild, csproj, configuration, output_path) :
string.format(clean_format, config.linux.msbuild, csproj, configuration),
//build = os === 'win' ? string.format(build_format, config.win.powershell, config.win.msbuild, csproj, configuration ):
// string.format(build_format, config.linux.msbuild, csproj, configuration),
template_file_content = fs.readFileSync('./templates/AssemblyInfo.cs');
//template_file_content = S(template_file_content).replaceAll('@TITLE@', title).s;
template_file_content = S(template_file_content).replaceAll('@VERSION@', config.version).s;
//grunt.log.writeln('template_file_content = "%s"', template_file_content);
fs.writeFileSync(string.format('{0}Properties/AssemblyInfo.cs', dir_path), template_file_content);
if (!copyOnly) {
tasks.push(clean);
}
}
for (i = 0; i < nuget_builds.length; i++) {
if (nuget_builds[i].Name !== 'EngineIoClientDotNet.netstandard1.3') {
addBuildWithTitle(nuget_builds[i].Name, nuget_builds[i].NuGetDir, nuget_builds[i].copyOnly);
}
}
grunt.log.writeln('tasks = %s', JSON.stringify(tasks));
grunt.config('shell.exec.command', tasks.join('&&'));
grunt.task.run('shell');
if (configuration === 'Release') {
//grunt.task.run('clean:release');
if (os === 'win') {
grunt.task.run('copy:release');
} else {
grunt.task.run('copy:release_mono');
}
}
});
};

View File

@@ -0,0 +1,56 @@
module.exports = function (grunt) {
grunt.registerTask('buildTest',
'test modules', function () {
var
fs = require('fs'),
S = require('string'),
string = require('string-formatter'),
os = grunt.config('os'),
config = grunt.config('config'),
configuration = grunt.config('msbuild_configuration'),
tasks = [],
clean_format = os === 'win' ? '{0} start-process ' +
'-NoNewWindow ' +
//'-WindowStyle Normal ' + //-WindowStyle (Hidden | Normal) | -NoNewWindow
'-FilePath {1} ' +
'-ArgumentList \' {2} /t:clean /p:Configuration={3} \' ' :
'{0} {1} /t:clean /p:Configuration={2}',
build_format = os === 'win' ? '{0} start-process ' +
'-NoNewWindow ' +
//'-WindowStyle Normal ' + //-WindowStyle (Hidden | Normal) | -NoNewWindow
'-FilePath {1} ' +
'-ArgumentList \' {2} /p:Configuration={3} \' ' :
'{0} {1} /p:Configuration={2}';
function addBuildWithTitle(title) {
var
dir_path = string.format('{0}/../../Src/{1}/', __dirname,title),
csproj = string.format('{0}{1}.csproj', dir_path, title),
clean = os === 'win' ? string.format(clean_format, config.win.powershell, config.win.msbuild, csproj, configuration ):
string.format(clean_format, config.linux.msbuild, csproj, configuration),
build = os === 'win' ? string.format(build_format, config.win.powershell, config.win.msbuild, csproj, configuration ):
string.format(build_format, config.linux.msbuild, csproj, configuration),
template_file_content = fs.readFileSync('./templates/AssemblyInfo.cs');
template_file_content = S(template_file_content).replaceAll('@VERSION@', config.version).s;
//grunt.log.writeln('template_file_content = "%s"', template_file_content);
fs.writeFileSync(string.format('{0}Properties/AssemblyInfo.cs', dir_path), template_file_content);
tasks.push(clean);
tasks.push(build);
}
if (os === 'win') {
addBuildWithTitle('EngineIoClientDotNet.Tests.net45');
} else {
addBuildWithTitle('EngineIoClientDotNet.Tests.mono');
}
grunt.log.writeln('tasks = %s', JSON.stringify(tasks));
grunt.config('shell.exec.command', tasks.join('&&'));
grunt.task.run('shell');
});
};

View File

@@ -0,0 +1,98 @@
module.exports = function (grunt) {
grunt.registerTask('createNugetPackage',
'create package ', function () {
var
fs = require('fs'),
S = require('string'),
string = require('string-formatter'),
os = grunt.config('os'),
config = grunt.config('config'),
working_path = grunt.config('working_path'),
package_path = working_path + '/NuGet/',
package_lib_path = working_path + '/NuGet/lib/',
//configuration = grunt.config('msbuild_configuration'),
configuration = grunt.config('msbuild_configuration'),
output_path_base = 'bin\\' + configuration + '\\',
nuget_builds = grunt.config('nuget_builds'),
nuget_path = os === 'win' ?
config.win.nuget : config.linux.nuget,
dst_path,
template_file_content,
i,
tasks = [];
//function createPackageWithTitle(title) {
// var
// dir_path = string.format('{0}/../../{1}/', __dirname, title),
// csproj = string.format('{0}{1}.csproj', dir_path, title),
// pack = string.format('{0} pack {1}', nuget_path, csproj);
// tasks.push(pack);
//}
if (os !== 'win') {
return;
}
if (configuration !== 'Release') {
grunt.log.writeln('wrong configuration = ' + configuration);
return;
}
//createPackageWithTitle('EngineIoClientDotNet');
if (! fs.existsSync(working_path)) {
fs.mkdirSync(working_path);
fs.mkdirSync(package_path);
fs.mkdirSync(package_lib_path);
}
if (!fs.existsSync(package_path)) {
fs.mkdirSync(package_path);
fs.mkdirSync(package_lib_path);
}
if (!fs.existsSync(package_lib_path)) {
fs.mkdirSync(package_lib_path);
}
for (i = 0; i < nuget_builds.length; i++) {
dst_path = package_lib_path + nuget_builds[i].NuGetDir + '/';
//files = fs.readdirSync(dst_path);
grunt.log.writeln(string.format('dst_path={0}', dst_path));
fs.mkdirSync(dst_path);
}
template_file_content = fs.readFileSync('./templates/EngineIoClientDotNet.nuspec');
template_file_content = S(template_file_content).replaceAll('@VERSION@', config.version).s;
fs.writeFileSync(string.format('{0}EngineIoClientDotNet.nuspec', package_path), template_file_content);
function addBuildWithTitle(title, destsubdir, srcsubdir) {
var src_path = string.format('{0}/../../Src/{1}/{2}{3}/', __dirname, title, output_path_base, srcsubdir);
var dst_path = package_lib_path + destsubdir + '/';
var filename = 'EngineIoClientDotNet.dll';
var src_file = string.format('{0}{1}', src_path, filename);
var dst_file = string.format('{0}EngineIoClientDotNet.dll', dst_path);
grunt.log.writeln(string.format('src_file={0} dst_file={1}', src_file, dst_file));
fs.writeFileSync(dst_file, fs.readFileSync(src_file));
//src_file = src_path + string.format('{0}.xml', title);
//dst_file = string.format('{0}EngineIoClientDotNet.xml', dst_path);
//grunt.log.writeln(string.format('src_file={0} dst_file={1}', src_file, dst_file));
//fs.writeFileSync(dst_file, fs.readFileSync(src_file));
}
for (i = 0; i < nuget_builds.length; i++) {
addBuildWithTitle(nuget_builds[i].Name, nuget_builds[i].NuGetDir, nuget_builds[i].SourceDir);
}
tasks.push('C:/WINDOWS/System32/WindowsPowerShell/v1.0/powershell.exe pwd');
tasks.push(string.format('{0} pack EngineIoClientDotNet.nuspec', config.win.nuget));
grunt.log.writeln('tasks = %s', JSON.stringify(tasks));
grunt.config('shell.exec.options.execOptions.cwd', package_path);
grunt.config('shell.exec.command', tasks.join('&&'));
grunt.task.run('shell');
});
};

View File

@@ -0,0 +1,32 @@
module.exports = function (grunt) {
grunt.registerTask('installNpm',
'install node modules', function () {
var
string = require('string-formatter'),
server_path2 = grunt.config('server_path'),
os = grunt.config('os'),
config = grunt.config('config'),
win_pwd_command = string.format('{0} pwd', config.win.powershell);
grunt.log.writeln('server_path = "%s"', server_path2);
grunt.log.writeln('win_pwd_command = "%s"', win_pwd_command);
if (os === 'win') {
grunt.config('shell.exec.options.execOptions.cwd', '<%= server_path %>');
grunt.config('shell.exec.command', [win_pwd_command,
'npm install'].join('&&'));
grunt.task.run('shell');
} else {
grunt.config('shell.exec.options.execOptions.cwd', '<%= server_path %>');
grunt.config('shell.exec.command', ['pwd', 'npm install'].join('&&'));
grunt.task.run('shell');
}
});
};

View File

@@ -0,0 +1,40 @@
module.exports = function (grunt) {
grunt.registerTask('nuget',
'get nuget assemblies', function () {
var
//fs = require('fs'),
//S = require('string'),
string = require('string-formatter'),
os = grunt.config('os'),
config = grunt.config('config'),
//configuration = grunt.config('msbuild_configuration'),
nuget_builds = grunt.config('nuget_builds'),
nuget_path = os === 'win' ?
config.win.nuget : config.linux.nuget,
format_str = os === 'win' ?
'{0} restore "{1}"' :
'mono --runtime=v4.0.30319 {0} restore {1}',
tasks = [],
i;
function restorePackagesWithTitle(title) {
var
sln = string.format('{0}/../../Src/{1}/{2}.sln',__dirname, title,title),
restore = string.format(format_str, nuget_path, sln);
tasks.push(restore);
}
if (os === 'win') {
for (i = 0; i < nuget_builds.length; i++) {
restorePackagesWithTitle(nuget_builds[i].Name);
}
}
grunt.log.writeln('tasks = %s', JSON.stringify(tasks));
grunt.config('shell.exec.command', tasks.join('&&'));
grunt.task.run('shell');
});
};

View File

@@ -0,0 +1,44 @@
module.exports = function (grunt) {
grunt.registerTask('startServer',
'install node modules', function () {
var
server_path = grunt.config('server_path'),
os = grunt.config('os'),
string = require('string-formatter'),
config = grunt.config('config'),
tasks = [],
start,
pwd;
grunt.log.writeln('server_path = "%s"', server_path);
if (os === 'win') {
start = '{0} start-process ' +
'-NoNewWindow ' +
//'-WindowStyle Normal ' + //-WindowStyle (Hidden | Normal) | -NoNewWindow
'-FilePath node ' +
'-ArgumentList \' server.js \' ';
start = string.format(start, config.win.powershell);
pwd = string.format('{0} pwd',config.win.powershell);
tasks.push(pwd);
tasks.push(start);
grunt.log.writeln('tasks = %s', JSON.stringify(tasks));
grunt.config('shell.exec.options.execOptions.cwd', '<%= server_path %>');
grunt.config('shell.exec.command', tasks.join('&&'));
grunt.task.run('shell');
} else {
grunt.config('shell.exec.options.execOptions.cwd', '<%= server_path %>');
grunt.config('shell.exec.command', ['pwd', 'node server.js'].join('&&'));
grunt.task.run('shell');
}
});
};

View File

@@ -0,0 +1,39 @@
module.exports = function (grunt) {
grunt.registerTask('testClient',
'test cs', function () {
var
string = require('string-formatter'),
os = grunt.config('os'),
config = grunt.config('config'),
tasks = [],
configuration = grunt.config('msbuild_configuration'),
test_format_str = os === 'win' ?
'{0}/xunit.console.exe {1} -nunit test.xml -parallel none' :
'mono {0}/xunit.console.clr4.exe {1}',
xunit_path = os === 'win' ?
config.win.xunit_path : config.linux.xunit_path;
function addTestDllWithTitle(title) {
var
dir_path = string.format('{0}/../../Src/{1}/', __dirname, title),
test_dll = string.format('{0}bin/{1}/{2}.dll', dir_path, configuration, title);
tasks.push( string.format(test_format_str,xunit_path, test_dll) );
}
if (os === 'win') {
addTestDllWithTitle('EngineIoClientDotNet.Tests.net45');
} else {
addTestDllWithTitle('EngineIoClientDotNet.Tests.mono');
}
grunt.log.writeln('tasks = %s', JSON.stringify(tasks));
grunt.config('shell.exec.command', tasks.join('&&'));
grunt.task.run('shell');
});
};

View File

@@ -0,0 +1,35 @@
using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EngineIoClientDotNet")]
[assembly: AssemblyDescription("Engine.IO Client Library for .Net")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Quobject Software")]
[assembly: AssemblyProduct("EngineIoClientDotNet")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a95e75cd-35e6-4e88-9e22-631e3fd01546")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("@VERSION@")]
[assembly: AssemblyFileVersion("@VERSION@")]

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>EngineIoClientDotNet</id>
<version>@VERSION@</version>
<title>EngineIoClientDotNet</title>
<authors>Matthias Ludwig</authors>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<dependencies>
<group targetFramework="netcore45">
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
<group targetFramework="portable-wpa81+wp81">
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
<group targetFramework="net35">
<dependency id="WebSocket4Net" version="0.14.1" />
<dependency id="Newtonsoft.Json" version="8.0.1" />
<dependency id="System.Threading.Tasks.Unofficial" version="3.1.0" />
</group>
<group targetFramework="net40">
<dependency id="WebSocket4Net" version="0.14.1" />
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
<group targetFramework="net45">
<dependency id="WebSocket4Net" version="0.14.1" />
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
<group targetFramework="windowsphone8">
<dependency id="WebSocket4Net" version="0.12.0" />
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
<group targetFramework="monoandroid10">
<dependency id="WebSocket4Net" version="0.14.1" />
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
<group targetFramework="xamarinios10">
<dependency id="WebSocket4Net" version="0.14.1" />
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
<group targetFramework="Xamarin.Mac20">
<dependency id="WebSocket4Net" version="0.14.1" />
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
<group targetFramework="monotouch10">
<dependency id="WebSocket4Net" version="0.14.1" />
<dependency id="Newtonsoft.Json" version="8.0.1" />
</group>
</dependencies>
<projectUrl>https://github.com/Quobject/EngineIoClientDotNet/</projectUrl>
<description>This is the Engine.IO Client Library for C#.</description>
<summary>This library supports all of the features the JS client does, including events, options and upgrading transport. EngineIoClientDotNet has a similar api to those of the JavaScript client.</summary>
<tags>engine.io.client</tags>
<frameworkAssemblies>
<frameworkAssembly assemblyName="System.Web" targetFramework="net45" />
</frameworkAssemblies>
</metadata>
</package>

View File

@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>EngineIoClientDotNet</id>
<version>@VERSION@</version>
<title>EngineIoClientDotNet</title>
<authors>Matthias Ludwig</authors>
<licenseUrl>http://opensource.org/licenses/MIT</licenseUrl>
<requireLicenseAcceptance>true</requireLicenseAcceptance>
<dependencies>
<group targetFramework="net35">
<dependency id="WebSocket4Net" version="0.15.1" />
<dependency id="SuperSocket.ClientEngine.Core" version="0.9.0" />
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="System.Threading.Tasks.Unofficial" version="3.1.0" />
</group>
<group targetFramework="net40">
<dependency id="WebSocket4Net" version="0.15.1" />
<dependency id="SuperSocket.ClientEngine.Core" version="0.9.0" />
<dependency id="Newtonsoft.Json" version="9.0.1" />
</group>
<group targetFramework="net45">
<dependency id="WebSocket4Net" version="0.15.1" />
<dependency id="SuperSocket.ClientEngine.Core" version="0.9.0" />
<dependency id="System.Collections.Immutable" version="1.4.0" />
<dependency id="Newtonsoft.Json" version="9.0.1" />
</group>
<group targetFramework="netstandard1.3">
<dependency id="WebSocket4Net" version="0.15.1" />
<dependency id="System.Collections.Immutable" version="1.4.0" />
<dependency id="Newtonsoft.Json" version="9.0.1" />
<dependency id="System.Net.Requests" version="4.3.0" />
</group>
</dependencies>
<projectUrl>https://github.com/Quobject/EngineIoClientDotNet/</projectUrl>
<description>This is the Engine.IO Client Library for C#.</description>
<summary>This library supports all of the features the JS client does, including events, options and upgrading transport. EngineIoClientDotNet has a similar api to those of the JavaScript client.</summary>
<tags>engine.io.client</tags>
</metadata>
</package>