- some formatting...
aa5860f6
Dimitar Tsenev
committed
4 changed files
MainWindow.xaml.cs
/BExplorer/BetterExplorer/MainWindow.xaml.cs-219+135
/BExplorer/BetterExplorer/MainWindow.xaml.cs
Add comment 1 Plus  // --------------------------------------------------------------------------------------------------------------------
Add comment 2 Plus  // <copyright file="MainWindow.xaml.cs" company="Gainedge ORG">
Add comment 3 Plus  // Better Explorer (c)2016
Add comment 4 Plus  // </copyright>
Add comment 5 Plus  // <summary>
Add comment 6 Plus  // Interaction logic for MainWindow.xaml
Add comment 7 Plus  // </summary>
Add comment 8 Plus  // --------------------------------------------------------------------------------------------------------------------
Add comment 9 Plus  
Add comment 1 10 using System;
Add comment 2 11 using System.Collections.Generic;
Add comment 3 12 using System.Collections.Specialized;
Add comment 25 34 using System.Windows.Threading;
Add comment 26 35 using System.Xml;
Add comment 27 36 using System.Xml.Linq;
Add comment 37 Plus  using BEHelper;
Add comment 28 38 using BetterExplorer.UsbEject;
Add comment 29 39 using BetterExplorerControls;
Add comment 30 Minus  using BEHelper;
Add comment 31 40 using BExplorer.Shell;
Add comment 41 Plus  using BExplorer.Shell._Plugin_Interfaces;
Add comment 42 Plus  using BExplorer.Shell.CommonFileDialogs;
Add comment 43 Plus  using BExplorer.Shell.DropTargetHelper;
Add comment 32 44 using BExplorer.Shell.Interop;
Add comment 33 45 using Fluent;
Add comment 34 46 using LTR.IO.ImDisk;
Add comment 35 47 using Microsoft.Win32;
Add comment 48 Plus  using Settings;
Add comment 36 49 using SevenZip;
Add comment 37 50 using Shell32;
Add comment 51 Plus  using TaskDialogInterop;
Add comment 38 52 using wyDay.Controls;
Add comment 53 Plus  
Add comment 39 54 using Clipboards = System.Windows.Forms.Clipboard;
Add comment 40 55 using ContextMenu = Fluent.ContextMenu;
Add comment 56 Plus  using Image = System.Windows.Controls.Image;
Add comment 41 57 using MenuItem = Fluent.MenuItem;
Add comment 42 Minus  using BExplorer.Shell.CommonFileDialogs;
Add comment 43 Minus  using BExplorer.Shell.DropTargetHelper;
Add comment 44 58 using WIN = System.Windows;
Add comment 45 Minus  using BExplorer.Shell._Plugin_Interfaces;
Add comment 46 Minus  using Settings;
Add comment 47 Minus  using TaskDialogInterop;
Add comment 48 Minus  using Image = System.Windows.Controls.Image;
Add comment 49 59
Add comment 50 Minus  
Add comment 51 60 namespace BetterExplorer {
Add comment 52 61
Add comment 53 62 /// <summary>
Add comment 119 128 spCommandPrompt.Height = GridLength.Auto;
Add comment 120 129 if (!ctrlConsole.IsProcessRunning)
Add comment 121 130 ctrlConsole.ChangeFolder(_ShellListView.CurrentFolder.ParsingName, _ShellListView.CurrentFolder.IsFileSystem);
Add comment 122 Minus   }
Add comment 123 Minus   else {
Add comment 131 Plus   } else {
Add comment 124 132 rCommandPrompt.MinHeight = 0;
Add comment 125 133 rCommandPrompt.Height = new GridLength(0);
Add comment 126 134 spCommandPrompt.Height = new GridLength(0);
Add comment 128 136 }
Add comment 129 137 }
Add comment 130 138 private void backstage_IsOpenChanged(object sender, DependencyPropertyChangedEventArgs e) {
Add comment 131 Minus   if (((Boolean)e.NewValue)) {
Add comment 139 Plus   if ((Boolean)e.NewValue) {
Add comment 132 140 this._ShellListView.IsFocusAllowed = false;
Add comment 133 Minus   backstage.Focus();
Add comment 134 Minus   }
Add comment 135 Minus   else {
Add comment 141 Plus   this.backstage.Focus();
Add comment 142 Plus   } else {
Add comment 136 143 this._ShellListView.IsFocusAllowed = true;
Add comment 137 144 }
Add comment 138 145 this.autoUpdater.Visibility = Visibility.Visible;
Add comment 139 Minus   autoUpdater.UpdateLayout();
Add comment 146 Plus   this.autoUpdater.UpdateLayout();
Add comment 140 147
Add comment 141 Minus   if (KeepBackstageOpen) {
Add comment 142 Minus   backstage.IsOpen = true;
Add comment 143 Minus   KeepBackstageOpen = false;
Add comment 148 Plus   if (this.KeepBackstageOpen) {
Add comment 149 Plus   this.backstage.IsOpen = true;
Add comment 150 Plus   this.KeepBackstageOpen = false;
Add comment 144 151 }
Add comment 145 152 }
Add comment 146 153
Add comment 148 155 /// Loads initial position of the main window
Add comment 149 156 /// </summary>
Add comment 150 157 private void LoadInitialWindowPositionAndState() {
Add comment 151 Minus   RegistryKey rk = Registry.CurrentUser;
Add comment 152 Minus   RegistryKey rks = rk.OpenSubKey(@"Software\BExplorer", false);
Add comment 153 Minus  
Add comment 154 Minus   if (rks == null) return;
Add comment 155 Minus  
Add comment 156 158 this.Width = BESettings.LastWindowWidth;
Add comment 157 159 this.Height = BESettings.LastWindowHeight;
Add comment 158 160
Add comment 159 161 var location = new System.Drawing.Point();
Add comment 160 162 try {
Add comment 161 163 location = new System.Drawing.Point((int)BESettings.LastWindowPosLeft, (int)BESettings.LastWindowPosTop);
Add comment 162 Minus   }
Add comment 163 Minus   catch { }
Add comment 164 Plus   } catch { }
Add comment 164 165
Add comment 165 Minus   if (location != null) {
Add comment 166 this.Left = location.X;
Add comment 167 this.Top = location.Y;
Add comment 168 Minus   }
Add comment 169 168
Add comment 170 Minus   switch (Convert.ToInt32(rks.GetValue("LastWindowState"))) {
Add comment 169 Plus   switch (BESettings.LastWindowState) {
Add comment 171 170 case 2:
Add comment 172 171 this.WindowState = WindowState.Maximized;
Add comment 173 172 break;
Add comment 182 181 break;
Add comment 183 182 }
Add comment 184 183
Add comment 185 Minus   chkRibbonMinimizedGlass.IsChecked = BESettings.IsGlassOnRibonMinimized;
Add comment 186 Minus   TheRibbon.IsMinimized = BESettings.IsRibonMinimized;
Add comment 184 Plus   this.chkRibbonMinimizedGlass.IsChecked = BESettings.IsGlassOnRibonMinimized;
Add comment 185 Plus   this.TheRibbon.IsMinimized = BESettings.IsRibonMinimized;
Add comment 187 186
Add comment 188 187 //CommandPrompt window size
Add comment 189 188 this.CommandPromptWinHeight = BESettings.CmdWinHeight;
Add comment 190 Minus   rCommandPrompt.Height = new GridLength(this.CommandPromptWinHeight);
Add comment 189 Plus   this.rCommandPrompt.Height = new GridLength(this.CommandPromptWinHeight);
Add comment 191 190
Add comment 192 191 if (BESettings.IsConsoleShown) {
Add comment 193 Minus   rCommandPrompt.MinHeight = 100;
Add comment 194 Minus   rCommandPrompt.Height = new GridLength(this.CommandPromptWinHeight);
Add comment 195 Minus   spCommandPrompt.Height = GridLength.Auto;
Add comment 192 Plus   this.rCommandPrompt.MinHeight = 100;
Add comment 193 Plus   this.rCommandPrompt.Height = new GridLength(this.CommandPromptWinHeight);
Add comment 194 Plus   this.spCommandPrompt.Height = GridLength.Auto;
Add comment 195 Plus   } else {
Add comment 196 Plus   this.rCommandPrompt.MinHeight = 0;
Add comment 197 Plus   this.rCommandPrompt.Height = new GridLength(0);
Add comment 198 Plus   this.spCommandPrompt.Height = new GridLength(0);
Add comment 196 199 }
Add comment 197 Minus   else {
Add comment 198 Minus   rCommandPrompt.MinHeight = 0;
Add comment 199 Minus   rCommandPrompt.Height = new GridLength(0);
Add comment 200 Minus   spCommandPrompt.Height = new GridLength(0);
Add comment 201 200 }
Add comment 202 201
Add comment 203 Minus   rks.Close();
Add comment 204 Minus   }
Add comment 205 Minus  
Add comment 206 202 private void LoadColorCodesFromFile() {
Add comment 207 203 Task.Run(() => {
Add comment 208 204 var itemColorSettingsLocation = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), @"BExplorer\itemcolors.cfg");
Add comment 211 207 var docs = XDocument.Load(itemColorSettingsLocation);
Add comment 212 208
Add comment 213 209 docs.Root.Elements("ItemColorRow")
Add comment 214 Minus   .Select(element => new LVItemColor(element.Elements().ToArray()[0].Value,
Add comment 215 Minus   WIN.Media.Color.FromArgb(BitConverter.GetBytes(Convert.ToInt32(element.Elements().ToArray()[1].Value))[0], BitConverter.GetBytes(Convert.ToInt32(element.Elements().ToArray()[1].Value))[1], BitConverter.GetBytes(Convert.ToInt32(element.Elements().ToArray()[1].Value))[2], BitConverter.GetBytes(Convert.ToInt32(element.Elements().ToArray()[1].Value))[3])))
Add comment 210 Plus   .Select(
Add comment 211 Plus   element =>
Add comment 212 Plus   new LVItemColor(
Add comment 213 Plus   element.Elements().ToArray()[0].Value,
Add comment 214 Plus   WIN.Media.Color.FromArgb(
Add comment 215 Plus   BitConverter.GetBytes(Convert.ToInt32(element.Elements().ToArray()[1].Value))[0],
Add comment 216 Plus   BitConverter.GetBytes(Convert.ToInt32(element.Elements().ToArray()[1].Value))[1],
Add comment 217 Plus   BitConverter.GetBytes(Convert.ToInt32(element.Elements().ToArray()[1].Value))[2],
Add comment 218 Plus   BitConverter.GetBytes(Convert.ToInt32(element.Elements().ToArray()[1].Value))[3])))
Add comment 216 219 .ToList().ForEach(e => this.LVItemsColorCol.Add(e));
Add comment 217 220
Add comment 218 221 }
Add comment 220 223 }
Add comment 221 224
Add comment 222 225 private void RibbonWindow_Initialized(object sender, EventArgs e) {
Add comment 223 Minus   LoadInitialWindowPositionAndState();
Add comment 224 Minus   LoadColorCodesFromFile();
Add comment 226 Plus   this.LoadInitialWindowPositionAndState();
Add comment 227 Plus   this.LoadColorCodesFromFile();
Add comment 225 228
Add comment 226 229 AppCommands.RoutedNewTab.InputGestures.Add(new KeyGesture(Key.T, ModifierKeys.Control));
Add comment 227 230 AppCommands.RoutedEnterInBreadCrumbCombo.InputGestures.Add(new KeyGesture(Key.E, ModifierKeys.Alt));
Add comment 252 255 var IsCheckable2 = _ShellListView.LastGroupCollumn != null && (item.pkey.fmtid == _ShellListView.LastGroupCollumn.pkey.fmtid) && (item.pkey.pid == _ShellListView.LastGroupCollumn.pkey.pid);
Add comment 253 256 btnGroup.Items.Add(Utilities.Build_MenuItem(item.Name, item, checkable: true, isChecked: IsCheckable2, GroupName: "GR3", onClick: mig_Click));
Add comment 254 257 }
Add comment 255 Minus   }
Add comment 256 Minus   catch (Exception ex) {
Add comment 258 Plus   } catch (Exception ex) {
Add comment 257 259 //FIXME: I disable this message because of strange null after filter
Add comment 258 260 MessageBox.Show("BetterExplorer had an issue loading the visible columns for the current view. You might not be able to sort or group items.", ex.ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
Add comment 259 261 }
Add comment 300 302 var IsChecked = _ShellListView.Collumns.Any(col => col.pkey.fmtid == allAvailColls[j].pkey.fmtid && col.pkey.pid == allAvailColls[j].pkey.pid);
Add comment 301 303 btnMoreColls.Items.Add(Utilities.Build_MenuItem(allAvailColls[j].Name, allAvailColls[j], checkable: true, onClick: mic_Click, isChecked: IsChecked));
Add comment 302 304 chcm.Items.Add(Utilities.Build_MenuItem(allAvailColls[j].Name, allAvailColls[j], checkable: true, onClick: mic_Click, isChecked: IsChecked));
Add comment 305 Plus   } catch (Exception) {
Add comment 303 306 }
Add comment 304 Minus   catch (Exception) {
Add comment 305 307 }
Add comment 306 Minus   }
Add comment 307 308
Add comment 308 309 int ItemsCount = _ShellListView.Items.Count;
Add comment 309 310 sbiItemsCount.Visibility = ItemsCount == 0 ? Visibility.Collapsed : Visibility.Visible;
Add comment 352 353 var lib = ShellLibrary.Load(Path.GetFileNameWithoutExtension(_ShellListView.CurrentFolder.ParsingName), false);
Add comment 353 354 lib.DefaultSaveFolder = SaveLoc.ParsingName;
Add comment 354 355 lib.Close();
Add comment 355 Minus   }
Add comment 356 Minus   else if (_ShellListView.GetFirstSelectedItem().ParsingName.Contains(KnownFolders.Libraries.ParsingName)) {
Add comment 356 Plus   } else if (_ShellListView.GetFirstSelectedItem().ParsingName.Contains(KnownFolders.Libraries.ParsingName)) {
Add comment 357 var lib = ShellLibrary.Load(Path.GetFileNameWithoutExtension(_ShellListView.GetFirstSelectedItem().ParsingName), false);
Add comment 358 lib.DefaultSaveFolder = SaveLoc.ParsingName;
Add comment 359 lib.Close();
Add comment 437 */
Add comment 438 if (selectedItemsCount == 0)
Add comment 439 ctgLibraries.Visibility = Visibility.Collapsed;
Add comment 440 Minus   else if (selectedItemsCount > 1) { }
Add comment 441 Minus   else if (ctgLibraries.Visibility == Visibility.Visible && _ShellListView.CurrentFolder.ParsingName.Equals(KnownFolders.Libraries.ParsingName))
Add comment 440 Plus   else if (selectedItemsCount > 1) { } else if (ctgLibraries.Visibility == Visibility.Visible && _ShellListView.CurrentFolder.ParsingName.Equals(KnownFolders.Libraries.ParsingName))
Add comment 442 441 SetupLibrariesTab(ShellLibrary.Load(Path.GetFileNameWithoutExtension(selectedItem.ParsingName), false));
Add comment 443 442 else if (ctgLibraries.Visibility == Visibility.Visible && _ShellListView.CurrentFolder.Parent.ParsingName.Equals(KnownFolders.Libraries.ParsingName))
Add comment 444 443 SetupLibrariesTab(ShellLibrary.Load(Path.GetFileNameWithoutExtension(_ShellListView.CurrentFolder.ParsingName), false));
Add comment 471 470 if (BESettings.AutoSwitchImageTools) TheRibbon.SelectedTabItem = ctgImage.Items[0];
Add comment 472 471 }
Add comment 473 472 }
Add comment 474 Minus   }
Add comment 475 Minus   catch (Exception) {
Add comment 473 Plus   } catch (Exception) {
Add comment 476 474 MessageBox.Show("Image was invalid");
Add comment 477 475 }
Add comment 478 476 }
Add comment 558 556
Add comment 559 557 if (selectedItem == null) {
Add comment 560 558 btnOpenWith.IsEnabled = false;
Add comment 561 Minus   }
Add comment 562 Minus   else {
Add comment 559 Plus   } else {
Add comment 563 560 var mnu = new ShellContextMenu(this._ShellListView, false);
Add comment 564 561
Add comment 565 562 try {
Add comment 566 563 var tempPoint = btnOpenWith.PointToScreen(new WIN.Point(0, 0));
Add comment 567 564 var itemMenuCount = mnu.ShowContextMenu(new System.Drawing.Point((int)tempPoint.X, (int)tempPoint.Y + (int)btnOpenWith.ActualHeight), 1, false);
Add comment 568 565 btnOpenWith.IsEnabled = itemMenuCount > 0 && selItemsCount == 1;
Add comment 569 Minus   }
Add comment 570 Minus   catch {
Add comment 566 Plus   } catch {
Add comment 571 567 btnOpenWith.IsEnabled = false;
Add comment 572 568 }
Add comment 573 569 }
Add comment 630 626 FolderSizeWindow.Open(_ShellListView.GetFirstSelectedItem().ParsingName, this);
Add comment 631 627 return;
Add comment 632 628 }
Add comment 633 Minus   }
Add comment 634 Minus   else if ((_ShellListView.CurrentFolder.IsFolder || _ShellListView.CurrentFolder.IsDrive) && _ShellListView.CurrentFolder.IsFileSystem) {
Add comment 629 Plus   } else if ((_ShellListView.CurrentFolder.IsFolder || _ShellListView.CurrentFolder.IsDrive) && _ShellListView.CurrentFolder.IsFileSystem) {
Add comment 635 630 FolderSizeWindow.Open(_ShellListView.CurrentFolder.ParsingName, this);
Add comment 636 631 }
Add comment 637 632 }
Add comment 936 931 var root = String.Empty;
Add comment 937 932 try {
Add comment 938 933 root = Path.GetPathRoot(w.ShellObject.ParsingName.ToShellParsingName());
Add comment 939 Minus   }
Add comment 940 Minus   catch { }
Add comment 934 Plus   } catch { }
Add comment 941 935 return !String.IsNullOrEmpty(root) && (w.ShellObject.IsFileSystem &&
Add comment 942 936 root.ToLowerInvariant() == $"{DriveLetter}:\\".ToLowerInvariant());
Add comment 943 937 }).ToArray();
Add comment 946 940 tcMain.RemoveTabItem(tab);
Add comment 947 941 }
Add comment 948 942 }));
Add comment 949 Minus   }
Add comment 950 Minus   else {
Add comment 943 Plus   } else {
Add comment 951 944 var message = String.Empty;
Add comment 952 945 var obj = new ShellItem(item.LogicalDrive);
Add comment 953 946 switch (veto) {
Add comment 1007 1000 try {
Add comment 1008 1001 ImDiskAPI.GetDeviceList();
Add comment 1009 1002 return true;
Add comment 1010 Minus   }
Add comment 1011 Minus   catch (DllNotFoundException) {
Add comment 1003 Plus   } catch (DllNotFoundException) {
Add comment 1012 1004 return false;
Add comment 1013 1005 }
Add comment 1014 1006 }
Add comment 1081 1073 try {
Add comment 1082 1074 var freeDriveLetter = $"{ImDiskAPI.FindFreeDriveLetter()}:";
Add comment 1083 1075 ImDiskAPI.CreateDevice(0, 0, 0, 0, 0, ImDiskFlags.Auto, _ShellListView.GetFirstSelectedItem().ParsingName, false, freeDriveLetter, IntPtr.Zero);
Add comment 1084 Minus   }
Add comment 1085 Minus   catch (DllNotFoundException) {
Add comment 1076 Plus   } catch (DllNotFoundException) {
Add comment 1086 1077 ShowInstallImDiskMessage();
Add comment 1087 Minus   }
Add comment 1088 Minus   catch (Exception ex) {
Add comment 1078 Plus   } catch (Exception ex) {
Add comment 1089 1079 MessageBox.Show("An error occurred while trying to mount this file. \n\n" + ex.Message, ex.ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
Add comment 1090 1080 }
Add comment 1091 1081 }
Add comment 1105 1095 ImDiskAPI.ForceRemoveDevice(SelectedDriveID);
Add comment 1106 1096 else
Add comment 1107 1097 ImDiskAPI.RemoveDevice(SelectedDriveID);
Add comment 1108 Minus   }
Add comment 1109 Minus   catch {
Add comment 1098 Plus   } catch {
Add comment 1110 1099 if (MessageBox.Show("The drive could not be removed. Would you like to try to force a removal?", "Remove Drive Failed", MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes) {
Add comment 1111 1100 ImDiskAPI.ForceRemoveDevice(SelectedDriveID);
Add comment 1112 1101 }
Add comment 1177 1166 sw.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + " : " + value);
Add comment 1178 1167 }
Add comment 1179 1168 }
Add comment 1180 Minus   }
Add comment 1181 Minus   catch (Exception exe) {
Add comment 1169 Plus   } catch (Exception exe) {
Add comment 1182 1170 MessageBox.Show("An error occurred while writing to the log file. This error can be avoided if you disable the action logging feature. Please report this issue at http://bugs.gainedge.org/public/betterexplorer. \r\n\r\n Here is some information about the error: \r\n\r\n" + exe.Message + "\r\n\r\n" + exe.ToString(), "Error While Writing to Log", MessageBoxButton.OK, MessageBoxImage.Error);
Add comment 1183 1171 }
Add comment 1184 1172 }
Add comment 1265 1253 }
Add comment 1266 1254 }
Add comment 1267 1255 Reader.Close();
Add comment 1256 Plus   } catch (Exception) {
Add comment 1268 1257 }
Add comment 1269 Minus   catch (Exception) {
Add comment 1270 Minus   }
Add comment 1271 1258
Add comment 1272 1259 return result;
Add comment 1273 1260 }
Add comment 1335 1322 var SelectedColumn = this._ShellListView.Collumns[e.ColumnIndex];
Add comment 1336 1323 if (SelectedColumn.CollumnType == typeof(String)) {
Add comment 1337 1324 Things.AddRange(new[] { "0 - 9", "A - H", "I - P", "Q - Z", "Other" });
Add comment 1338 Minus   }
Add comment 1339 Minus   else if (SelectedColumn.CollumnType == typeof(DateTime)) {
Add comment 1325 Plus   } else if (SelectedColumn.CollumnType == typeof(DateTime)) {
Add comment 1340 1326 var Container = new ItemsControl();
Add comment 1341 1327 Container.Items.Add(new MenuItem() { Icon = new ImageSourceConverter().ConvertFromString(packUri) as ImageSource, Header = "Select a date or date range:", HorizontalContentAlignment = HorizontalAlignment.Stretch, HorizontalAlignment = HorizontalAlignment.Stretch, IsCheckable = true, StaysOpenOnClick = true });
Add comment 1342 1328 Container.Items.Add(new Calendar() { SelectionMode = CalendarSelectionMode.SingleRange, Margin = new Thickness(30, 0, 0, 0) });
Add comment 1343 1329 menu.AddItem(Container);
Add comment 1344 1330
Add comment 1345 1331 Things.AddRange(new[] { "A long time ago", "Earlier this year", "Earlier this month", "Last week", "Today" });
Add comment 1346 Minus   }
Add comment 1347 Minus   else if (SelectedColumn.CollumnType == typeof(long)) {
Add comment 1332 Plus   } else if (SelectedColumn.CollumnType == typeof(long)) {
Add comment 1348 1333 Things.AddRange(new[] { "Tiny (0 - 10 KB)", "Small (10 - 100 KB)", "Medium (100 KB - 1 MB)", "Large (1 - 16 MB)", "Huge (16 - 128 MB)", "Unspecified" });
Add comment 1349 Minus   }
Add comment 1350 Minus   else if (SelectedColumn.CollumnType == typeof(Type)) {
Add comment 1334 Plus   } else if (SelectedColumn.CollumnType == typeof(Type)) {
Add comment 1351 1335 var distictItems = this._ShellListView.Items.Select(s => s.GetPropertyValue(SelectedColumn.pkey, SelectedColumn.CollumnType).Value).Distinct().Cast<String>().ToArray().OrderBy(o => o);
Add comment 1352 1336 Things.AddRange(distictItems);
Add comment 1353 1337 }
Add comment 1431 1415 if (BESettings.IsInfoPaneEnabled) {
Add comment 1432 1416 rPreviewPane.Height = new GridLength(BESettings.InfoPaneHeight);
Add comment 1433 1417 rPreviewPaneSplitter.Height = new GridLength(1);
Add comment 1434 Minus   }
Add comment 1435 Minus   else {
Add comment 1418 Plus   } else {
Add comment 1436 1419 rPreviewPane.Height = new GridLength(0);
Add comment 1437 1420 rPreviewPaneSplitter.Height = new GridLength(0);
Add comment 1438 1421 }
Add comment 1442 1425 if (BESettings.IsPreviewPaneEnabled) {
Add comment 1443 1426 clPreview.Width = new GridLength(BESettings.PreviewPaneWidth);
Add comment 1444 1427 clPreviewSplitter.Width = new GridLength(1);
Add comment 1445 Minus   }
Add comment 1446 Minus   else {
Add comment 1428 Plus   } else {
Add comment 1447 1429 clPreview.Width = new GridLength(0);
Add comment 1448 1430 clPreviewSplitter.Width = new GridLength(0);
Add comment 1449 1431 }
Add comment 1498 1480 chkIsDefault.IsEnabled = true;
Add comment 1499 1481 rksbe.Close();
Add comment 1500 1482 rkbe.Close();
Add comment 1501 Minus   }
Add comment 1502 Minus   catch (Exception) {
Add comment 1483 Plus   } catch (Exception) {
Add comment 1503 1484 chkIsDefault.IsChecked = false;
Add comment 1504 1485 chkIsDefault.IsEnabled = false;
Add comment 1505 1486 }
Add comment 1526 1507 try {
Add comment 1527 1508 autoUpdater.UpdateType = Settings.BESettings.IsUpdateCheck ? UpdateType.OnlyCheck : UpdateType.DoNothing;
Add comment 1528 1509 if (Settings.BESettings.IsUpdateCheckStartup) this.CheckForUpdate();
Add comment 1529 Minus   }
Add comment 1530 Minus   catch (IOException) {
Add comment 1510 Plus   } catch (IOException) {
Add comment 1531 1511 this.stiUpdate.Content = "Switch to another BetterExplorer window or restart to check for updates.";
Add comment 1532 1512 this.btnUpdateCheck.IsEnabled = false;
Add comment 1533 1513 }
Add comment 1563 1543 });
Add comment 1564 1544
Add comment 1565 1545 AppJL.Apply();
Add comment 1546 Plus   } catch {
Add comment 1566 1547 }
Add comment 1567 Minus   catch {
Add comment 1568 1548 }
Add comment 1569 Minus   }
Add comment 1570 1549
Add comment 1571 1550 private void Window_Loaded(object sender, RoutedEventArgs e) {
Add comment 1572 1551 this._ProgressTimer.Tick += (obj, args) => {
Add comment 1573 1552 if (this.bcbc.ProgressValue + 2 == this.bcbc.ProgressMaximum) {
Add comment 1574 1553 this.bcbc.ProgressMaximum = this.bcbc.ProgressMaximum + 2;
Add comment 1575 1554 this.bcbc.SetProgressValue(this.bcbc.ProgressValue + 2, TimeSpan.FromMilliseconds(0));
Add comment 1576 Minus   }
Add comment 1577 Minus   else {
Add comment 1555 Plus   } else {
Add comment 1578 1556 this.bcbc.SetProgressValue(this.bcbc.ProgressValue + 2, TimeSpan.FromMilliseconds(450));
Add comment 1579 1557 }
Add comment 1580 1558 };
Add comment 1662 1640 var sho = FileSystemListItem.ToFileSystemItem(this._ShellListView.LVHandle, cmd.ToShellParsingName());
Add comment 1663 1641 tcMain.NewTab(sho, true);
Add comment 1664 1642 }
Add comment 1665 Minus   }
Add comment 1666 Minus   else {
Add comment 1643 Plus   } else {
Add comment 1667 1644 InitializeInitialTabs();
Add comment 1668 1645 }
Add comment 1669 1646
Add comment 1677 1654 }
Add comment 1678 1655
Add comment 1679 1656 focusTimer.Tick += focusTimer_Tick;
Add comment 1680 Minus   }
Add comment 1681 Minus   catch (Exception exe) {
Add comment 1657 Plus   } catch (Exception exe) {
Add comment 1682 1658 MessageBox.Show($"An error occurred while loading the window. Please report this issue at http://bugs.gainedge.org/public/betterexplorer. \r\n\r\n Here is some information about the error: \r\n\r\n{exe.Message}\r\n\r\n{exe}", "Error While Loading", MessageBoxButton.OK, MessageBoxImage.Error);
Add comment 1683 1659 }
Add comment 1684 1660 }
Add comment 1702 1678 if (newVersion.Contains("RC") || newVersion.Contains("Nightly") || newVersion.Contains("Beta") || newVersion.Contains("Alpha")) {
Add comment 1703 1679 config.FooterText = "This is an experimental version and may contains bugs. Use at your own risk!";
Add comment 1704 1680 config.FooterIcon = VistaTaskDialogIcon.Warning;
Add comment 1705 Minus   }
Add comment 1706 Minus   else {
Add comment 1681 Plus   } else {
Add comment 1707 1682 config.FooterText = "This is a final version and can be installed safely!";
Add comment 1708 1683 config.FooterIcon = VistaTaskDialogIcon.SecuritySuccess;
Add comment 1709 1684 }
Add comment 1725 1700 if (args.ButtonId == 500) {
Add comment 1726 1701 this.autoUpdater.ReadyToBeInstalled += AutoUpdater_ReadyToBeInstalled;
Add comment 1727 1702 this.autoUpdater.InstallNow();
Add comment 1728 Minus   }
Add comment 1729 Minus   else if (args.ButtonId == 501) {
Add comment 1703 Plus   } else if (args.ButtonId == 501) {
Add comment 1730 1704 }
Add comment 1731 1705 break;
Add comment 1732 1706 }
Add comment 1826 1800
Add comment 1827 1801 this.WindowState = WindowState.Minimized;
Add comment 1828 1802 this.Visibility = Visibility.Hidden;
Add comment 1829 Minus   }
Add comment 1830 Minus   else {
Add comment 1803 Plus   } else {
Add comment 1831 1804 beNotifyIcon.Visibility = Visibility.Collapsed;
Add comment 1832 1805 }
Add comment 1833 1806
Add comment 1910 1883 try {
Add comment 1911 1884 Directory.CreateDirectory(OutputLoc);
Add comment 1912 1885 ExtractToLocation(SelectedArchive, OutputLoc);
Add comment 1913 Minus   }
Add comment 1914 Minus   catch (Exception) {
Add comment 1886 Plus   } catch (Exception) {
Add comment 1915 1887 MessageBoxResult wtd = MessageBox.Show($"The directory {OutputLoc} already exists. Would you like for BetterExplorer to extract there instead?", "Folder Exists", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
Add comment 1916 1888 switch (wtd) {
Add comment 1917 1889 case MessageBoxResult.Cancel:
Add comment 1929 1901 break;
Add comment 1930 1902 }
Add comment 1931 1903 }
Add comment 1932 Minus   }
Add comment 1933 Minus   else {
Add comment 1904 Plus   } else {
Add comment 1934 1905 ExtractToLocation(SelectedArchive, txtExtractLocation.Text);
Add comment 1935 1906 }
Add comment 1936 1907 }
Add comment 1959 1930 try {
Add comment 1960 1931 var CAI = new CreateArchive(selectedItems, false, _ShellListView.GetFirstSelectedItem().ParsingName);
Add comment 1961 1932 CAI.Show(this.GetWin32Window());
Add comment 1962 Minus   }
Add comment 1963 Minus   catch {
BESettings.cs
/Settings/BESettings.cs-14+1
/Settings/BESettings.cs
Add comment 10 //Make sure GetValue and rks.GetValue are ONLY used here and not in the MainWindow
Add comment 11
Add comment 12 namespace Settings {
Add comment 13 Minus  
Add comment 14 Minus   public static class Extensions {
Add comment 15 Minus   public static Boolean ToBoolean(this Object value) {
Add comment 16 Minus   if (value is Int32) {
Add comment 17 Minus   return (Int32?)value == 1;
Add comment 18 Minus   }
Add comment 19 Minus   else if (value is String) {
Add comment 20 Minus   return Boolean.Parse(value.ToString());
Add comment 21 Minus   }
Add comment 22 Minus   return (Boolean)value;
Add comment 23 Minus   }
Add comment 24 Minus   }
Add comment 25 Minus  
Add comment 26 13 /// <summary>
Add comment 27 14 /// Contains all settings for Better Explorer (all settings will be moved here eventually)
Add comment 28 15 /// </summary>
Add comment 149 136 rks.SetValue("IsConsoleShown", IsConsoleShown);
Add comment 150 137 rks.SetValue("EnableActionLog", EnableActionLog);
Add comment 151 138 rks.SetValue("IsGlassOnRibonMinimized", IsGlassOnRibonMinimized);
Add comment 152 Minus   rks.SetValue("LastUpdateCheck", LastUpdateCheck.ToBinary());
Add comment 139 Plus   rks.SetValue("LastUpdateCheck", LastUpdateCheck.ToBinary(), RegistryValueKind.QWord);
Add comment 153 140 rks.SetValue("InfoPaneHeight", InfoPaneHeight, RegistryValueKind.DWord);
Add comment 154 141 rks.SetValue("CurrentTheme", CurrentTheme);
Add comment 155 142 rks.SetValue("PreviewPaneEnabled", IsPreviewPaneEnabled);
Extensions.cs
/Settings/Extensions.cs+15
/Settings/Extensions.cs
Add comment 1 Plus  namespace Settings {
Add comment 2 Plus   using System;
Add comment 3 Plus  
Add comment 4 Plus   public static class Extensions {
Add comment 5 Plus   public static Boolean ToBoolean(this Object value) {
Add comment 6 Plus   if (value is Int32) {
Add comment 7 Plus   return (Int32?)value == 1;
Add comment 8 Plus   }
Add comment 9 Plus   else if (value is String) {
Add comment 10 Plus   return Boolean.Parse(value.ToString());
Add comment 11 Plus   }
Add comment 12 Plus   return (Boolean)value;
Add comment 13 Plus   }
Add comment 14 Plus   }
Add comment 15 Plus  }
Settings.csproj
/Settings/Settings.csproj
/Settings/Settings.csproj