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));
        }
Beispiel #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();
        }
Beispiel #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();
        }
        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));
            }
        }
        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));

            }
        }
Beispiel #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);
        }
Beispiel #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);
        }
Beispiel #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();
     }
 }
Beispiel #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();
            }
        }
Beispiel #11
0
 public void reverse(MinecraftPaths p)
 {
     string t = p.resolvePath(target, ExtraTags);
     File.Delete(t);
 }
Beispiel #12
0
 public void execute(MinecraftPaths p)
 {
     File.Copy(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags), true);
 }
Beispiel #13
0
 public void reverse(MinecraftPaths p)
 {
     string s = p.resolvePath(source);
     string t = p.resolvePath(target);
     SMMMUtil.FileSystemUtils.UndoDirectoryCopy(s, t);
 }
 public void reverse(MinecraftPaths p)
 {
     File.Delete(p.resolvePath(target));
 }
 public void reverse(MinecraftPaths p)
 {
     File.Delete(p.resolvePath(target));
 }
Beispiel #16
0
 public void execute(MinecraftPaths p)
 {
     File.Copy(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags), true);
 }
 public void execute(MinecraftPaths p)
 {
     SevenZipCompressor comp = new SevenZipCompressor();
     comp.ArchiveFormat = OutArchiveFormat.Zip;
     comp.CompressDirectory(p.resolvePath(source, ExtraTags), p.resolvePath(target, ExtraTags));
 }
Beispiel #18
0
        public void reverse(MinecraftPaths p)
        {
            string t = p.resolvePath(target, ExtraTags);

            File.Delete(t);
        }