コード例 #1
0
        private void Import(IFile f, IPackageGroup group, FileImporter importer, bool preferEarly)
        {
            var importerTiming = ReflectionHelper.GetAttribute <OperationTimingAttribute>(importer.GetType())
                                 ?.Timing ?? OperationTiming.Any;

            Utils.LogDebug($"Trying to Import [{f.GetType()}] using [{importer.GetType()}]" +
                           $"\n    ImporterTiming: [{importerTiming}]" +
                           $"\n    State: [{Localizer.State}]" +
                           $"\n    PreferEarly: [{preferEarly}]");
            if (!Localizer.CanDoOperationNow(importer.GetType()) ||
                (preferEarly && importerTiming > Localizer.State &&
                 importerTiming == OperationTiming.Any &&
                 Localizer.State != OperationTiming.BeforeModCtor))
            {
                return;
            }
            importer.Import(f, group.Mod, group.Packages.ToList()[0].Language);
            Utils.LogDebug($"Import Complete");
        }