public void Initialize(System.Activities.ActivityInstance activityInstance, int nextArgumentIndex, IDictionary<string, object> argumentValueOverrides, Location resultLocation)
 {
     base.Reinitialize(activityInstance);
     this.nextArgumentIndex = nextArgumentIndex;
     this.argumentValueOverrides = argumentValueOverrides;
     this.resultLocation = resultLocation;
 }
 protected override void ReleaseToPool(ActivityExecutor executor)
 {
     base.ClearForReuse();
     this.nextArgumentIndex = 0;
     this.resultLocation = null;
     this.argumentValueOverrides = null;
     executor.ResolveNextArgumentWorkItemPool.Release(this);
 }
 public void Register(Location location, Activity activity, LocationReference locationOwner, System.Activities.ActivityInstance activityInstance)
 {
     if (this.mappableLocations == null)
     {
         this.mappableLocations = new List<MappableLocation>();
     }
     this.mappableLocations.Add(new MappableLocation(locationOwner, activity, activityInstance, location));
 }
 public void Unregister(Location location)
 {
     int count = this.mappableLocations.Count;
     for (int i = 0; i < count; i++)
     {
         if (object.ReferenceEquals(this.mappableLocations[i].Location, location))
         {
             this.mappableLocations.RemoveAt(i);
             return;
         }
     }
 }
 private bool TrackData(string name, int id, System.Activities.ActivityInstance currentInstance, ICollection <string> data, bool wildcard, ref Dictionary <string, object> trackedData)
 {
     if (wildcard || data.Contains(name))
     {
         System.Activities.Location specificLocation = currentInstance.Environment.GetSpecificLocation(id);
         if (specificLocation != null)
         {
             if (trackedData == null)
             {
                 trackedData = new Dictionary <string, object>(10);
             }
             string str = name ?? NameGenerator.Next();
             trackedData[str] = specificLocation.Value;
             if (TD.TrackingDataExtractedIsEnabled())
             {
                 TD.TrackingDataExtracted(str, this.Activity.Name);
             }
             return(true);
         }
     }
     return(false);
 }
        protected override void GatherOutputs(System.Activities.ActivityInstance completedInstance)
        {
            int id = -1;

            if (completedInstance.Activity.HandlerOf != null)
            {
                DelegateOutArgument resultArgument = completedInstance.Activity.HandlerOf.GetResultArgument();
                if (resultArgument != null)
                {
                    id = resultArgument.Id;
                }
                else
                {
                    ActivityWithResult activity = completedInstance.Activity as ActivityWithResult;
                    if ((activity != null) && TypeHelper.AreTypesCompatible(activity.ResultType, typeof(T)))
                    {
                        id = this.GetResultId(activity);
                    }
                }
            }
            else
            {
                id = this.GetResultId((ActivityWithResult)completedInstance.Activity);
            }
            if (id >= 0)
            {
                System.Activities.Location specificLocation = completedInstance.Environment.GetSpecificLocation(id);
                Location <T> location2 = specificLocation as Location <T>;
                if (location2 != null)
                {
                    this.resultValue = location2.Value;
                }
                else if (specificLocation != null)
                {
                    this.resultValue = TypeHelper.Convert <T>(specificLocation.Value);
                }
            }
        }
Exemple #7
0
        public bool SetValueAsString(System.Activities.Location location, string value, string stringRadix)
        {
            bool flag = true;

            try
            {
                value = value.Trim();
                Type locationType = location.LocationType;
                if (((locationType == typeof(string)) && value.StartsWith("\"", StringComparison.Ordinal)) && value.EndsWith("\"", StringComparison.Ordinal))
                {
                    location.Value = RemoveQuotes(value);
                    return(flag);
                }
                if (locationType == typeof(bool))
                {
                    location.Value = Convert.ToBoolean(value, CultureInfo.InvariantCulture);
                    return(flag);
                }
                if (locationType == typeof(sbyte))
                {
                    location.Value = Convert.ToSByte(RemoveHexadecimalPrefix(value), Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture));
                    return(flag);
                }
                if (locationType == typeof(char))
                {
                    char ch;
                    flag = ConvertToChar(value, Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture), out ch);
                    if (flag)
                    {
                        location.Value = ch;
                    }
                    return(flag);
                }
                if (locationType == typeof(short))
                {
                    location.Value = Convert.ToInt16(RemoveHexadecimalPrefix(value), Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture));
                    return(flag);
                }
                if (locationType == typeof(int))
                {
                    location.Value = Convert.ToInt32(RemoveHexadecimalPrefix(value), Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture));
                    return(flag);
                }
                if (locationType == typeof(long))
                {
                    location.Value = Convert.ToInt64(RemoveHexadecimalPrefix(value), Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture));
                    return(flag);
                }
                if (locationType == typeof(byte))
                {
                    location.Value = Convert.ToByte(RemoveHexadecimalPrefix(value), Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture));
                    return(flag);
                }
                if (locationType == typeof(ushort))
                {
                    location.Value = Convert.ToUInt16(RemoveHexadecimalPrefix(value), Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture));
                    return(flag);
                }
                if (locationType == typeof(uint))
                {
                    location.Value = Convert.ToUInt32(RemoveHexadecimalPrefix(value), Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture));
                    return(flag);
                }
                if (locationType == typeof(ulong))
                {
                    location.Value = Convert.ToUInt64(RemoveHexadecimalPrefix(value), Convert.ToInt32(stringRadix, CultureInfo.InvariantCulture));
                    return(flag);
                }
                if (locationType == typeof(float))
                {
                    if (!value.Contains(","))
                    {
                        location.Value = Convert.ToSingle(value, CultureInfo.InvariantCulture);
                        return(flag);
                    }
                    return(false);
                }
                if (locationType == typeof(double))
                {
                    if (!value.Contains(","))
                    {
                        location.Value = Convert.ToDouble(value, CultureInfo.InvariantCulture);
                        return(flag);
                    }
                    return(false);
                }
                if (locationType == typeof(decimal))
                {
                    value = value.TrimEnd(new char[0]);
                    if (value.EndsWith("M", StringComparison.OrdinalIgnoreCase) || value.EndsWith("D", StringComparison.OrdinalIgnoreCase))
                    {
                        value = value.Substring(0, value.Length - 1);
                    }
                    if (value.Contains(","))
                    {
                        return(false);
                    }
                    location.Value = Convert.ToDecimal(value, CultureInfo.InvariantCulture);
                    return(flag);
                }
                if (locationType == typeof(DateTime))
                {
                    location.Value = Convert.ToDateTime(value, CultureInfo.CurrentCulture);
                    return(flag);
                }
                if (locationType.IsEnum)
                {
                    location.Value = Enum.Parse(locationType, value, true);
                }
            }
            catch (InvalidCastException)
            {
                flag = false;
            }
            catch (OverflowException)
            {
                flag = false;
            }
            catch (FormatException)
            {
                flag = false;
            }
            catch (ArgumentOutOfRangeException)
            {
                flag = false;
            }
            return(flag);
        }
Exemple #8
0
 public ReferenceLocation(Location innerLocation, bool bufferGets)
 {
     this.innerLocation = innerLocation;
     this.bufferGets = bufferGets;
 }
Exemple #9
0
 public MappableLocation(LocationReference locationOwner, Activity activity, System.Activities.ActivityInstance activityInstance, System.Activities.Location location)
 {
     this.Name             = locationOwner.Name;
     this.OwnerDisplayName = activity.DisplayName;
     this.Location         = location;
     this.MappingKeyName   = string.Format(CultureInfo.InvariantCulture, "activity.{0}-{1}_{2}", new object[] { activity.Id, locationOwner.Id, activityInstance.Id });
 }