示例#1
0
文件: BOI.cs 项目: thalber/BOI
        //
        //blacklist stuff over
        //

        //brings mods up to date if necessary
        private void RetrieveAllDlls()
        {
            var           plugins = new DirectoryInfo(PluginsFolder);
            var           monomod = new DirectoryInfo(PatchesFolder);
            List <string> bl      = new List <string>();

            bl.AddRange(pluginBlacklist);
            bl.AddRange(patchBlacklist);
            var fl = plugins.GetFiles().ToList();

            fl.AddRange(monomod.GetFiles());
            foreach (FileInfo inpl in fl)
            {
                try
                {
                    if (inpl.Attributes.HasFlag(FileAttributes.ReparsePoint))
                    {
                        continue;
                    }
                    string pb = PathBack(inpl);
                    if (pb == null || bl.Contains(inpl.Name))
                    {
                        continue;
                    }
                    var wayBack = new FileInfo(pb);
                    if (!wayBack.Exists)
                    {
                        inpl.CopyTo(wayBack.FullName);
                    }
                }
                catch (IOException ioe)
                {
                    Wood.WriteLine($"ERROR WHILE RETRIEVING {inpl}: ");
                    Wood.Indent();
                    Wood.WriteLine(ioe);
                    Wood.Unindent();
                }
            }



            string PathBack(FileInfo fi)
            {
                if (fi.Attributes.HasFlag(FileAttributes.ReparsePoint) || fi.Extension != ".dll")
                {
                    return(null);
                }
                return(Path.Combine(ModFolder, PtModData.GiveMeBackMyName(fi.Name)));
            }
        }
示例#2
0
文件: BOI.cs 项目: thalber/BOI
        //deletes Pubstunt and mixmods from where they shouldn't be
        private void Rootout()
        {
            string[] patchfoldercontents  = Directory.GetFiles(PatchesFolder);
            string[] pluginfoldercontents = Directory.GetFiles(PluginsFolder);
            foreach (string s in patchfoldercontents)
            {
                var fi = new FileInfo(s);
                if (fi.Extension == ".dll" && !fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
                {
                    if (AintThisPS(s))
                    {
                        PubstuntFound = true;
                        Wood.WriteLine("Located PublicityStunt in active Plugins folder, removing.");
                        File.Delete(s);
                    }
                    else
                    {
                        ModRelay.ModType mt = ModRelay.GetModType(s);
                        if (!(mt == ModRelay.ModType.Patch || mt == ModRelay.ModType.Invalid) && !patchBlacklist.Contains(s) && !fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
                        {
                            Wood.WriteLine("Found a misplaced mod in Patches folder: " + fi.Name + "; Type: " + mt.ToString());
                            if (File.Exists(ModFolder + PtModData.GiveMeBackMyName(fi.Name)))
                            {
                                File.Delete(s);
                            }
                            else
                            {
                                File.Move(s, ModFolder + PtModData.GiveMeBackMyName(fi.Name));
                            }
                        }
                    }
                }
            }
            foreach (string s in pluginfoldercontents)
            {
                var fi = new FileInfo(s);
                if (fi.Extension == ".dll" && !pluginBlacklist.Contains(s) && !fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
                {
                    if (AintThisPS(s))
                    {
                        File.Delete(s);
                        Wood.WriteLine("Located PublicityStunt in active Plugins folder, removing.");
                        PubstuntFound = true;
                    }
                    else
                    {
                        ModRelay.ModType mt = ModRelay.GetModType(s);

                        if (mt == ModRelay.ModType.Patch || mt == ModRelay.ModType.Invalid)
                        {
                            Wood.WriteLine("Found a misplaced mod in Plugins folder: " + fi.Name + "; Type: " + mt.ToString());
                            if (File.Exists(ModFolder + PtModData.GiveMeBackMyName(fi.Name)))
                            {
                                File.Delete(s);
                                Wood.WriteLine("Duplicate exists in Mods folder, deleting.");
                            }
                            else
                            {
                                Wood.WriteLine("Moving to Mods folder.");
                                File.Move(s, ModFolder + PtModData.GiveMeBackMyName(fi.Name));
                            }
                        }
                    }
                }
            }
        }