示例#1
0
    internal override async Task <bool> OnGetScriptSource(MessageId msg_id, string script_id, CancellationToken token)
    {
        if (!SourceId.TryParse(script_id, out SourceId id))
        {
            return(false);
        }

        SourceFile src_file = (await LoadStore(msg_id, token)).GetFileById(id);

        try
        {
            var    uri    = new Uri(src_file.Url);
            string source = $"// Unable to find document {src_file.SourceUri}";

            using (Stream data = await src_file.GetSourceAsync(checkHash: false, token: token))
            {
                if (data.Length == 0)
                {
                    return(false);
                }

                using (var reader = new StreamReader(data))
                    source = await reader.ReadToEndAsync(token);
            }
            await SendEvent(msg_id, "", JObject.FromObject(new { source, from = script_id }), token);
        }
        catch (Exception e)
        {
            var o = JObject.FromObject(new
            {
                source = $"// Unable to read document ({e.Message})\n" +
                         $"Local path: {src_file?.SourceUri}\n" +
                         $"SourceLink path: {src_file?.SourceLinkUri}\n",
                from = script_id
            });

            await SendEvent(msg_id, "", o, token);
        }
        return(true);
    }
示例#2
0
#pragma warning disable S1541 // Methods and properties should not be too complex
        public bool Equals(RedisCounterActivity other)
#pragma warning restore S1541 // Methods and properties should not be too complex
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return(base.Equals(other) &&
                   string.Equals(Result, other.Result) &&
                   SourceId.Equals(other.SourceId) &&
                   string.Equals(Key, other.Key) &&
                   string.Equals(StepSize, other.StepSize) &&
                   string.Equals(CounterType, other.CounterType) &&
                   string.Equals(DisplayName, other.DisplayName) &&
                   string.Equals(Response, other.Response));
        }
示例#3
0
        public bool EqualsIgnoringProviderId(IReadonlyRelation <IRelatableEntity, IRelatableEntity> other)
        {
            if (ReferenceEquals(other, null))
            {
                return(false);
            }
            if (ReferenceEquals(other, this))
            {
                return(true);
            }

            var objCast = other as Relation;

            if (ReferenceEquals(objCast, null))
            {
                return(false);
            }

            var equals = true;

            if (Type != other.Type)
            {
                equals = false;
            }
            if (!SourceId.EqualsIgnoringProviderId(other.SourceId))
            {
                equals = false;
            }
            if (!DestinationId.EqualsIgnoringProviderId(other.DestinationId))
            {
                equals = false;
            }
            if (!MetaData.OrderBy(x => x.Key).SequenceEqual(objCast.MetaData.OrderBy(x => x.Key)))
            {
                equals = false;
            }

            return(equals);
        }
示例#4
0
        async Task <bool> OnGetScriptSource(MessageId msg_id, string script_id, CancellationToken token)
        {
            if (!SourceId.TryParse(script_id, out var id))
            {
                return(false);
            }

            var src_file = (await LoadStore(msg_id, token)).GetFileById(id);

            try
            {
                var    uri    = new Uri(src_file.Url);
                string source = $"// Unable to find document {src_file.SourceUri}";

                using (var data = await src_file.GetSourceAsync(checkHash: false, token: token))
                {
                    if (data.Length == 0)
                    {
                        return(false);
                    }

                    using (var reader = new StreamReader(data))
                        source = await reader.ReadToEndAsync();
                }
                SendResponse(msg_id, Result.OkFromObject(new { scriptSource = source }), token);
            }
            catch (Exception e)
            {
                var o = new
                {
                    scriptSource = $"// Unable to read document ({e.Message})\n" +
                                   $"Local path: {src_file?.SourceUri}\n" +
                                   $"SourceLink path: {src_file?.SourceLinkUri}\n"
                };

                SendResponse(msg_id, Result.OkFromObject(o), token);
            }
            return(true);
        }
        public override int GetHashCode()
        {
            int hash = 1;

            if (SourceId.Length != 0)
            {
                hash ^= SourceId.GetHashCode();
            }
            if (pattern_ != null)
            {
                hash ^= Pattern.GetHashCode();
            }
            if (OwnerId.Length != 0)
            {
                hash ^= OwnerId.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#6
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (AppId.Length != 0)
            {
                hash ^= AppId.GetHashCode();
            }
            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Namespace.Length != 0)
            {
                hash ^= Namespace.GetHashCode();
            }
            if (Revision != 0UL)
            {
                hash ^= Revision.GetHashCode();
            }
            if (SourceId.Length != 0)
            {
                hash ^= SourceId.GetHashCode();
            }
            hash ^= Jobs.GetHashCode();
            if (createdAt_ != null)
            {
                hash ^= CreatedAt.GetHashCode();
            }
            if (CreatedBy.Length != 0)
            {
                hash ^= CreatedBy.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
示例#7
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (SourceId.Length != 0)
            {
                hash ^= SourceId.GetHashCode();
            }
            if (DestinationId.Length != 0)
            {
                hash ^= DestinationId.GetHashCode();
            }
            if (DrillerCount != 0)
            {
                hash ^= DrillerCount.GetHashCode();
            }
            hash ^= specialistIds_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = base.GetHashCode();
                hashCode = (hashCode * 397) ^ (SourceId.GetHashCode());
                if (ProcedureName != null)
                {
                    hashCode = (hashCode * 397) ^ (ProcedureName.GetHashCode());
                }

                if (CommandTimeout != null)
                {
                    hashCode = (hashCode * 397) ^ CommandTimeout.Value;
                }

                if (ExecuteActionString != null)
                {
                    hashCode = (hashCode * 397) ^ (ExecuteActionString.GetHashCode());
                }

                return(hashCode);
            }
        }
示例#9
0
        public List <SourceLocation> FindPossibleBreakpoints(SourceLocation start, SourceLocation end)
        {
            //XXX FIXME no idea what todo with locations on different files
            if (start.Id != end.Id)
            {
                logger.LogDebug($"FindPossibleBreakpoints: documents differ (start: {start.Id}) (end {end.Id}");
                return(null);
            }

            SourceId sourceId = start.Id;

            SourceFile doc = GetFileById(sourceId);

            var res = new List <SourceLocation>();

            if (doc == null)
            {
                logger.LogDebug($"Could not find document {sourceId}");
                return(res);
            }

            foreach (MethodInfo method in doc.Methods)
            {
                if (!method.DebugInformation.SequencePointsBlob.IsNil)
                {
                    foreach (SequencePoint sequencePoint in method.DebugInformation.GetSequencePoints())
                    {
                        if (!sequencePoint.IsHidden && Match(sequencePoint, start, end))
                        {
                            res.Add(new SourceLocation(method, sequencePoint));
                        }
                    }
                }
            }
            return(res);
        }
示例#10
0
 public override IEnumerable <StateVariable> GetState()
 {
     return(new[] {
         new StateVariable
         {
             Name = "Key",
             Value = Key,
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = "TTL",
             Value = TTL.ToString(),
             Type = StateVariable.StateType.Input
         },
         new StateVariable
         {
             Name = "Result",
             Value = Result,
             Type = StateVariable.StateType.Output
         }
         ,
         new StateVariable
         {
             Name = "Response",
             Value = Response,
             Type = StateVariable.StateType.Output
         },
         new StateVariable
         {
             Name = "SourceId",
             Value = SourceId.ToString(),
             Type = StateVariable.StateType.Input
         }
     });
 }
示例#11
0
 public DailyWireTransferLimitSet(CorrelationId correlationId, SourceId sourceId)
     : base(correlationId, sourceId)
 {
 }
示例#12
0
 public OverDraftLimitSetEvent(CorrelationId correlationId, SourceId sourceId)
     : base(correlationId, sourceId)
 {
 }
示例#13
0
 public AccountUnblocked(CorrelationId correlationId, SourceId sourceId)
     : base(correlationId, sourceId)
 {
 }
 public OverdraftLimited(CorrelationId correlationId, SourceId sourceId)
     : base(correlationId, sourceId)
 {
 }
示例#15
0
 public Source(SourceId id, Humanity.FeedType feed_type)
 {
     this.id         = id;
     this.feedType   = feed_type;
     this.properties = new List <IndexableProperty>();
 }
示例#16
0
 public CashWithdrawn(CorrelationId correlationId, SourceId sourceId)
     : base(correlationId, sourceId)
 {
 }
示例#17
0
        /// <summary>
        /// Escreve os dados da instancia no xml.
        /// </summary>
        /// <param name="writer"></param>
        void IXmlSerializable.WriteXml(System.Xml.XmlWriter writer)
        {
            writer.WriteElementString("DefaultValueGroupId", DefaultValueGroupId.ToString());
            writer.WriteElementString("FullName", FullName);
            writer.WriteElementString("GroupRoleId", GroupRoleId.ToString());

            writer.WriteStartElement("IsAnonymous");
            writer.WriteValue(IsAnonymous);
            writer.WriteEndElement();

            writer.WriteElementString("SearchMode", SearchMode.ToString());

            writer.WriteDateTimeOffset(LastActivityDate, "LastActivityDate");
            writer.WriteDateTimeOffset(LastUpdatedDate, "LastUpdatedDate");
            writer.WriteElementString("ProfileId", ProfileId.ToString());


            writer.WriteStartElement("Properties");
            if (Properties != null)
            {
                var serializer = new XmlSerializer(typeof(ProfileProperty), new XmlRootAttribute("ProfileProperty"));
                foreach (IXmlSerializable i in Properties)
                {
                    serializer.Serialize(writer, i);
                }
            }
            writer.WriteEndElement();

            writer.WriteStartElement("RoleSet");
            if (RoleSet != null)
            {
                ((IXmlSerializable)RoleSet).WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("Source");
            if (Source != null)
            {
                ((IXmlSerializable)Source).WriteXml(writer);
            }
            writer.WriteEndElement();

            writer.WriteElementString("SourceId", SourceId.ToString());
            writer.WriteElementString("UserId", UserId.ToString());
            writer.WriteElementString("UserName", UserName);
            writer.WriteStartElement("MarkGroupId");
            if (MarkGroupId.HasValue)
            {
                writer.WriteValue(MarkGroupId.Value);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("SellerTreeId");
            if (SellerTreeId.HasValue)
            {
                writer.WriteValue(SellerTreeId.Value);
            }
            writer.WriteEndElement();

            writer.WriteStartElement("IntermediateId");
            if (IntermediateId.HasValue)
            {
                writer.WriteValue(IntermediateId.Value);
            }
            writer.WriteEndElement();
        }
示例#18
0
 public ThingyPingCommand(ThingyId aggregateId, SourceId sourceId, PingId pingId)
     : base(aggregateId, sourceId)
 {
     PingId = pingId;
 }
示例#19
0
 public override bool Equals(object obj)
 {
     return((this == obj) ||
            (obj is Edge edge && SourceId.Equals(edge.SourceId) && TargetId.Equals(edge.TargetId) &&
             Math.Abs(Weight - edge.Weight) < 0.01));
 }
示例#20
0
 public override int GetHashCode()
 {
     return((SourceId.GetHashCode() + TargetId.GetHashCode()) / 2);
 }
 public CashWireTransfered(CorrelationId correlationId, SourceId sourceId) : base(correlationId, sourceId)
 {
 }
 public ChequeDeposited(CorrelationId correlationId, SourceId sourceId) : base(correlationId, sourceId)
 {
 }
示例#23
0
 public XmlNode GetNode(string strLanguage)
 {
     if (_objCachedMyXmlNode == null || strLanguage != _strCachedXmlNodeLanguage || GlobalOptions.LiveCustomData)
     {
         _objCachedMyXmlNode       = XmlManager.Load(_eSource == Improvement.ImprovementSource.Bioware ? "bioware.xml" : "cyberware.xml", strLanguage).SelectSingleNode("/chummer/grades/grade[id = \"" + SourceId.ToString("D") + "\"]");
         _strCachedXmlNodeLanguage = strLanguage;
     }
     return(_objCachedMyXmlNode);
 }
 public WireFundTransferred(CorrelationId correlationId, SourceId sourceId)
     : base(correlationId, sourceId)
 {
 }
示例#25
0
 public SourceFile GetFileById(SourceId id) => AllSources().SingleOrDefault(f => f.SourceId.Equals(id));
示例#26
0
 public PingCommand(TestId aggregateId, SourceId sourceId, PingId pingId)
     : base(aggregateId, sourceId)
 {
     PingId = pingId;
 }
示例#27
0
 public SourceLocation(SourceId id, int line, int column)
 {
     this.id     = id;
     this.line   = line;
     this.column = column;
 }
示例#28
0
 /// <inheritdoc/>
 public bool Equals(KeyVaultCertificateIdentifier other) =>
 SourceId.Equals(other.SourceId);
 public WoftamEvent(string property1, string property2) : base(CorrelationId.NewId(), SourceId.NullSourceId())
 {
     Property1 = property1;
     Property2 = property2;
 }
示例#30
0
 public override int GetHashCode() =>
 SourceId.GetHashCode();