コード例 #1
0
            public override string Execute(string original)
            {
                original = original.Replace("${Gs2::Weave::ExchangeNamespaceName}", _installer.exchangeNamespaceName);
                original = original.Replace("${Gs2::Weave::ExchangeKeyNamespaceName}", _installer.keyNamespaceName);
                original = original.Replace("${Gs2::Weave::ExchangeKeyName}", _installer.keyName);

                {
                    var master = new StaminaMaster
                    {
                        rateModels = _installer.products.Select(
                            product => product.ToModel(
                                _installer.staminaInstaller.staminaNamespaceName,
                                _installer.staminaInstaller.staminaModelName,
                                _installer.moneyInstaller.moneyNamespaceName
                                )
                            ).ToList()
                    };

                    var stringBuilder = new StringBuilder();
                    var jsonWriter    = new JsonWriter(stringBuilder);
                    master.WriteJson(jsonWriter);

                    var json = JsonMapper.ToObject(original);
                    json["Resources"]["ExchangeSettings"]["Properties"]["Settings"] = stringBuilder.ToString();
                    original = json.ToJson();
                }

                return(original);
            }
コード例 #2
0
            public override string Execute(string original)
            {
                original = original.Replace("${Gs2::Weave::StaminaNamespaceName}", _installer.staminaNamespaceName);
                original = original.Replace("${Gs2::Weave::StaminaModelName}", _installer.staminaModelName);
                original = original.Replace("${Gs2::Weave::Capacity}", _installer.capacity.ToString());
                original = original.Replace("${Gs2::Weave::RecoverValue}", _installer.recoverValue.ToString());
                original = original.Replace("${Gs2::Weave::RecoverIntervalMinutes}", _installer.recoverIntervalMinutes.ToString());

                {
                    var master = new StaminaMaster
                    {
                        staminaModels = new List <StaminaModel>
                        {
                            new StaminaModel
                            {
                                name                   = _installer.staminaModelName,
                                initialCapacity        = _installer.capacity,
                                maxCapacity            = _installer.capacity,
                                recoverValue           = _installer.recoverValue,
                                recoverIntervalMinutes = _installer.recoverIntervalMinutes,
                            }
                        }
                    };

                    var stringBuilder = new StringBuilder();
                    var jsonWriter    = new JsonWriter(stringBuilder);
                    master.WriteJson(jsonWriter);

                    var json = JsonMapper.ToObject(original);
                    json["Resources"]["StaminaSettings"]["Properties"]["Settings"] = stringBuilder.ToString();
                    original = json.ToJson();
                }

                return(original);
            }