コード例 #1
0
        private void addGeocachesToMap(List <Framework.Data.Geocache> gcList)
        {
            List <GCInfo> gcil = new List <GCInfo>();

            foreach (Framework.Data.Geocache gc in gcList)
            {
                var gci = new GCInfo();
                gci.a = gc.Code;
                gci.b = gc.Lat;
                gci.c = gc.Lon;
                if (gc.Found)
                {
                    gci.d = "foundIcon";
                }
                else
                {
                    gci.d = string.Format("gct{0}Icon", gc.GeocacheType.ID.ToString().Replace("-", "_"));
                }
                gcil.Add(gci);
            }
            var jsonSerialiser = new JavaScriptSerializer();

            jsonSerialiser.MaxJsonLength = int.MaxValue;
            var json = jsonSerialiser.Serialize(gcil);

            executeScript(string.Format("updateGeocaches({0})", json));
        }
コード例 #2
0
        public bool GetGCHeapData(out GCInfo data)
        {
            InitDelegate(ref _getGCHeapData, VTable->GetGCHeapData);
            int hr = _getGCHeapData(Self, out data);

            return(hr == S_OK);
        }
コード例 #3
0
        /// <summary>
        /// 获取所有工厂信息
        /// </summary>
        /// <returns>工厂信息列表的json字符串形式</returns>
        public string GetAllGCInfo(int page, int rows)
        {
            int start = (page - 1) * rows;
            int end   = page * rows;

            string where = "limit " + start + "," + end;
            string        sql             = "SELECT * FROM `web`.`工厂表` order by 集团名称 desc ";
            List <GCInfo> gcs             = new List <GCInfo>();
            Dictionary <string, object> d = new Dictionary <string, object>();
            //获取数据总数(注意是总数,不是一页中数据的条数)
            DataTable dTable = data.GetTable(sql);

            d.Add("total", data.GetTable(sql).Rows.Count);
            //获取page页的数据
            dTable = dTable.AsEnumerable().Skip((page - 1) * rows).Take(rows).CopyToDataTable();
            for (int i = 0; i < dTable.Rows.Count; i++)
            {
                GCInfo gc = new GCInfo();
                gc.ID          = dTable.Rows[i]["ID"].ToString();
                gc.Name        = dTable.Rows[i]["工厂名称"].ToString();
                gc.Address     = dTable.Rows[i]["工厂地址"].ToString();
                gc.PostAddress = dTable.Rows[i]["工厂邮编"].ToString();
                gc.Introduce   = dTable.Rows[i]["工厂介绍"].ToString();
                gc.Phone       = dTable.Rows[i]["工厂电话"].ToString();
                gc.Email       = dTable.Rows[i]["工厂电子邮箱"].ToString();
                gc.JTName      = dTable.Rows[i]["集团名称"].ToString();
                gc.JW          = dTable.Rows[i]["工厂经纬度"].ToString();
                gcs.Add(gc);
            }
            d.Add("rows", gcs);
            return(JsonConvert.SerializeObject(d));
        }
コード例 #4
0
 private bool IsInducedGc(GCInfo info, int depth)
 {
     return((info.Reason == GCReason.InducedCompacting ||
             info.Reason == GCReason.InducedLowMemory ||
             info.Reason == GCReason.InducedNotForced ||
             info.Reason == GCReason.Induced) &&
            info.Depth == depth);
 }
コード例 #5
0
        /// <summary>
        /// 更新工厂信息
        /// </summary>
        /// <param name="gc">工厂信息</param>
        /// <returns>更新是否成功</returns>
        public bool Update(GCInfo gc)
        {
            string sql = "Update `web`.`工厂表` SET " +
                         "`工厂地址` = '" + gc.Address + "'," +
                         "`工厂邮编` = '" + gc.PostAddress + "'," +
                         "`工厂介绍` = '" + gc.Introduce + "'," +
                         "`工厂电话` = '" + gc.Phone + "'," +
                         "`工厂电子邮箱` = '" + gc.Email + "'," +
                         "`集团名称` = '" + gc.JTName + "'," +
                         "`工厂经纬度` = '" + gc.JW + "'" + " WHERE `工厂名称` = '" + gc.Name + "'";

            return(data.ExecSql(sql));
        }
コード例 #6
0
        /// <summary>
        /// 保存工厂的信息
        /// </summary>
        /// <param name="user"></param>
        public bool Add(GCInfo gc)
        {
            string sql = "INSERT INTO `web`.`工厂表`(`工厂名称`, `工厂地址`, `工厂邮编`, `工厂介绍`, `工厂电话`, `工厂电子邮箱`, `集团名称`, `工厂经纬度`) VALUES ('" +
                         gc.Name + "', '" +
                         gc.Address + "', '" +
                         gc.PostAddress + "', '" +
                         gc.Introduce + "', '" +
                         gc.Phone + "', '" +
                         gc.Email + "', '" +
                         gc.JTName + "', '" +
                         gc.JW + "')";

            return(data.ExecSql(sql));
        }
コード例 #7
0
        public void Should_notify_observers_if_merger_returned_GCInfo_on_GCStop()
        {
            var(monitor, source, merger) = CreateMonitor();
            var observer = Substitute.For <IObserver <GCInfo> >();

            monitor.Subscribe(observer);
            var gcInfo = new GCInfo();

            merger.CompleteOrNull(Arg.Any <ETWEventClrGCEnd>()).Returns(gcInfo);

            source.GCStop += Raise.Event <Action <ETWEventClrGCEnd> >(null as ETWEventClrGCEnd);

            observer.Received(1).OnNext(gcInfo);
        }
コード例 #8
0
ファイル: GMapForm.cs プロジェクト: pheijmans-zz/GAPP
        private void addGeocachesToMap(List <Framework.Data.Geocache> gcList)
        {
            List <GCInfo> gcil = new List <GCInfo>();

            foreach (Framework.Data.Geocache gc in gcList)
            {
                var gci = new GCInfo();
                if (PluginSettings.Instance.ShowNameInToolTip && gc.Name != null)
                {
                    gci.a = string.Format("{0}, {1}", gc.Code, gc.Name.Replace('"', ' ').Replace('\'', ' ').Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' ').Replace('\\', ' '));
                }
                else
                {
                    gci.a = gc.Code;
                }
                if (gc.Found)
                {
                    gci.d = "foundIcon";
                }
                else
                {
                    if (gc.ContainsCustomLatLon)
                    {
                        gci.d = string.Format("gct{0}IconC", gc.GeocacheType.ID.ToString().Replace("-", "_"));
                    }
                    else
                    {
                        gci.d = string.Format("gct{0}Icon", gc.GeocacheType.ID.ToString().Replace("-", "_"));
                    }
                }
                if (gc.ContainsCustomLatLon)
                {
                    gci.b = (double)gc.CustomLat;
                    gci.c = (double)gc.CustomLon;
                }
                else
                {
                    gci.b = (double)gc.Lat;
                    gci.c = (double)gc.Lon;
                }
                gcil.Add(gci);
            }
            var jsonSerialiser = new JavaScriptSerializer();

            jsonSerialiser.MaxJsonLength = int.MaxValue;
            var json = jsonSerialiser.Serialize(gcil);

            executeScript(string.Format("updateGeocaches({0})", json));
        }
コード例 #9
0
ファイル: GMapForm.cs プロジェクト: gahadzikwa/GAPP
 private void addGeocachesToMap(List<Framework.Data.Geocache> gcList)
 {
     List<GCInfo> gcil = new List<GCInfo>();
     foreach (Framework.Data.Geocache gc in gcList)
     {
         var gci = new GCInfo();
         if (PluginSettings.Instance.ShowNameInToolTip && gc.Name != null)
         {
             gci.a = string.Format("{0}, {1}", gc.Code, gc.Name.Replace('"', ' ').Replace('\'', ' ').Replace('\r', ' ').Replace('\n', ' ').Replace('\t', ' ').Replace('\\', ' '));
         }
         else
         {
             gci.a = gc.Code;
         }
         if (gc.Found)
         {
             gci.d = "foundIcon";
         }
         else
         {
             if (gc.ContainsCustomLatLon)
             {
                 gci.d = string.Format("gct{0}IconC", gc.GeocacheType.ID.ToString().Replace("-", "_"));
             }
             else
             {
                 gci.d = string.Format("gct{0}Icon", gc.GeocacheType.ID.ToString().Replace("-", "_"));
             }
         }
         if (gc.ContainsCustomLatLon)
         {
             gci.b = (double)gc.CustomLat;
             gci.c = (double)gc.CustomLon;
         }
         else
         {
             gci.b = (double)gc.Lat;
             gci.c = (double)gc.Lon;
         }
         gcil.Add(gci);
     }
     var jsonSerialiser = new JavaScriptSerializer();
     jsonSerialiser.MaxJsonLength = int.MaxValue;
     var json = jsonSerialiser.Serialize(gcil);
     executeScript(string.Format("updateGeocaches({0})", json));
 }
コード例 #10
0
        public void Run(Options options)
        {
            // Applying options
            if (!string.IsNullOrEmpty(options.GCLatencyMode))
            {
                GCSettings.LatencyMode = Enum.Parse <GCLatencyMode>(options.GCLatencyMode);
            }
            if (options.Duration.HasValue)
            {
                BurnTester.DefaultDuration = TimeSpan.FromSeconds(options.Duration.Value);
            }
            BurnTester.DefaultMaxSize = ArgumentHelper.ParseRelativeValue(
                options.MaxSize, BurnTester.DefaultMaxSize, true);
            ParallelRunner.ThreadCount = (int)ArgumentHelper.ParseRelativeValue(
                options.ThreadCount, ParallelRunner.ThreadCount, true);
            var tests           = options.Tests?.ToLowerInvariant() ?? "";
            var ramSizeGb       = HardwareInfo.GetRamSize() ?? 4;
            var staticSetSizeGb = 0;

            if (!string.IsNullOrEmpty(options.StaticSetSize))
            {
                tests          += "b";
                staticSetSizeGb = (int)ArgumentHelper.ParseRelativeValue(options.StaticSetSize, ramSizeGb, true);
            }
            var outputMode = options.OutputMode ?? "f";

            if (outputMode == "f")
            {
                // Dumping environment info
                Writer.AppendValue("Launch parameters", string.Join(" ", Environment.GetCommandLineArgs().Skip(1)));
                using (Writer.Section("Software:")) {
                    Writer.AppendValue("Runtime", ".NET Core");
                    using (Writer.Indent()) {
                        Writer.AppendValue("Version", RuntimeInformation.FrameworkDescription);
                        Writer.AppendValue("GC mode", GCInfo.GetGCMode());
                    }

                    Writer.AppendValue("OS",
                                       $"{RuntimeInformation.OSDescription.Trim()} ({RuntimeInformation.OSArchitecture})");
                }

                using (Writer.Section("Hardware:")) {
                    var coreCountAddon = ParallelRunner.ThreadCount != Environment.ProcessorCount
                        ? $", {ParallelRunner.ThreadCount} used by test"
                        : "";
                    Writer.AppendValue("CPU", HardwareInfo.GetCpuModelName());
                    Writer.AppendValue("CPU core count", $"{Environment.ProcessorCount}{coreCountAddon}");
                    Writer.AppendValue("RAM size", $"{ramSizeGb:N0} GB");
                }
                Writer.AppendLine();
            }

            RunWarmup();

            if (tests == "")
            {
                RunSpeedTest();
                RunBurnTest("--- Stateless server (no static set) ---", 0);
                RunBurnTest("--- Worker / typical server (static set = 20% RAM) ---", (long)(ramSizeGb * Sizes.GB / 5));
                RunBurnTest("--- Caching / compute server (static set = 50% RAM) ---", (long)(ramSizeGb * Sizes.GB / 2));
                return;
            }

            if (tests.Contains("a"))
            {
                RunSpeedTest();
            }
            if (tests.Contains("b"))
            {
                var title = $"--- Static set = {staticSetSizeGb} GB ({staticSetSizeGb * 100.0 / ramSizeGb:0.##} % RAM) ---";
                RunBurnTest(title, (long)(staticSetSizeGb * Sizes.GB));
            }
        }
コード例 #11
0
 private void addGeocachesToMap(List<Framework.Data.Geocache> gcList)
 {
     List<GCInfo> gcil = new List<GCInfo>();
     foreach (Framework.Data.Geocache gc in gcList)
     {
         var gci = new GCInfo();
         gci.a = gc.Code;
         gci.b = gc.Lat;
         gci.c = gc.Lon;
         if (gc.Found)
         {
             gci.d = "foundIcon";
         }
         else
         {
             gci.d = string.Format("gct{0}Icon", gc.GeocacheType.ID.ToString().Replace("-", "_"));
         }
         gcil.Add(gci);
     }
     var jsonSerialiser = new JavaScriptSerializer();
     jsonSerialiser.MaxJsonLength = int.MaxValue;
     var json = jsonSerialiser.Serialize(gcil);
     executeScript(string.Format("updateGeocaches({0})", json));
 }
コード例 #12
0
        public void ProcessRequest(HttpContext context)
        {
            ResultInfo result = new ResultInfo();
            GCInfo     gc1    = new GCInfo();
            string     action = context.Request["action"].ToString();

            context.Response.ContentType = "text/plain";

            switch (action)
            {
            case "GetAll":
                context.Response.Write(GetAll());
                break;

            case "GetGC":
                string jt = HttpUtility.UrlDecode(context.Request["jt"]);
                context.Response.Write(GetGC(jt));
                break;

            case "Add":
                try
                {
                    gc1.Name        = context.Request.Form["Name"];
                    gc1.Address     = context.Request.Form["Address"];
                    gc1.PostAddress = context.Request.Form["PostAddress"];
                    gc1.Introduce   = context.Request.Form["Introduce"];
                    gc1.Phone       = context.Request.Form["Phone"];
                    gc1.Email       = context.Request.Form["Email"];
                    gc1.JTName      = context.Request.Form["JTName"];
                    gc1.JW          = context.Request.Form["JW"];
                    //保存数据到数据库中
                    result.Success = Add(gc1);
                    result.Message = "插入工厂信息" + ((result.Success == true) ? "成功" : "失败") + "!";
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Message = "异常:" + ex.Message;
                }
                //返回客户端信息
                context.Response.Write(JsonHelper <ResultInfo> .ObjectToJsonString(result));
                break;

            case "Update":
                try
                {
                    gc1             = new GCInfo();
                    gc1.ID          = context.Request.Form["ID"];
                    gc1.Name        = context.Request.Form["Name"];
                    gc1.Address     = context.Request.Form["Address"];
                    gc1.PostAddress = context.Request.Form["PostAddress"];
                    gc1.Introduce   = context.Request.Form["Introduce"];
                    gc1.Phone       = context.Request.Form["Phone"];
                    gc1.Email       = context.Request.Form["Email"];
                    gc1.JTName      = context.Request.Form["JTName"];
                    gc1.JW          = context.Request.Form["JW"];
                    result.Success  = Update(gc1);
                    result.Message  = "更新工厂[" + gc1.Name + "]信息" + ((result.Success == true) ? "成功" : "失败") + "!";
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Message = "异常:" + ex.Message;
                }
                //返回客户端信息
                context.Response.Write(JsonHelper <ResultInfo> .ObjectToJsonString(result));
                break;

            case "Delete":
                try
                {
                    int      count = 0;
                    string   id    = context.Request["Id"];
                    string[] ids   = id.Split(',');
                    for (int i = 0; i < ids.Length; i++)
                    {
                        result.Success = Delete(ids[i]);
                        if (result.Success == false)
                        {
                            break;
                        }
                        count++;
                    }
                    result.Message = ((result.Success == true) ? "操作成功:" : "操作失败:") + "共删除" + count + "条信息!";
                }
                catch (Exception ex)
                {
                    result.Success = false;
                    result.Message = "异常:" + ex.Message;
                }
                //返回客户端信息
                context.Response.Write(JsonHelper <ResultInfo> .ObjectToJsonString(result));
                break;

            case "GetAllGCInfo":
                int page = int.Parse(context.Request.Form["page"]);
                int rows = int.Parse(context.Request.Form["rows"]);
                context.Response.Write(GetAllGCInfo(page, rows));
                break;

            case "GetAllGCJZInfo":
                int    menuid = int.Parse(CheckLoginStatus.node);
                string gcname = MenuHelper.GetMenuNameById(menuid);
                // string gcname = System.Web.HttpContext.Current.Request.QueryString["node"].ToString();
                context.Response.Write(GetAllGCJZInfo(gcname));
                break;

            default:
                break;
            }
        }
コード例 #13
0
 private void DumpGCInfo(GCInfo arg)
 {
     Console.WriteLine(arg);
 }