diff --git a/wuauApp1/wuauApp1.sln b/wuauApp1/wuauApp1.sln deleted file mode 100644 index 6215cdb..0000000 --- a/wuauApp1/wuauApp1.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "wuauApp1", "wuauApp1\wuauApp1.csproj", "{8A051545-5118-4970-9BCF-29595E31003D}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {8A051545-5118-4970-9BCF-29595E31003D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8A051545-5118-4970-9BCF-29595E31003D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8A051545-5118-4970-9BCF-29595E31003D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8A051545-5118-4970-9BCF-29595E31003D}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {5A300D8C-F39C-4E18-9B7C-0A0C9AFE5B3E} - EndGlobalSection -EndGlobal diff --git a/wuauApp1/wuauApp1/App.config b/wuauApp1/wuauApp1/App.config deleted file mode 100644 index 00bfd11..0000000 --- a/wuauApp1/wuauApp1/App.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/wuauApp1/wuauApp1/Program.cs b/wuauApp1/wuauApp1/Program.cs deleted file mode 100644 index 32730b3..0000000 --- a/wuauApp1/wuauApp1/Program.cs +++ /dev/null @@ -1,164 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using WUApiLib;//this is required to use the Interfaces given by microsoft. - -namespace wuauApp1 -{ - class Program - { - static void Main(string[] args) - { - UpdatesAvailable(); - if (NeedsUpdate()) - { - Console.WriteLine("There are updates for your computer available."); - EnableUpdateServices();//enables everything windows need in order to make an update - InstallUpdates(DownloadUpdates()); - } - else - { - Console.WriteLine("There are no updates for your computer at this time."); - } - Console.WriteLine("Press any key to finalize the process"); - Console.Read(); - } - //this is my first try.. I can see the need for abstract classes here... - //but at least it gives most people a good starting point. - public static void InstalledUpdates() - { - UpdateSession UpdateSession = new UpdateSession(); - IUpdateSearcher UpdateSearchResult = UpdateSession.CreateUpdateSearcher(); - UpdateSearchResult.Online = true;//checks for updates online - ISearchResult SearchResults = UpdateSearchResult.Search("IsInstalled=1 AND IsHidden=0"); - //for the above search criteria refer to - //http://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=VS.85).aspx - //Check the remakrs section - Console.WriteLine("The following updates are available"); - foreach (IUpdate x in SearchResults.Updates) - { - Console.WriteLine(x.Title); - } - } - public static void UpdatesAvailable() - { - UpdateSession UpdateSession = new UpdateSession(); - IUpdateSearcher UpdateSearchResult = UpdateSession.CreateUpdateSearcher(); - UpdateSearchResult.Online = true;//checks for updates online - ISearchResult SearchResults = UpdateSearchResult.Search("IsInstalled=0 AND IsPresent=0"); - //for the above search criteria refer to - //http://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=VS.85).aspx - //Check the remakrs section - - foreach (IUpdate x in SearchResults.Updates) - { - Console.WriteLine(x.Title); - } - } - public static bool NeedsUpdate() - { - UpdateSession UpdateSession = new UpdateSession(); - IUpdateSearcher UpdateSearchResult = UpdateSession.CreateUpdateSearcher(); - UpdateSearchResult.Online = true;//checks for updates online - ISearchResult SearchResults = UpdateSearchResult.Search("IsInstalled=0 AND IsPresent=0"); - //for the above search criteria refer to - //http://msdn.microsoft.com/en-us/library/windows/desktop/aa386526(v=VS.85).aspx - //Check the remakrs section - if (SearchResults.Updates.Count > 0) - return true; - else return false; - } - public static UpdateCollection DownloadUpdates() - { - UpdateSession UpdateSession = new UpdateSession(); - IUpdateSearcher SearchUpdates = UpdateSession.CreateUpdateSearcher(); - ISearchResult UpdateSearchResult = SearchUpdates.Search("IsInstalled=0 and IsPresent=0"); - UpdateCollection UpdateCollection = new UpdateCollection(); - //Accept Eula code for each update - for (int i = 0; i < UpdateSearchResult.Updates.Count; i++) - { - IUpdate Updates = UpdateSearchResult.Updates[i]; - if (Updates.EulaAccepted == false) - { - Updates.AcceptEula(); - } - UpdateCollection.Add(Updates); - } - //Accept Eula ends here - //if it is zero i am not sure if it will trow an exception -- I havent tested it. - if (UpdateSearchResult.Updates.Count > 0) - { - UpdateCollection DownloadCollection = new UpdateCollection(); - UpdateDownloader Downloader = UpdateSession.CreateUpdateDownloader(); - - for (int i = 0; i < UpdateCollection.Count; i++) - { - DownloadCollection.Add(UpdateCollection[i]); - } - - Downloader.Updates = DownloadCollection; - Console.WriteLine("Downloading Updates... This may take several minutes."); - - - IDownloadResult DownloadResult = Downloader.Download(); - UpdateCollection InstallCollection = new UpdateCollection(); - for (int i = 0; i < UpdateCollection.Count; i++) - { - if (DownloadCollection[i].IsDownloaded) - { - InstallCollection.Add(DownloadCollection[i]); - } - } - Console.WriteLine("Download Finished"); - return InstallCollection; - } - else - return UpdateCollection; - } - public static void InstallUpdates(UpdateCollection DownloadedUpdates) - { - Console.WriteLine("Installing updates now..."); - UpdateSession UpdateSession = new UpdateSession(); - UpdateInstaller InstallAgent = UpdateSession.CreateUpdateInstaller() as UpdateInstaller; - InstallAgent.Updates = DownloadedUpdates; - - //Starts a synchronous installation of the updates. - // http://msdn.microsoft.com/en-us/library/windows/desktop/aa386491(v=VS.85).aspx#methods - if (DownloadedUpdates.Count > 0) - { - IInstallationResult InstallResult = InstallAgent.Install(); - if (InstallResult.ResultCode == OperationResultCode.orcSucceeded) - { - Console.WriteLine("Updates installed succesfully"); - if (InstallResult.RebootRequired == true) - { - Console.WriteLine("Reboot is required for one of more updates."); - } - } - else - { - Console.WriteLine("Updates failed to install do it manually"); - } - } - else - { - Console.WriteLine("The computer that this script was executed is up to date"); - } - - } - public static void EnableUpdateServices() - { - IAutomaticUpdates updates = new AutomaticUpdates(); - if (!updates.ServiceEnabled) - { - Console.WriteLine("Not all updates services where enabled. Enabling Now" + updates.ServiceEnabled); - updates.EnableService(); - Console.WriteLine("Service enable success"); - } - - - } - } -} diff --git a/wuauApp1/wuauApp1/Properties/AssemblyInfo.cs b/wuauApp1/wuauApp1/Properties/AssemblyInfo.cs deleted file mode 100644 index f106f6d..0000000 --- a/wuauApp1/wuauApp1/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -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("wuauApp1")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("wuauApp1")] -[assembly: AssemblyCopyright("Copyright © 2018")] -[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("8a051545-5118-4970-9bcf-29595e31003d")] - -// 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/wuauApp1/wuauApp1/wuauApp1.csproj b/wuauApp1/wuauApp1/wuauApp1.csproj deleted file mode 100644 index e23616b..0000000 --- a/wuauApp1/wuauApp1/wuauApp1.csproj +++ /dev/null @@ -1,63 +0,0 @@ - - - - - Debug - AnyCPU - {8A051545-5118-4970-9BCF-29595E31003D} - Exe - wuauApp1 - wuauApp1 - v4.6.1 - 512 - true - - - AnyCPU - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - AnyCPU - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - {B596CC9F-56E5-419E-A622-E01BB457431E} - 2 - 0 - 0 - tlbimp - False - True - - - - \ No newline at end of file