diff --git a/Mk0.Software.NoSaver.sln b/Mk0.Software.NoSaver.sln new file mode 100644 index 0000000..20e1057 --- /dev/null +++ b/Mk0.Software.NoSaver.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.27428.2037 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NoSaver", "NoSaver\NoSaver.csproj", "{3BCAAC5B-B052-469A-AA82-AD9CDA965EA5}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {3BCAAC5B-B052-469A-AA82-AD9CDA965EA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3BCAAC5B-B052-469A-AA82-AD9CDA965EA5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3BCAAC5B-B052-469A-AA82-AD9CDA965EA5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3BCAAC5B-B052-469A-AA82-AD9CDA965EA5}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8350D65A-A5A4-454E-8CD7-DC83AD34A22F} + EndGlobalSection +EndGlobal diff --git a/NoSaver/App.config b/NoSaver/App.config new file mode 100644 index 0000000..ecdcf8a --- /dev/null +++ b/NoSaver/App.config @@ -0,0 +1,6 @@ + + + + + + diff --git a/NoSaver/Main.Designer.cs b/NoSaver/Main.Designer.cs new file mode 100644 index 0000000..9eb840c --- /dev/null +++ b/NoSaver/Main.Designer.cs @@ -0,0 +1,71 @@ +namespace NoSaver +{ + partial class Main + { + /// + /// Erforderliche Designervariable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Verwendete Ressourcen bereinigen. + /// + /// True, wenn verwaltete Ressourcen gelöscht werden sollen; andernfalls False. + protected override void Dispose(bool disposing) + { + if(disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Vom Windows Form-Designer generierter Code + + /// + /// Erforderliche Methode für die Designerunterstützung. + /// Der Inhalt der Methode darf nicht mit dem Code-Editor geändert werden. + /// + private void InitializeComponent() + { + this.label1 = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(12, 9); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(116, 26); + this.label1.TabIndex = 0; + this.label1.Text = "Prevents screen saver.\r\nClose to allow again."; + // + // Main + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(192, 55); + this.Controls.Add(this.label1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "Main"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "NoSaver"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing); + this.Load += new System.EventHandler(this.Main_Load); + this.Shown += new System.EventHandler(this.Form1_Shown); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.Label label1; + } +} + diff --git a/NoSaver/Main.cs b/NoSaver/Main.cs new file mode 100644 index 0000000..5396fba --- /dev/null +++ b/NoSaver/Main.cs @@ -0,0 +1,58 @@ +using System; +using System.Windows.Forms; +using System.Runtime.InteropServices; +using Mk0.Software.OnlineUpdater; + +namespace NoSaver +{ + public partial class Main : Form + { + [FlagsAttribute()] + public enum EXECUTION_STATE : uint + { + ES_AWAYMODE_REQUIRED = 0x40, + ES_CONTINUOUS = 0x80000000u, + ES_DISPLAY_REQUIRED = 0x2, + ES_SYSTEM_REQUIRED = 0x1 + } + + [DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)] + private static extern EXECUTION_STATE SetThreadExecutionState(EXECUTION_STATE esFlags); + + [DllImport("user32", EntryPoint = "SystemParametersInfo", CharSet = CharSet.Auto, SetLastError = true)] + private static extern int SystemParametersInfo(int uAction, int uParam, string lpvParam, int fuWinIni); + + private const Int32 SPI_SETSCREENSAVETIMEOUT = 15; + + public Main() + { + InitializeComponent(); + } + + public void KeepMonitorActive() + { + SetThreadExecutionState(EXECUTION_STATE.ES_DISPLAY_REQUIRED | EXECUTION_STATE.ES_CONTINUOUS); + } + + public void RestoreMonitorSettings() + { + SetThreadExecutionState(EXECUTION_STATE.ES_CONTINUOUS); + } + + private void Form1_Shown(object sender, EventArgs e) + { + KeepMonitorActive(); + } + + private void Form1_FormClosing(object sender, FormClosingEventArgs e) + { + RestoreMonitorSettings(); + } + + private void Main_Load(object sender, EventArgs e) + { + AutoUpdater.ShowSkipButton = false; + AutoUpdater.Start("https://www.kmpr.at/update/nosaver.xml"); + } + } +} diff --git a/NoSaver/Main.resx b/NoSaver/Main.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/NoSaver/Main.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NoSaver/NoSaver.csproj b/NoSaver/NoSaver.csproj new file mode 100644 index 0000000..d421619 --- /dev/null +++ b/NoSaver/NoSaver.csproj @@ -0,0 +1,117 @@ + + + + + Debug + AnyCPU + {3BCAAC5B-B052-469A-AA82-AD9CDA965EA5} + WinExe + Mk0.Software.NoSaver + NoSaver + v4.7.2 + 512 + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 0 + 1.0.0.%2a + false + false + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + NoSaver.Program + + + screensaver.ico + + + + ..\..\..\source\repos\manuelkamp\Mk0.Software.OnlineUpdater\Mk0.Software.OnlineUpdater\bin\Debug\Mk0.Software.OnlineUpdater.dll + + + + + + + + + + + + + + + + Form + + + Main.cs + + + + + Main.cs + + + ResXFileCodeGenerator + Resources.Designer.cs + Designer + + + True + Resources.resx + True + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + True + Settings.settings + True + + + + + + + + + + + False + .NET Framework 3.5 SP1 + false + + + + \ No newline at end of file diff --git a/NoSaver/Program.cs b/NoSaver/Program.cs new file mode 100644 index 0000000..5ed5417 --- /dev/null +++ b/NoSaver/Program.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace NoSaver +{ + static class Program + { + /// + /// Der Haupteinstiegspunkt für die Anwendung. + /// + [STAThread] + static void Main() + { + Application.EnableVisualStyles(); + Application.SetCompatibleTextRenderingDefault(false); + Application.Run(new Main()); + } + } +} diff --git a/NoSaver/Properties/AssemblyInfo.cs b/NoSaver/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..8254576 --- /dev/null +++ b/NoSaver/Properties/AssemblyInfo.cs @@ -0,0 +1,36 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// Allgemeine Informationen über eine Assembly werden über die folgenden +// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern, +// die einer Assembly zugeordnet sind. +[assembly: AssemblyTitle("NoSaver")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("kmpr.at")] +[assembly: AssemblyProduct("NoSaver")] +[assembly: AssemblyCopyright("Copyright © 2020 by kmpr.at")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly +// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von +// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen. +[assembly: ComVisible(false)] + +// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird +[assembly: Guid("3bcaac5b-b052-469a-aa82-ad9cda965ea5")] + +// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten: +// +// Hauptversion +// Nebenversion +// Buildnummer +// Revision +// +// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden, +// übernehmen, indem Sie "*" eingeben: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NoSaver/Properties/Resources.Designer.cs b/NoSaver/Properties/Resources.Designer.cs new file mode 100644 index 0000000..19b5b10 --- /dev/null +++ b/NoSaver/Properties/Resources.Designer.cs @@ -0,0 +1,63 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Mk0.Software.NoSaver.Properties { + using System; + + + /// + /// Eine stark typisierte Ressourcenklasse zum Suchen von lokalisierten Zeichenfolgen usw. + /// + // Diese Klasse wurde von der StronglyTypedResourceBuilder automatisch generiert + // -Klasse über ein Tool wie ResGen oder Visual Studio automatisch generiert. + // Um einen Member hinzuzufügen oder zu entfernen, bearbeiten Sie die .ResX-Datei und führen dann ResGen + // mit der /str-Option erneut aus, oder Sie erstellen Ihr VS-Projekt neu. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resources { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resources() { + } + + /// + /// Gibt die zwischengespeicherte ResourceManager-Instanz zurück, die von dieser Klasse verwendet wird. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Mk0.Software.NoSaver.Properties.Resources", typeof(Resources).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Überschreibt die CurrentUICulture-Eigenschaft des aktuellen Threads für alle + /// Ressourcenzuordnungen, die diese stark typisierte Ressourcenklasse verwenden. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + } +} diff --git a/NoSaver/Properties/Resources.resx b/NoSaver/Properties/Resources.resx new file mode 100644 index 0000000..af7dbeb --- /dev/null +++ b/NoSaver/Properties/Resources.resx @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/NoSaver/Properties/Settings.Designer.cs b/NoSaver/Properties/Settings.Designer.cs new file mode 100644 index 0000000..5e534ed --- /dev/null +++ b/NoSaver/Properties/Settings.Designer.cs @@ -0,0 +1,26 @@ +//------------------------------------------------------------------------------ +// +// Dieser Code wurde von einem Tool generiert. +// Laufzeitversion:4.0.30319.42000 +// +// Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn +// der Code erneut generiert wird. +// +//------------------------------------------------------------------------------ + +namespace Mk0.Software.NoSaver.Properties { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] + internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { + + private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); + + public static Settings Default { + get { + return defaultInstance; + } + } + } +} diff --git a/NoSaver/Properties/Settings.settings b/NoSaver/Properties/Settings.settings new file mode 100644 index 0000000..3964565 --- /dev/null +++ b/NoSaver/Properties/Settings.settings @@ -0,0 +1,7 @@ + + + + + + + diff --git a/NoSaver/screensaver.ico b/NoSaver/screensaver.ico new file mode 100644 index 0000000..e0bf49c Binary files /dev/null and b/NoSaver/screensaver.ico differ