Example #1
0
        void IModule.OnCreate(System.Object param)
        {
            CreateParameters createParam = param as CreateParameters;

            if (createParam == null)
            {
                throw new Exception($"{nameof(PatchManager)} create param is invalid.");
            }
            if (createParam.ServerInfo == null)
            {
                throw new Exception("ServerInfo is null");
            }

            // 注册变体规则
            if (createParam.VariantRules != null)
            {
                _variantCollector = new VariantCollector();
                foreach (var variantRule in createParam.VariantRules)
                {
                    _variantCollector.RegisterVariantRule(variantRule.VariantGroup, variantRule.TargetVariant);
                }
            }

            // 创建补丁管理器实现类
            _patcher = new PatchManagerImpl();
            _patcher.Create(createParam);
        }
        void IModule.OnCreate(System.Object param)
        {
            CreateParameters createParam = param as CreateParameters;

            if (createParam == null)
            {
                throw new Exception($"{nameof(PatchManager)} create param is invalid.");
            }
            if (createParam.ServerInfo == null)
            {
                throw new Exception("ServerInfo is null");
            }
            if (createParam.GameVersionParser == null)
            {
                throw new Exception($"{nameof(IGameVersionParser)} is null.");
            }

            // 创建补丁管理器实现类
            _patcher = new PatchManagerImpl();
            _patcher.Create(createParam);
        }