Exemplo n.º 1
0
    internal static void PurgeCache()
    {
        if (UserSettings.All.AskDeleteCacheWhenClosing && !CacheDialog.Ask(false, out _))
        {
            return;
        }

        try
        {
            var cache = Other.AdjustPath(UserSettings.All.TemporaryFolderResolved);

            Directory.Delete(cache, true);
        }
        catch (Exception e)
        {
            LogWriter.Log(e, "Purging cache");
        }
    }
Exemplo n.º 2
0
        private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
        {
            try
            {
                //This is used when trying to load missing assemblies, which are not located in same folder as the main executable.

                var name = args.Name.Split(',').First();

                if (!name.StartsWith("SharpDX"))
                    return null;

                var path = Other.AdjustPath(UserSettings.All.SharpDxLocationFolder ?? "");

                return Assembly.LoadFrom(System.IO.Path.Combine(path, $"{name}.dll"));
            }
            catch (Exception e)
            {
                LogWriter.Log(e, "Error loading assemblies");
                return null;
            }
        }