Exemple #1
0
        private static void Process()
        {
            var wrapper = new TmodFileWrapper(typeof(BitsByte).Assembly);
            var modFile = wrapper.LoadFile(_modFilePath);

            var processors =
                typeof(Program)
                .Assembly
                .GetTypes()
                .Where(t => t.BaseType?.IsGenericType == true &&
                       t.BaseType.GetGenericTypeDefinition() == typeof(Processor <>));

            Directory.CreateDirectory(modFile.Name);
            foreach (var folder in DefaultConfigurations.FolderMapper.Values)
            {
                Directory.CreateDirectory(modFile.Name + Path.DirectorySeparatorChar + folder);
            }

            Logger.Warn("Directory created: {0}", modFile.Name);

            if (_dump)
            {
                Dump(modFile, processors);
            }
            else
            {
                Patch(modFile, processors);
            }
        }
        public void Run()
        {
            try
            {
                var wrapper = new TmodFileWrapper(typeof(Terraria.BitsByte).Assembly);
                Mod = wrapper.LoadFile(ModPath);
            }
            catch (Exception ex)
            {
                throw new Exception("Cannot initialize mod file instance", ex);
            }

            var processors = GetProcessors();

            switch (Mode)
            {
            case RunningMode.Dump:
                Dump(processors);
                break;

            case RunningMode.Patch:
                Patch(processors);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
        protected ProcessEngine(string modPath, string sourcePath, GameCultures language)
        {
            ModPath    = modPath;
            SourcePath = sourcePath;
            Language   = language;

            var wrapper = new TmodFileWrapper(typeof(BitsByte).Assembly);

            Mod = wrapper.LoadFile(ModPath);

            Processors = new List <Type>();
            SetupProcessors((IList <Type>)Processors);
        }