diff --git a/OneCleaner/App.config b/OneCleaner/App.config
index 88fa402..d1428ad 100644
--- a/OneCleaner/App.config
+++ b/OneCleaner/App.config
@@ -1,6 +1,6 @@
-
+
-
+
-
\ No newline at end of file
+
diff --git a/OneCleaner/App.xaml b/OneCleaner/App.xaml
index b857312..8af9a20 100644
--- a/OneCleaner/App.xaml
+++ b/OneCleaner/App.xaml
@@ -2,8 +2,9 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:OneCleaner"
- StartupUri="MainWindow.xaml">
+ StartupUri="MainWindow.xaml"
+ Startup="App_Startup" >
-
+
diff --git a/OneCleaner/App.xaml.cs b/OneCleaner/App.xaml.cs
index 7e16426..983b2a1 100644
--- a/OneCleaner/App.xaml.cs
+++ b/OneCleaner/App.xaml.cs
@@ -1,9 +1,7 @@
using System;
-using System.Collections.Generic;
-using System.Configuration;
-using System.Data;
-using System.Linq;
-using System.Threading.Tasks;
+using System.Diagnostics;
+using System.Reflection;
+using System.Security.Principal;
using System.Windows;
namespace OneCleaner
@@ -13,5 +11,41 @@ namespace OneCleaner
///
public partial class App : Application
{
+ private bool IsRunAsAdministrator()
+ {
+ var windowsIdentity = WindowsIdentity.GetCurrent();
+ var windowsPrincipal = new WindowsPrincipal(windowsIdentity);
+
+ return windowsPrincipal.IsInRole(WindowsBuiltInRole.Administrator);
+ }
+
+ private void App_Startup(object sender, StartupEventArgs e)
+ {
+ if (!IsRunAsAdministrator())
+ {
+ // It is not possible to launch a ClickOnce app as administrator directly, so instead we launch the
+ // app as administrator in a new process.
+ var processInfo = new ProcessStartInfo(Assembly.GetExecutingAssembly().CodeBase)
+ {
+ // The following properties run the new process as administrator
+ UseShellExecute = true,
+ Verb = "runas"
+ };
+
+ // Start the new process
+ try
+ {
+ Process.Start(processInfo);
+ }
+ catch (Exception)
+ {
+ // The user did not allow the application to run as administrator
+ MessageBox.Show("Sorry, this application must be run as Administrator.");
+ }
+
+ // Shut down the current process
+ Application.Current.Shutdown();
+ }
+ }
}
}
diff --git a/OneCleaner/MainWindow.xaml b/OneCleaner/MainWindow.xaml
index 85c1b58..28f2365 100644
--- a/OneCleaner/MainWindow.xaml
+++ b/OneCleaner/MainWindow.xaml
@@ -1,11 +1,12 @@
-
+ Title="OneCleaner" Height="350" Width="525" Loaded="Window_LoadedAsync" Icon="icon.ico">
@@ -47,7 +48,7 @@
-
+
diff --git a/OneCleaner/MainWindow.xaml.cs b/OneCleaner/MainWindow.xaml.cs
index bfa0b44..1b1c6da 100644
--- a/OneCleaner/MainWindow.xaml.cs
+++ b/OneCleaner/MainWindow.xaml.cs
@@ -1,18 +1,12 @@
using OneCleaner.Platform;
-using System;
using System.Collections.Generic;
using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using System.Windows.Navigation;
-using System.Windows.Shapes;
using System.Windows.Shell;
namespace OneCleaner
@@ -28,7 +22,7 @@ namespace OneCleaner
public MainWindow()
{
InitializeComponent();
- list.ItemsSource = _installedVersions;
+ List.ItemsSource = _installedVersions;
#if DEBUG
this.Title = this.Title + " (DEBUG)";
@@ -37,12 +31,12 @@ namespace OneCleaner
private async void Window_LoadedAsync(object sender, RoutedEventArgs e)
{
- list.Visibility = Visibility.Hidden;
+ List.Visibility = Visibility.Hidden;
ButtonUninstall.IsEnabled = false;
await _installedVersions.GetVersions();
- list.Visibility = Visibility.Visible;
+ List.Visibility = Visibility.Visible;
ButtonUninstall.IsEnabled = true;
}
@@ -106,7 +100,7 @@ namespace OneCleaner
}
- private void list_PreviewKeyDown(object sender, KeyEventArgs e)
+ private void List_PreviewKeyDown(object sender, KeyEventArgs e)
{
foreach (InstalledVersionUI item in ((ListBox)(sender)).SelectedItems)
{
@@ -136,13 +130,9 @@ namespace OneCleaner
private async void ButtonUninstall_Click(object sender, RoutedEventArgs e)
{
List uninst = _installedVersions
- .Where(item => item.IsChecked && item.State == State.Installed)
- .Select(item =>
- {
- item.State = State.MarkedForUninstall;
- return item;
- })
- .ToList();
+ .Where(item => item.IsChecked && item.State == State.Installed)
+ .Select(item => { item.State = State.MarkedForUninstall; return item; })
+ .ToList();
SetWindowStateInProgress();
diff --git a/OneCleaner/OneCleaner.csproj b/OneCleaner/OneCleaner.csproj
index 9eede1c..f9f336d 100644
--- a/OneCleaner/OneCleaner.csproj
+++ b/OneCleaner/OneCleaner.csproj
@@ -8,11 +8,32 @@
WinExe
OneCleaner
OneCleaner
- v4.5.2
+ v4.5
512
{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}
4
true
+
+ false
+ \\BONDAREVSKIY-V\Utilities\OneCleaner\
+ true
+ Unc
+ true
+ Foreground
+ 7
+ Days
+ false
+ false
+ true
+ OneCleaner
+ Vladimir Bondarevskiy
+ publish.htm
+ false
+ 10
+ 1.0.1.%2a
+ true
+ true
+ true
AnyCPU
@@ -33,6 +54,29 @@
prompt
4
+
+ icon.ico
+
+
+
+
+
+
+ 564D3C1FF9AFEC58D9C42E12487B4FC0CE036C8B
+
+
+ OneCleaner_TemporaryKey.pfx
+
+
+ true
+
+
+ true
+
+
+
+ LocalIntranet
+
@@ -89,6 +133,7 @@
ResXFileCodeGenerator
Resources.Designer.cs
+
SettingsSingleFileGenerator
Settings.Designer.cs
@@ -98,14 +143,25 @@
-
-
+
+
+
+
+ False
+ Microsoft .NET Framework 4.5.2 %28x86 и x64%29
+ true
+
+
+ False
+ .NET Framework 3.5 SP1
+ false
+
\ No newline at end of file
diff --git a/OneCleaner/Platform/InstalledVersion.cs b/OneCleaner/Platform/InstalledVersion.cs
index bd12ef3..a60b3d3 100644
--- a/OneCleaner/Platform/InstalledVersion.cs
+++ b/OneCleaner/Platform/InstalledVersion.cs
@@ -1,8 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
namespace OneCleaner.Platform
{
diff --git a/OneCleaner/Platform/InstalledVersionUI.cs b/OneCleaner/Platform/InstalledVersionUI.cs
index e20cfd0..71b0f00 100644
--- a/OneCleaner/Platform/InstalledVersionUI.cs
+++ b/OneCleaner/Platform/InstalledVersionUI.cs
@@ -1,9 +1,6 @@
using System;
-using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
@@ -125,17 +122,16 @@ namespace OneCleaner.Platform
var result = 0;
System.Threading.Thread.Sleep(5000);
#else
- //var result = mngObject.InvokeMethod("Uninstall", args);
-
- if(uninstallStr == null)
+ if (_uninstallStr == null)
{
return false;
}
- var ProcessInfo = new System.Diagnostics.ProcessStartInfo("msiexec.exe", String.Format("/X{0} /quiet",uninstallStr));
- ProcessInfo.CreateNoWindow = true;
- ProcessInfo.UseShellExecute = true;
-
+ var ProcessInfo = new System.Diagnostics.ProcessStartInfo("msiexec.exe", String.Format("/x{0} /q", _uninstallStr))
+ {
+ CreateNoWindow = false,
+ UseShellExecute = true
+ };
var Process = System.Diagnostics.Process.Start(ProcessInfo);
Process.WaitForExit();
var result = Process.ExitCode;
diff --git a/OneCleaner/Platform/InstalledVersionUICollection.cs b/OneCleaner/Platform/InstalledVersionUICollection.cs
index cbf1040..fbeae59 100644
--- a/OneCleaner/Platform/InstalledVersionUICollection.cs
+++ b/OneCleaner/Platform/InstalledVersionUICollection.cs
@@ -1,9 +1,6 @@
-using Microsoft.Win32;
-using System;
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
-using System.Text;
using System.Threading.Tasks;
namespace OneCleaner.Platform
diff --git a/OneCleaner/Properties/AssemblyInfo.cs b/OneCleaner/Properties/AssemblyInfo.cs
index 78a5c3c..87c6232 100644
--- a/OneCleaner/Properties/AssemblyInfo.cs
+++ b/OneCleaner/Properties/AssemblyInfo.cs
@@ -1,6 +1,4 @@
using System.Reflection;
-using System.Resources;
-using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
@@ -8,11 +6,11 @@ using System.Windows;
// набора атрибутов. Измените значения этих атрибутов, чтобы изменить сведения,
// связанные со сборкой.
[assembly: AssemblyTitle("OneCleaner")]
-[assembly: AssemblyDescription("")]
+[assembly: AssemblyDescription("Средство для удаления неиспользуемых версий 1С:Предприятие 8")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("OneCleaner")]
-[assembly: AssemblyCopyright("Copyright © 2017")]
+[assembly: AssemblyCopyright("Copyright © 2017 Vladimir Bondarevskiy")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -51,5 +49,5 @@ using System.Windows;
// Можно задать все значения или принять номер сборки и номер редакции по умолчанию.
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
-[assembly: AssemblyVersion("1.0.0.0")]
-[assembly: AssemblyFileVersion("1.0.0.0")]
+[assembly: AssemblyVersion("1.0.2.0")]
+[assembly: AssemblyFileVersion("1.0.2.0")]
diff --git a/OneCleaner/Properties/Resources.Designer.cs b/OneCleaner/Properties/Resources.Designer.cs
index c858335..84b3c52 100644
--- a/OneCleaner/Properties/Resources.Designer.cs
+++ b/OneCleaner/Properties/Resources.Designer.cs
@@ -1,69 +1,61 @@
//------------------------------------------------------------------------------
//
-// Этот код создан программным средством.
-// Версия среды выполнения: 4.0.30319.42000
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
//
-// Изменения в этом файле могут привести к неправильному поведению и будут утрачены, если
-// код создан повторно.
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
//
//------------------------------------------------------------------------------
-namespace OneCleaner.Properties
-{
-
-
+namespace OneCleaner.Properties {
+ using System;
+
+
///
- /// Класс ресурсов со строгим типом для поиска локализованных строк и пр.
+ /// Класс ресурса со строгой типизацией для поиска локализованных строк и т.д.
///
- // Этот класс был автоматически создан при помощи StronglyTypedResourceBuilder
- // класс с помощью таких средств, как ResGen или Visual Studio.
- // Для добавления или удаления члена измените файл .ResX, а затем перезапустите ResGen
- // с параметром /str или заново постройте свой VS-проект.
+ // Этот класс создан автоматически классом StronglyTypedResourceBuilder
+ // с помощью такого средства, как ResGen или Visual Studio.
+ // Чтобы добавить или удалить член, измените файл .ResX и снова запустите ResGen
+ // с параметром /str или перестройте свой проект VS.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- internal class Resources
- {
-
+ 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()
- {
+ internal Resources() {
}
-
+
///
- /// Возврат кэшированного экземпляра ResourceManager, используемого этим классом.
+ /// Возвращает кэшированный экземпляр ResourceManager, использованный этим классом.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Resources.ResourceManager ResourceManager
- {
- get
- {
- if ((resourceMan == null))
- {
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("OneCleaner.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
-
+
///
- /// Переопределяет свойство CurrentUICulture текущего потока для всех
- /// подстановки ресурсов с помощью этого класса ресурсов со строгим типом.
+ /// Перезаписывает свойство CurrentUICulture текущего потока для всех
+ /// обращений к ресурсу с помощью этого класса ресурса со строгой типизацией.
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
- internal static global::System.Globalization.CultureInfo Culture
- {
- get
- {
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
return resourceCulture;
}
- set
- {
+ set {
resourceCulture = value;
}
}
diff --git a/OneCleaner/Properties/Settings.Designer.cs b/OneCleaner/Properties/Settings.Designer.cs
index f04b644..166c683 100644
--- a/OneCleaner/Properties/Settings.Designer.cs
+++ b/OneCleaner/Properties/Settings.Designer.cs
@@ -1,28 +1,24 @@
//------------------------------------------------------------------------------
//
-// This code was generated by a tool.
-// Runtime Version:4.0.30319.42000
+// Этот код создан программой.
+// Исполняемая версия:4.0.30319.42000
//
-// Changes to this file may cause incorrect behavior and will be lost if
-// the code is regenerated.
+// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае
+// повторной генерации кода.
//
//------------------------------------------------------------------------------
-namespace OneCleaner.Properties
-{
-
-
+namespace OneCleaner.Properties {
+
+
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
- internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
- {
-
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.1.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
- {
+
+ public static Settings Default {
+ get {
return defaultInstance;
}
}
diff --git a/OneCleaner/delete.ico b/OneCleaner/delete.ico
deleted file mode 100644
index 350612f..0000000
Binary files a/OneCleaner/delete.ico and /dev/null differ
diff --git a/OneCleaner/icon.ico b/OneCleaner/icon.ico
new file mode 100644
index 0000000..e5d88df
Binary files /dev/null and b/OneCleaner/icon.ico differ
diff --git a/OneCleaner/icon.png b/OneCleaner/icon.png
deleted file mode 100644
index 58d7641..0000000
Binary files a/OneCleaner/icon.png and /dev/null differ