当前位置: 首页>>代码示例>>C#>>正文


C# Results.Add方法代码示例

本文整理汇总了C#中Results.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Results.Add方法的具体用法?C# Results.Add怎么用?C# Results.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Results的用法示例。


在下文中一共展示了Results.Add方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Match

        protected internal override Results Match(string userAgent)
        {
            bool isMobile = false;

            // Use RIS to find a match first.
            Results results = base.Match(userAgent);

            // If no match with RIS then try edit distance.
            if (results == null || results.Count == 0)
                results = Matcher.Match(userAgent, this);

            // If a match other than edit distance was used then we'll have more confidence
            // and return the mobile version of the device.
            if (results.GetType() == typeof (Results))
                isMobile = true;

            Results newResults = new Results();

            // Look at the results for one that matches our isMobile setting based on the
            // matcher used.
            foreach (Result result in results)
            {
                if (result.Device.IsMobileDevice == isMobile)
                    newResults.Add(result.Device);
            }

            // Return the new results if any values are available.
            return newResults;
        }
开发者ID:irobinson,项目名称:51DegreesDNN,代码行数:29,代码来源:CatchAllHandler.cs

示例2: Join

 public Results Join(Guid partyId, int userId, out IPlayer player)
 {
     player = null;
     var results = new Results();
     IParty party = this.GetAllJoinable(userId).Where(p => p.Id == partyId).FirstOrDefault();
     if (party != null)
     {
         var players = party.Players.Where(p => p.UserId == userId);
         if (players.Count() == 1)
         {
             player = players.ElementAt(0);
             results.Add(ResultCode.Undefined, @"\Games\mv\map.html?partyId=" + partyId);
         }
     }
     else
     {
         results.Add(ResultCode.PartyNotFound);
     }
     return results;
 }
开发者ID:zolix7508,项目名称:FGC,代码行数:20,代码来源:PartyService.cs

示例3: Login

        public bool Login(string userName, string password, bool rememberMe, out Results results)
        {
            bool ok = WebSecurity.Login(userName, password, persistCookie: rememberMe);
            results = new Results();
            if (ok)
            {
                var user = base.Resolve<IUserRepository>().GetUserByUserName(userName);
                if (user != null)
                    CreateAuthTicket(userName, Guid.Empty, string.Empty, rememberMe, HttpContext.Current.Response, user.Nick, Guid.Empty);
            }

            if (!ok) results.Add(ResultCode.LoginError);
            return ok;
        }
开发者ID:zolix7508,项目名称:FGC,代码行数:14,代码来源:AuthenticationService.cs

示例4: GetLatestAlertResults

 public static Results GetLatestAlertResults(String ipHost, Namespace nameSpace)
 {
     if (!latest_results.ContainsKey(nameSpace))
         latest_results[nameSpace] = new Dictionary<String, ResultsCounter>();
     if (!latest_results[nameSpace].ContainsKey(ipHost))
         latest_results[nameSpace].Add(ipHost, new ResultsCounter());
     Results results = new Results();
     foreach (IResult result in latest_results[nameSpace][ipHost].Results.ToEnumerable())
     {
         if(!result.Ok)
             results.Add(result);
     }
     return results;
 }
开发者ID:fronn,项目名称:win-net-mon,代码行数:14,代码来源:ResultChecker.cs

示例5: SecondPass

 private static void SecondPass(VersionHandler handler, int[] maxCharacters, List<DeviceResult> initialResults, Results results)
 {
     int lowestScore = int.MaxValue;
     foreach (DeviceResult current in initialResults)
     {
         // Calculate the score for this device.
         int deviceScore = 0;
         for (int segment = 0; segment < handler.VersionRegexes.Length; segment++)
         {
             deviceScore += (maxCharacters[segment] - current.Scores[segment].CharactersMatched + 1)*
                            (current.Scores[segment].Difference + maxCharacters[segment] -
                             current.Scores[segment].CharactersMatched);
         }
         // If the score is lower than the lowest so far then reset the list
         // of best matching devices.
         if (deviceScore < lowestScore)
         {
             results.Clear();
             lowestScore = deviceScore;
         }
         // If the device score is the same as the lowest score so far then add this
         // device to the list.
         if (deviceScore == lowestScore)
         {
             results.Add(current.Device);
         }
     }
 }
开发者ID:irobinson,项目名称:51DegreesDNN,代码行数:28,代码来源:Matcher.cs

示例6: Geocode

        public IResults Geocode(string _address)
        {
            Results results = new Results();
            Uri uriRequest = new Uri(c_strRequestUri + "\"" + _address + "\"");
            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(uriRequest);

            WebProxy proxy = null;

            IWebProxy proxySystem = HttpWebRequest.GetSystemWebProxy();
            Uri uriProxy = proxySystem.GetProxy(uriRequest);

            if (uriProxy != uriRequest)
            {
                proxy = new WebProxy(uriProxy);
                proxy.UseDefaultCredentials = true;
                request.Proxy = proxy;
            }

            HttpWebResponse response = (HttpWebResponse)request.GetResponse();
            String content = new StreamReader(response.GetResponseStream()).ReadToEnd();

            Regex reg = new Regex(
                "\"Name\":\"(?<name>.*?)\".*?,\"BestLocation\":{.*?\"Latitude\":(?<lat>.*?),\"Longitude\":(?<lon>.*?)}}.*?\"Locality\":\"(?<locality>.*?)\",.*?\"AdminDistrict\":\"(?<state>.*?)\",\"PostalCode\":\"(?<code>.*?)\",\"CountryRegion\":\"(?<country>.*?)\""
                , RegexOptions.IgnoreCase);

            foreach (Match match in reg.Matches(content)) //mResult.Result("${result}"
            {
                Result r = new Result();

                r.Address = match.Result("${name}");
                r.Country = match.Result("${country}");
                r.City = match.Result("${locality}");
                r.State = match.Result("${state}");
                r.Zip = match.Result("${code}");
                try {
                    r.Latitude = Double.Parse(match.Result("${lat}"));
                    r.Longitude = Double.Parse(match.Result("${lon}"));
                }
                catch (ArgumentNullException) { }
                catch (FormatException) { }
                catch (OverflowException) { }

                results.Add(r);
            }

            /*
            Regex regex = new Regex(@"AddLocation\(.*?\)", RegexOptions.IgnoreCase);
            MatchCollection matchCollection = regex.Matches(content);

            foreach (Match match in matchCollection)
            {
                Double dLongitude;
                Double dLatitude;

                String m = match.Value.Remove(0, 12); m = m.Remove(m.Length - 1);
                if (!m.StartsWith("'")) continue;
                Int32 a = m.IndexOf("'", 1); if (a == -1) continue;
                String address = HttpUtility.HtmlDecode(m.Substring(1, a - 1));
                m = m.Substring(a + 1);
                String[] marr = m.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                try
                {
                    dLongitude = Convert.ToDouble(marr[1].Trim(), CultureInfo.InvariantCulture);
                    dLatitude = Convert.ToDouble(marr[0].Trim(), CultureInfo.InvariantCulture);
                }
                catch (InvalidCastException) { continue; }

                results.Add(new Result(address, dLongitude, dLatitude));
            }

            regex = new Regex(@"new Array\('.*?',.*?\)", RegexOptions.IgnoreCase);
            matchCollection = regex.Matches(content);

            foreach (Match match in matchCollection)
            {
                Double dLongitude;
                Double dLatitude;

                String m = match.Value.Remove(0, 10); m = m.Remove(m.Length - 1);
                if (!m.StartsWith("'")) continue;
                Int32 a = m.IndexOf("'", 1); if (a == -1) continue;
                String address = HttpUtility.HtmlDecode(m.Substring(1, a - 1));
                m = m.Substring(a + 1);
                String[] marr = m.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

                try
                {
                    dLongitude = (Convert.ToDouble(marr[1].Trim(), CultureInfo.InvariantCulture) + Convert.ToDouble(marr[3].Trim(), CultureInfo.InvariantCulture)) / 2;
                    dLatitude = (Convert.ToDouble(marr[0].Trim(), CultureInfo.InvariantCulture) + Convert.ToDouble(marr[2].Trim(), CultureInfo.InvariantCulture)) / 2;
                }
                catch (InvalidCastException) { continue; }

                results.Add(new Result(address, dLongitude, dLatitude));
            }

            if (results.Count == 0)
            {
                regex = new Regex(@"SetViewport\(.*?\)", RegexOptions.IgnoreCase);
                Match match = regex.Match(content);
//.........这里部分代码省略.........
开发者ID:jmkelly,项目名称:Manifold-ISIs,代码行数:101,代码来源:Server.cs

示例7: OnStopped

        private async void OnStopped(Results results)
        {
            string reason = results.TryFindString("reason");

            if (reason.StartsWith("exited") || reason.StartsWith("disconnected"))
            {
                if (this.ProcessState != ProcessState.Exited)
                {
                    this.ProcessState = ProcessState.Exited;
                    if (ProcessExitEvent != null)
                    {
                        ProcessExitEvent(this, new ResultEventArgs(results));
                    }
                }
                return;
            }

            //if this is an exception reported from LLDB, it will not currently contain a frame object in the MI
            //if we don't have a frame, check if this is an exception and retrieve the frame
            if (!results.Contains("frame") &&
                (string.Compare(reason, "exception-received", StringComparison.OrdinalIgnoreCase) == 0 ||
                string.Compare(reason, "signal-received", StringComparison.OrdinalIgnoreCase) == 0)
                )
            {
                //get the info for the current frame
                Results frameResult = await MICommandFactory.StackInfoFrame();

                //add the frame to the stopping results
                results = results.Add("frame", frameResult.Find("frame"));
            }

            bool fIsAsyncBreak = MICommandFactory.IsAsyncBreakSignal(results);
            if (await DoInternalBreakActions(fIsAsyncBreak))
            {
                return;
            }

            this.ProcessState = ProcessState.Stopped;
            FlushBreakStateData();

            if (!results.Contains("frame"))
            {
                if (ModuleLoadEvent != null)
                {
                    ModuleLoadEvent(this, new ResultEventArgs(results));
                }
            }
            else if (BreakModeEvent != null)
            {
                BreakRequest request = _requestingRealAsyncBreak;
                _requestingRealAsyncBreak = BreakRequest.None;
                BreakModeEvent(this, new StoppingEventArgs(results, request));
            }
        }
开发者ID:wesrupert,项目名称:MIEngine,代码行数:54,代码来源:Debugger.cs

示例8: OnStopped

        private async void OnStopped(Results results)
        {
            string reason = results.TryFindString("reason");

            if (reason.StartsWith("exited"))
            {
                string threadGroupId = results.TryFindString("id");
                if (!String.IsNullOrEmpty(threadGroupId))
                {
                    lock (_debuggeePids)
                    {
                        _debuggeePids.Remove(threadGroupId);
                    }
                }

                if (IsLocalGdbAttach())
                {
                    CmdExitAsync();
                }

                this.ProcessState = ProcessState.Exited;
                if (ProcessExitEvent != null)
                {
                    ProcessExitEvent(this, new ResultEventArgs(results));
                }
                return;
            }

            //if this is an exception reported from LLDB, it will not currently contain a frame object in the MI
            //if we don't have a frame, check if this is an excpetion and retrieve the frame
            if (!results.Contains("frame") &&
                string.Compare(reason, "exception-received", StringComparison.OrdinalIgnoreCase) == 0
                )
            {
                //get the info for the current frame
                Results frameResult = await MICommandFactory.StackInfoFrame();

                //add the frame to the stopping results
                results.Add("frame", frameResult.Find("frame"));
            }

            bool fIsAsyncBreak = MICommandFactory.IsAsyncBreakSignal(results);
            if (await DoInternalBreakActions(fIsAsyncBreak))
            {
                return;
            }

            this.ProcessState = ProcessState.Stopped;
            FlushBreakStateData();

            if (!results.Contains("frame"))
            {
                if (ModuleLoadEvent != null)
                {
                    ModuleLoadEvent(this, new ResultEventArgs(results));
                }
            }
            else if (BreakModeEvent != null)
            {
                if (fIsAsyncBreak) { _requestingRealAsyncBreak = false; }
                BreakModeEvent(this, new ResultEventArgs(results));
            }
        }
开发者ID:wiktork,项目名称:MIEngine,代码行数:63,代码来源:Debugger.cs

示例9: GetProjectResults

 private static List<Result> GetProjectResults(Results all, string projectName)
 {
   Contract.Ensures(Contract.Result<List<Result>>() != null);
   List<Result> list;
   if (!all.TryGetValue(projectName, out list))
   {
     list = new List<Result>();
     all.Add(projectName, list);
   }
   else
   {
     Contract.Assume(list != null);
   }
   return list;
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:15,代码来源:Program.cs

示例10: Main

 static int Main(string[] args)
 {
   if (args.Length > 2) { System.Diagnostics.Debugger.Launch(); }
   if (args.Length < 1)
   {
     Console.WriteLine("Usage: parseStats logfile");
     return -1;
   }
   if (args[0].StartsWith(@"*\"))
   {
     var components = args[0].Split('\\');
     var results = new Results();
     // first dir is key
     Contract.Assume(components.Count() > 0, "Follows from the fact that Split return a non-empty array");
     foreach (var file in Directory.EnumerateFiles(".", components.Last(), SearchOption.AllDirectories)) {
       var fileComps = file.Split('\\');
       if (Matches(components, fileComps))
       {
         var lr = RunOneLog(file);
         var stats = Sum(lr);
         results.Add(fileComps[1], stats);
       }
     }
     PrintStats(results, args.Length > 1);
   }
   else
   {
     var lr = RunOneLog(args[0]);
     PrintStats(lr, args.Length > 1);
   }
   return 0;
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:32,代码来源:Program.cs

示例11: RenderRules

        /// <summary>
        ///     Renders the rules.
        /// </summary>
        /// <returns> </returns>
        public IValidationContext RenderRules()
        {
            results = new Results();
            if (rules == null || rules.Count < 1)
            {
                return this;
            }
            else
            {
                //sort rules based on priority;
                rules.Sort();
            }

            foreach (RulePolicy rule in rules)
            {
                if (!exitRuleRendering)
                {
                    rule.OnRuleRendered += OnRuleRenderedHandler;
                    results.Add(rule.Execute());
                }
                else
                {
                    break;
                }
            }

            ProcessResults();
            return this;
        }
开发者ID:kahneraja,项目名称:Vergosity,代码行数:33,代码来源:ValidationContextBase.cs


注:本文中的Results.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。