Пример #1
0
        public void Set_System_Infos()
        {
            ManagementObjectSearcher System_Infos = Infos.System_Infos();

            foreach (ManagementObject Info in System_Infos.Get())
            {
                System_LBL.Text = $"System : {Info["Caption"]} \n\n" +
                                  $"Architechture : {Info["OSArchitecture"]} \n\n" +
                                  $"Version : {Info["Version"]}";
            }
        }
Пример #2
0
        public static int GetSpellID(SkillName name)
        {
            MasteryInfo info = Infos.FirstOrDefault(i => i.MasterySkill == name && i.Passive);

            if (info == null)
            {
                return(-1);
            }

            return(info.SpellID);
        }
        /// <summary>
        /// 处理单次输入
        /// </summary>
        /// <param name="input"></param>
        private void ProcessUnit(string input)
        {
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");

            Infos.Filter(input);
            this.textBox_Info.SafeInvoke(() =>
            {
                this.textBox_Info.Text = string.Format(@"{0} 至 {1:yyyy-MM-dd HH:mm:ss.fff} ==>
数据列表长度:{2}", time, DateTime.Now, this.Infos.ListTrigger_Cluster.Count);
            });
        }
Пример #4
0
 /// <summary>
 /// Creates an instance of the class
 /// </summary>
 /// <param name="owner">addin owner instance</param>
 /// <param name="isAutomation">host application is started for automation</param>
 protected internal CommonUtils(NetOffice.Tools.COMAddinBase owner, bool isAutomation)
 {
     if (null == owner)
     {
         throw new ArgumentNullException("owner");
     }
     Owner              = owner;
     _ownerApplication  = owner.AppInstance;
     _isAutomation      = isAutomation;
     _headerCaptionLine = _headerCaptionLineDefault;
     _infos             = new Infos(this);
 }
Пример #5
0
        public void Set_CPU_Infos()
        {
            ManagementObjectSearcher CPU_Info = Infos.CPU_Infos();


            foreach (ManagementObject Info in CPU_Info.Get())
            {
                CPU_LBL.Text = $"CPU : {Info["Name"]} \n\n" +
                               $"Cores : {Info["NumberOfCores"]} \n\n" +
                               $"Enabled Cores : {Info["NumberOfEnabledCore"]}";
            }
        }
Пример #6
0
        /// <summary>获取图片ImageFormat
        /// </summary>
        public static ImageFormat GetImageFormatByImage(Image image)
        {
            var imageFormats = Infos.Select(x => x.ImageFormat).ToList();

            foreach (var imageFormat in imageFormats)
            {
                if (imageFormat.Guid == image.RawFormat.Guid)
                {
                    return(imageFormat);
                }
            }
            return(DefaultImageFormat());
        }
Пример #7
0
 public override void Serialize(IDataWriter writer)
 {
     writer.WriteUShort(Infos.TypeID);
     Infos.Serialize(writer);
     writer.WriteInt(CreationDate);
     writer.WriteVarUhShort(NbTaxCollectors);
     writer.WriteShort((short)Members.Count);
     for (var membersIndex = 0; membersIndex < Members.Count; membersIndex++)
     {
         var objectToSend = Members[membersIndex];
         objectToSend.Serialize(writer);
     }
 }
Пример #8
0
 public AppDataInfo(Infos.ProjectInfo projectInfo, string settingsFileName)
 {
     m_sFullPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
     if (projectInfo.COMPANY_NAME != "")
     {
         m_sFullPath += @"\" + projectInfo.COMPANY_NAME;
     }
     if (projectInfo.APPLICATION_NAME == "")
     {
         throw new Exception("Application name is missing in " + this.GetType().Name);
     }
     m_sFullPath += @"\" + projectInfo.APPLICATION_NAME + @"\" + settingsFileName;
 }
Пример #9
0
        /// <summary>
        /// Removes a JID from the recognized set of JIDs.
        /// </summary>
        /// <param name="FullJID">Full JID.</param>
        public void RemovePeerAddresses(string FullJID)
        {
            string ThisExternalIp = this.p2pNetwork.ExternalAddress is null ? string.Empty : this.p2pNetwork.ExternalAddress.ToString();

            lock (this.addressesByFullJid)
            {
                if (this.addressesByFullJid.TryGetValue(FullJID, out AddressInfo Info))
                {
                    this.addressesByFullJid.Remove(FullJID);

                    if (this.addressesByExternalIPPort.TryGetValue(Info.ExternalIp, out Dictionary <int, AddressInfo> Infos))
                    {
                        if (Infos.Remove(Info.ExternalPort) && Infos.Count == 0)
                        {
                            this.addressesByExternalIPPort.Remove(Info.ExternalIp);
                        }
                    }

                    if (Info.ExternalIp == ThisExternalIp)
                    {
                        if (this.addressesByLocalIPPort.TryGetValue(Info.LocalIp, out Infos))
                        {
                            if (Infos.Remove(Info.LocalPort) && Infos.Count == 0)
                            {
                                this.addressesByLocalIPPort.Remove(Info.LocalIp);
                            }
                        }
                    }
                }
                else
                {
                    return;
                }
            }

            this.Information("Removing JID from set of recognized JIDs: " + FullJID);

            PeerAddressEventHandler h = this.PeerAddressRemoved;

            if (h != null)
            {
                try
                {
                    h(this, new PeerAddressEventArgs(FullJID, string.Empty, 0, string.Empty, 0));
                }
                catch (Exception ex)
                {
                    Log.Critical(ex);
                }
            }
        }
Пример #10
0
        private void ReportPlayer(Bot bot, GameServerRequest gsr)
        {
            GameServer gs = bot.Manager.GetServerByID(gsr.ServerID);

            string[] ids     = gsr.Arguments.Split('/');
            SteamID  steamID = GetSteamIDFromString(ids[0]);

            if (!steamID.IsValid)
            {
                return;
            }

            SteamID reportedDude = GetSteamIDFromString(ids[1]);

            if (!steamID.IsValid)
            {
                return;
            }

            Infos spGuy  = bot.GetSteamProfileInfo(steamID);
            Infos spDude = bot.GetSteamProfileInfo(reportedDude);

            if (spDude != null && spGuy != null)
            {
                string firstMsg = String.Format("{0} ({1}) reported {2} ({3}) for \"{4}\" @ {5} ({6}) !", spGuy.Name, steamID.ToString(), spDude.Name, reportedDude.ToString(), ids[2], DateTime.Now.ToString("dd/MM/yyyy"), DateTime.Now.ToString("HH:mm"));

                /*string[] data = { spGuy.Name, steamID.ToString(), spDude.Name, reportedDude.ToString(), ids[2], DateTime.Now.ToString("dd/MM/yyyy"), DateTime.Now.ToString("HH:mm") };
                 * string firstMsg = String.Format("REPORT_MSG_1", data);*/
                string secondMsg = String.Format("Name of server : {0}", gs.Name);
                string thirdMsg  = String.Format("Direct URL : steam://connect/{0}:{1}", gs.IP, gs.Port);

                foreach (SteamID steamid in bot.Friends)
                {
                    if (bot.Config.IsAdmin(steamid) || bot.Config.IsAdmin(steamid))
                    {
                        bot.SteamFriends.SendChatMessage(steamid, EChatEntryType.ChatMsg, firstMsg);
                        Thread.Sleep(100);
                        bot.SteamFriends.SendChatMessage(steamid, EChatEntryType.ChatMsg, secondMsg);
                        Thread.Sleep(100);
                        bot.SteamFriends.SendChatMessage(steamid, EChatEntryType.ChatMsg, thirdMsg);
                    }
                }
            }
            else
            {
                Program.PrintErrorMessage("One of the following steam ID is wrong !");
                Program.PrintErrorMessage("> " + ids[0]);
                Program.PrintErrorMessage("> " + ids[1]);
                Program.PrintErrorMessage("Report was denied !");
            }
        }
Пример #11
0
 public void Serialize(IDataWriter writer)
 {
     Infos.Serialize(writer);
     for (var i = 0; i < Guilds.Length; i++)
     {
         Guilds[i].Serialize(writer);
     }
     for (var i = 0; i < ControlledSubareaIds.Length; i++)
     {
         writer.WriteVarShort((Int16)ControlledSubareaIds[i]);
     }
     writer.WriteVarLong(LeaderCharacterId);
     writer.WriteUTF(LeaderCharacterName);
 }
Пример #12
0
 private void ChangeDirectory(DirectoryInfo directory)
 {
     CurrentDirectory     = directory;
     CurrentDirectoryPath = directory.ToString();
     Infos.Clear();
     foreach (var dir in CurrentDirectory.EnumerateDirectories())
     {
         Infos.Add(dir.ToInfo());
     }
     foreach (var file in CurrentDirectory.EnumerateFiles())
     {
         Infos.Add(file.ToInfo());
     }
 }
Пример #13
0
        /// <summary>
        /// Adds the specified logical name to the collection of entities that are mapped.  Entities are cached so no work is performed when an entity type is added a second time
        /// </summary>
        /// <param name="logicalName">Name of the logical.</param>
        public void Add(string logicalName)
        {
            lock (_readWriteLock)
            {
                if (Infos.ContainsKey(logicalName))
                {
                    // Already added Id type, nothing to do.
                    return;
                }

                CurrentVersion++;
                SingleThreadAdd(logicalName);
            }
        }
Пример #14
0
        /// <summary>
        /// Adds the specified logical name to the collection of entities that are mapped.  Entities are cached so no work is performed when an entity type is added a second time
        /// </summary>
        /// <param name="logicalName">Name of the logical.</param>
        public void Add(string logicalName)
        {
            lock (_readWriteLock)
            {
                if (Infos.ContainsKey(logicalName))
                {
                    // Already added Id type, nothing to do.
                    return;
                }

                CurrentVersion++;
                SingleThreadAdd(logicalName);
                DependencyOrderLog.Enqueue($"Order: {string.Join(", ", Types.Select(t => t.LogicalName))}");
            }
        }
Пример #15
0
 /// <summary>
 /// Creates an instance of the application
 /// </summary>
 /// <param name="application">owner application</param>
 /// <param name="ownerAssembly">owner assembly</param>
 public CommonUtils(ICOMObject application, Assembly ownerAssembly)
 {
     if (null == application)
     {
         throw new ArgumentNullException("application");
     }
     if (null == ownerAssembly)
     {
         throw new ArgumentNullException("ownerAssembbly");
     }
     _ownerApplication  = application;
     _ownerAssembly     = ownerAssembly;
     _headerCaptionLine = _headerCaptionLineDefault;
     _infos             = new Infos(this);
 }
Пример #16
0
        static void assertAllChunksHaveMatchingScene()
        {
#if !DEADLINE_APPROACHING
            bool ok = true;
            foreach (ChunkID c in Enum.GetValues(typeof(ChunkID)))
            {
                if (!Infos.ContainsKey(c))
                {
                    ok = false;
                    Debug.LogError("ChunkID " + c + " does NOT have a matching scene name!");
                }
            }
            Exit.If(!ok, "All ChunkIDs must have a matching scene name!");
#endif
        }
        /// <inheritdoc />
        public Type GetModelType(string?alias)
        {
            Infos infos = EnsureModels();

            // fail fast
            if (alias is null ||
                infos.ModelInfos is null ||
                !infos.ModelInfos.TryGetValue(alias, out ModelInfo? modelInfo) ||
                modelInfo.ModelType is null)
            {
                return(typeof(IPublishedElement));
            }

            return(modelInfo.ModelType);
        }
Пример #18
0
        public override void Deserialize(IDataReader reader)
        {
            Infos = ProtocolTypeManager.GetInstance <GuildFactSheetInformations>(reader.ReadUShort());
            Infos.Deserialize(reader);
            CreationDate    = reader.ReadInt();
            NbTaxCollectors = reader.ReadVarUhShort();
            var membersCount = reader.ReadUShort();

            Members = new List <CharacterMinimalInformations>();
            for (var membersIndex = 0; membersIndex < membersCount; membersIndex++)
            {
                var objectToAdd = new CharacterMinimalInformations();
                objectToAdd.Deserialize(reader);
                Members.Add(objectToAdd);
            }
        }
Пример #19
0
        /// <summary>
        /// 撈取後台 html 欄位資料
        /// </summary>
        /// <param name="_Url"></param>
        /// <returns></returns>
        public dynamic GetHtmlInfo(string _Url)
        {
            Infos infos = _context.Infos.FirstOrDefault(a => a.HtmlUrl == _Url);

            if (infos == null)
            {
                return(NotFound());
            }
            else
            {
                ViewBag.Html  = string.IsNullOrEmpty(infos.HtmlContent) ? "" : infos.HtmlContent;
                ViewBag.Title = string.IsNullOrEmpty(infos.Title) ? "" : infos.Title;
                ViewBag.id    = infos.Id;
            }
            return(true);
        }
Пример #20
0
 public override void Serialize(IDataWriter writer)
 {
     Infos.Serialize(writer);
     writer.WriteShort((short)Guilds.Count);
     foreach (var x in Guilds)
     {
         x.Serialize(writer);
     }
     writer.WriteShort((short)ControlledSubareaIds.Count);
     foreach (var x in ControlledSubareaIds)
     {
         writer.WriteVarShort(x);
     }
     writer.WriteVarUhLong(LeaderCharacterId);
     writer.WriteUTF(LeaderCharacterName);
 }
Пример #21
0
        /// <summary>
        /// 合成代码块
        /// </summary>
        public static void NowFormat()
        {
            SaveFileName = "";
            Dictionary <int, string> dictionary = ReSortDictionary(Pictures);
            Bitmap bitmap = new Bitmap(TryToInt32(TextDatas.Fglarge.Width), TryToInt32(TextDatas.Fglarge.Height));

            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                foreach (int key in dictionary.Keys)             //遍历词典依次获得图片信息并且在Graphics绘制图片。
                {
                    Infos infos = new Infos(dictionary[key]);
                    if (infos.PicInfo != null)
                    {
                        #region 合成文件名称。
                        if (string.IsNullOrEmpty(SaveFileName))
                        {
                            SaveFileName += Path.GetFileNameWithoutExtension(dictionary[key]);
                        }
                        else
                        {
                            SaveFileName = SaveFileName + "+" + GetIDFromFilePatch(dictionary[key]);
                        }
                        #endregion
                        if (TryToInt32(infos.PicInfo.Opacity) != 255)
                        {
                            graphics.DrawImage(infos.Pic,
                                               new Rectangle(TryToInt32(infos.PicInfo.Left), TryToInt32(infos.PicInfo.Top), TryToInt32(infos.PicInfo.Width), TryToInt32(infos.PicInfo.Height)),
                                               0,
                                               0,
                                               infos.Pic.Width,
                                               infos.Pic.Height,
                                               GraphicsUnit.Pixel,
                                               Picture.GetAlphaImgAttr(TryToInt32(infos.PicInfo.Opacity))
                                               );
                        }
                        else
                        {
                            graphics.DrawImage(infos.Pic,
                                               new Rectangle(TryToInt32(infos.PicInfo.Left), TryToInt32(infos.PicInfo.Top), TryToInt32(infos.PicInfo.Width), TryToInt32(infos.PicInfo.Height))
                                               );
                        }
                    }
                }
            }
            var rect = Picture.GetRectFromPictureWithouBlank(bitmap);
            NewPicture = bitmap.Clone(rect, bitmap.PixelFormat);//裁剪生成图片多余的透明像素
        }
        private void load()
        {
            var responsedhy = Unirest.get("https://skyscanner-skyscanner-flight-search-v1.p.rapidapi.com/apiservices/pricing/uk2/v1.0/%2F" + ms + "?pageIndex=0&pageSize=10")
                              .header("X-RapidAPI-Key", "107dc24922mshbd9bd597451997fp19a55fjsnc869fe1003a4")
                              .asJson <string>();



            res = JsonConvert.DeserializeObject <Info>(responsedhy.Body);

            Console.WriteLine(res.Itineraries[0].PricingOptions[0].Price);

            int ag = res.Itineraries[0].PricingOptions[0].Agents[0];

            foreach (var item in res.Itineraries)
            {
                Useful newo = new Useful();
                Itineraries.Add(item);
                newo.Price         = $"{item.PricingOptions[0].Price}$";
                newo.OutboundLegId = item.OutboundLegId;

                var value  = res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).OriginStation;
                var value2 = res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).DestinationStation;
                newo.Duration = $"{ res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).Duration / 60}h { res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).Duration%60} ";
                newo.Deals    = $"{item.PricingOptions.Count}  deals";
                var photo = res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).Carriers[0];
                newo.Photo = res.Carriers.First(itemm => itemm.Id == photo).ImageUrl;
                if (res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).SegmentIds.Count == 2)
                {
                    newo.Mode = "Direct";
                }
                else
                {
                    newo.Mode = $"{(res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).SegmentIds.Count - 2).ToString()} stop";
                }

                newo.Departuretime = res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).Departure.Split('T').Last();;
                newo.Departuredate = res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).Departure.Split('T').First();;
                newo.Arrival       = res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).Arrival.Split('T').Last();
                newo.ArrivalDate   = res.Legs.First(itemm => itemm.Id == newo.OutboundLegId).Arrival.Split('T').First();
                newo.OriginPlace   = res.Places.First(itemm => itemm.Id == value).Code;
                newo.DestPlace     = res.Places.First(itemm => itemm.Id == value2).Code;
                newo.Destcity      = res.Places.First(itemm => itemm.Id == value2).Name;
                Application.Current.Dispatcher.Invoke(new Action(() => { Infos.Add(newo); }));
                //Infos.Add(newo);
            }
        }
Пример #23
0
        /// <summary>
        /// 处理单次输入
        /// </summary>
        /// <param name="input"></param>
        private void ProcessUnit(string input)
        {
            string time = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");

            Infos.Filter(input);
            if (this.IsShown)
            {
                this.textBox_Input.SafeInvoke(() => this.textBox_Input.Text = input);
                this.textBox_Info.SafeInvoke(() =>
                {
                    this.textBox_Info.Text = string.Format(@"{0} 至 {1:yyyy-MM-dd HH:mm:ss.fff} ==>
数据列表长度:{2}
集群或目标数量:{3}
实际数量:{4}", time, DateTime.Now, this.Infos.ListTriggerCount, this.Infos.BufferSize, this.Infos.ActualSize);
                });
            }
        }
Пример #24
0
        public static string GetCountryCode(Infos sp)
        {
            try
            {
                if (sp == null)
                {
                    return("en");
                }
                else
                {
                    string country = sp.Location.Substring(sp.Location.LastIndexOf(" ") + 1);
                    country = RemoveBetween(country.Split(' ')[0], '(', ')').Trim();

                    var        regions       = CultureInfo.GetCultures(CultureTypes.SpecificCultures).Select(x => new RegionInfo(x.LCID));
                    RegionInfo englishRegion = regions.FirstOrDefault(region => region.EnglishName.Contains(country));

                    if (englishRegion == null)
                    {
                        Console.WriteLine("Country \"" + country + "\" not found !");
                        return("en");
                    }
                    else
                    {
                        return(englishRegion.TwoLetterISORegionName.ToLower());
                    }
                }
            }
            catch (Exception e)
            {
                Program.PrintErrorMessage("Error while fetching country code. Assumed 'en'. Details here : ");
                if (sp.Location == null)
                {
                    Program.PrintErrorMessage("Location null !");
                }
                else
                {
                    Program.PrintErrorMessage("Faulty country >>> " + sp.Location.Substring(sp.Location.LastIndexOf(" ") + 1));
                }

                Program.PrintErrorMessage("Send to Arkarr please!");

                Program.PrintErrorMessage(e.ToString());

                return("en");
            }
        }
Пример #25
0
        //巴黎協定
        public IActionResult Pact2()
        {
            string _url  = Url.Action().ToString();
            Infos  infos = _context.Infos.FirstOrDefault(a => a.HtmlUrl == _url);

            if (infos == null)
            {
                return(NotFound());
            }
            else
            {
                ViewBag.html  = string.IsNullOrEmpty(infos.HtmlContent) ? "" : infos.HtmlContent;
                ViewBag.Title = string.IsNullOrEmpty(infos.Title) ? "" : infos.Title;
                ViewBag.id    = infos.Id;
            }
            return(View());
        }
Пример #26
0
        public void Set_GPU_Infos()
        {
            ManagementObjectSearcher GPU = Infos.GPU_Infos();


            foreach (ManagementObject Info in GPU.Get())
            {
                int    GPU_RAM_Size       = (int)Convert.ToInt64(Info["AdapterRAM"]);
                string GPU_RAM_Size_In_GB = Calc.BytesTo_KMG((ulong)Convert.ToInt64(Info["AdapterRAM"]), "GB");

                GPU_LBL.Text = $"Name : {Info["Name"]} \n\n" +
                               $"Processor : {Info["VideoProcessor"]} \n\n" +
                               $"RAM : {GPU_RAM_Size_In_GB} \n\n" +
                               $"Driver Version : {Info["DriverVersion"]} \n\n" +
                               $"Status : {Info["Status"]}";
            }
        }
Пример #27
0
        public static void PerformDatabaseOperations(double batteryPower, double panelPower, double consumersPower, double utilityMoney)
        {
            using (var db = new InfosDbContext())
            {
                var info = new Infos
                {
                    BatteryPower   = batteryPower,
                    PanelPower     = panelPower,
                    ConsumersPower = consumersPower,
                    UtilityMoney   = utilityMoney,
                    Time           = DateTime.Now
                };

                db.Infos.Add(info);
                db.SaveChanges();
            }
        }
Пример #28
0
        public DBPropertyConvertInfo FindBaseInfo(Type _type)
        {
            var result = Infos.Find((v) => { return(v.BaseType.Equals(_type)); });

            if (result != null)
            {
                return(result);
            }
            else if (_type.IsEnum && false == _type.IsArray)
            {
                result = new DBPropertyConvertInfo(_type, null, new DBDataEnum(_type), ObjectTo);
                Infos.Add(result);
                return(result);
            }

            return(null);
        }
Пример #29
0
    void Start()
    {
        hm = GameObject.Find("HexagonManager").GetComponent <HexagonManager>();

        Debug.Log(hm.Towns.Count);
        Group group = hm.Towns[Random.Range(0, hm.Towns.Count)];

        while (group.Buildings.Count < 3)
        {
            group = hm.Towns[Random.Range(0, hm.Towns.Count)];
        }
        GameObject city  = group.Buildings[Random.Range(0, group.Buildings.Count)];
        Infos      infos = city.GetComponent <Infos>();

        Camera.main.gameObject.GetComponent <CameraManager>().ZoomOnHexagon(city.GetComponent <Hexagon>());
        infectedTiles.Add(infos);
    }
Пример #30
0
        private void GenerateExceptions()
        {
            foreach (BuildInformation info in Aggregator.Informations.Values)
            {
                ExceptionInformation exception;
                if (Infos.ContainsKey(info.Name))
                {
                    exception = Infos[info.Name];
                    Generate(info.Name, exception);

                    if (info.Name == ComponentType.Core.ToString())
                    {
                        exception = Infos["BaseException"];
                        Generate(info.Name, exception);
                    }
                }
            }
        }
Пример #31
0
        public static PassiveSpell GetActivePassive(Mobile m)
        {
            if (m == null || m.Skills == null || Infos == null)
            {
                return(PassiveSpell.None);
            }

            SkillName mastery = m.Skills.CurrentMastery;

            MasteryInfo info = Infos.FirstOrDefault(i => i.Passive && i.MasterySkill == mastery && i.PassiveSpell != PassiveSpell.AnticipateHit);

            if (info != null)
            {
                return(info.PassiveSpell);
            }

            return(PassiveSpell.None);
        }
Пример #32
0
 void printInfos(string desc, Infos infos)
 {
     Log.n("{0}", desc);
     foreach (var info in infos.getInfos())
         printOptionAndExplanation(info.name, info.desc);
 }