private void OnFileChanged(object sender, FileSystemEventArgs e) { string path = e.FullPath; if (IsFileChanged(path) == false) { return; } OnCodeChanged.Invoke(sender, e); }
private void OnFileChanged(object sender, FileSystemEventArgs e) { string path = e.FullPath; if (IsFileChanged(path) == false) { return; } OnCodeChanged.Invoke(sender, e); lastModifications[path] = stopwatch.Elapsed; }
public static void ApplyHotReloadDelta(IEnumerable <UpdateDelta> update) { Console.WriteLine("Applying delta"); foreach (var item in update) { Console.WriteLine(Convert.ToBase64String(item.MetadataDelta)); var assembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(a => a.Modules.FirstOrDefault() is Module m && m.ModuleVersionId == item.ModuleId); if (assembly is not null) { Console.WriteLine($"Applying update to {assembly}."); System.Reflection.Metadata.AssemblyExtensions.ApplyUpdate(assembly, item.MetadataDelta, item.ILDelta, ReadOnlySpan <byte> .Empty); } } OnCodeChanged?.Invoke(); }
public static void DeltaApplied() { OnCodeChanged?.Invoke(); }