• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Administrator's Toolkit VS plugin


Commit MetaInfo

Revisión42bea37764f1ce9e875fe81362abeea72ee21e09 (tree)
Tiempo2022-01-31 13:30:53
Autormelchior <melchior@user...>
Commitermelchior

Log Message

Update for VS, Plus backup announcer

Updated references for VS1.16.0, Global backup announcer

Cambiar Resumen

Diferencia incremental

--- a/AdminToolkit/AdminToolkit.csproj
+++ b/AdminToolkit/AdminToolkit.csproj
@@ -20,7 +20,7 @@
2020 <ConsolePause>false</ConsolePause>
2121 <CustomCommands>
2222 <CustomCommands>
23- <Command type="AfterBuild" command="7z -tzip a AdminMod_${ProjectConfig}.zip" workingdir="${TargetDir}" />
23+ <Command type="AfterBuild" command="7z a -tzip -x!*.zip -aoa ${ProjectName}_${ProjectConfig}.zip" workingdir="${TargetDir}" />
2424 <Command type="BeforeClean" command="rm -f *.zip" workingdir="${TargetDir}" />
2525 </CustomCommands>
2626 </CustomCommands>
@@ -33,7 +33,7 @@
3333 <ConsolePause>false</ConsolePause>
3434 <CustomCommands>
3535 <CustomCommands>
36- <Command type="AfterBuild" command="7z -tzip a AdminMod_${ProjectConfig}.zip" workingdir="${TargetDir}" />
36+ <Command type="AfterBuild" command="7z a -tzip -x!*.zip -aoa ${ProjectName}_${ProjectConfig}.zip" workingdir="${TargetDir}" />
3737 <Command type="BeforeClean" command="rm -f *.zip" workingdir="${TargetDir}" />
3838 </CustomCommands>
3939 </CustomCommands>
--- a/AdminToolkit/Commands/BackupCycleCommand.cs
+++ b/AdminToolkit/Commands/BackupCycleCommand.cs
@@ -17,10 +17,9 @@ namespace AdminToolkit
1717 private long backupTickerID;
1818 private const string _timeFormat = @"d\D\ hh\H\ mm\M\ ss\S";
1919
20-
2120 private DateTimeOffset _lastBackupTime = DateTimeOffset.MinValue;
22-
2321 private string fileFilter;
22+ private FileSystemWatcher backupDirMonitor;
2423
2524 public BackupCycleCommand(ICoreServerAPI _serverAPI) : base(_serverAPI)
2625 {
@@ -31,7 +30,6 @@ namespace AdminToolkit
3130 this.Syntax = "enable / disable / delay [hours] / stats";
3231
3332
34-
3533 ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, ServerStarts);
3634 }
3735
@@ -148,7 +146,7 @@ namespace AdminToolkit
148146
149147
150148 private void BackupCycleHandler(float elapsed)
151- {
149+ {
152150 Logger.Event("Backup cycle triggered, elasped {0} @{1} Uptime", elapsed, ServerAPI.Server.ServerUptimeSeconds);
153151 //Peek at backup DIR, count files of the backup type
154152 var backupDir = new DirectoryInfo(GamePaths.Backups);
@@ -177,12 +175,6 @@ namespace AdminToolkit
177175
178176 this.backupTickerID = ServerAPI.Event.RegisterCallback(BackupCycleHandler, ( int )this.CachedConfiguration.BackupDelay.TotalMilliseconds);
179177 Logger.Notification("BackupCycle re-engaged, delay: {0} next time: {1}", this.CachedConfiguration.BackupDelay.ToString(_timeFormat), DateTimeOffset.UtcNow.Add(this.CachedConfiguration.BackupDelay).ToString("u"));
180-
181- //GlobalConstants.ConsoleGroup
182- /*
183- backupFileName = Path.GetFileName(server.Config.WorldConfig.SaveFileLocation).Replace(GlobalConstants.WorldSaveExtension, "") + "-" + string.Format("{0:yyyy-MM-dd_HH-mm-ss}", DateTime.Now) + GlobalConstants.WorldSaveExtension;
184- */
185-
186178 }
187179
188180 private void AlterTimeDelay(int delay)
@@ -281,10 +273,21 @@ namespace AdminToolkit
281273
282274 fileFilter = $"{worldNameTrimmed}-*{GlobalConstants.WorldSaveExtension}";
283275 Logger.VerboseDebug("File Filter: {0}", fileFilter);
276+ backupDirMonitor = new FileSystemWatcher(GamePaths.Backups, fileFilter);
277+ backupDirMonitor.Created += BackupFileCreation;
278+ backupDirMonitor.IncludeSubdirectories = false;
279+ backupDirMonitor.EnableRaisingEvents = true;
284280
285281 if (CachedConfiguration.Autobackup) { ToggleBackupCycle(true); }
286282 }
287- }
283+
284+ private void BackupFileCreation(object sender, FileSystemEventArgs e)
285+ {
286+ if (ServerAPI.Server.CurrentRunPhase == EnumServerRunPhase.RunGame) {
287+ ServerAPI.BroadcastMessageToAllGroups($"Backup procceeds concurrently... '{e.Name}'", EnumChatType.Notification);
288+ }
289+ }
290+}
288291
289292
290293 }
--- a/AdminToolkit/modinfo.json
+++ b/AdminToolkit/modinfo.json
@@ -2,11 +2,11 @@
22 "type": "code",
33 "name": "Administrator's Toolkit mod",
44 "ModID":"atk",
5- "description" : "Provides misc. Admin functions;\n admin listing, rules display (multi-lingual), auto-backup & much more.",
5+ "description" : "Provides Admin functions;\n admin listing, rules display (multi-lingual), auto-backup & more.",
66 "authors": ["Melchior", ],
7- "version": "0.3.7",
7+ "version": "0.3.8",
88 "dependencies": {
9- "game": "1.15.0-rc.3"
9+ "game": "1.16.0"
1010 },
1111 "requiredonclient":false,
1212 "website": "https://osdn.net/users/melchior/pf/admintoolkit/"