Ejemplo n.º 1
0
        //
        //blacklist stuff over
        //

        //brings mods up to date if necessary
        private void RetrieveAllDlls()
        {
            string[] pluginFolderContents = Directory.GetFiles(PluginsFolder);
            foreach (string s in pluginFolderContents)
            {
                var fi = new FileInfo(s);
                if (fi.Extension == ".dll" && !pluginBlacklist.Contains(fi.Name) && !fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
                {
                    if (File.Exists(pathtomods(fi)))
                    {
                    }
                    else
                    {
                        File.Copy(s, pathtomods(fi));
                        Debug.WriteLine(fi.Name + " from Plugins does not have a counterpart in Mods, copying.");
                    }
                }
            }
            string[] patchFolderContents = Directory.GetFiles(PatchesFolder);
            foreach (string s in patchFolderContents)
            {
                var fi = new FileInfo(s);
                if (fi.Extension == ".dll" && !patchBlacklist.Contains(fi.Name) && !fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
                {
                    if (!File.Exists(ModFolder + PtModData.GiveMeBackMyName(fi.Name)))
                    {
                        File.Copy(s, ModFolder + PtModData.GiveMeBackMyName(fi.Name));
                        Debug.WriteLine(fi.Name + "from patch folder does not have a counterpart in Mods, copying");
                    }
                    else if (fi.LastWriteTime < new FileInfo(ModFolder + PtModData.GiveMeBackMyName(fi.Name)).LastWriteTime)
                    {
                        File.Delete(s);
                        File.Copy(ModFolder + PtModData.GiveMeBackMyName(fi.Name), s);
                        Debug.WriteLine(fi.Name + "from Patches folder brought up to date.");
                    }
                }
            }
            string pathtomods(FileInfo fi)
            {
                return(ModFolder + fi.Name);
            }
        }
Ejemplo n.º 2
0
        //deletes Pubstunt and mixmods
        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;
                        Debug.WriteLine("Located PublicityStunt in active Plugins folder, removing.");
                        File.Delete(s);
                    }
                    else
                    {
                        ModRelay.ModType mt = ModRelay.GetModType(s);

                        if (mt != ModRelay.ModType.Patch && !patchBlacklist.Contains(s) && !fi.Attributes.HasFlag(FileAttributes.ReparsePoint))
                        {
                            Debug.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);
                        Debug.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)
                        {
                            Debug.WriteLine("Found a misplaced mod in Plugins folder: " + fi.Name + "; Type: " + mt.ToString());
                            if (File.Exists(ModFolder + PtModData.GiveMeBackMyName(fi.Name)))
                            {
                                File.Delete(s);
                                Debug.WriteLine("Duplicate exists in Mods folder, deleting.");
                            }
                            else
                            {
                                Debug.WriteLine("Moving to Mods folder.");
                                File.Move(s, ModFolder + PtModData.GiveMeBackMyName(fi.Name));
                            }
                        }
                    }
                }
            }
        }