Browse Source

Add option to specify CEF's remote debugging port in app.config

Antony Male 10 years ago
parent
commit
81b72219fc

+ 13 - 10
src/SyncTrayzor/App.config

@@ -31,16 +31,8 @@
             <setting name="EnableAutostartOnFirstStart" serializeAs="String">
                 <value>False</value>
             </setting>
-            <setting name="PathConfiguration" serializeAs="Xml">
-                <value>
-                    <PathConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-                        <LogFilePath>%EXEPATH%\data\logs</LogFilePath>
-                        <SyncthingCustomHomePath>%EXEPATH%\data\syncthing</SyncthingCustomHomePath>
-                        <SyncthingPath>%EXEPATH%\syncthing.exe</SyncthingPath>
-                        <ConfigurationFilePath>%EXEPATH%\data\config.xml</ConfigurationFilePath>
-                    </PathConfiguration>
-                </value>
+            <setting name="CefRemoteDebuggingPort" serializeAs="String">
+                <value>0</value>
             </setting>
             <setting name="DefaultUserConfiguration" serializeAs="Xml">
                 <value>
@@ -63,6 +55,17 @@
                     </Configuration>
                 </value>
             </setting>
+            <setting name="PathConfiguration" serializeAs="Xml">
+                <value>
+                    <PathConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+                        xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+                        <LogFilePath>%EXEPATH%\data\logs</LogFilePath>
+                        <SyncthingCustomHomePath>%EXEPATH%\data\syncthing</SyncthingCustomHomePath>
+                        <SyncthingPath>%EXEPATH%\syncthing.exe</SyncthingPath>
+                        <ConfigurationFilePath>%EXEPATH%\data\config.xml</ConfigurationFilePath>
+                    </PathConfiguration>
+                </value>
+            </setting>
         </SyncTrayzor.Properties.Settings>
     </applicationSettings>
     <nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

+ 5 - 1
src/SyncTrayzor/Pages/ViewerViewModel.cs

@@ -15,6 +15,7 @@ using CefSharp.Wpf;
 using SyncTrayzor.Localization;
 using SyncTrayzor.Services.Config;
 using System.Threading;
+using SyncTrayzor.Properties;
 
 namespace SyncTrayzor.Pages
 {
@@ -68,7 +69,10 @@ namespace SyncTrayzor.Pages
 
         protected override void OnInitialActivate()
         {
-            Cef.Initialize();
+            Cef.Initialize(new CefSettings()
+            {
+                RemoteDebuggingPort = Settings.Default.CefRemoteDebuggingPort,
+            });
         }
 
         private void InitializeBrowser(IWpfWebBrowser webBrowser)

+ 37 - 26
src/SyncTrayzor/Properties/Settings.Designer.cs

@@ -79,42 +79,53 @@ namespace SyncTrayzor.Properties {
         
         [global::System.Configuration.ApplicationScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute(@"<?xml version=""1.0"" encoding=""utf-16""?>
-<PathConfiguration xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
-  <LogFilePath>%EXEPATH%\logs</LogFilePath>
-  <SyncthingCustomHomePath>%EXEPATH%\data\syncthing</SyncthingCustomHomePath>
-  <SyncthingPath>%EXEPATH%\syncthing.exe</SyncthingPath>
-  <ConfigurationFilePath>%EXEPATH%\data\config.xml</ConfigurationFilePath>
-</PathConfiguration>")]
-        public global::SyncTrayzor.Services.Config.PathConfiguration PathConfiguration {
+        [global::System.Configuration.DefaultSettingValueAttribute("0")]
+        public int CefRemoteDebuggingPort {
             get {
-                return ((global::SyncTrayzor.Services.Config.PathConfiguration)(this["PathConfiguration"]));
+                return ((int)(this["CefRemoteDebuggingPort"]));
             }
         }
         
         [global::System.Configuration.ApplicationScopedSettingAttribute()]
         [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
-        [global::System.Configuration.DefaultSettingValueAttribute(@"<?xml version=""1.0"" encoding=""utf-16""?>
-<Configuration xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
-  <ShowTrayIconOnlyOnClose>false</ShowTrayIconOnlyOnClose>
-  <MinimizeToTray>false</MinimizeToTray>
-  <CloseToTray>true</CloseToTray>
-  <ShowSynchronizedBalloon>true</ShowSynchronizedBalloon>
-  <ShowDeviceConnectivityBalloons>true</ShowDeviceConnectivityBalloons>
-  <SyncthingAddress>localhost:8384</SyncthingAddress>
-  <StartSyncthingAutomatically>true</StartSyncthingAutomatically>
-  <SyncthingUseCustomHome>true</SyncthingUseCustomHome>
-  <SyncthingDenyUpgrade>false</SyncthingDenyUpgrade>
-  <SyncthingRunLowPriority>false</SyncthingRunLowPriority>
-  <Folders />
-  <NotifyOfNewVersions>true</NotifyOfNewVersions>
-  <ObfuscateDeviceIDs>true</ObfuscateDeviceIDs>
-  <UseComputerCulture>true</UseComputerCulture>
-</Configuration>")]
+        [global::System.Configuration.DefaultSettingValueAttribute(@"
+                    <Configuration xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
+                        <ShowTrayIconOnlyOnClose>false</ShowTrayIconOnlyOnClose>
+                        <MinimizeToTray>false</MinimizeToTray>
+                        <CloseToTray>true</CloseToTray>
+                        <ShowSynchronizedBalloon>true</ShowSynchronizedBalloon>
+                        <ShowDeviceConnectivityBalloons>true</ShowDeviceConnectivityBalloons>
+                        <SyncthingAddress>localhost:8384</SyncthingAddress>
+                        <StartSyncthingAutomatically>true</StartSyncthingAutomatically>
+                        <SyncthingUseCustomHome>true</SyncthingUseCustomHome>
+                        <SyncthingDenyUpgrade>false</SyncthingDenyUpgrade>
+                        <SyncthingRunLowPriority>false</SyncthingRunLowPriority>
+                        <Folders />
+                        <NotifyOfNewVersions>true</NotifyOfNewVersions>
+                        <ObfuscateDeviceIDs>true</ObfuscateDeviceIDs>
+                        <UseComputerCulture>true</UseComputerCulture>
+                    </Configuration>
+                ")]
         public global::SyncTrayzor.Services.Config.Configuration DefaultUserConfiguration {
             get {
                 return ((global::SyncTrayzor.Services.Config.Configuration)(this["DefaultUserConfiguration"]));
             }
         }
+        
+        [global::System.Configuration.ApplicationScopedSettingAttribute()]
+        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+        [global::System.Configuration.DefaultSettingValueAttribute(@"
+                    <PathConfiguration xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"">
+                        <LogFilePath>%EXEPATH%\data\logs</LogFilePath>
+                        <SyncthingCustomHomePath>%EXEPATH%\data\syncthing</SyncthingCustomHomePath>
+                        <SyncthingPath>%EXEPATH%\syncthing.exe</SyncthingPath>
+                        <ConfigurationFilePath>%EXEPATH%\data\config.xml</ConfigurationFilePath>
+                    </PathConfiguration>
+                ")]
+        public global::SyncTrayzor.Services.Config.PathConfiguration PathConfiguration {
+            get {
+                return ((global::SyncTrayzor.Services.Config.PathConfiguration)(this["PathConfiguration"]));
+            }
+        }
     }
 }

+ 30 - 25
src/SyncTrayzor/Properties/Settings.settings

@@ -20,33 +20,38 @@
     <Setting Name="EnableAutostartOnFirstStart" Type="System.Boolean" Scope="Application">
       <Value Profile="(Default)">False</Value>
     </Setting>
-    <Setting Name="PathConfiguration" Type="SyncTrayzor.Services.Config.PathConfiguration" Scope="Application">
-      <Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
-&lt;PathConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
-  &lt;LogFilePath&gt;%EXEPATH%\logs&lt;/LogFilePath&gt;
-  &lt;SyncthingCustomHomePath&gt;%EXEPATH%\data\syncthing&lt;/SyncthingCustomHomePath&gt;
-  &lt;SyncthingPath&gt;%EXEPATH%\syncthing.exe&lt;/SyncthingPath&gt;
-  &lt;ConfigurationFilePath&gt;%EXEPATH%\data\config.xml&lt;/ConfigurationFilePath&gt;
-&lt;/PathConfiguration&gt;</Value>
+    <Setting Name="CefRemoteDebuggingPort" Type="System.Int32" Scope="Application">
+      <Value Profile="(Default)">0</Value>
     </Setting>
     <Setting Name="DefaultUserConfiguration" Type="SyncTrayzor.Services.Config.Configuration" Scope="Application">
-      <Value Profile="(Default)">&lt;?xml version="1.0" encoding="utf-16"?&gt;
-&lt;Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
-  &lt;ShowTrayIconOnlyOnClose&gt;false&lt;/ShowTrayIconOnlyOnClose&gt;
-  &lt;MinimizeToTray&gt;false&lt;/MinimizeToTray&gt;
-  &lt;CloseToTray&gt;true&lt;/CloseToTray&gt;
-  &lt;ShowSynchronizedBalloon&gt;true&lt;/ShowSynchronizedBalloon&gt;
-  &lt;ShowDeviceConnectivityBalloons&gt;true&lt;/ShowDeviceConnectivityBalloons&gt;
-  &lt;SyncthingAddress&gt;localhost:8384&lt;/SyncthingAddress&gt;
-  &lt;StartSyncthingAutomatically&gt;true&lt;/StartSyncthingAutomatically&gt;
-  &lt;SyncthingUseCustomHome&gt;true&lt;/SyncthingUseCustomHome&gt;
-  &lt;SyncthingDenyUpgrade&gt;false&lt;/SyncthingDenyUpgrade&gt;
-  &lt;SyncthingRunLowPriority&gt;false&lt;/SyncthingRunLowPriority&gt;
-  &lt;Folders /&gt;
-  &lt;NotifyOfNewVersions&gt;true&lt;/NotifyOfNewVersions&gt;
-  &lt;ObfuscateDeviceIDs&gt;true&lt;/ObfuscateDeviceIDs&gt;
-  &lt;UseComputerCulture&gt;true&lt;/UseComputerCulture&gt;
-&lt;/Configuration&gt;</Value>
+      <Value Profile="(Default)">
+                    &lt;Configuration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
+                        &lt;ShowTrayIconOnlyOnClose&gt;false&lt;/ShowTrayIconOnlyOnClose&gt;
+                        &lt;MinimizeToTray&gt;false&lt;/MinimizeToTray&gt;
+                        &lt;CloseToTray&gt;true&lt;/CloseToTray&gt;
+                        &lt;ShowSynchronizedBalloon&gt;true&lt;/ShowSynchronizedBalloon&gt;
+                        &lt;ShowDeviceConnectivityBalloons&gt;true&lt;/ShowDeviceConnectivityBalloons&gt;
+                        &lt;SyncthingAddress&gt;localhost:8384&lt;/SyncthingAddress&gt;
+                        &lt;StartSyncthingAutomatically&gt;true&lt;/StartSyncthingAutomatically&gt;
+                        &lt;SyncthingUseCustomHome&gt;true&lt;/SyncthingUseCustomHome&gt;
+                        &lt;SyncthingDenyUpgrade&gt;false&lt;/SyncthingDenyUpgrade&gt;
+                        &lt;SyncthingRunLowPriority&gt;false&lt;/SyncthingRunLowPriority&gt;
+                        &lt;Folders /&gt;
+                        &lt;NotifyOfNewVersions&gt;true&lt;/NotifyOfNewVersions&gt;
+                        &lt;ObfuscateDeviceIDs&gt;true&lt;/ObfuscateDeviceIDs&gt;
+                        &lt;UseComputerCulture&gt;true&lt;/UseComputerCulture&gt;
+                    &lt;/Configuration&gt;
+                </Value>
+    </Setting>
+    <Setting Name="PathConfiguration" Type="SyncTrayzor.Services.Config.PathConfiguration" Scope="Application">
+      <Value Profile="(Default)">
+                    &lt;PathConfiguration xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;
+                        &lt;LogFilePath&gt;%EXEPATH%\data\logs&lt;/LogFilePath&gt;
+                        &lt;SyncthingCustomHomePath&gt;%EXEPATH%\data\syncthing&lt;/SyncthingCustomHomePath&gt;
+                        &lt;SyncthingPath&gt;%EXEPATH%\syncthing.exe&lt;/SyncthingPath&gt;
+                        &lt;ConfigurationFilePath&gt;%EXEPATH%\data\config.xml&lt;/ConfigurationFilePath&gt;
+                    &lt;/PathConfiguration&gt;
+                </Value>
     </Setting>
   </Settings>
 </SettingsFile>