Skip to content

Commit

Permalink
service auto-start / remove log for release
Browse files Browse the repository at this point in the history
  • Loading branch information
simonchen committed Apr 5, 2024
1 parent 35b84ba commit 7bbc3de
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 2 additions & 0 deletions lf_daemon/ProcessExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,12 @@ private enum WTS_INFO_CLASS

public static void log(string msg)
{
#if (DEBUG)
string strAppPath = Path.Combine(Path.GetDirectoryName(System.Reflection.Assembly.GetEntryAssembly().Location), "lt_daemon.log");
FileStream fs = File.Open(strAppPath, FileMode.Append);
fs.Write(System.Text.UTF8Encoding.UTF8.GetBytes(msg+"\r\n"));
fs.Close();
#endif
}
/// <devdoc>
/// Gets the user token from the currently active session. Application must be running within the context of the LocalSystem Account.
Expand Down
8 changes: 4 additions & 4 deletions lf_daemon/createService.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@echo off
@rem Intended to run from the same directory (e.g. bin); build should copy to bin.
sc create "LenovoFanDaemon" binpath= "%~dp0lf_daemon.exe LenovoFan.exe" displayname= "LenovoFanDaemon"
sc start "LenovoFanDaemon"
@echo off
@rem Intended to run from the same directory (e.g. bin); build should copy to bin.
sc create "LenovoFanDaemon" binpath= "%~dp0lf_daemon.exe LenovoFan.exe" displayname= "LenovoFanDaemon" start=auto
sc start "LenovoFanDaemon"

0 comments on commit 7bbc3de

Please sign in to comment.