diff --git a/Duplicati/Library/Utility/Duplicati.Library.Utility.csproj b/Duplicati/Library/Utility/Duplicati.Library.Utility.csproj
index de498b25c..6d93e7fc6 100644
--- a/Duplicati/Library/Utility/Duplicati.Library.Utility.csproj
+++ b/Duplicati/Library/Utility/Duplicati.Library.Utility.csproj
@@ -43,6 +43,7 @@
..\..\..\packages\FasterHashing.1.2.1\lib\net45\FasterHashing.dll
+
@@ -80,6 +81,7 @@
+
diff --git a/Duplicati/Library/Utility/Power/PowerSupply.cs b/Duplicati/Library/Utility/Power/PowerSupply.cs
index ea54167f6..ff5deadb6 100644
--- a/Duplicati/Library/Utility/Power/PowerSupply.cs
+++ b/Duplicati/Library/Utility/Power/PowerSupply.cs
@@ -39,6 +39,10 @@ namespace Duplicati.Library.Utility.Power
{
state = new LinuxPowerSupplyState();
}
+ else if (Utility.IsClientWindows)
+ {
+ state = new WindowsPowerSupplyState();
+ }
else
{
state = new DefaultPowerSupplyState();
diff --git a/Duplicati/Library/Utility/Power/WindowsPowerSupplyState.cs b/Duplicati/Library/Utility/Power/WindowsPowerSupplyState.cs
new file mode 100644
index 000000000..c1ffa620a
--- /dev/null
+++ b/Duplicati/Library/Utility/Power/WindowsPowerSupplyState.cs
@@ -0,0 +1,46 @@
+// Copyright (C) 2017, The Duplicati Team
+// http://www.duplicati.com, info@duplicati.com
+//
+// This library is free software; you can redistribute it and/or modify
+// it under the terms of the GNU Lesser General Public License as
+// published by the Free Software Foundation; either version 2.1 of the
+// License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful, but
+// WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+using System.Windows.Forms;
+
+namespace Duplicati.Library.Utility.Power
+{
+ public class WindowsPowerSupplyState : IPowerSupplyState
+ {
+ public PowerSupply.Source GetSource()
+ {
+ try
+ {
+ PowerLineStatus status = System.Windows.Forms.SystemInformation.PowerStatus.PowerLineStatus;
+ if (status == PowerLineStatus.Online)
+ {
+ return PowerSupply.Source.AC;
+ }
+ if (status == PowerLineStatus.Offline)
+ {
+ return PowerSupply.Source.Battery;
+ }
+
+ return PowerSupply.Source.Unknown;
+ }
+ catch
+ {
+ return PowerSupply.Source.Unknown;
+ }
+ }
+ }
+}