commit 51e854364fd6b96c3f4ea895c4022332d5638b1a Author: Peter Donker Date: Sat May 10 20:37:54 2025 +0200 Initial commit diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3caf149 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +.vs +**/bin +**/obj +node_modules +tools +Releases +local.json diff --git a/.yo-rc.json b/.yo-rc.json new file mode 100644 index 0000000..16942b3 --- /dev/null +++ b/.yo-rc.json @@ -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" + } +} diff --git a/Bring2mind.DnnConnect2025Demo.sln b/Bring2mind.DnnConnect2025Demo.sln new file mode 100644 index 0000000..72edcea --- /dev/null +++ b/Bring2mind.DnnConnect2025Demo.sln @@ -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 diff --git a/License.md b/License.md new file mode 100644 index 0000000..61fe959 --- /dev/null +++ b/License.md @@ -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. + diff --git a/Server/SysMonitor/Bring2mind.DnnConnect2025Demo.SysMonitor.csproj b/Server/SysMonitor/Bring2mind.DnnConnect2025Demo.SysMonitor.csproj new file mode 100644 index 0000000..8e43b4c --- /dev/null +++ b/Server/SysMonitor/Bring2mind.DnnConnect2025Demo.SysMonitor.csproj @@ -0,0 +1,29 @@ + + + Bring2mind.DnnConnect2025Demo.SysMonitor + net48 + bin + false + false + Peter Donker + Bring2mind + dnnconnect2025demo + Copyright 2025 by Bring2mind + DnnConnect2025Demo + 0.0.1 + 0.0.1 + DnnConnect2025Demo module + en-US + + Library + + Portable + + + + + + + + + \ No newline at end of file diff --git a/Server/SysMonitor/SysController.cs b/Server/SysMonitor/SysController.cs new file mode 100644 index 0000000..433a8c9 --- /dev/null +++ b/Server/SysMonitor/SysController.cs @@ -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 + { + } +} diff --git a/Server/SysMonitor/SysMethods.cs b/Server/SysMonitor/SysMethods.cs new file mode 100644 index 0000000..6c726e9 --- /dev/null +++ b/Server/SysMonitor/SysMethods.cs @@ -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; + } + } + } +} diff --git a/Server/SysMonitor/dnn.json b/Server/SysMonitor/dnn.json new file mode 100644 index 0000000..2517caa --- /dev/null +++ b/Server/SysMonitor/dnn.json @@ -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" + } +} diff --git a/build.ps1 b/build.ps1 new file mode 100644 index 0000000..a707719 --- /dev/null +++ b/build.ps1 @@ -0,0 +1,2 @@ +dotnet run --project build/Build.csproj -- $args +exit $LASTEXITCODE; \ No newline at end of file diff --git a/build/Build.csproj b/build/Build.csproj new file mode 100644 index 0000000..b7245ba --- /dev/null +++ b/build/Build.csproj @@ -0,0 +1,20 @@ + + + Exe + net8 + $(MSBuildProjectDirectory) + 0.0.1 + 0.0.1 + dnnconnect2025demo + DnnConnect2025Demo module + Bring2mind + Copyright 2025 by Bring2mind + + + + + + + + + \ No newline at end of file diff --git a/build/Program.cs b/build/Program.cs new file mode 100644 index 0000000..84b6d09 --- /dev/null +++ b/build/Program.cs @@ -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() + .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 +{ + 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 +{ + 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 +{ + 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(); + 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 +{ +} \ No newline at end of file diff --git a/cake.config b/cake.config new file mode 100644 index 0000000..db14da9 --- /dev/null +++ b/cake.config @@ -0,0 +1,3 @@ +[settings] +skippackageversioncheck=true + diff --git a/nuget.config b/nuget.config new file mode 100644 index 0000000..6cd2166 --- /dev/null +++ b/nuget.config @@ -0,0 +1,7 @@ + + + + + + + \ No newline at end of file diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..2a1fc79 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,12 @@ +{ + "name": "dnnconnect2025demo", + "version": "0.0.1", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "dnnconnect2025demo", + "version": "0.0.1" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..fe01156 --- /dev/null +++ b/package.json @@ -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" +} diff --git a/tslint.json b/tslint.json new file mode 100644 index 0000000..310a203 --- /dev/null +++ b/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": ["tslint:latest", "tslint:react"], + "rules": { + "object-literal-sort-keys": false, + "no-unused-variable": [true, "react"] + } +} \ No newline at end of file