Exemplo n.º 1
0
        /// <summary>
        /// Look for DLC installed in GameData
        /// </summary>
        /// <returns>
        /// True if not the same list as last scan, false otherwise
        /// </returns>
        public bool ScanDlc()
        {
            var           dlc = new Dictionary <string, ModuleVersion>(registry.InstalledDlc);
            ModuleVersion foundVer;
            bool          changed = false;

            registry.ClearDlc();

            var testDlc = TestDlcScan();

            foreach (var i in testDlc)
            {
                if (!changed &&
                    (!dlc.TryGetValue(i.Key, out foundVer) ||
                     foundVer != i.Value))
                {
                    changed = true;
                }
                registry.RegisterDlc(i.Key, i.Value);
            }

            var wellKnownDlc = WellKnownDlcScan();

            foreach (var i in wellKnownDlc)
            {
                if (!changed &&
                    (!dlc.TryGetValue(i.Key, out foundVer) ||
                     foundVer != i.Value))
                {
                    changed = true;
                }
                registry.RegisterDlc(i.Key, i.Value);
            }

            // Check if anything got removed
            if (!changed)
            {
                foreach (var i in dlc)
                {
                    if (!registry.InstalledDlc.TryGetValue(i.Key, out foundVer) ||
                        foundVer != i.Value)
                    {
                        changed = true;
                        break;
                    }
                }
            }
            return(changed);
        }
Exemplo n.º 2
0
        public void ScanDlc()
        {
            var testDlc      = TestDlcScan();
            var wellKnownDlc = WellKnownDlcScan();

            registry.ClearDlc();

            foreach (var i in testDlc)
            {
                registry.RegisterDlc(i.Key, i.Value);
            }

            foreach (var i in wellKnownDlc)
            {
                registry.RegisterDlc(i.Key, i.Value);
            }
        }
Exemplo n.º 3
0
        public void CompatibleModules_MHInstalled_IncludesModulesDependingOnMH()
        {
            // Arrange
            registry.RegisterDlc("MakingHistory-DLC", new UnmanagedModuleVersion("1.1.0"));

            CkanModule DLCDepender = CkanModule.FromJson(@"{
                ""identifier"": ""DLC-Depender"",
                ""version"":    ""1.0.0"",
                ""download"":   ""https://kerbalstuff.com/mod/269/Dogecoin%20Flag/download/1.01"",
                ""depends"": [
                    { ""name"": ""MakingHistory-DLC"" }
                ]
            }");

            registry.AddAvailable(DLCDepender);

            // Act
            List <CkanModule> avail = registry.CompatibleModules(v0_24_2).ToList();

            // Assert
            Assert.IsTrue(avail.Contains(DLCDepender));
        }