1.0.0.20102102

Former-commit-id: db5a049d35df0ae54b49e9fc40337b305cba8756
Former-commit-id: 3970f3614d43c9f16a73f14318d8fdfcf8bbd3cb
TSXN
wanggang 5 years ago
parent c6b5d2ec69
commit 7916ee7563

@ -1,5 +1,6 @@
using System;
using System.IO;
using System.IO.Compression;
using System.Security.Cryptography;
using System.Text;
@ -11,24 +12,25 @@ namespace CheckSum
{
Console.InputEncoding = Encoding.UTF8;
Console.OutputEncoding = Encoding.UTF8;
using var sha = SHA512.Create();
while (true)
var file = string.Empty;
using var sha = SHA1.Create();
if (args.Length > 0)
{
file = args[0];
}
else
{
Console.WriteLine("input file name:");
var file = Console.ReadLine();
if (File.Exists(file))
{
Console.WriteLine(BitConverter.ToString(sha.ComputeHash(File.ReadAllBytes(file))).Replace("-", "").ToLower());
}
else
{
Console.WriteLine($"file {file} does not Exist");
}
var key = Console.ReadKey().Key;
if (key == ConsoleKey.Escape)
{
break;
}
file = Console.ReadLine();
}
if (File.Exists(file))
{
Console.WriteLine(BitConverter.ToString(sha.ComputeHash(File.ReadAllBytes(file))).Replace("-", ""));
ZipFile.ExtractToDirectory(file, Path.Combine(Directory.GetCurrentDirectory(), "IoTNode"), true);
}
else
{
Console.WriteLine($"file {file} does not Exist");
}
}
}

@ -1,4 +1,4 @@
using Application.Domain.Entities;
using Application.Domain.Entities;
using Application.Models;
using Infrastructure.Application;
using Infrastructure.Data;
@ -6,6 +6,7 @@ using Infrastructure.Extensions;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Primitives;
using System;
using System.Linq;
@ -33,6 +34,12 @@ namespace IoT.Shared.Areas.Admin.Controlls
{
throw new ArgumentNullException(nameof(model));
}
if (this.HttpContext.Request.Query.TryGetValue("query.organNumber", out StringValues value))
{
var organNumber = value.ToString();
query = query.WhereIf(!string.IsNullOrWhiteSpace(organNumber), o => o.Node.OrganNodes.Any(o => o.Organ.Number == organNumber));
}
return query
.WhereIf(model.Query.NodeId.HasValue, o => o.NodeId == model.Query.NodeId.Value)
.WhereIf(model.Query.ProductId.HasValue, o => o.ProductId == model.Query.ProductId.Value)

@ -44,11 +44,12 @@ namespace IoTCenter.Api.Controllers
}
[HttpPost]
public ActionResult GetNodes()
public ActionResult GetNodes(string organNumber)
{
try
{
var model = this._nodeRepo.ReadOnlyTable()
.WhereIf(!string.IsNullOrWhiteSpace(organNumber), o => o.OrganNodes.Any(on => on.Organ.Number == organNumber))
.Where(o => !o.Hidden)
.OrderBy(o => o.Name)
.ToList()

@ -15,17 +15,20 @@ namespace IoTCenter.Api.Controllers
public class ProductController : ControllerBase
{
private readonly IRepository<Product> _productRepo;
private readonly IRepository<Node> _nodeRepo;
private readonly IRepository<Device> _deviceRepo;
public ProductController(IRepository<Product> productRepo,
IRepository<Node> nodeRepo,
IRepository<Device> deviceRepo)
{
this._productRepo = productRepo;
this._nodeRepo = nodeRepo;
this._deviceRepo = deviceRepo;
}
[HttpPost]
public ActionResult GetProducts()
public ActionResult GetProducts(string organNumber)
{
try
{
@ -40,7 +43,9 @@ namespace IoTCenter.Api.Controllers
o.Number,
o.Image,
o.DisplayOrder,
Count = _deviceRepo.ReadOnlyTable().Count(d => d.ProductId == o.Id)
Count = _deviceRepo.ReadOnlyTable()
.WhereIf(!string.IsNullOrWhiteSpace(organNumber), o => o.Node.OrganNodes.Any(o => o.Organ.Number == organNumber))
.Count(d => d.ProductId == o.Id)
});
return Ok(model);
}
@ -52,18 +57,17 @@ namespace IoTCenter.Api.Controllers
}
[HttpPost]
public ActionResult GetProduct([Required(ErrorMessage = nameof(RequiredAttribute))] string number)
public ActionResult GetProduct([Required(ErrorMessage = nameof(RequiredAttribute))] string number, string organNumber)
{
try
{
var model = this._productRepo.ReadOnlyTable()
var model = this._nodeRepo.ReadOnlyTable()
.WhereIf(!string.IsNullOrWhiteSpace(organNumber), o => o.OrganNodes.Any(o => o.Organ.Number == organNumber))
.Where(o => o.Devices.Any(o => o.Product.Number == number))
.Include(o => o.Devices)
.ThenInclude(o => o.Data)
.Include(o => o.Devices)
.ThenInclude(o => o.Node)
.Where(o => o.Number == number)
.FirstOrDefault();
model.Devices = model.Devices.OrderBy(o => o.NodeId).ToList();
.SelectMany(o => o.Devices)
.OrderBy(o => o.NodeId).ToList();
return Ok(model);
}
catch (Exception ex)

@ -10,6 +10,7 @@ using System.Net;
using System.Net.Http;
using System.Runtime.InteropServices;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Xml;
@ -194,7 +195,7 @@ namespace IoTDameon
//更新程序
try
{
ZipFile.ExtractToDirectory(file, root, true);
ZipFile.ExtractToDirectory(file, root, Encoding.UTF8, true);
this.Log($"解压更新文件 {file} 到 {appPath}");
}
catch (Exception ex)
@ -226,11 +227,11 @@ namespace IoTDameon
private string GetCheckSum(string file)
{
using (var sha = SHA512.Create())
using (var sha = SHA1.Create())
{
using (var fs = File.OpenRead(file))
{
var checksum = BitConverter.ToString(sha.ComputeHash(fs)).Replace("-", "").ToLower();
var checksum = BitConverter.ToString(sha.ComputeHash(fs)).Replace("-", "");
return checksum;
}
}

@ -148,6 +148,14 @@ namespace IoTNode.DeviceServices.Onvif
this.UpdateData(deviceRepo, device, device.CreateData("ffmpeg.file", file, DeviceDataType.String, "ffmpeg路径", hidden: true));
this.UpdateData(deviceRepo, device, device.CreateData("ffmpeg.args", GetSetting("ffmpeg.args"), DeviceDataType.String, "ffmpeg.args", hidden: true));
}
else
{
if (device.Ip != ipCamera.Ip)
{
device.Ip = ipCamera.Ip;
deviceRepo.SaveChanges();
}
}
var profiles = this._onvifDeviceManagement.GetProfiles(ipCamera.DeviceUrl, ipCamera.MediaUrl);
var needAuth = false;
var hasAuth = false;

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.20101901")]
[assembly: AssemblyInformationalVersion("1.0.0.20102102")]

@ -1,4 +1,4 @@
using System.Reflection;
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0.20101601")]
[assembly: AssemblyInformationalVersion("1.0.0.20102001")]

@ -1,13 +1,20 @@
echo start:
Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
echo 'delete dist folder'
if(Test-Path dist)
{
Remove-Item ./dist/* -recurse -force
}
else
{
echo 'create dist folder'
mkdir ./dist;
}
echo 'copy src to dist'
Copy-Item ./src/* ./dist -recurse -Exclude @('.gitignore','start-dev.cmd','docker-compose.override.yml','nginx.development.conf')
echo 'remove temp file in dist folder'
Remove-Item ./dist/linux-x64/publish/docker/log/* -recurse -force
Remove-Item ./dist/linux-x64/publish/docker/data/* -recurse -force
Remove-Item ./dist/linux-x64/publish/apps/srs/objs/*.log -recurse -force
@ -17,6 +24,7 @@ Remove-Item ./dist/linux-x64/publish/apps/srs/objs/nginx/html/live/*.png -recurs
Remove-Item ./dist/linux-x64/publish/apps/srs/objs/nginx/html/live/*.m3u8 -recurse -force
Remove-Item ./dist/linux-x64/publish/apps/srs/objs/nginx/html/live/*.ts -recurse -force
echo 'copy project files to dist folder'
Copy-Item ../projects/WebMVC/wwwroot/* ./dist/linux-x64/publish/apps/WebMVC/wwwroot -recurse
Copy-Item ../projects/WebSPA/wwwroot/* ./dist/linux-x64/publish/apps/WebSPA/wwwroot -recurse
@ -26,4 +34,24 @@ dotnet publish ../projects/IoTCenter/IoTCenter.csproj -c Release -r linux-x64 -o
dotnet publish ../projects/IoTNode/IoTNode.csproj -c Release -r linux-arm64 -o ../publish/dist/linux-arm64/publish/apps/IoTNode
dotnet publish ../projects/IoTDameon/IoTDameon.csproj -c Release -r linux-arm64 -o ../publish/dist/linux-arm64/publish/apps/IoTDameon
dotnet publish ../projects/IoTDameon/IoTDameon.csproj -c Release -r linux-arm64 -o ../publish/dist/linux-arm64/publish/apps/IoTDameon
Add-Type -Assembly "System.IO.Compression.FileSystem"
echo 'create zip file'
$level = [System.IO.Compression.CompressionLevel]::Optimal
[System.IO.Compression.ZipFile]::CreateFromDirectory((Get-Item .).FullName+"/dist/linux-arm64/publish", (Get-Item .).FullName+"/dist/linux-arm64/publish.zip",$level,$true)
[System.IO.Compression.ZipFile]::CreateFromDirectory((Get-Item .).FullName+"/dist/linux-arm64/publish/apps/IoTNode", (Get-Item .).FullName+"/dist/linux-arm64/IoTNode.zip",$level,$true)
$zip=(Get-Item .).FullName+"/dist/linux-arm64/IoTNode.zip"
echo 'create xml file'
$v=[System.Diagnostics.FileVersionInfo]::GetVersionInfo((Get-Item .).FullName+"/dist/linux-arm64/publish/apps/IoTNode/IoTNode.dll").ProductVersion;
$sha1 = New-Object System.Security.Cryptography.SHA1CryptoServiceProvider
$checksum=[System.BitConverter]::ToString( $sha1.ComputeHash([System.IO.File]::ReadAllBytes($zip)))
$file = (Get-Item .).FullName+'/dist/linux-arm64/iotnode.xml'
$xml = New-Object System.Xml.XmlDocument
$xml.PreserveWhitespace = $true
$xml.LoadXml('<?xml version="1.0" encoding="utf-8" ?><app><version>'+$v+'</version><checksum>D71BD377E3A026C6E4A077554701E44C20B28798</checksum></app>')
$xml.Save($file)
echo end!
Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
Read-Host -Prompt "Press any key to continue"

@ -57,6 +57,6 @@ if uname -a | grep -q "NanoPC-T4"
# sed -i "s/managed=true/managed=false/g" /etc/NetworkManager/NetworkManager.conf
# cp -f /etc/network/interfaces /etc/network/interfaces.bk
# cp ~/publish/interfaces /etc/network/interfaces
nmcli connection modify 'Wired connection 1' connection.autoconnect yes ipv4.method manual ipv4.address 192.168.1.3/24 ipv4.gateway 192.168.1.1 ipv4.dns "223.5.5.5 119.29.29.29 180.76.76.76"
nmcli connection modify 'Wired connection 1' connection.autoconnect yes ipv4.method manual ipv4.address 192.168.100.3/24 ipv4.gateway 192.168.100.1 ipv4.dns "223.5.5.5 119.29.29.29 180.76.76.76"
nmcli c up 'Wired connection 1'
fi
Loading…
Cancel
Save