/// <summary> /// Resolver callback, provide assemblies used in this patcher. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> /// <returns></returns> private static Assembly AssemblyResolver(object sender, ResolveEventArgs args) { AssemblyName name = new AssemblyName(args.Name); _logger._Debug("Resolving global assembly " + args.Name); try { return(Assembly.LoadFile(Path.Combine(_paths.WorkingPath, $"{name.Name}.dll"))); } catch (Exception) { return(null); } }
private void SaveConfig() { _logger.Info($"Saving Loader config, actual loader state: [{_configValues.Enabled}]"); string content = BuildConfig(); _logger._Debug($"Saving config: \n{content}"); try { using (FileStream stream = File.Create(_configFileName)) { byte[] byteContent = new UTF8Encoding(true).GetBytes(content); stream.Write(byteContent, 0, byteContent.Length); } _logger.Info("Loader config saved successfully!"); } catch (Exception e) { _logger.Error("Something went wrong while saving config \n" + e); } }