private static void WaitForLockFile() { Watcher.Path = LeaguePath; Watcher.NotifyFilter = NotifyFilters.LastWrite | NotifyFilters.FileName | NotifyFilters.DirectoryName | NotifyFilters.LastAccess; Watcher.Filter = "lockfile"; FileSystemEventHandler OnLockFileChanged = (o, e) => { if (IsActive || LockFile.Equals("")) { return; } Init(); }; Watcher.Created += OnLockFileChanged; Watcher.Changed += OnLockFileChanged; Watcher.Deleted += (o, e) => { IsActive = false; Stopped?.Invoke(null, EventArgs.Empty); Connection = null; CurrentSummoner = null; LoggedOut?.Invoke(null, EventArgs.Empty); }; Watcher.EnableRaisingEvents = true; if (LockFileLocation != null && File.Exists(LockFileLocation)) { Init(); } }
public void LockFile_ComparesEqualTools() { // Arrange var lockFileA = new LockFile { Tools = { new LockFileTarget { TargetFramework = FrameworkConstants.CommonFrameworks.NetStandard12, Libraries = { new LockFileTargetLibrary { Name = "SomeLibrary" } } } } }; // same thing var lockFileB = new LockFile { Tools = { new LockFileTarget { TargetFramework = FrameworkConstants.CommonFrameworks.NetStandard12, Libraries = { new LockFileTargetLibrary { Name = "SomeLibrary" } } } } }; // Act & Assert Assert.True(lockFileA.Equals(lockFileB), "The two lock files should be equal."); }
public void LockFile_ComparesDifferentTools() { // Arrange var lockFileA = new LockFile { Tools = { new LockFileTarget { TargetFramework = FrameworkConstants.CommonFrameworks.NetStandard12, Libraries = { new LockFileTargetLibrary { Name = "SomeLibrary" } } } } }; // different thing var lockFileB = new LockFile { Tools = { new LockFileTarget { TargetFramework = FrameworkConstants.CommonFrameworks.NetStandard12, Libraries = { new LockFileTargetLibrary { Name = "SomeLibrary" } } }, new LockFileTarget { TargetFramework = FrameworkConstants.CommonFrameworks.NetStandard12, Libraries = { new LockFileTargetLibrary { Name = "OtherLibrary" } } } } }; // Act & Assert Assert.False(lockFileA.Equals(lockFileB), "The two lock files should not be equal."); }
public void LockFile_ComparesEqualProjectFileToolGroups() { // Arrange var lockFileA = new LockFile { ProjectFileToolGroups = { new ProjectFileDependencyGroup("FrameworkA", new [] { "DependencyA" }) } }; // same thing var lockFileB = new LockFile { ProjectFileToolGroups = { new ProjectFileDependencyGroup("FrameworkA", new [] { "DependencyA" }) } }; // Act & Assert Assert.True(lockFileA.Equals(lockFileB), "The two lock files should be equal."); }
public void LockFile_ComparesDifferentProjectFileToolGroups() { // Arrange var lockFileA = new LockFile { ProjectFileToolGroups = { new ProjectFileDependencyGroup("FrameworkA", new [] { "DependencyA" }) } }; // different thing var lockFileB = new LockFile { ProjectFileToolGroups = { new ProjectFileDependencyGroup("FrameworkA", new [] { "DependencyA" }), new ProjectFileDependencyGroup("FrameworkB", new [] { "DependencyB" }) } }; // Act & Assert Assert.False(lockFileA.Equals(lockFileB), "The two lock files should not be equal."); }