コード例 #1
0
 internal static void UnescapeTag(this NeuronResult value)
 {
     if (value.Tag != null)
     {
         value.Tag = Regex.Unescape(value.Tag);
     }
 }
コード例 #2
0
        public async Task <IEnumerable <NeuronResult> > Get(Guid guid, Guid?centralGuid = null, RelativeType type = RelativeType.NotSet, bool shouldLoadTerminals = false, CancellationToken token = default(CancellationToken))
        {
            IEnumerable <NeuronResult> result = null;

            if (!centralGuid.HasValue)
            {
                result = new NeuronResult[] { new NeuronResult()
                                              {
                                                  Neuron = this.cache[guid]
                                              } }
            }
            ;
            else
            {
                var temp = this.GetNeuronResults(centralGuid.Value, string.Empty, InMemoryNeuronRepository.ConvertRelativeToDirection(type));
                // TODO: optimize by passing this into GetNeuronResults AQL
                result = temp.Where(nr =>
                                    (nr.Neuron != null && nr.Neuron.Id == guid.ToString()) ||
                                    (nr.Terminal != null && nr.Terminal.TargetId == guid.ToString())
                                    );
            }

            return(await Task.FromResult(result));
        }