示例#1
0
        public void Load(string rootPath, string moduleName)
        {
            if (!Directory.Exists(rootPath))
            {
                return;
            }
            _rm        = new ResourceManager();
            moduleName = Path.GetExtension(moduleName) != ErfFile.ModExt
                ? moduleName + ErfFile.ModExt
                : moduleName;

            _diRoot     = new DirectoryInfo(rootPath);
            _diModules  = new DirectoryInfo(_diRoot.FullName + ModuleDir);
            _diOverride = new DirectoryInfo(_diRoot.FullName + OverrideDir);
            _diHak      = new DirectoryInfo(_diRoot.FullName + HakDir);

            _rm.Add(Directory.GetFiles(_diRoot.FullName, "*" + KeyFile.Ext));
            _rm.Add(_diOverride.FullName);

            _mod     = new ErfFile(_diModules.FullName + "/" + moduleName);
            _modInfo = new GffDocument(_mod[FileInfoName].DataStream);
            _rm.Add(HakList);

            _rm.Add(_diModules.FullName + "/" + moduleName);
        }
示例#2
0
        public void ContainerExtractAllTest()
        {
            Container    cont = new ErfFile("D:/NWN/modules/FFR2_V1_0a.mod");
            const string path = "D:/NWN/modules/FFR2_V1_0a";
            Func <ContentObject, bool> condMeth = item => true;

            cont.ExtractAll(path, condMeth);
        }
示例#3
0
        public void Start()
        {
            GetConfig();
            GetBaseDirectory();
            _tempDirName = _baseDirName + "/modules/temp0";
            _xmlDirName  = _baseDirName + "/modules/xml";
            if (!Directory.Exists(_tempDirName))
            {
                CreateDirectory(_tempDirName);
                GetModuleDirectory();
                var mod = new ErfFile(_modDirName);
                Console.WriteLine("Extraction du module... Veuillez patienter.");
                var dt = DateTime.Now;
                mod.ExtractAll(_tempDirName);
                Console.WriteLine("Extraction exécutée en " + (DateTime.Now.Subtract(dt).TotalSeconds + " secondes."));
                PushToContinue();
            }
            else
            {
                Console.WriteLine("Utilisation du dossier temp0 déjà présent.");
                PushToContinue();
            }
            SetConfig();
            CreateDirectory(_xmlDirName);
            Again = true;

            while (Again)
            {
                WriteHeader();
                Console.WriteLine("Votre choix : ");
                int result = Convert.ToChar(Console.Read());
                switch (result)
                {
                case Modelisation:
                    DoOnFiles(_tempDirName, _xmlDirName, IsGff, ModelFile);
                    break;

                case Demodelisation:
                    DoOnFiles(_xmlDirName, _tempDirName, IsXml, DemodFile);
                    break;

                case Quitter:
                    SetToClose();
                    break;
                }
            }
        }
示例#4
0
        /// <summary>
        /// Disposer.
        /// </summary>
        /// <param name="Disposing">Supplies true if the object is
        /// disposing.</param>
        public override void Dispose(bool Disposing)
        {
            //
            // If disposing, invoke disposer for the ErfFile.
            //

            if (Disposing)
            {
                if (ErfFile != null)
                {
                    ErfFile.Dispose();
                    ErfFile = null;
                }
            }

            //
            // Invoke base class dispose.
            //

            base.Dispose(Disposing);
        }
 public void Add(params string[] list)
 {
     foreach (var path in list)
     {
         Container c = null;
         if (Directory.Exists(path))
         {
             c = new DirectoryContainer(path);
         }
         else
         {
             if (File.Exists(path))
             {
                 if (KeyFile.IsKey(path))
                 {
                     c = new KeyFile(path);
                 }
                 else if (ErfFile.IsErf(path))
                 {
                     c = new ErfFile(path);
                 }
                 else
                 {
                     throw new ApplicationException("Impossible d'ajouter le chemin spécifié : " + path);
                 }
             }
         }
         if (c == null)
         {
             throw new ApplicationException("Le conteneur de ressource n'est pas initialisé correctement.");
         }
         foreach (ContentObject co in c)
         {
             Add(co);
         }
     }
 }