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

View File

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

View File

@ -1,3 +1,3 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<configuration> <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); var app = require(name);
// load the service // load the service