Пример #1
0
        private void GenerateDevicePorts(object sender, ValueChangedEventArgs e)
        {
            if (this.DeviceAmount.Value > this.lastValue)
            {
                while (this.lastValue != this.DeviceAmount.Value)
                {
                    IValueObject Port1 = this.TypeService.CreateString(PortTypes.String, "Gerät " + (this.lastValue + 1));
                    Devices.Add(Port1);

                    IValueObject Port2 = this.TypeService.CreateString(PortTypes.String, "Person " + (this.lastValue + 1));
                    Devices.Add(Port2);

                    this.lastValue++;
                }
            }
            else
            {
                while (this.lastValue != this.DeviceAmount.Value)
                {
                    int c = Devices.Count;
                    Devices.RemoveAt(c - 1);
                    Devices.RemoveAt(c - 2);
                    this.lastValue--;
                }
            }
        }
Пример #2
0
        public LootGoalProcessor(IValueObject vo, AbstractGoalManager parent) : base(vo, parent)
        {
            string goalItem = parent.GetGoalItem(vo);

            if (goalItem != null)
            {
                if (goalItem == "credits")
                {
                    this.itemType = 0;
                    goto IL_92;
                }
                if (goalItem == "materials")
                {
                    this.itemType = 1;
                    goto IL_92;
                }
                if (goalItem == "contraband")
                {
                    this.itemType = 2;
                    goto IL_92;
                }
            }
            Service.Logger.ErrorFormat("Loot type not found for goal {0}", new object[]
            {
                vo.Uid
            });
IL_92:
            Service.EventManager.RegisterObserver(this, EventId.BattleEndProcessing);
        }
Пример #3
0
 private void AssertValueObject(IValueObject expected, IValueObject actual)
 {
     if (!expected.Same(actual))
     {
         throw new Xunit.Sdk.EqualException(expected, actual);
     }
 }
Пример #4
0
 private string GetUidToLog(IValueObject vo)
 {
     if (vo != null)
     {
         return(vo.Uid);
     }
     return("NULL");
 }
Пример #5
0
 /// <summary>
 ///     Returns a value indicating whether this <see cref="IValueObject"/> is equal to a specified <see cref="ValueObject"/>.
 /// </summary>
 /// <param name="other">
 ///     A <see cref="ValueObject"/> to compare with this instance of <see cref="ValueObject"/>.
 /// </param>
 /// <returns>
 ///     true if all components from this <see cref="GetEqualityComponents"/> is sequentially equal
 ///     to that of the other;
 ///     otherwise, false.
 /// </returns>
 public bool Equals(IValueObject other)
 {
     if (other is ValueObject otherValueObject)
     {
         return(Equals(otherValueObject));
     }
     return(false);
 }
Пример #6
0
        /// <summary>
        /// This helps to save the view and change operational state.
        /// </summary>
        /// <param name="regionManager"></param>
        /// <param name="dialogService"></param>
        /// <param name="dataProvider"></param>
        /// <param name="valueObject"></param>


        public ViewSaver(IRegionManager regionManager,
                         IDataProvider <DomainType, SummaryType> dataProvider,
                         IValueObject <DtoType> valueObject)
        {
            _regionManager = regionManager;
            _dataProvider  = dataProvider;
            _valueObject   = valueObject;
        }
Пример #7
0
        public EpisodePointGoalProcessor(IValueObject vo, AbstractGoalManager parent) : base(vo, parent)
        {
            EventManager eventManager = Service.EventManager;

            eventManager.RegisterObserver(this, EventId.RaidComplete);
            eventManager.RegisterObserver(this, EventId.PvpBattleWon);
            eventManager.RegisterObserver(this, EventId.ObjectiveCompleted);
            eventManager.RegisterObserver(this, EventId.TournamentTierReached);
        }
Пример #8
0
        public async Task <IResponseModel> Process(IValueObject vo, Func <object, object, IResponseModel> createResponse)
        {
            var websiteVO = (WebsiteVO)vo;
            IList <IValueObject> images = await ExtractAllImages(websiteVO.Url, websiteVO.Download);

            IList <IValueObject> words = await ExtractMostUsedWords(websiteVO.Url);

            return(await Task.Run(() => createResponse(images, words)));
        }
        public IValueComponent DeepOutRef(IValueComponent a, out IValueComponent o, ref IValueObject r)
        {
            IValueComponent oTarget;
            IValueObject    rTarget = NotifyPropertyChangeFactory.GetTarget(r);
            var             result  = _target.DeepOutRef(NotifyPropertyChangeFactory.GetTarget(a), out oTarget, ref rTarget);

            o = NotifyPropertyChangeFactory.GetProxy(oTarget);
            r = NotifyPropertyChangeFactory.GetProxy(rTarget);
            return(NotifyPropertyChangeFactory.GetProxy(result));
        }
Пример #10
0
        private void ReadValue(IValueObject dataSourceValue, Func <object, object> convert)
        {
            var originalValue = dataSourceValue.Value;
            var newValue      = convert?.Invoke(originalValue) ?? originalValue;

            if (!object.Equals(newValue, bindingProperty.GetValue(Component)))
            {
                bindingProperty.SetValue(Component, newValue);
            }
        }
Пример #11
0
        private void WriteValue(IValueObject dataSourceValue, Func <object, object> convertBack)
        {
            var originalValue = bindingProperty.GetValue(Component);
            var newValue      = convertBack?.Invoke(originalValue) ?? originalValue;

            if (!object.Equals(newValue, dataSourceValue.Value))
            {
                dataSourceValue.Value = newValue;
            }
        }
Пример #12
0
        public override GoalType GetGoalType(IValueObject goalVO)
        {
            EpisodeTaskProgressInfo currentEpisodeTaskProgress = this.GetCurrentEpisodeTaskProgress();

            if (currentEpisodeTaskProgress != null)
            {
                EpisodeTaskActionVO episodeTaskActionVO = Service.StaticDataController.Get <EpisodeTaskActionVO>(currentEpisodeTaskProgress.actionUID);
                return(StringUtils.ParseEnum <GoalType>(episodeTaskActionVO.Type));
            }
            return(GoalType.Invalid);
        }
Пример #13
0
        public override string GetGoalItem(IValueObject goalVO)
        {
            EpisodeTaskProgressInfo currentEpisodeTaskProgress = this.GetCurrentEpisodeTaskProgress();

            if (currentEpisodeTaskProgress != null)
            {
                EpisodeTaskActionVO episodeTaskActionVO = Service.StaticDataController.Get <EpisodeTaskActionVO>(currentEpisodeTaskProgress.actionUID);
                return(episodeTaskActionVO.Item);
            }
            return(null);
        }
 public IValueComponent this[IValueComponent a, IValueComponent o, IValueObject r]
 {
     get
     {
         return(NotifyPropertyChangeFactory.GetProxy(_target[NotifyPropertyChangeFactory.GetTarget(a), NotifyPropertyChangeFactory.GetTarget(o), NotifyPropertyChangeFactory.GetTarget(r)]));
     }
     set
     {
         _target[NotifyPropertyChangeFactory.GetTarget(a), NotifyPropertyChangeFactory.GetTarget(o), NotifyPropertyChangeFactory.GetTarget(r)] = NotifyPropertyChangeFactory.GetTarget(value);
     }
 }
Пример #15
0
        public virtual bool Equals(IValueObject other)
        {
            if (other == null)
            {
                return(false);
            }

            var properties = GetProperties();

            return(properties.All(property => SameValues(property.GetValue(other), property.GetValue(this))));
        }
Пример #16
0
 internal CommandBinding(ICommand command, CommandTarget target, IValueObject commandParameter)
 {
     _target           = target;
     _command          = command;
     _commandParameter = commandParameter;
     target.DoEvent(OnTargetEventHandle);
     if (commandParameter != null)
     {
         commandParameter.ValueChanged += OnVlaueChanged;
     }
 }
Пример #17
0
 public bool Equal(IValueObject that)
 {
     ILink link = that as ILink;
     if (link != null)
     {
         if (link.LinkName == this.LinkName
             && link.LinkTitle == this.LinkTitle
             )
             return true;
     }
     return false;
 }
Пример #18
0
 public DeployTroopIdGoalProcessor(IValueObject vo, AbstractGoalManager parent) : base(vo, parent)
 {
     this.troopId = parent.GetGoalItem(vo);
     if (string.IsNullOrEmpty(this.troopId))
     {
         Service.Logger.ErrorFormat("Troop ID not found for goal {0}", new object[]
         {
             vo.Uid
         });
     }
     Service.EventManager.RegisterObserver(this, EventId.TroopPlacedOnBoard);
 }
Пример #19
0
 public DeploySpecialAttackIdGoalProcessor(IValueObject vo, AbstractGoalManager parent) : base(vo, parent)
 {
     this.specialAttackID = parent.GetGoalItem(vo);
     if (string.IsNullOrEmpty(this.specialAttackID))
     {
         Service.Logger.ErrorFormat("Special Attack ID not found for goal {0}", new object[]
         {
             vo.Uid
         });
     }
     Service.EventManager.RegisterObserver(this, EventId.SpecialAttackSpawned);
 }
Пример #20
0
 public DestroyBuildingIdGoalProcessor(IValueObject vo, AbstractGoalManager parent) : base(vo, parent)
 {
     this.buildingID = parent.GetGoalItem(vo);
     if (string.IsNullOrEmpty(this.buildingID))
     {
         Service.Logger.ErrorFormat("Building ID not found for goal {0}", new object[]
         {
             vo.Uid
         });
     }
     Service.EventManager.RegisterObserver(this, EventId.EntityKilled);
 }
 /// <summary>コンストラクタ。</summary>
 /// <param name="chars">与えられた値文字列。</param>
 public ValueObject(string chars)
 {
     if (chars != string.Empty)
     {
         this.chars = chars;
         this.value = null;
     }
     else
     {
         this.chars = string.Empty;
         this.value = ValueEmpty.Empty;
     }
 }
        public override IDatabaseModel ConvertToDatabaseType(IValueObject valueObject)
        {
            var category = valueObject as ICategory;

            if (category == null)
            {
                return(null);
            }

            return(new CategoryDatabase
            {
                Id = (valueObject as ValueObject).Id,
                Description = category.Description
            });
        }
 /// <summary>コンストラクタ。</summary>
 /// <param name="chars">読み込んだ文字列。</param>
 /// <param name="st">開始位置。</param>
 /// <param name="ed">終了位置。</param>
 internal ValueObject(List <char> chars, int st, int ed)
 {
     if (ed > st)
     {
         var temp = new char[ed - st];
         chars.CopyTo(st, temp, 0, ed - st);
         this.chars = new string(temp);
         this.value = null;
     }
     else
     {
         this.chars = string.Empty;
         this.value = ValueEmpty.Empty;
     }
 }
Пример #24
0
        public bool Equal(IValueObject that)
        {
            ILink link = that as ILink;

            if (link != null)
            {
                if (link.LinkName == this.LinkName &&
                    link.LinkTitle == this.LinkTitle
                    )
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #25
0
        public bool Equal(IValueObject that)
        {
            IContentLink link = that as IContentLink;

            if (link != null)
            {
                if (link.ContentId == this.ContentId &&
                    link.RelatedContentId == this.RelatedContentId
                    )
                {
                    return(true);
                }
            }
            return(false);
        }
Пример #26
0
 public Buff(BuffTypeVO buffType, ArmorType armorType, BuffVisualPriority visualPriority)
 {
     this.BuffType       = buffType;
     this.ProcCount      = 0;
     this.StackSize      = 0;
     this.msRemaining    = this.BuffType.Duration;
     this.msToNextProc   = this.BuffType.MillisecondsToFirstProc;
     this.armorTypeIndex = (int)armorType;
     this.VisualPriority = visualPriority;
     this.BuffData       = new Dictionary <string, object>();
     if (buffType.Modify == BuffModify.Summon)
     {
         this.Details = Service.StaticDataController.Get <SummonDetailsVO>(buffType.Details);
     }
 }
Пример #27
0
        public async Task <IActionResult> Post([FromBody] ExtractorRequest model)
        {
            IValueObject vo = model.ConvertToVo(() => new WebsiteVO {
                Url = model.Url, Download = model.Download
            });

            _logger.LogInformation($"Processing URL: {model.Url}");
            IResponseModel response = await _service.Process(vo, (imageList, wordList) =>
                                                             new ExtractorResponse((IList <IValueObject>)imageList, (IList <IValueObject>)wordList));

            string jsonString = JsonConvert.SerializeObject(response);

            _logger.LogInformation($"Response: {jsonString}");

            return(new JsonResult(response));
        }
Пример #28
0
 /// <summary>
 /// Called when the SecondaryFunction receives a new value, in order to update which
 /// of the outputs exist, and which labels they have.
 /// </summary>
 private void updateIdleValueType(object sender = null,
                                  ValueChangedEventArgs evArgs = null)
 {
     if (mIdleValueType.HasValue)
     {
         if (PortTypes.Bool == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateBool(PortTypes.Bool, "IdleValue");
         }
         else if (PortTypes.Integer == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateInt(PortTypes.Integer, "IdleValue");
         }
         else if (PortTypes.Number == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateDouble(PortTypes.Number, "IdleValue");
         }
         else if (PortTypes.TimeSpan == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateTimeSpan(PortTypes.TimeSpan, "IdleValue");
         }
         else if (PortTypes.Time == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateTimeSpan(PortTypes.Time, "IdleValue");
         }
         else if (PortTypes.Date == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateDateTime(PortTypes.Date, "IdleValue");
         }
         else if (PortTypes.DateTime == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateDateTime(PortTypes.DateTime, "IdleValue");
         }
         else if (PortTypes.String == mIdleValueType.Value)
         {
             mIdleValue = mTypeService.CreateString(PortTypes.String, "IdleValue");
         }
         else
         {
             mIdleValue = null;
         }
     }
     else
     {
         mIdleValue = null;
     }
 }
Пример #29
0
        public DestroyBuildingTypeGoalProcessor(IValueObject vo, AbstractGoalManager parent) : base(vo, parent)
        {
            string goalItem = parent.GetGoalItem(vo);

            if (string.IsNullOrEmpty(goalItem))
            {
                Service.Logger.ErrorFormat("Building Type not found for goal {0}", new object[]
                {
                    vo.Uid
                });
            }
            else
            {
                this.buildingType = StringUtils.ParseEnum <BuildingType>(goalItem);
            }
            Service.EventManager.RegisterObserver(this, EventId.EntityKilled);
        }
Пример #30
0
        public DeployTroopTypeGoalProcessor(IValueObject vo, AbstractGoalManager parent) : base(vo, parent)
        {
            string goalItem = parent.GetGoalItem(vo);

            if (string.IsNullOrEmpty(goalItem))
            {
                Service.Logger.ErrorFormat("Troop type not found for goal {0}", new object[]
                {
                    vo.Uid
                });
            }
            else
            {
                this.troopType = StringUtils.ParseEnum <TroopType>(goalItem);
            }
            Service.EventManager.RegisterObserver(this, EventId.TroopPlacedOnBoard);
        }
Пример #31
0
        //	*************************************************************************
        //				   Public methods
        //	*************************************************************************

        /// <summary>
        /// Copy all the member variables from the source object.
        /// Call base.CopyFrom first in the implementation.
        /// </summary>
        /// <param name="source">The source object.</param>
        public override void CopyFrom(IValueObject source)
        {
            SupplierAddress sourceSupplierAddress = (SupplierAddress)source;

            base.CopyFrom(source);
            _supplierId   = sourceSupplierAddress._supplierId;
            _contactId    = sourceSupplierAddress._contactId;
            _addressType  = sourceSupplierAddress._addressType;
            _fromSupplier = sourceSupplierAddress._fromSupplier;
            _addressLine1 = sourceSupplierAddress._addressLine1;
            _addressLine2 = sourceSupplierAddress._addressLine2;
            _city         = sourceSupplierAddress._city;
            _state        = sourceSupplierAddress._state;
            _zipCode      = sourceSupplierAddress._zipCode;
            _country      = sourceSupplierAddress._country;
            _county       = sourceSupplierAddress._county;
            _addressId    = sourceSupplierAddress._addressId;
        }
Пример #32
0
 public static string Encrypt(EncryptionType type, IValueObject value)
 {
     return GetProvider(type).Encrypt(value.Value.ToString());
 }