private void AddAssembly(string path) { var name = Path.GetFileNameWithoutExtension(path); var settings = AssembliesSettingsFile.GetOrAdd(name); settings.Name = name; settings.OriginalPath = path; settings.ModifiedTime = File.GetLastWriteTimeUtc(path); settings.SubPath = Path.Combine(name, Path.GetFileName(path)); }
public void Uninstall(string name) { TryClean(); var toFolder = GetAssemblyFolder(name); Directory.Delete(toFolder, true); AssembliesSettingsFile.Delete(name); Load(); }
public void Update(string name) { if (!UpdatingIsNeed(name)) { return; } var settings = AssembliesSettingsFile.Get(name); var path = settings.OriginalPath; Uninstall(name); Install(path); }
public virtual void Load() { TryClean(); AssembliesSettingsFile.Load(); ActiveFolder = CreateActiveFolder(); DirectoryUtilities.Copy(AssembliesFolder, ActiveFolder, true); ActiveAssemblies = AssembliesSettings .Select(item => Path.Combine(ActiveFolder, item.Value.SubPath)) .Where(i => !string.IsNullOrWhiteSpace(i)) .Where(File.Exists) .Select(LoadAssembly) .ToDictionary(i => i.GetSimpleName(), i => i); }
public bool UpdatingIsNeed(string name) { var settings = AssembliesSettingsFile.Get(name); var path = settings.OriginalPath; if (string.IsNullOrWhiteSpace(path) || !File.Exists(path)) { return(false); } var time = settings.ModifiedTime; var checkTime = File.GetLastWriteTimeUtc(path); if (time == checkTime) { return(false); } return(true); }
public virtual void Save() { TryClean(); AssembliesSettingsFile.Save(); }