Ejemplo n.º 1
0
        public static IpPacket Create(System.Func <string, string, string> mapper, string[] values)
        {
            IpPacket newObj = new IpPacket();

            newObj._FrameNumber = mapper.Invoke("frame.number", values[0]).ToInt32();
            newObj._EthSrc      = mapper.Invoke("eth.src", values[1]).ToString();
            newObj._EthDst      = mapper.Invoke("eth.dst", values[2]).ToString();
            newObj._IpSrc       = mapper.Invoke("ip.src", values[3]).ToString();
            newObj._IpDst       = mapper.Invoke("ip.dst", values[4]).ToString();
            return(newObj);
        }
Ejemplo n.º 2
0
        public static DnsPacket Create(System.Func <string, string, string> mapper, string[] values)
        {
            DnsPacket newObj = new DnsPacket();

            newObj._FrameNumber       = mapper.Invoke("frame.number", values[0]).ToInt32();
            newObj._FrameTimeRelative = mapper.Invoke("frame.time_relative", values[1]).ToDouble();
            newObj._IpSrc             = mapper.Invoke("ip.src", values[2]).ToString();
            newObj._IpDst             = mapper.Invoke("ip.dst", values[3]).ToString();
            newObj._DnsId             = mapper.Invoke("dns.id", values[4]).ToString();
            newObj._DnsFlagsResponse  = mapper.Invoke("dns.flags.response", values[5]).ToBoolean();
            newObj._DnsFlagsRcode     = mapper.Invoke("dns.flags.rcode", values[6]).ToInt32();
            newObj._DnsTime           = mapper.Invoke("dns.time", values[7]).ToDouble();
            newObj._DnsQryName        = mapper.Invoke("dns.qry.name", values[8]).ToString();
            newObj._DnsA = mapper.Invoke("dns.a", values[9]).ToString();
            return(newObj);
        }
Ejemplo n.º 3
0
        protected internal override void CopyScriptableObjects(System.Func <ScriptableObject, ScriptableObject> replaceSerializableObject)
        {
            connection = replaceSerializableObject.Invoke(connection) as NodeOutput;
            // Multiple connections
//			for (int conCnt = 0; conCnt < connections.Count; conCnt++)
//				connections[conCnt] = replaceSerializableObject.Invoke (connections[conCnt]) as NodeOutput;
        }
Ejemplo n.º 4
0
            public Opts Var(string varname, System.Func <Matrix4x4> func)
            {
                this.ShaderConfigurators.Add((shader, kernelId) =>
                                             shader.SetMatrix(varname, func.Invoke()));

                return(this);
            }
Ejemplo n.º 5
0
        /// <summary>
        /// 对值进行比较返回序列中的非重复元素。
        /// </summary>
        /// <typeparam name="TSource"></typeparam>
        /// <param name="source">要去重复的对象。</param>
        /// <param name="condition">用于区分重复的委托对象。</param>
        /// <returns></returns>
        public static System.Collections.Generic.List <TSource> Distinct <TSource>(this System.Collections.Generic.List <TSource> source, System.Func <TSource, TSource, bool> condition)
        {
            if (!object.ReferenceEquals(source, null) && source.Count > 1)
            {
                System.Collections.Generic.List <TSource> result = new System.Collections.Generic.List <TSource>(source.Count);

                for (int i = 0; i < source.Count; i++)
                {
                    int count = 0;
                    for (int j = i + 1; j < source.Count; j++)
                    {
                        if (condition.Invoke(source[i], source[j]))
                        {
                            count++;
                            break;
                        }
                    }
                    if (count == 0)
                    {
                        result.Add(source[i]);
                    }
                }
                return(result);
            }
            return(source);
        }
Ejemplo n.º 6
0
            IEnumerator DoExecute(SystemContext self, SystemContext next, SystemContextContainer container)
            {
                self._isCurrent = false;

                yield return(OnCurPreUnload?.Invoke());

                yield return(self.DoPreUnload());

                yield return(OnCurUnload?.Invoke());

                yield return(self.DoUnload());

                yield return(OnCurUnloaded?.Invoke());

                yield return(self.DoUnloaded());

                yield return(OnNextPreLoad?.Invoke());

                yield return(next.DoPreLoad(container));

                yield return(OnNextLoad?.Invoke());

                yield return(next.DoLoad(container));

                yield return(OnNextLoaded?.Invoke());

                yield return(next.DoLoaded(container));

                next._isCurrent = true;
            }
        private Vector4[] CalculateSnapPositions(Vector3 Start, Vector3 Direction, float Distance, float SnapDistance, System.Func <Vector4, Vector4> Filter = null, bool AlignToTerrain = false, LayerMask TerrainLayer = default(LayerMask))
        {
            int Steps = Mathf.Clamp(Mathf.RoundToInt((Distance / SnapDistance)), 0, int.MaxValue) + 1; // calculate how many steps with the given snap distance fit in the distance

            if (Steps > 0)                                                                             // if there are any steps
            {
                Terrain ActiveTerrain   = Terrain.activeTerrain;
                Vector3 TerrainPosition = ActiveTerrain.transform.position;
                float   Height          = ActiveTerrain.terrainData.size.y;

                Vector4[] SnapPositions = new Vector4[Steps];                     // init new snap position array with the length of the total amount of steps
                for (int i = 0; i < Steps; i++)                                   // loop through each step to calculate its new position
                {
                    SnapPositions [i] = Start + (Direction * (SnapDistance * i)); // calculate the step position
                    if (Filter != null)
                    {
                        SnapPositions [i] = Filter.Invoke(SnapPositions[i]);
                    }                                                                                                                                                            // if there is a filter use it
                    if (AlignToTerrain)                                                                                                                                          // align position to the terrain
                    {
                        RaycastHit Hit = new RaycastHit();                                                                                                                       // init new raycast hit info
                        if (Physics.Raycast(new Vector3(SnapPositions[i].x, TerrainPosition.y + Height, SnapPositions[i].z), Vector3.down, out Hit, (Height * 2), TerrainLayer)) // raycast down for terrain
                        {
                            SnapPositions [i].y = Hit.point.y;
                            SnapPositions [i].w = CalculateAngle(Vector3.up, Hit.normal);
                        }                         // hit the terrain
                    }
                }
                return(SnapPositions);                // return results
            }

            return(new Vector4[0]);            // return empty result array
        }
Ejemplo n.º 8
0
        public static DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot ETA(string units, string origins, string destinations)
        {
            System.Func <string> getUrl = () =>
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                return("" + "?units=" + units + "&origins=" + origins + "&destinations=" + destinations);
            };
            var _operationRelativeUrl = getUrl.Invoke().Trim();

            if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true)
            {
                _operationRelativeUrl = _operationRelativeUrl.TrimStart('/');
            }
            var _targetUrl = BaseUrl + _operationRelativeUrl;
            var _options   = new RestServiceConsumptionOptions
            {
                Url             = _targetUrl,
                Verb            = RestHTTPVerb.GET,
                ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
                {
                },
                LogAccess        = false,
                IsCachingEnabled = false,
                ApiName          = "GoogleDistanceMatrixAPI",
                Operation        = "ETA"
            };
            Func <ServiceConsumptionContainer, DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot> _invocation = (_httpResponse) =>
            {
                var _returnedItem = RestServiceConsumer.Consume <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot>(_options, _httpResponse);
                return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot>(_returnedItem));
            };
            var _consumer = new ServiceConsumer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDistanceMatrixAPI.GoogleDistanceMatrixAPIRoot>(_invocation);

            return(_consumer.Invoke(_options));
        }
Ejemplo n.º 9
0
        public string GetNewPath()
        {
            string entryName = _entryNameFunction.Invoke();
            string name      = string.IsNullOrEmpty(entryName) ? "xunknown" : entryName;

            return(Path.Combine(_pathToAudioFiles, MakeSafeName(name + "-" + GetSomewhatRandomString()) + ".wav"));
        }
Ejemplo n.º 10
0
            public static void SafeWhile(System.Func <bool> loopContent, int maxIterations = 1000, bool logWarning = true, UnityEngine.Object logContext = null)
            {
                if (loopContent.IsNull())
                {
                    Debug.LogWarning($"SafeWhile loop exited due to null {nameof(loopContent)}", logContext); return;
                }

                int _iterationCount = 0;

                while (loopContent.Invoke() == true)
                {
                    _iterationCount++;

                    if (_iterationCount < maxIterations)
                    {
                        continue;
                    }
                    if (logWarning)
                    {
                        Debug.LogWarning($"SafeWhile loop broken out of, exceeded max iterations ({maxIterations})", logContext);
                    }

                    break;
                }
            }
Ejemplo n.º 11
0
        public static ArpPacket Create(System.Func <string, string, string> mapper, string[] values)
        {
            ArpPacket newObj = new ArpPacket();

            newObj._FrameNumber       = mapper.Invoke("frame.number", values[0]).ToInt32();
            newObj._FrameTimeRelative = mapper.Invoke("frame.time_relative", values[1]).ToDouble();
            newObj._EthSrc            = mapper.Invoke("eth.src", values[2]).ToString();
            newObj._EthDst            = mapper.Invoke("eth.dst", values[3]).ToString();
            newObj._ArpOpcode         = mapper.Invoke("arp.opcode", values[4]).ToInt32();
            newObj._ArpSrcHwMac       = mapper.Invoke("arp.src.hw_mac", values[5]).ToString();
            newObj._ArpDstHwMac       = mapper.Invoke("arp.dst.hw_mac", values[6]).ToString();
            newObj._ArpSrcProtoIpv4   = mapper.Invoke("arp.src.proto_ipv4", values[7]).ToString();
            newObj._ArpDstProtoIpv4   = mapper.Invoke("arp.dst.proto_ipv4", values[8]).ToString();
            newObj._EthPadding        = mapper.Invoke("eth.padding", values[9]).ToString();
            return(newObj);
        }
        public static DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse Directions(float?originLat, float?originLong, float?destinationLat, float?destinationLong)
        {
            System.Func <string> getUrl = () =>
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                return("json?origin=" + originLat.GetValueOrDefault(0) + "," + originLong.GetValueOrDefault(0) + "&destination=" + destinationLat.GetValueOrDefault(0) + "," + destinationLong.GetValueOrDefault(0) + "&key=AIzaSyDn7jvEi9-m-NbaNj8vJjggUCAq7-43hMM");
            };
            var _operationRelativeUrl = getUrl.Invoke().Trim();

            if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true)
            {
                _operationRelativeUrl = _operationRelativeUrl.TrimStart('/');
            }
            var _targetUrl = BaseUrl + _operationRelativeUrl;
            var _options   = new RestServiceConsumptionOptions
            {
                Url             = _targetUrl,
                Verb            = RestHTTPVerb.GET,
                ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
                {
                },
                LogAccess        = false,
                IsCachingEnabled = false,
                ApiName          = "GoogleDirections",
                Operation        = "Directions"
            };
            Func <ServiceConsumptionContainer, DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse> _invocation = (_httpResponse) =>
            {
                var _returnedItem = RestServiceConsumer.Consume <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse>(_options, _httpResponse);
                return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse>(_returnedItem));
            };
            var _consumer = new ServiceConsumer <DSS3_LogisticsPoolingForUrbanDistribution.ExternalStructs.GoogleDirections.DirectionsResponse>(_invocation);

            return(_consumer.Invoke(_options));
        }
Ejemplo n.º 13
0
            public Opts Buffer(string bufname, System.Func <ComputeBuffer> func)
            {
                this.ShaderConfigurators.Add((shader, kernelId) =>
                                             shader.SetBuffer(kernelId, bufname, func.Invoke()));

                return(this);
            }
        public static DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root GeoLocation(string address)
        {
            System.Func <string> getUrl = () =>
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                return("json?address=" + address + "&key=AIzaSyCZs5R7fS9r6xCoilVedcK-Oq-hHk7mzdI");
            };
            var _operationRelativeUrl = getUrl.Invoke().Trim();

            if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true)
            {
                _operationRelativeUrl = _operationRelativeUrl.TrimStart('/');
            }
            var _targetUrl = BaseUrl + _operationRelativeUrl;
            var _options   = new RestServiceConsumptionOptions
            {
                Url             = _targetUrl,
                Verb            = RestHTTPVerb.GET,
                ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
                {
                },
                LogAccess        = false,
                IsCachingEnabled = false,
                ApiName          = "GoogleGeocode",
                Operation        = "GeoLocation"
            };
            Func <ServiceConsumptionContainer, DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root> _invocation = (_httpResponse) =>
            {
                var _returnedItem = RestServiceConsumer.Consume <DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root>(_options, _httpResponse);
                return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root>(_returnedItem));
            };
            var _consumer = new ServiceConsumer <DSS5_SupplyChainFinancialsOptimisation.ExternalStructs.GoogleGeocode.Root>(_invocation);

            return(_consumer.Invoke(_options));
        }
Ejemplo n.º 15
0
 /// <summary>
 /// Follows the specified target while the given condition is true
 /// </summary>
 /// <param name="transform"></param>
 /// <param name="target"></param>
 /// <param name="speed"></param>
 /// <param name="condition"></param>
 /// <param name="stopDistance"></param>
 /// <param name="timeScale"></param>
 /// <returns></returns>
 public static IEnumerator FollowWhile(Transform transform, Transform target, float speed, System.Func <bool> condition, float stopDistance = 0.0f, TimeScale timeScale = TimeScale.Delta)
 {
     while (condition.Invoke())
     {
         FollowProcedure(transform, target, speed, stopDistance, timeScale.GetTime());
         yield return(timeScale.Yield());
     }
 }
        private ModularPlacableObject PlaceObjectAt(Vector3 Position, Quaternion Rotation, StrokeType Type)
        {
            ModularPlacableObject Placable = ModularInstanceGetter.Invoke(Type); // get placable

            Placable.transform.rotation = Rotation;                              // set rotation
            Placable.Position           = Position;                              // set position
            return(Placable);
        }
Ejemplo n.º 17
0
 private static object CheckForDynamics(object val)
 {
     if (IsDynamic(val))
     {
         System.Func <object> Dynamic = (System.Func <object>)val;
         val = Dynamic.Invoke();
     }
     return(val);
 }
Ejemplo n.º 18
0
    private IEnumerator PutAwayWeapon()
    {
        WeaponType?weaponType   = _putAwayWeapon?.Invoke();
        float      timeToFinish = 1.5f; AnimationUtility.GetCurrentAnimatorTime(_characterAnimator, 1);

        print(timeToFinish);
        yield return(new WaitForSeconds(timeToFinish));

        PutWeaponOnSocket(weaponType.Value);
    }
Ejemplo n.º 19
0
        public static TlsServerHello Create(System.Func <string, string, string> mapper, string[] values)
        {
            TlsServerHello newObj = new TlsServerHello();

            newObj._FrameNumber             = mapper.Invoke("frame.number", values[0]).ToInt32();
            newObj._FrameTimeRelative       = mapper.Invoke("frame.time_relative", values[1]).ToDouble();
            newObj._IpSrc                   = mapper.Invoke("ip.src", values[2]).ToString();
            newObj._IpDst                   = mapper.Invoke("ip.dst", values[3]).ToString();
            newObj._TcpSrcport              = mapper.Invoke("tcp.srcport", values[4]).ToInt32();
            newObj._TcpDstport              = mapper.Invoke("tcp.dstport", values[5]).ToInt32();
            newObj._TlsRecordVersion        = mapper.Invoke("tls.record.version", values[6]).ToInt32();
            newObj._TlsHandshakeCiphersuite = mapper.Invoke("tls.handshake.ciphersuite", values[7]).ToInt32();
            return(newObj);
        }
Ejemplo n.º 20
0
 public static R?NullOr <T, R>(this T?self, System.Func <T, R> f)
     where T : struct
     where R : struct
 {
     if (self.HasValue)
     {
         return((R?)f.Invoke(self.Value));
     }
     else
     {
         return(null);
     }
 }
Ejemplo n.º 21
0
        public string ToString(System.Func <DataString, string> toString = null)
        {
            string result = "";

            foreach (DataString token in tokens)
            {
                if (token != null)
                {
                    result += toString.Invoke(token) + " ";
                }
            }

            return(result);
        }
Ejemplo n.º 22
0
        public static IcmpPacket Create(System.Func <string, string, string> mapper, string[] values)
        {
            IcmpPacket newObj = new IcmpPacket();

            newObj._FrameNumber = mapper.Invoke("frame.number", values[0]).ToInt32();
            newObj._IpSrc       = mapper.Invoke("ip.src", values[1]).ToString();
            newObj._IpDst       = mapper.Invoke("ip.dst", values[2]).ToString();
            newObj._IcmpType    = mapper.Invoke("icmp.type", values[3]).ToInt32();
            newObj._IcmpCode    = mapper.Invoke("icmp.code", values[4]).ToInt32();
            newObj._IcmpIdent   = mapper.Invoke("icmp.ident", values[5]).ToInt32();
            newObj._IcmpSeq     = mapper.Invoke("icmp.seq", values[6]).ToInt32();
            return(newObj);
        }
Ejemplo n.º 23
0
        public virtual T Get(Key key, TimeSpan expiration)
        {
            lock (lockObj)
            {
                if (cacheArray.ContainsKey(key))
                {
                    var val = cacheArray[key].Get();
                    if (val != null)
                    {
                        return(val);
                    }
                }

                T value = contentFunc.Invoke(key);
                if (value != null)
                {
                    cacheArray.Add(key, getTCacheInstance(key, expiration, o => contentFunc.Invoke(key))
                                   //new TCache(expiration, prefix + key.ToString(), (obj) => contentFunc.Invoke(key))
                                   );
                    cacheArray[key].ForceRefreshCache(value);
                }
                return(value);
            }
        }
Ejemplo n.º 24
0
 public IEnumerable <T> SelectSelectedElements <T>(System.Func <Element, bool> onWhere, System.Func <Element, T> onSelector)
 {
     if (state.selectedIDs.Count > 0)
     {
         List <int> ids = state.selectedIDs;
         return(FindRowElements((element) =>
         {
             if (ids.Contains(element.id) != false)
             {
                 return onWhere?.Invoke(element) ?? true;
             }
             return false;
         }).Select(x => onSelector(x as Element)));
     }
     return(null);
 }
Ejemplo n.º 25
0
        /// <summary>
        /// 匹配url,默认至少返回一条记录,即使所有工作不正常
        /// </summary>
        /// <param name="source">url健康信息</param>
        /// <param name="matchA10Content">对source参数每一个元素最后报告的内容进行匹配,如果是相同,则返回可进行请求的url结果中</param>
        /// <returns></returns>
        protected virtual IApiUriHealthElement[] Select(IEnumerable <IApiUriHealthElement> source, System.Func <string, bool> matchA10Content)
        {
            var matchs = (from n in source where matchA10Content.Invoke(n.ReportText) orderby n.Id select n).ToArray();

            if (matchs.IsNullOrEmpty())
            {
                this.Write(source, Enumerable.Empty <IApiUriHealthElement>());

                /*表示可能都不能正常工作,则取temp的第一个*/
                return(new[] { source.OrderBy(o => o.Id).FirstOrDefault() });
            }

            //写日志
            this.Write(source, matchs);

            return(matchs);
        }
Ejemplo n.º 26
0
    public List <PathHeuristic> GetExtendedPaths(System.Func <Tile, Tile, int> _HeuristicFunction, Tile _End)
    {
        List <PathHeuristic> allExtendedpaths = new List <PathHeuristic>(10);       // assume 4 as initial capacity

        for (int i = 0; i < LastStep.Neighbors.Count; i++)
        {
            Tile beforeLast = Steps.Count > 1 ? Steps[Steps.Count - 2] : null;
            Tile neighbor   = LastStep.Neighbors[i];
            if (!neighbor.IsAccessible || beforeLast == neighbor)
            {
                continue;
            }
            PathHeuristic extendedPath = new PathHeuristic(this);
            extendedPath.AddStep(neighbor, _HeuristicFunction.Invoke(neighbor, _End));
            allExtendedpaths.Add(extendedPath);
        }
        return(allExtendedpaths);
    }
Ejemplo n.º 27
0
 private void PositiveDelegate()
 {
     Constants.EscapeOrEnterLocked = false;
     Constants.DecreaseInputLayer();
     if (_returnVirtualKeyCode)
     {
         _resultAction?.Invoke(_newKeyCode.GetHashCode());
     }
     else
     {
         _resultAction?.Invoke(_newTypedKeyCode.GetHashCode());
     }
     Destroy(gameObject);
 }
        public static DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results GetAnomaliesOnHits(int?hits, DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.RecordRequest q)
        {
            System.Func <string> getUrl = () =>
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                return("/.ml-anomalies-custom-obapi_hm_resp_hits_per_service/_search?size=" + hits.GetValueOrDefault(0));
            };
            var _operationRelativeUrl = getUrl.Invoke().Trim();

            if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true)
            {
                _operationRelativeUrl = _operationRelativeUrl.TrimStart('/');
            }
            var _targetUrl = BaseUrl + _operationRelativeUrl;
            var _options   = new RestServiceConsumptionOptions
            {
                Url             = _targetUrl,
                Verb            = RestHTTPVerb.POST,
                SecurityType    = RestSecurityType.BasicAuth,
                UserName        = "******",
                Password        = "******",
                ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
                {
                },
                LogAccess        = false,
                IsCachingEnabled = false,
                ApiName          = "XPackML",
                Operation        = "GetAnomaliesOnHits",
                PostType         = PostType.JSON,
                Data             = q, FormData = new Dictionary <string, object> {
                    { "q", q }
                }
            };
            Func <ServiceConsumptionContainer, DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results> _invocation = (_httpResponse) =>
            {
                var _returnedItem = RestServiceConsumer.Consume <DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results>(_options, _httpResponse);
                return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results>(_returnedItem));
            };
            var _consumer = new ServiceConsumer <DSS1_RetailerDriverStockOptimisation.ExternalStructs.XPackML.Results>(_invocation);

            return(_consumer.Invoke(_options));
        }
        public static DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse Search(DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchRequest query, int?hits)
        {
            System.Func <string> getUrl = () =>
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                return("/selis-*/_search?filter_path=hits.total,hits.max_score,hits.hits._id,hits.hits._source&size=" + hits.GetValueOrDefault(0));
            };
            var _operationRelativeUrl = getUrl.Invoke().Trim();

            if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true)
            {
                _operationRelativeUrl = _operationRelativeUrl.TrimStart('/');
            }
            var _targetUrl = BaseUrl + _operationRelativeUrl;
            var _options   = new RestServiceConsumptionOptions
            {
                Url             = _targetUrl,
                Verb            = RestHTTPVerb.POST,
                SecurityType    = RestSecurityType.BasicAuth,
                UserName        = "******",
                Password        = "******",
                ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
                {
                },
                LogAccess        = false,
                IsCachingEnabled = false,
                ApiName          = "Elasticsearch",
                Operation        = "Search",
                PostType         = PostType.JSON,
                Data             = query, FormData = new Dictionary <string, object> {
                    { "query", query }
                }
            };
            Func <ServiceConsumptionContainer, DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse> _invocation = (_httpResponse) =>
            {
                var _returnedItem = RestServiceConsumer.Consume <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse>(_options, _httpResponse);
                return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse>(_returnedItem));
            };
            var _consumer = new ServiceConsumer <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.SearchResponse>(_invocation);

            return(_consumer.Invoke(_options));
        }
        public static DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status Info()
        {
            System.Func <string> getUrl = () =>
            {
                System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
                return("/");
            };
            var _operationRelativeUrl = getUrl.Invoke().Trim();

            if (_operationRelativeUrl?.StartsWith("/") == true && BaseUrl?.EndsWith("/") == true)
            {
                _operationRelativeUrl = _operationRelativeUrl.TrimStart('/');
            }
            var _targetUrl = BaseUrl + _operationRelativeUrl;
            var _options   = new RestServiceConsumptionOptions
            {
                Url             = _targetUrl,
                Verb            = RestHTTPVerb.GET,
                SecurityType    = RestSecurityType.BasicAuth,
                UserName        = "******",
                Password        = "******",
                ExtraHeaderData = new System.Collections.Generic.Dictionary <string, string>(StringComparer.OrdinalIgnoreCase)
                {
                },
                LogAccess        = false,
                IsCachingEnabled = true,
                ApiName          = "Elasticsearch",
                Operation        = "Info",
                CachePerUser     = false,
                ExpirationMode   = CacheManager.Core.ExpirationMode.None,
                ServerTimeSpan   = 0
            };
            Func <ServiceConsumptionContainer, DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status> _invocation = (_httpResponse) =>
            {
                var _returnedItem = RestServiceConsumer.Consume <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status>(_options, _httpResponse);
                return(zAppDev.DotNet.Framework.Utilities.Common.SafeCast <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status>(_returnedItem));
            };
            var _consumer = new ServiceConsumer <DSS1_RetailerDriverStockOptimisation.ExternalStructs.Elasticsearch.Status>(_invocation);

            return(_consumer.Invoke(_options));
        }