Example #1
0
        public override string AddStone(params Stone[] stone)
        {
            Stone st = stone[0];

            if (st.Weight + CurrentWeight <= MaxWeight)
            {
                if (st.Decryption)
                {
                    Random random = new Random();
                    if (random.Next(11) == 0)
                    {
                        Baggage.Add(st);
                        CurrentWeight += st.Weight;
                        return(st.GetInfo() + "\r\n Succesfully decrypted and added");
                    }
                    else
                    {
                        return("Decryption failed");
                    }
                }
                else
                {
                    Baggage.Add(st);
                    CurrentWeight += st.Weight;
                    return(st.GetInfo() + "\r\n Succesfully added");
                }
            }
            else
            {
                return("You can`t lift this stone. Robot overload");
            }
        }
        /// <summary>
        ///     Converts a <see cref="LightStep.SpanContext" /> to a <see cref="SpanContext" />
        /// </summary>
        /// <param name="ctx">A SpanContext</param>
        /// <returns>Proto SpanContext</returns>
        public SpanContext MakeSpanContextFromOtSpanContext(LightStep.SpanContext ctx)
        {
            SpanId  = ctx.SpanIdValue;
            TraceId = ctx.TraceIdValue;

            ctx.GetBaggageItems().ToList().ForEach(baggage => Baggage.Add(baggage.Key, baggage.Value));
            return(this);
        }
        /// <summary>
        ///     Converts a <see cref="LightStep.SpanContext" /> to a <see cref="SpanContext" />
        /// </summary>
        /// <param name="ctx">A SpanContext</param>
        /// <returns>Proto SpanContext</returns>
        public SpanContext MakeSpanContextFromOtSpanContext(LightStep.SpanContext ctx)
        {
            try
            {
                SpanId = Convert.ToUInt64(ctx.SpanId);
            }
            catch (FormatException)
            {
                SpanId = Convert.ToUInt64(ctx.SpanId, 16);
            }

            try
            {
                TraceId = Convert.ToUInt64(ctx.TraceId);
            }
            catch (FormatException)
            {
                TraceId = Convert.ToUInt64(ctx.TraceId, 16);
            }

            ctx.GetBaggageItems().ToList().ForEach(baggage => Baggage.Add(baggage.Key, baggage.Value));
            return(this);
        }
Example #4
0
 public ISpan SetBaggageItem(string key, string value)
 {
     Baggage.Add(key, value);
     return(this);
 }