Pārlūkot izejas kodu

Renamed DbReload to PRSRecovery
Included PRSRecovery in PRS App

frogsoftware 1 nedēļu atpakaļ
vecāks
revīzija
c8ed8dd2db

+ 0 - 16
DbReload/DbReload.sln

@@ -1,16 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 12.00
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbReload", "DbReload\DbReload.csproj", "{23B04B8E-64E5-460C-A292-BBBDAE4F504A}"
-EndProject
-Global
-	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug|Any CPU = Debug|Any CPU
-		Release|Any CPU = Release|Any CPU
-	EndGlobalSection
-	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{23B04B8E-64E5-460C-A292-BBBDAE4F504A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{23B04B8E-64E5-460C-A292-BBBDAE4F504A}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{23B04B8E-64E5-460C-A292-BBBDAE4F504A}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{23B04B8E-64E5-460C-A292-BBBDAE4F504A}.Release|Any CPU.Build.0 = Release|Any CPU
-	EndGlobalSection
-EndGlobal

+ 0 - 7
DbReload/global.json

@@ -1,7 +0,0 @@
-{
-  "sdk": {
-    "version": "8.0.0",
-    "rollForward": "latestMinor",
-    "allowPrerelease": false
-  }
-}

+ 0 - 0
DbReload/DbReload/App.xaml → prs.recovery/App.xaml


+ 0 - 0
DbReload/DbReload/App.xaml.cs → prs.recovery/App.xaml.cs


+ 0 - 0
DbReload/DbReload/AssemblyInfo.cs → prs.recovery/AssemblyInfo.cs


+ 4 - 0
DbReload/DbReload/MainViewModel.cs → prs.recovery/MainViewModel.cs

@@ -1,7 +1,11 @@
+using System;
+using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Data.SQLite;
 using System.IO;
+using System.Linq;
 using System.Reflection;
+using System.Threading.Tasks;
 using System.Windows.Threading;
 using CommunityToolkit.Mvvm.ComponentModel;
 using CommunityToolkit.Mvvm.Input;

+ 1 - 1
DbReload/DbReload/MainWindow.xaml → prs.recovery/MainWindow.xaml

@@ -5,7 +5,7 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:DbReload"
         mc:Ignorable="d"
-        Title="MainWindow" Height="450" Width="800">
+        Title="PRS Recovery Utility" Height="450" Width="800">
     <Window.DataContext>
         <local:MainViewModel />
     </Window.DataContext>

+ 0 - 0
DbReload/DbReload/MainWindow.xaml.cs → prs.recovery/MainWindow.xaml.cs


+ 2 - 0
DbReload/DbReload/DbReload.csproj → prs.recovery/PRSRecovery.csproj

@@ -6,6 +6,8 @@
         <Nullable>enable</Nullable>
         <ImplicitUsings>enable</ImplicitUsings>
         <UseWPF>true</UseWPF>
+        <RootNamespace>prs.recovery</RootNamespace>
+        <ApplicationIcon>recovery.ico</ApplicationIcon>
     </PropertyGroup>
 
     <ItemGroup>

+ 0 - 0
DbReload/DbReload/SqlTokenizer.cs → prs.recovery/SqlTokenizer.cs


BIN
prs.recovery/recovery.ico


+ 21 - 1
prs.server/Forms/ServerGrid.cs

@@ -50,6 +50,8 @@ public class ServerGrid : DynamicGrid<Server>
     private Button _channelButton;
 
     private Button _statusButton;
+    
+    private Button _recoveryButton;
 
     private CancellationTokenSource cancel = new CancellationTokenSource();
 
@@ -73,8 +75,18 @@ public class ServerGrid : DynamicGrid<Server>
         _channelButton = AddButton("", Properties.Resources.autoupdate.AsBitmapImage(), "Change Update Channel", EditUpdateChannel_Click);
         _statusButton = AddButton("", Properties.Resources.secure.AsBitmapImage(), "Check Service Status", ShowServiceStatus);
 
+        if (File.Exists(Path.Combine(BaseDirectory(), "PRSRecovery", "PRSRecovery.exe")))
+        {
+            _recoveryButton = AddButton("", ImageUtils.SvgToBitmapImage("/Resources/recovery.svg"),
+                "Launch Recovery Utility", LaunchRecovery);
+        }
+        
+        
+
     }
 
+    private static string BaseDirectory() => Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) ?? "";
+
     protected override void DoReconfigure(DynamicGridOptions options)
     {
         base.DoReconfigure(options);
@@ -591,7 +603,15 @@ public class ServerGrid : DynamicGrid<Server>
     #endregion
 
     #region Server Configuration
-
+    
+    private bool LaunchRecovery(Button button, CoreRow[] rows)
+    {
+        var _mobileApp = System.IO.Path.Combine(BaseDirectory(), "PRSRecovery", "PRSRecovery.exe");
+        var _info = new ProcessStartInfo(_mobileApp);
+        Process.Start(_info);
+        return false;
+    }
+    
     private bool EditUpdateChannel_Click(Button arg1, CoreRow[] arg2)
     {
         var settings = new LocalConfiguration<AutoUpdateSettings>().Load();

+ 4 - 0
prs.server/PRSServer.csproj

@@ -187,6 +187,10 @@
         <Resource Include="Resources\upload.png">
             <CopyToOutputDirectory>Always</CopyToOutputDirectory>
         </Resource>
+        <None Remove="Resources\rcovery.svg" />
+        <Resource Include="Resources\recovery.svg">
+          <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+        </Resource>
     </ItemGroup>
 
     <ItemGroup>

+ 1 - 0
prs.server/PRSServer.iss

@@ -51,6 +51,7 @@ Type: files; Name: {userappdata}\PRSServer\version.txt
 Source: "{#Dependency_Path_NetCoreCheck}netcorecheck.exe"; Flags: dontcopy noencryption
 Source: "{#Dependency_Path_NetCoreCheck}netcorecheck_x64.exe"; Flags: dontcopy noencryption
 Source: "bin\{#ReleaseType}\net8.0-windows\*.*"; Excludes: "ServerSettings.settings, version.txt"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; AfterInstall: UpdateVersionNumber
+Source: "..\PRS.Recovery\PrsRecovery\bin\{#ReleaseType}\net8.0-windows\*"; DestDir: "{app}\PRSRecovery"; Flags: ignoreversion recursesubdirs createallsubdirs;
 
 [Dirs]
 Name: "{userappdata}\PRSServer\"; 

+ 12 - 1
prs.server/Properties/Resources.Designer.cs

@@ -1,7 +1,6 @@
 //------------------------------------------------------------------------------
 // <auto-generated>
 //     This code was generated by a tool.
-//     Runtime Version:4.0.30319.42000
 //
 //     Changes to this file may cause incorrect behavior and will be lost if
 //     the code is regenerated.
@@ -9,6 +8,9 @@
 //------------------------------------------------------------------------------
 
 namespace PRSServer.Properties {
+    using System;
+    
+    
     /// <summary>
     ///   A strongly-typed resource class, for looking up localized strings, etc.
     /// </summary>
@@ -277,6 +279,15 @@ namespace PRSServer.Properties {
             }
         }
         
+        /// <summary>
+        ///   Looks up a localized string similar to C:\Development\prs\prs.server\Resources\recovery.svg.
+        /// </summary>
+        public static string recovery {
+            get {
+                return ResourceManager.GetString("recovery", resourceCulture);
+            }
+        }
+        
         /// <summary>
         ///   Looks up a localized resource of type System.Drawing.Bitmap.
         /// </summary>

+ 3 - 0
prs.server/Properties/Resources.resx

@@ -250,4 +250,7 @@
     <value>..\Resources\working.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral,
             PublicKeyToken=b03f5f7f11d50a3a</value>
   </data>
+  <data name="recovery" xml:space="preserve">
+    <value>C:\Development\prs\prs.server\Resources\recovery.svg</value>
+  </data>
 </root>

+ 32 - 0
prs.server/Resources/recovery.svg

@@ -0,0 +1,32 @@
+<svg
+        xmlns="http://www.w3.org/2000/svg"
+        viewBox="0 0 100 100"
+        width="100%"
+        height="100%">
+
+  <!-- Circle with 5% margin -->
+  <circle
+          cx="50"
+          cy="50"
+          r="45"
+          fill="none"
+          stroke="red"
+          stroke-width="3" />
+
+  <!-- Vertical bar of the plus (thicker) -->
+  <rect
+          x="43"
+          y="20"
+          width="14"
+          height="60"
+          fill="red" />
+
+  <!-- Horizontal bar of the plus (thicker) -->
+  <rect
+          x="20"
+          y="43"
+          width="60"
+          height="14"
+          fill="red" />
+
+</svg>

+ 3 - 0
prs.server/install.bat

@@ -24,6 +24,9 @@ dotnet build ../prs.server/prsserver.csproj -c %release_type% -p:Version=%versio
 echo Building PRSLicensing...
 dotnet build ../prs.licensing/prslicensing.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail
 
+echo Building PRSRecovery...
+dotnet build ../prs.recovery/prsrecovery.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail
+
 echo Building PRS.Avalonia.Desktop...
 dotnet build ../prs.avalonia/prs.avalonia.desktop/prs.avalonia.desktop.csproj -c %release_type% -p:Version=%version_number% -p:PackageOutputPath=%package_folder% > build.log 2>&1 || goto :build_fail