コード例 #1
0
 public void RefreshSomeDomain(CPanel cPanel, ProgressReporter reporter)
 {
     ProgressReporter.Coalesce(ref reporter);
     reporter.Report(0, "Domeny zaparkowane");
     if (!parkedLoaded)
     {
         Parked = cPanel.Call_ParkedDomain_List();
     }
     reporter.Report(33, "Domeny dodatkowe");
     if (!addonLoaded)
     {
         Addon = cPanel.Call_AddonDomain_List();
     }
     reporter.Report(66, "Subdomeny");
     if (!subLoaded)
     {
         Sub = cPanel.Call_SubDomain_List();
     }
     reporter.Report(75, "Domeny główne");
     if (!rootLoaded)
     {
         SetRootDomainsFromAllDomainsIncludingRoot(cPanel);
     }
     reporter.Finish();
 }
コード例 #2
0
        public void Run()
        {
            if (Progress == null)
            {
                Progress = new DummyProgressReporter();
            }

            try {
                Result = FileModExec.ExecuteMods(Path, Storage, Mods, Progress);
            } catch (Exception ex) {
                Progress.Error("Error while patching game files: " + ex.Message);
                Progress.Finish(false);
                return;
            }

            Progress.Message("Successfully patched game files.");
            Progress.Finish(true);
        }
コード例 #3
0
        public RootDomain IncrementalDomainSearch(string domainName, bool forceReload, CPanel cPanel, ProgressReporter reporter)
        {
            ProgressReporter.Coalesce(ref reporter);
            reporter.Report(0, "Domeny zaparkowane");
            if (!parkedLoaded || forceReload)
            {
                Parked = cPanel.Call_ParkedDomain_List();
            }
            var f1 = Parked.Where(i => i.NameEquals(domainName));

            if (f1.Any())
            {
                return(f1.First());
            }

            reporter.Report(33, "Domeny dodatkowe");
            if (!addonLoaded || forceReload)
            {
                Addon = cPanel.Call_AddonDomain_List();
            }
            var f2 = Addon.Where(i => i.NameEquals(domainName));

            if (f2.Any())
            {
                return(f2.First());
            }

            reporter.Report(66, "Subdomeny");
            if (!subLoaded || forceReload)
            {
                Sub = cPanel.Call_SubDomain_List();
            }
            var f3 = Sub.Where(i => i.NameEquals(domainName));

            if (f3.Any())
            {
                return(f3.First());
            }

            reporter.Report(75, "Domeny główne");
            if (!rootLoaded || forceReload)
            {
                SetRootDomainsFromAllDomainsIncludingRoot(cPanel);
                //var allNoRoot = All;
                //var allWithRoot = cPanel.Call_DomainLookup_GetDocRoots();
                // Root = DomainContainer.ComputeRootDomains(allNoRoot, allWithRoot);
            }
            var f4 = root.Where(i => i.NameEquals(domainName));

            if (f4.Any())
            {
                return(f4.First());
            }

            reporter.Finish();
            return(null);
        }
コード例 #4
0
        /// <summary>
        /// Pobiera listę wszystkich domen, ale bez root
        /// </summary>
        /// <param name="percent_report">Raportuje postęp</param>
        /// <returns></returns>
        public ParkedDomain[] GetAllDomains(ProgressReporter percent_report, bool skipCache = false)
        {
            ParkedDomain[] all;
            ParkedDomain[] parkedDomains;
            AddonDomain[]  addonDomains;
            SubDomain[]    subDomains;

            ProgressReporter.Coalesce(ref percent_report);

            percent_report.Report(0, Polish.strDomenyZaparkowane);
            parkedDomains = Call_ParkedDomain_List(skipCache);
            percent_report.Report(33, Polish.strDomenyDodatkowe);
            addonDomains = Call_AddonDomain_List(skipCache);
            percent_report.Report(67, Polish.strSubdomeny);
            subDomains = Call_SubDomain_List(skipCache);
            percent_report.Finish();
            all = parkedDomains.Concat(addonDomains.OfType <ParkedDomain>()).Concat(subDomains.OfType <ParkedDomain>()).ToArray();
            return(all);
        }
コード例 #5
0
        /// <summary>
        /// Zwraca dokładnie wszystkie domeny
        /// </summary>
        /// <param name="percent_report"></param>
        /// <param name="skipCache"></param>
        /// <returns></returns>
        public RootDomain[] GetAllDomains2(ProgressReporter percent_report, bool skipCache = false)
        {
            ProgressReporter.Coalesce(ref percent_report);
            ParkedDomain[] allNoRoot;
            if (percent_report != null)
            {
                allNoRoot = GetAllDomains(percent_report.GetScaled(0, 75), skipCache);
            }
            else
            {
                allNoRoot = GetAllDomains(null, skipCache);
            }
            percent_report.Report(75, Polish.strDomenyGlowne);
            var allWithRoot = Call_DomainLookup_GetDocRoots();

            percent_report.Finish();
            var c = DomainContainer.ComputeRootDomains(allNoRoot, allWithRoot);

            return(c.Union(allNoRoot).ToArray());
        }
コード例 #6
0
            public void Cs1GameInit()
            {
                int  CurrentProgress       = 0;
                int  TotalProgress         = 4;
                bool shouldAutoCloseWindow = true;

                try {
                    Progress.Message("Checking Sen1Launcher.exe...", CurrentProgress++, TotalProgress);
                    using (var fs = new HyoutaUtils.Streams.DuplicatableFileStream(Sen1LauncherPath)) {
                        SHA1 hash = ChecksumUtils.CalculateSHA1ForEntireStream(fs);
                        if (hash != new SHA1(0x8dde2b39f128179aul, 0x0beb3301cfd56a98ul, 0xc0f98a55u))
                        {
                            Progress.Error("Selected file does not appear to be Sen1Launcher.exe of version 1.6.");
                            Progress.Finish(false);
                            return;
                        }
                    }
                } catch (Exception ex) {
                    Progress.Error("Error while validating Sen1Launcher.exe: " + ex.Message);
                    Progress.Finish(false);
                    return;
                }

                try {
                    Path = System.IO.Path.GetDirectoryName(Sen1LauncherPath);
                    Progress.Message("Checking if we have encoding errors in filenames...", CurrentProgress++, TotalProgress);
                    if (FilenameFix.FixupIncorrectEncodingInFilenames(Path, 1, false, Progress))
                    {
                        if (!FilenameFix.FixupIncorrectEncodingInFilenames(Path, 1, true, Progress))
                        {
                            Progress.Error("Failed to fix encoding errors in filenames, attempting to proceed anyway...");
                            shouldAutoCloseWindow = false;
                        }
                    }
                    Progress.Message("Initializing patch data...", CurrentProgress++, TotalProgress);
                    var files = Sen1KnownFiles.Files;
                    Progress.Message("Initializing game data...", CurrentProgress++, TotalProgress);
                    var storageInit = FileModExec.InitializeAndPersistFileStorage(Path, files, Progress);
                    Storage = storageInit?.Storage;
                    if (storageInit == null || storageInit.Errors.Count != 0)
                    {
                        shouldAutoCloseWindow = false;
                    }
                } catch (Exception ex) {
                    Progress.Error("Error while initializing CS1 patch/game data: " + ex.Message);
                    Progress.Finish(false);
                    return;
                }

                ShouldProceedToPatchOptionWindow = Path != null && Storage != null;
                if (shouldAutoCloseWindow)
                {
                    Progress.Message("Initialized CS1 data, proceeding to patch options...", CurrentProgress, TotalProgress);
                }
                else
                {
                    Progress.Message("", CurrentProgress, TotalProgress);
                    if (ShouldProceedToPatchOptionWindow)
                    {
                        Progress.Error(
                            "Encountered problems while initializing CS1 data. "
                            + "Closing this window will proceed to the patch options anyway, but be aware that some patches may not work correctly. "
                            + "It is recommended to verify the game files using Steam or GOG Galaxy's build-in feature to do so, or to reinstall the game. "
                            + "Please also ensure you're trying to patch a compatible version of the game. (XSEED release version 1.6; other game versions are not compatible)"
                            );
                    }
                    else
                    {
                        Progress.Error(
                            "Unrecoverable issues while initializing CS1 data. "
                            + "Please ensure SenPatcher has read and write access to the selected game directory, then try again."
                            );
                    }
                }
                Progress.Finish(shouldAutoCloseWindow);
            }