Exemple #1
0
        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();
            }
        }
Exemple #2
0
        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.");
        }
Exemple #3
0
        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.");
        }
Exemple #4
0
        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.");
        }
Exemple #5
0
        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.");
        }