Initial commit

This commit is contained in:
2025-05-10 20:37:54 +02:00
commit 51e854364f
16 changed files with 438 additions and 0 deletions

7
.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
.vs
**/bin
**/obj
node_modules
tools
Releases
local.json

26
.yo-rc.json Normal file
View File

@@ -0,0 +1,26 @@
{
"generator-dotnetnuke": {
"promptValues": {
"projType": "library",
"dnnVersion": "10.0.0",
"npm": true,
"projectname": "DnnConnect2025Demo",
"projectdescription": "DnnConnect2025Demo module",
"yourname": "Peter Donker",
"email": "peter@bring2mind.net",
"companyfull": "Bring2mind",
"companyshort": "Bring2mind",
"companyUrl": "bring2mind.net",
"dnnHost": "http://dnndev.me",
"dnnRoot": "DL/",
"namespace": "Bring2mind.DnnConnect2025Demo",
"Name": "SysMonitor",
"Namespace": "Bring2mind.DnnConnect2025Demo.SysMonitor",
"Separate": true
},
"Company": "Bring2mind",
"Project": "DnnConnect2025Demo",
"Namespace": "Bring2mind.DnnConnect2025Demo",
"Solution": "Bring2mind.DnnConnect2025Demo"
}
}

View File

@@ -0,0 +1,34 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Bring2mind.DnnConnect2025Demo.SysMonitor", "Server\SysMonitor\Bring2mind.DnnConnect2025Demo.SysMonitor.csproj", "{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Debug|Any CPU.Build.0 = Debug|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Debug|x64.ActiveCfg = Debug|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Debug|x64.Build.0 = Debug|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Debug|x86.ActiveCfg = Debug|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Debug|x86.Build.0 = Debug|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Release|Any CPU.ActiveCfg = Release|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Release|Any CPU.Build.0 = Release|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Release|x64.ActiveCfg = Release|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Release|x64.Build.0 = Release|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Release|x86.ActiveCfg = Release|Any CPU
{C6FCF8D1-0763-45E4-9A2F-507E11BA3D72}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

10
License.md Normal file
View File

@@ -0,0 +1,10 @@
Copyright (c) 2025 Bring2mind, All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,29 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AssemblyName>Bring2mind.DnnConnect2025Demo.SysMonitor</AssemblyName>
<TargetFramework>net48</TargetFramework>
<OutputPath>bin</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
<Authors>Peter Donker</Authors>
<Company>Bring2mind</Company>
<Product>dnnconnect2025demo</Product>
<Copyright>Copyright 2025 by Bring2mind</Copyright>
<PackageId>DnnConnect2025Demo</PackageId>
<AssemblyVersion>0.0.1</AssemblyVersion>
<FileVersion>0.0.1</FileVersion>
<Description>DnnConnect2025Demo module</Description>
<NeutralLanguage>en-US</NeutralLanguage>
<ApplicationIcon />
<OutputType>Library</OutputType>
<StartupObject />
<DebugType>Portable</DebugType>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="DotNetNuke.Abstractions" Version="10.0.0" />
<PackageReference Include="DotNetNuke.Core" Version="10.0.0" />
<PackageReference Include="DotNetNuke.WebApi" Version="10.0.0" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Web" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,13 @@
using DotNetNuke.Application;
using DotNetNuke.Web.Api;
using System.IO;
using System.Net.Http;
using System.Net;
using System.Web.Http;
namespace Bring2mind.DnnConnect2025Demo.SysMonitor
{
public class SysController
{
}
}

View File

@@ -0,0 +1,40 @@
using System.IO;
namespace Bring2mind.DnnConnect2025Demo.SysMonitor
{
internal class SysMethods
{
public static string GetWebConfigMd5(string webConfigPath)
{
var fileBytes = File.ReadAllBytes(webConfigPath);
var md5 = System.Security.Cryptography.MD5.Create();
var hash = md5.ComputeHash(fileBytes);
var md5String = System.BitConverter.ToString(hash).Replace("-", "").ToLower();
return md5String;
}
public static bool IsDirectoryWritable(string dirPath, bool throwIfFails = false)
{
try
{
using (FileStream fs = File.Create(
Path.Combine(
dirPath,
Path.GetRandomFileName()
),
1,
FileOptions.DeleteOnClose)
)
{ }
return true;
}
catch
{
if (throwIfFails)
throw;
else
return false;
}
}
}
}

View File

@@ -0,0 +1,16 @@
{
"projectType": "library",
"name": "Bring2mind_SysMonitor",
"friendlyName": "Bring2mind SysMonitor",
"description": "Bring2mind SysMonitor Library",
"packageName": "Bring2mind_SysMonitor",
"folder": "Bring2mind/SysMonitor",
"library": {},
"pathsAndFiles": {
"pathToAssemblies": "./bin",
"pathToScripts": "./Server/SqlScripts",
"assemblies": ["Bring2mind.DnnConnect2025Demo.SysMonitor.dll"],
"releaseFiles": [],
"zipName": "Bring2mind.SysMonitor"
}
}

2
build.ps1 Normal file
View File

@@ -0,0 +1,2 @@
dotnet run --project build/Build.csproj -- $args
exit $LASTEXITCODE;

20
build/Build.csproj Normal file
View File

@@ -0,0 +1,20 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8</TargetFramework>
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
<AssemblyVersion>0.0.1</AssemblyVersion>
<FileVersion>0.0.1</FileVersion>
<Product>dnnconnect2025demo</Product>
<Description>DnnConnect2025Demo module</Description>
<Company>Bring2mind</Company>
<Copyright>Copyright 2025 by Bring2mind</Copyright>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Cake.FileHelpers" Version="5.0.0" />
<PackageReference Include="Cake.Frosting" Version="2.0.0" />
<PackageReference Include="Cake.Npm" Version="1.0.0" />
<PackageReference Include="Dnn.CakeUtils" Version="2.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
</Project>

156
build/Program.cs Normal file
View File

@@ -0,0 +1,156 @@
using Cake.Common.Diagnostics;
using Cake.Common.IO;
using Cake.Common.Tools.MSBuild;
using Cake.Common.Tools.NuGet;
using Cake.Core;
using Cake.Core.Diagnostics;
using Cake.Core.IO;
using Cake.Frosting;
using Cake.Npm;
using Dnn.CakeUtils;
using Dnn.CakeUtils.Manifest;
using System;
using System.Collections.Generic;
using System.Linq;
public static class Program
{
public static int Main(string[] args)
{
return new CakeHost()
.InstallTool(new Uri("nuget:?package=NuGet.CommandLine&version=5.8.1"))
.UseContext<BuildContext>()
.Run(args);
}
}
public class BuildContext : FrostingContext
{
public Solution Solution { get; set; }
public MSBuildSettings BuildSettings { get; set; }
public BuildContext(ICakeContext context)
: base(context)
{
context.Environment.WorkingDirectory = context.Environment.WorkingDirectory.FullPath + "/../";
this.Solution = Solution.New(".\\package.json");
this.BuildSettings = new MSBuildSettings()
.SetConfiguration("Release")
.UseToolVersion(MSBuildToolVersion.VS2022)
.WithProperty("OutDir", new System.IO.DirectoryInfo(this.Solution.dnn.pathsAndFiles.pathToAssemblies).FullName);
}
}
[TaskName("AssemblyInfo")]
public sealed class AssemblyInfoTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
var ptrn = new string[] { "./**/AssemblyInfo.*" };
var files = context.GetFilesByPatterns(ptrn, context.Solution.dnn.pathsAndFiles.excludeFilter);
foreach (var file in files)
{
context.Information("Updating Assembly: {0}", file);
context.UpdateAssemblyInfo(context.Solution, file);
}
ptrn = new string[] { "./**/*.csproj" };
files = context.GetFilesByPatterns(ptrn, context.Solution.dnn.pathsAndFiles.excludeFilter);
foreach (var file in files)
{
context.Information("Updating Project File: {0}", file);
context.UpdateCsProjFile(context.Solution, file);
}
}
}
[TaskName("Build")]
[IsDependentOn(typeof(AssemblyInfoTask))]
public sealed class BuildTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
context.CleanDirectory(context.Solution.dnn.pathsAndFiles.pathToAssemblies);
context.NuGetRestore(context.Solution.dnn.pathsAndFiles.solutionFile);
context.MSBuild(context.Solution.dnn.pathsAndFiles.solutionFile, context.BuildSettings);
// context.NpmRunScript("build");
}
}
[TaskName("Package")]
[IsDependentOn(typeof(BuildTask))]
public sealed class PackageTask : FrostingTask<BuildContext>
{
public override void Run(BuildContext context)
{
var packageName = context.Solution.dnn.pathsAndFiles.zipName + "_" + context.Solution.version + "_Install.zip";
var packagePath = context.Solution.dnn.pathsAndFiles.packagesPath + "/" + packageName;
if (!System.IO.Directory.Exists(context.Solution.dnn.pathsAndFiles.packagesPath))
{
System.IO.Directory.CreateDirectory(context.Solution.dnn.pathsAndFiles.packagesPath);
}
if (System.IO.File.Exists(packagePath))
{
System.IO.File.Delete(packagePath);
}
var addedDlls = new List<string>();
foreach (var pfolder in context.Solution.dnn.projectFolders)
{
var p = context.Solution.dnn.projects[pfolder];
context.Information("Loading " + p.name);
var devPath = System.IO.Path.Combine(context.Solution.dnn.pathsAndFiles.devFolder, pfolder);
var releaseFiles = p.pathsAndFiles.releaseFiles == null ? context.Solution.dnn.pathsAndFiles.releaseFiles : p.pathsAndFiles.releaseFiles;
if (releaseFiles.Length > 0)
{
var excludeFiles = p.pathsAndFiles.excludeFilter;
if (excludeFiles == null)
{
excludeFiles = context.Solution.dnn.pathsAndFiles.excludeFilter;
}
else
{
excludeFiles = excludeFiles.Concat(context.Solution.dnn.pathsAndFiles.excludeFilter).ToArray();
}
context.CreateResourcesFile(new DirectoryPath(devPath), packagePath, p.packageName, releaseFiles, excludeFiles);
}
foreach (var a in p.pathsAndFiles.assemblies)
{
if (!addedDlls.Contains(a))
{
var files = context.GetFiles(context.Solution.dnn.pathsAndFiles.pathToAssemblies + "/" + a);
context.AddFilesToZip(packagePath, context.Solution.dnn.pathsAndFiles.pathToAssemblies, context.Solution.dnn.pathsAndFiles.packageAssembliesFolder, files, true);
addedDlls.Add(a);
}
}
if (!string.IsNullOrEmpty(p.pathsAndFiles.pathToScripts))
{
var files = context.GetFiles(p.pathsAndFiles.pathToScripts + "/*.SqlDataProvider");
context.AddFilesToZip(packagePath, p.pathsAndFiles.pathToScripts, context.Solution.dnn.pathsAndFiles.packageScriptsFolder + "/" + p.packageName, files, true);
}
}
if (context.Solution.dnn.pathsAndFiles.licenseFile != "")
{
var license = context.GetTextOrMdFile(System.IO.Path.GetFileNameWithoutExtension(context.Solution.dnn.pathsAndFiles.licenseFile));
if (license != "")
{
context.AddTextFileToZip(packagePath, license, "License.txt", true);
}
}
if (context.Solution.dnn.pathsAndFiles.releaseNotesFile != "")
{
var releaseNotes = context.GetTextOrMdFile(System.IO.Path.GetFileNameWithoutExtension(context.Solution.dnn.pathsAndFiles.releaseNotesFile));
if (releaseNotes != "")
{
context.AddTextFileToZip(packagePath, releaseNotes, "ReleaseNotes.txt", true);
}
}
var m = new Manifest(context.Solution);
context.AddXmlFileToZip(packagePath, m, context.Solution.name + ".dnn", true);
}
}
[TaskName("Default")]
[IsDependentOn(typeof(PackageTask))]
public class DefaultTask : FrostingTask
{
}

3
cake.config Normal file
View File

@@ -0,0 +1,3 @@
[settings]
skippackageversioncheck=true

7
nuget.config Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<packageSources>
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" protocolVersion="3" />
<add key="dotnet.myget.org" value="https://dotnet.myget.org/F/dotnet-core/api/v3/index.json" protocolVersion="3" />
</packageSources>
</configuration>

12
package-lock.json generated Normal file
View File

@@ -0,0 +1,12 @@
{
"name": "dnnconnect2025demo",
"version": "0.0.1",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "dnnconnect2025demo",
"version": "0.0.1"
}
}
}

56
package.json Normal file
View File

@@ -0,0 +1,56 @@
{
"name": "dnnconnect2025demo",
"version": "0.0.1",
"description": "DnnConnect2025Demo module",
"dnn": {
"projectFolders": [
"Server/SysMonitor"
],
"owner": {
"name": "Peter Donker",
"organization": "Bring2mind",
"url": "bring2mind.net",
"email": "peter@bring2mind.net"
},
"pathsAndFiles": {
"solutionFile": "./Bring2mind.DnnConnect2025Demo.sln",
"pathToAssemblies": "./bin",
"devSiteUrl": "",
"devSitePath": "",
"excludeFilter": [
"bin/",
"obj/",
"node_modules"
],
"licenseFile": "./License.md",
"releaseNotesFile": "",
"releaseFiles": [
"App_LocalResources/*.resx",
"**/*.ascx",
"**/*.cshtml",
"**/*.vbhtml",
"js/*.js",
"css/*.css",
"*.css",
"**/*.html",
"**/*.png",
"**/*.jpg",
"**/*.jpeg",
"**/*.gif",
"**/*.eot",
"**/*.svg",
"**/*.ttf",
"**/*.woff",
"**/*.woff2",
"*.txt"
],
"zipName": "Bring2mind.DnnConnect2025Demo"
}
},
"scripts": {
"build": "set NODE_ENV=production&&webpack --config Client/webpack.config.js",
"watch": "webpack --config Client/webpack.config.js --progress --watch",
"watch-server": "node watch.js"
},
"author": "Peter Donker"
}

7
tslint.json Normal file
View File

@@ -0,0 +1,7 @@
{
"extends": ["tslint:latest", "tslint:react"],
"rules": {
"object-literal-sort-keys": false,
"no-unused-variable": [true, "react"]
}
}