Change the target framework version to 4.8, and renaming some functions

This commit is contained in:
Namhyeon Go 2024-07-26 17:24:56 +09:00
parent 3b18896564
commit 4a33238d7e
4 changed files with 12 additions and 6 deletions

View File

@ -117,7 +117,7 @@ namespace WelsonJS.Service
scriptControl.AddCode(scriptText);
// initialize
Log(InvokeScriptMethod("initializeService", scriptName, "start"));
Log(DispatchServiceEvent(scriptName, "start"));
}
catch (Exception ex)
{
@ -144,7 +144,7 @@ namespace WelsonJS.Service
try
{
Log(InvokeScriptMethod("initializeService", scriptName, "stop"));
Log(DispatchServiceEvent(scriptName, "stop"));
if (scriptControl != null)
{
scriptControl.Reset();
@ -163,7 +163,7 @@ namespace WelsonJS.Service
{
try
{
Log(InvokeScriptMethod("initializeService", scriptName, "elapsedTime"));
Log(DispatchServiceEvent(scriptName, "elapsedTime"));
}
catch (Exception ex)
{
@ -171,6 +171,11 @@ namespace WelsonJS.Service
}
}
private string DispatchServiceEvent(string name, string eventType)
{
return InvokeScriptMethod("dispatchServiceEvent", name, eventType);
}
private string InvokeScriptMethod(string methodName, params object[] parameters)
{
if (scriptControl != null)
@ -185,6 +190,7 @@ namespace WelsonJS.Service
return "void";
}
private void Log(string message)
{
using (StreamWriter writer = new StreamWriter(logFilePath, true))

View File

@ -8,7 +8,7 @@
<OutputType>WinExe</OutputType>
<RootNamespace>WelsonJS.Service</RootNamespace>
<AssemblyName>WelsonJS.Service</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />

View File

@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/></startup></configuration>

2
app.js
View File

@ -589,7 +589,7 @@ function initializeWindow(name, args, w, h) {
}
}
function initializeService(name, eventType) {
function dispatchServiceEvent(name, eventType) {
var app = require(name);
// load the service