Esempio n. 1
0
        public void reverse(MinecraftPaths p)
        {
            string s = p.resolvePath(source);
            string t = p.resolvePath(target);

            SMMMUtil.FileSystemUtils.UndoDirectoryCopy(s, t);
        }
        public void execute(MinecraftPaths p)
        {
            SevenZipCompressor comp = new SevenZipCompressor();

            comp.ArchiveFormat = OutArchiveFormat.Zip;
            comp.CompressDirectory(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags));
        }
Esempio n. 3
0
        public MinecraftInstance()
        {
            m_path         = new MinecraftPaths();
            m_jar          = new MinecraftJar(m_path.jarPath);
            m_jar.TempPath = m_path.tempDir;
            CompressedFile.defaultTempDir = m_path.tempDir;
            m_config = new ModConfig(m_path);

            //fsWatcher = new FileSystemWatcher(m_path.appModDir);
            //fsWatcher.Changed += new FileSystemEventHandler(fsWatcher_Changed);
            InitInstance();
            addAllMods();
            pruneConfig();
        }
Esempio n. 4
0
        public MinecraftInstance()
        {
            m_path = new MinecraftPaths();
            m_jar = new MinecraftJar(m_path.jarPath);
            m_jar.TempPath = m_path.tempDir;
            CompressedFile.defaultTempDir = m_path.tempDir;
            m_config = new ModConfig(m_path);

            //fsWatcher = new FileSystemWatcher(m_path.appModDir);
            //fsWatcher.Changed += new FileSystemEventHandler(fsWatcher_Changed);
            InitInstance();
            addAllMods();
            pruneConfig();
        }
Esempio n. 5
0
        public void execute(MinecraftPaths p)
        {
            Regex zip = new Regex(@"ZIP$");

            if (zip.IsMatch(target))
            {
                SevenZip.SevenZipCompressor comp = new SevenZipCompressor();
                Match m = zip.Match(target);

                target = target.Remove(m.Index) + "NAME";
                comp.CompressDirectory(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags));
            }
            else
            {
                SMMMUtil.FileSystemUtils.CopyDirectory(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags));
            }
        }
Esempio n. 6
0
        public void execute(MinecraftPaths p)
        {
            Regex zip = new Regex(@"ZIP$");
            if (zip.IsMatch(target))
            {
                SevenZip.SevenZipCompressor comp = new SevenZipCompressor();
                Match m = zip.Match(target);

                target = target.Remove(m.Index) + "NAME";
                comp.CompressDirectory(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags));

            }
            else
            {
                SMMMUtil.FileSystemUtils.CopyDirectory(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags));

            }
        }
Esempio n. 7
0
        public ModConfig(MinecraftPaths p)
        {
            paths = p;

            if (!File.Exists(Path.Combine(p.appConfigDir, "config.xml")))
            {
                XDeclaration dec = new XDeclaration("1.0", "UTF-8", "yes");
                document             = new XDocument();
                document.Declaration = dec;
                document.Add(new XElement("SMMMconfig"));
                document.Save(Path.Combine(paths.appConfigDir, "config.xml"));
            }
            else
            {
                document = XDocument.Load(Path.Combine(p.appConfigDir, "config.xml"));
            }
            m_numMods = document.Elements().ElementAt(0).Elements().Count();
            OnConfigChanged(EventArgs.Empty);
        }
Esempio n. 8
0
        public ModConfig(MinecraftPaths p)
        {
            paths = p;

            if (!File.Exists(Path.Combine(p.appConfigDir, "config.xml")))
            {
                XDeclaration dec = new XDeclaration("1.0", "UTF-8", "yes");
                document = new XDocument();
                document.Declaration = dec;
                document.Add(new XElement("SMMMconfig"));
                document.Save(Path.Combine(paths.appConfigDir, "config.xml"));
            }
            else
            {
                document = XDocument.Load(Path.Combine(p.appConfigDir, "config.xml"));
            }
            m_numMods = document.Elements().ElementAt(0).Elements().Count();
            OnConfigChanged(EventArgs.Empty);
        }
Esempio n. 9
0
 public static IFSAction GenerateAction(MinecraftPaths p, string source, string target, ICollection<KeyValuePair<string,string>> extraTags = null,  bool compress=true)
 {
     string s = p.resolvePath(source,extraTags);
     string t = p.resolvePath(target,extraTags);
     if (Path.GetExtension(t) == ".zip")
     {
         return new DirectoryCompressAction(p.CompressPath(s, extraTags), p.CompressPath(t, extraTags));
     }
     else if (Directory.Exists(s))
     {
         return new DirectoryCopyAction(p.CompressPath(s, extraTags), p.CompressPath(t, extraTags));
     }
     else if (File.Exists(s))
     {
         return new FileCopyAction(p.CompressPath(s, extraTags), Path.Combine(p.CompressPath(t, extraTags), Path.GetFileName(s)));
     }
     else
     {
         throw new InvalidOperationException();
     }
 }
Esempio n. 10
0
        public static IFSAction GenerateAction(MinecraftPaths p, string source, string target, ICollection <KeyValuePair <string, string> > extraTags = null, bool compress = true)
        {
            string s = p.resolvePath(source, extraTags);
            string t = p.resolvePath(target, extraTags);

            if (Path.GetExtension(t) == ".zip")
            {
                return(new DirectoryCompressAction(p.CompressPath(s, extraTags), p.CompressPath(t, extraTags)));
            }
            else if (Directory.Exists(s))
            {
                return(new DirectoryCopyAction(p.CompressPath(s, extraTags), p.CompressPath(t, extraTags)));
            }
            else if (File.Exists(s))
            {
                return(new FileCopyAction(p.CompressPath(s, extraTags), Path.Combine(p.CompressPath(t, extraTags), Path.GetFileName(s))));
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Esempio n. 11
0
 public void reverse(MinecraftPaths p)
 {
     string t = p.resolvePath(target, ExtraTags);
     File.Delete(t);
 }
Esempio n. 12
0
 public void execute(MinecraftPaths p)
 {
     File.Copy(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags), true);
 }
Esempio n. 13
0
 public void reverse(MinecraftPaths p)
 {
     string s = p.resolvePath(source);
     string t = p.resolvePath(target);
     SMMMUtil.FileSystemUtils.UndoDirectoryCopy(s, t);
 }
Esempio n. 14
0
 public void reverse(MinecraftPaths p)
 {
     File.Delete(p.resolvePath(target));
 }
Esempio n. 15
0
 public void reverse(MinecraftPaths p)
 {
     File.Delete(p.resolvePath(target));
 }
Esempio n. 16
0
 public void execute(MinecraftPaths p)
 {
     File.Copy(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags), true);
 }
Esempio n. 17
0
 public void execute(MinecraftPaths p)
 {
     SevenZipCompressor comp = new SevenZipCompressor();
     comp.ArchiveFormat = OutArchiveFormat.Zip;
     comp.CompressDirectory(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags));
 }
Esempio n. 18
0
        public void reverse(MinecraftPaths p)
        {
            string t = p.resolvePath(target, ExtraTags);

            File.Delete(t);
        }