Commit f8852114 authored by Pavel's avatar Pavel

Fixed bug when migration tool can't be used if any found Vivaldi root...

Fixed bug when migration tool can't be used if any found Vivaldi root directory doesn't have ".vivaldimods" dir
parent 8dfaff1e
......@@ -6,6 +6,8 @@ using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Threading;
using CrashReporterDotNET;
namespace VivaldiModManager
{
......@@ -24,5 +26,40 @@ namespace VivaldiModManager
}
};
}
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;
Application.Current.DispatcherUnhandledException += DispatcherOnUnhandledException;
TaskScheduler.UnobservedTaskException += TaskSchedulerOnUnobservedTaskException;
}
private void TaskSchedulerOnUnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs unobservedTaskExceptionEventArgs)
{
SendReport(unobservedTaskExceptionEventArgs.Exception);
Environment.Exit(0);
}
private void DispatcherOnUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs dispatcherUnhandledExceptionEventArgs)
{
SendReport(dispatcherUnhandledExceptionEventArgs.Exception);
Environment.Exit(0);
}
private static void CurrentDomainOnUnhandledException(object sender, UnhandledExceptionEventArgs unhandledExceptionEventArgs)
{
SendReport((Exception)unhandledExceptionEventArgs.ExceptionObject);
Environment.Exit(0);
}
public static void SendReport(Exception exception, string developerMessage = "")
{
var reportCrash = new ReportCrash("opencraysplixer@mail.ru")
{
DeveloperMessage = developerMessage
};
reportCrash.Send(exception);
}
}
}
......@@ -46,7 +46,6 @@ namespace VivaldiModManager
public MainWindow()
{
InitializeComponent();
LocalizeDictionary.Instance.SetCurrentThreadCulture = true;
setman = new SettingsManager(
this.Width, this.Height, this.Left, this.Top, WindowState.Normal,
......@@ -184,14 +183,15 @@ namespace VivaldiModManager
foreach(var item in this.modman.vivaldiInstallations)
{
string allVersionsPath = Directory.GetParent(item.modsPersistentDir).FullName;
dirs.AddRange(Directory.GetDirectories(allVersionsPath));
if(Directory.Exists(allVersionsPath))
dirs.AddRange(Directory.GetDirectories(allVersionsPath));
}
dirs = dirs.Distinct().ToList();
Regex regm = new Regex(@"(\d\.[\d\.]+)$");
foreach(var item in this.modman.vivaldiInstallations)
{
if(item.Enabled)
if(item.Enabled && Directory.Exists(Directory.GetParent(item.modsPersistentDir).FullName))
{
toVersions.Add(new MigrateVersions()
{
......@@ -206,13 +206,14 @@ namespace VivaldiModManager
{
string ver = regm.Match(dir).Value;
var sameInSidebar = this.modman.vivaldiInstallations.Where(f => f.modsPersistentDir == dir).FirstOrDefault();
fromVersions.Add(new MigrateVersions()
{
version = ver,
modsDir = sameInSidebar == null ? null : sameInSidebar.modsDir,
modsPersistentDir = dir,
Selected = false
});
if(Directory.Exists(Directory.GetParent(dir).FullName))
fromVersions.Add(new MigrateVersions()
{
version = ver,
modsDir = sameInSidebar == null ? null : sameInSidebar.modsDir,
modsPersistentDir = dir,
Selected = false
});
}
MigrationWizard mwiz = new MigrationWizard(fromVersions, toVersions);
if (!this.setman.CleanStart)
......
......@@ -51,7 +51,7 @@ using System.Windows;
// Можно задать все значения или принять номер сборки и номер редакции по умолчанию.
// используя "*", как показано ниже:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.2.2.0")]
[assembly: AssemblyFileVersion("0.2.2.0")]
[assembly: AssemblyVersion("0.2.3.0")]
[assembly: AssemblyFileVersion("0.2.3.0")]
[assembly: Guid("40ad3bd5-c96a-4dbf-93d5-450b68c3c8ed")]
......@@ -46,6 +46,9 @@
<Reference Include="ControlzEx, Version=3.0.2.4, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\ControlzEx.3.0.2.4\lib\net45\ControlzEx.dll</HintPath>
</Reference>
<Reference Include="CrashReporter.NET, Version=1.5.5.0, Culture=neutral, PublicKeyToken=7828e0fd88cab698, processorArchitecture=MSIL">
<HintPath>..\packages\CrashReporter.NET.Official.1.5.5\lib\net40\CrashReporter.NET.dll</HintPath>
</Reference>
<Reference Include="ICSharpCode.AvalonEdit, Version=5.0.3.0, Culture=neutral, PublicKeyToken=9cc39be672370310, processorArchitecture=MSIL">
<HintPath>..\packages\AvalonEdit.5.0.4\lib\Net40\ICSharpCode.AvalonEdit.dll</HintPath>
</Reference>
......@@ -186,7 +189,9 @@
</None>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\Entypo.ttf" />
......
......@@ -3,6 +3,7 @@
<package id="AvalonEdit" version="5.0.4" targetFramework="net45" />
<package id="ControlzEx" version="3.0.2.4" targetFramework="net45" />
<package id="Costura.Fody" version="3.1.4" targetFramework="net45" />
<package id="CrashReporter.NET.Official" version="1.5.5" targetFramework="net45" />
<package id="Fody" version="3.2.7" targetFramework="net45" developmentDependency="true" />
<package id="MahApps.Metro" version="1.6.5" targetFramework="net45" />
<package id="MahApps.Metro.Resources" version="0.6.1.0" targetFramework="net45" />
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment