コード例 #1
0
        private void btnStart_click(object sender, RoutedEventArgs e)
        {
            if (!CheckInput())
            {
                return;
            }

            var sb = new StringBuilder();

            sb.Append("threshold".ElementText(txtthreshold.Text));
            sb.Append("rtspId".ElementText(txtrtspId.Text));
            sb.Append("rtspPath".ElementImage(txtrtsp.Text));
            sb.Append("responseType".ElementBegin());

            var messageType = ((ComboBoxItem)cmbMessageType.SelectedItem).Content.ToString();

            if (messageType == callback)
            {
                sb.Append("type".ElementText("callback"));
            }
            else
            {
                sb.Append("type".ElementText("messageQueue"));
            }

            sb.Append("size".ElementText(txtsize.Text));
            sb.Append("responseType".ElementEnd());
            sb.Append("maxImageCount".ElementText("3"));
            sb.Append("frames".ElementText(txtframe.Text));
            var data    = sb.ToString();
            var xml     = XmlParse.GetXml("dynamicDetect", data);
            var content = FaceServices.FaceProxy.send(xml);

            if (content.IsEmpty())
            {
                WarnDialog(community_error);
                return;
            }
            var doc  = XmlParse.LoadXml(content);
            var code = doc.GetNodeText("code");

            Item("code->" + code);
            if (code.ToInt32() == status_ok)
            {
                if (messageType == callback)
                {
                    Setcallback();
                }
                else
                {
                    stopPool = false;
                    Loopquery();
                }
                btnStart.IsEnabled = false;
            }
            else
            {
                CustomDialog.Show("操作返回错误!");
            }
        }
コード例 #2
0
            public void PaserServerError(Stream inputStream, string contentType, long contentLength)
            {
                CosServerException cosServerException = new CosServerException(cosResult.httpCode, cosResult.httpMessage);
                List <string>      values;

                Headers.TryGetValue("x-cos-request-id", out values);
                cosServerException.requestId = (values != null && values.Count > 0) ? values[0] : null;
                Headers.TryGetValue("x-cos-trace-id", out values);
                cosServerException.traceId = (values != null && values.Count > 0) ? values[0] : null;
                if (inputStream != null && contentLength > 0)
                {
                    CosServerError cosServerError = new CosServerError();
                    try
                    {
                        XmlParse.ParseCosError(inputStream, cosServerError);
                        if (cosServerException.requestId != null)
                        {
                            cosServerException.requestId = cosServerError.requestId;
                        }
                        if (cosServerException.traceId != null)
                        {
                            cosServerException.traceId = cosServerError.traceId;
                        }
                        cosServerException.resource     = cosServerError.resource;
                        cosServerException.errorCode    = cosServerError.code;
                        cosServerException.errorMessage = cosServerError.message;
                    }
                    catch (Exception ex)
                    {
                        QLog.D(TAG, ex.Message);
                    }
                }
                throw cosServerException;
            }
コード例 #3
0
        public async Task <IActionResult> SendFile(IFormFile file)
        {
            List <Unit> units = new List <Unit>();

            if (file != null)
            {
                var      dateStr             = DateTime.Now.ToString().Replace(".", "").Replace(" ", "").Replace(":", "");
                string[] permittedextensions = { ".xml" };
                string   path = "/Files/" + dateStr + file.FileName;
                var      ext  = Path.GetExtension(path);
                if (!permittedextensions.Contains(ext))
                {
                    return(RedirectToAction("Error"));
                }
                using (var fileStream = new FileStream(_appEnvironment.WebRootPath + path, FileMode.Create))
                {
                    await file.CopyToAsync(fileStream);
                }
                units = XmlParse.Parse(_appEnvironment.WebRootPath + path);
            }
            List <string> Titles = new List <string>();

            foreach (var t in units)
            {
                Titles.Add(t.Title);
            }
            ViewBag.Units  = units;
            ViewBag.Titles = units.Select(x => new SelectListItem
            {
                Value = x.Id.ToString(),
                Text  = x.Title
            }).ToList();
            return(View());
        }
コード例 #4
0
ファイル: CutPicture.cs プロジェクト: zeroAone/hadunlike
        /// <summary>
        /// 切割按钮点击事件处理
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void cut_Click(object sender, EventArgs e)
        {
            XmlParse  xml  = new XmlParse();
            ArrayList list = xml.readAll(sPath1 + "/test.xml");

            foreach (Title t in list)
            {
                //获取编号
                string number = t.Number;
                //获取上限
                string up    = t.Up;
                double upInt = double.Parse(up);

                //获取下限
                string down    = t.Down;
                double downInt = double.Parse(down);


                //进行计算
                upInt   = upInt * oldImage.Height;
                downInt = downInt * oldImage.Height;
                MessageBox.Show(upInt.ToString() + "   " + downInt.ToString());
                string info = ImageUtils.cutImage(cutPath, 0, (int)upInt, oldImage.Width, (int)(downInt - upInt), "题号_" + number, sPath);

                Graphics g = Graphics.FromImage(show_pic.Image);
                g.Clear(Color.White);
                g.Dispose();
                show_pic.Refresh();
                Console.WriteLine("保存信息:" + info);
                skinButton1.Visible = true;
                show_pic.Enabled    = false;
            }
        }
コード例 #5
0
        private void queryPersons()
        {
            var sb = new StringBuilder();

            sb.Append("id".ElementText(txt1.Text));
            sb.Append("uuid".ElementText(txt2.Text));
            sb.Append("code".ElementText(txt3.Text));

            sb.Append("tags".ElementBegin());
            var tags = GetSelectedTags();

            foreach (var tag in tags)
            {
                sb.Append("tag".ElementText(tag));
            }
            sb.Append("tags".ElementEnd());

            sb.Append("offset".ElementText(offset.ToString()));
            sb.Append("size".ElementText(pagesize.ToString()));
            var data = sb.ToString();

            var xml = XmlParse.GetXml("queryPersons", data);

            Stopwatch sw      = Stopwatch.StartNew();
            var       content = FaceServices.FaceProxy.send(xml);

            sw.Stop();
            lbltime.Content = sw.ElapsedMilliseconds;
            if (content.IsEmpty())
            {
                WarnDialog(community_error);
                return;
            }
            ShowQueryResult(content);
        }
コード例 #6
0
ファイル: CutPicture.cs プロジェクト: zeroAone/hadunlike
        private void save_data_Click(object sender, EventArgs e)
        {
            bool insert = false;

            imagesHeigt = convert.getImageHeigt();
            XmlParse xml = new XmlParse();

            foreach (ImageHeigt imageH in imagesHeigt)
            {
                MessageBox.Show(imagesHeigt.Count().ToString());
                insert = xml.insertNode(sPath1 + "/" + newImageName[0] + ".xml", imageH.Title, imageH.StartHeigt.ToString(), imageH.EndHeigt.ToString());
            }

            if (insert)
            {
                MessageBox.Show("添加成功", "提示");
            }
            if (!insert)
            {
                MessageBox.Show("添加失败", "提示");
            }
            //显示下一个
            skinLabel6.Visible = true;
            cut.Visible        = true;
            comboBox1.Items.Add(sPath1 + "/" + newImageName[0] + ".xml");
            comboBox1.Refresh();
        }
コード例 #7
0
        private void ShowQueryResult(string content)
        {
            var doc = XmlParse.LoadXml(content);

            var code       = doc.GetNodeText("code");
            var totalCount = doc.GetNodeText("totalCount");

            Item("code->" + code);
            Item("totalCount->" + totalCount);
            lblpersoncount.Content = totalCount;
            var personNodes = doc.SelectNodes("/xml/persons/person");

            List <PersonInfo> persons = new List <PersonInfo>();

            foreach (XmlNode n in personNodes)
            {
                var p = new PersonInfo();
                p.faceId            = n.SelectSingleNode("faceId").InnerText;
                p.uuid              = n.SelectSingleNode("uuid").InnerText;
                p.code              = n.SelectSingleNode("code").InnerText;
                p.Name              = n.SelectSingleNode("name").InnerText;
                p.Description       = n.SelectSingleNode("description").InnerText;
                p.FaceImage1        = n.SelectSingleNode("imgData1").InnerText;
                p.HasSignatureCode1 = n.SelectSingleNode("hasSignatureCode1").InnerText.ToInt32() == 1;
                p.FaceImage2        = n.SelectSingleNode("imgData2").InnerText;
                p.HasSignatureCode2 = n.SelectSingleNode("hasSignatureCode2").InnerText.ToInt32() == 1;
                p.FaceImage3        = n.SelectSingleNode("imgData3").InnerText;
                p.HasSignatureCode3 = n.SelectSingleNode("hasSignatureCode3").InnerText.ToInt32() == 1;

                persons.Add(p);
            }

            dgPersons.ItemsSource = persons;
        }
コード例 #8
0
        private void delete()
        {
            var sb = new StringBuilder();

            sb.Append("tags".ElementBegin());
            foreach (var tag in delTags)
            {
                sb.Append("tag".ElementText(tag));
            }
            sb.Append("tags".ElementEnd());
            var data = sb.ToString();

            var xml     = XmlParse.GetXml("deletePersonsByTags", data);
            var content = FaceServices.FaceProxy.send(xml);

            if (content.IsEmpty())
            {
                return;
            }
            var doc         = XmlParse.LoadXml(content);
            var code        = doc.GetNodeText("code");
            var affectCount = doc.GetNodeText("affectCount");

            Item("code->" + code);
            Item("affectCount->" + affectCount);
            TipDialog("删除记录数->" + affectCount);
        }
コード例 #9
0
        public async IAsyncEnumerable <object[]> GetResponseMessage(string liveId)
        {
            yield return(new object[] { await _connect.SetLiveStatus(liveId) });

            await foreach (var response in _connect.ConnectLive())
            {
                var  comment  = XmlParse.parseCommentXml(response, NicoString.USER_CHAT);
                var  userId   = XmlParse.parseUserIdXml(response);
                var  userName = userId;
                int  id;
                bool isNot184 = int.TryParse(userId, out id);
                var  userIcon = new Uri(DirectoryPaths.UserDefaultIconPath, UriKind.Relative);
                if (isNot184)
                {
                    userName = await _connect.ExstractUserName(id);

                    if (await _connect.ExstractUserIcon(id))
                    {
                        userIcon = new Uri(ApiURL.USER_ICON_URL(id));
                    }
                }


                if (comment.NotEmpty() && userId.NotEmpty())
                {
                    yield return new object[] { userIcon, userName, comment, userId }
                }
                ;
            }
        }
コード例 #10
0
            public void PaserServerError(Stream inputStream, string contentType, long contentLength)
            {
                CosServerException cosServerException = new CosServerException(cosResult.httpCode, cosResult.httpMessage);
                List <string>      values;

                Headers.TryGetValue("x-cos-request-id", out values);
                cosServerException.requestId = (values != null && values.Count > 0) ? values[0] : null;
                Headers.TryGetValue("x-cos-trace-id", out values);
                cosServerException.traceId = (values != null && values.Count > 0) ? values[0] : null;

                if (inputStream != null)
                {
                    try
                    {
                        CosServerError cosServerError = XmlParse.Deserialize <CosServerError>(inputStream);

                        cosServerException.SetCosServerError(cosServerError);
                    }
                    catch (Exception ex)
                    {
                        QLog.Debug(TAG, ex.Message);
                    }
                }

                throw cosServerException;
            }
コード例 #11
0
        private void Compare(string imagebaseA, string imagebaseB, ref string similarity, ref long elapsemillseconds)
        {
            var sb = new StringBuilder();

            sb.Append("srcImgData".ElementImage(imagebaseA));
            sb.Append("destImgData".ElementImage(imagebaseB));
            var       sendxml = XmlParse.GetXml("compare", sb.ToString());
            Stopwatch sw      = Stopwatch.StartNew();
            var       content = IceApp.facePxy.send(sendxml);

            sw.Stop();
            elapsemillseconds = sw.ElapsedMilliseconds;

            if (content.IsEmpty())
            {
                return;
            }
            var doc  = XmlParse.LoadXml(content);
            var code = doc.GetNodeText("code");

            if (code.ToInt32() != status_ok)
            {
                return;
            }
            similarity = doc.GetNodeText("similarity");
            sb.Clear();
        }
コード例 #12
0
        private string GetImageFeature(string imagefile)
        {
            var buffer      = imagefile.FileToByte();
            var base64Image = buffer.ToBase64();

            var sb = new StringBuilder();

            sb.Append("imgData".ElementImage(base64Image));
            var data = sb.ToString();

            var       xml     = XmlParse.GetXml("convertSignatureCode", data);
            Stopwatch sw      = Stopwatch.StartNew();
            var       content = FaceServices.FaceProxy.send(xml);

            sw.Stop();
            if (content.IsEmpty())
            {
                WarnDialog(community_error);
                return(string.Empty);
            }

            var doc           = XmlParse.LoadXml(content);
            var code          = doc.GetNodeText("code");
            var signatureCode = doc.GetNodeText("signatureCode");

            return(signatureCode);
        }
コード例 #13
0
 internal override void ParseResponseBody(Stream inputStream, string contentType, long contentLength)
 {
     if (contentLength != 0)
     {
         _data = XmlParse.Deserialize <T>(inputStream);
     }
 }
コード例 #14
0
        public void testParse()
        {
            string content = "<ListAllMyBucketsResult>"
                             + "<Owner>"
                             + " <ID>qcs::cam::uin/1147518609:uin/1147518609</ID>"
                             + "<DisplayName>1147518609</DisplayName>"
                             + " </Owner>"
                             + "<Buckets>"
                             + "<Bucket>"
                             + "<Name>01</Name>"
                             + "<Location>ap-beijing</Location>"
                             + "<CreateDate>2016-09-13 15:20:15</CreateDate>"
                             + "</Bucket>"
                             + "<Bucket>"
                             + "<Name>0111</Name>"
                             + "<Location>ap-hongkong</Location>"
                             + "<CreateDate>2017-01-11 17:23:51</CreateDate>"
                             + "</Bucket>"
                             + "<Bucket>"
                             + "<Name>1201new</Name>"
                             + "<Location>eu-frankfurt</Location>"
                             + "<CreateDate>2016-12-01 09:45:02</CreateDate>"
                             + "</Bucket>"
                             + "</Buckets>"
                             + "</ListAllMyBucketsResult>";

            byte[]           bytes        = Encoding.ASCII.GetBytes(content);
            MemoryStream     memoryStream = new MemoryStream(bytes);
            ListAllMyBuckets result       = new ListAllMyBuckets();

            XmlParse.ParseListAllMyBucketsResult(memoryStream, result);
            Assert.AreEqual("qcs::cam::uin/1147518609:uin/1147518609", result.owner.id);
            Assert.AreEqual(3, result.buckets.Count);
        }
コード例 #15
0
        public async Task <string> ExstractUserName(int userId)
        {
            var response = await _connectionLogic.GetUserName(userId);

            var xmlStr = await response.Content.ReadAsStringAsync();

            return(XmlParse.parseXml(xmlStr, NicoString.USER_NICKNAME));
        }
コード例 #16
0
        public async Task 放送chat(int expected, string key)
        {
            var response = await logic.SetLiveStatus("lv328021115");

            var result = XmlParse.parseXml(response, key);

            TestContext.WriteLine(result);
        }
コード例 #17
0
 private void Form1_Load(object sender, EventArgs e)
 {
     XmlParse.ReadProducts();
     MealFunc.DefaultMeals();
     ProductFunc.PopulateTree(treeView1);
     MealFunc.PopulateMealTree(treeView2);
     UpdateCalories();
 }
コード例 #18
0
        public IActionResult Post([FromBody] string taskXML)
        {
            ITask task = XmlParse.GetHomework(taskXML);

            data.Add(task);
            DBProvider.Insert(task.Name, task.Description, task.IsDone.ToString());
            return(Ok(taskXML));
        }
コード例 #19
0
        /// <summary>
        /// 対象の配信情報を取得し、文字列として格納します
        /// </summary>
        /// <param name="liveId"> Lv** から始まるライブID </param>
        public async Task <string> SetLiveStatus(string liveId)
        {
            var response = await _connectionLogic.GetLiveStatus(liveId);

            this.responseMessage = await response.Content.ReadAsStringAsync();

            return(XmlParse.parseXml(responseMessage, XmlKeys.COMMUNITY_NUM));;
        }
コード例 #20
0
 internal override void ParseResponseBody(System.IO.Stream inputStream, string contentType, long contentLength)
 {
     if (contentLength <= 0)
     {
         return;
     }
     postResponse = new PostResponse();
     XmlParse.ParsePostResponse(inputStream, postResponse);
 }
コード例 #21
0
        private void LoadMedia()//载入数据
        {
            XmlParse _xmlparse = new XmlParse(ExtendUtils.XML_PATH + "text1.xml");

            for (int i = 0; i < _BlockList.Count; i++)
            {
                _BlockList[i].InFo = _xmlparse.Mlist[i % _xmlparse.Mlist.Count];
            }
        }
コード例 #22
0
        private void SetWeaponData(XElement weaponElement, UnitWeapon weapon)
        {
            // parent lookup
            string?parentValue = weaponElement.Attribute("parent")?.Value;

            if (!string.IsNullOrEmpty(parentValue))
            {
                XElement?parentElement = GameData.MergeXmlElements(_gameData.Elements(weaponElement.Name.LocalName).Where(x => x.Attribute("id")?.Value == parentValue));
                if (parentElement != null)
                {
                    SetWeaponData(parentElement, weapon);
                }
            }

            if (weapon == null)
            {
                return;
            }

            // loop through all elements and set found elements
            foreach (XElement element in weaponElement.Elements())
            {
                string elementName = element.Name.LocalName.ToUpperInvariant();

                if (elementName == "RANGE")
                {
                    weapon.Range = XmlParse.GetDoubleValue(weapon.WeaponNameId, element, _gameData);
                }
                else if (elementName == "PERIOD")
                {
                    weapon.Period = XmlParse.GetDoubleValue(weapon.WeaponNameId, element, _gameData);
                }
                else if (elementName == "DISPLAYEFFECT")
                {
                    string?displayEffectElementValue = element.Attribute("value")?.Value;
                    if (!string.IsNullOrEmpty(displayEffectElementValue))
                    {
                        XElement?effectDamageElement = GameData.MergeXmlElements(_gameData.Elements("CEffectDamage").Where(x => x.Attribute("id")?.Value == displayEffectElementValue));
                        if (effectDamageElement != null)
                        {
                            WeaponAddEffectDamage(effectDamageElement, weapon);
                        }
                    }
                }
                else if (elementName == "OPTIONS")
                {
                    string?indexValue = element.Attribute("index")?.Value;
                    string?value      = element.Attribute("value")?.Value;
                    if (IsHeroParsing && !string.IsNullOrEmpty(indexValue) && !string.IsNullOrEmpty(value) && indexValue.Equals("disabled", StringComparison.OrdinalIgnoreCase) && value == "1")
                    {
                        weapon.WeaponNameId = string.Empty;
                        return;
                    }
                }
            }
        }
コード例 #23
0
ファイル: Form2.cs プロジェクト: zeroAone/hadunlike
        private void button1_Click(object sender, EventArgs e)
        {
            XmlParse xml  = new XmlParse();
            bool     flag = xml.createXmlFile("H://test.xml");

            if (flag)
            {
                MessageBox.Show("保存成功", "提示");
            }
        }
コード例 #24
0
        private async static Task <string[]> GetMylistId(string userId)
        {
            using (var client = HttpClientBuilder.NewHttpClient())
            {
                var response = await client.GetAsync(ApiURL.GET_USER_MYLIST(userId));

                string[] mylistInfo = XmlParse.ParseMylistXml(await response.Content.ReadAsStringAsync());
                return(mylistInfo);
            }
        }
コード例 #25
0
        private void send()
        {
            var buffer1 = imageFile1.FileToByte();
            var image1  = Convert.ToBase64String(buffer1);

            var buffer2 = imageFile2.FileToByte();
            var image2  = Convert.ToBase64String(buffer2);

            var buffer3 = imageFile3.FileToByte();
            var image3  = Convert.ToBase64String(buffer3);

            var sb = new StringBuilder();

            sb.Append("uuid".ElementText(txtuuid.Text));
            sb.Append("code".ElementText(txtCode.Text));
            sb.Append("name".ElementText(txtName.Text));
            sb.Append("description".ElementImage("description"));
            sb.Append("imgData1".ElementImage(image1));
            sb.Append("signatureCode1".ElementImage(image1));
            sb.Append("imgData2".ElementImage(image2));
            sb.Append("signatureCode2".ElementImage(image2));
            sb.Append("imgData3".ElementImage(image3));
            sb.Append("signatureCode3".ElementImage(image3));
            sb.Append("tags".ElementBegin());
            foreach (var tagContent in tagList)
            {
                sb.Append("tag".ElementText(tagContent));
            }
            sb.Append("tags".ElementEnd());
            var data = sb.ToString();

            var size = ToKB(data);

            LogHelper.Info("数据包->" + size);

            var xml     = XmlParse.GetXml("createOrUpdatePerson", data);
            var content = FaceServices.FaceProxy.send(xml);

            if (content.IsEmpty())
            {
                WarnDialog(community_error);
                return;
            }
            //处理返回数据
            var doc    = XmlParse.LoadXml(content);
            var code   = doc.GetNodeText("code");
            var faceId = doc.GetNodeText("faceId");

            Item("code->" + code);
            Item("faceId->" + faceId);
            if (code.ToInt32() == status_ok)
            {
                MessageBox.Show("保存成功=" + faceId);
            }
        }
コード例 #26
0
ファイル: CutPicture.cs プロジェクト: zeroAone/hadunlike
        /// <summary>
        /// 创建xml文件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void creat_xml_Click(object sender, EventArgs e)
        {
            XmlParse xml  = new XmlParse();
            bool     flag = xml.createXmlFile(sPath1 + "/" + newImageName[0] + ".xml");

            if (flag)
            {
                MessageBox.Show("保存成功", "提示");
            }
            //显示下一个
            skinLabel5.Visible = true;
            save_data.Visible  = true;
        }
コード例 #27
0
        public BitmapImage GetVideoSamune()
        {
            var url = XmlParse.ParseXmlToImageURL(_responseMessage);

            BitmapImage bitmapImage = null;

            try
            {
                bitmapImage = new BitmapImage(new Uri(url));
            }
            catch (Exception)
            {
            }

            return(bitmapImage);
        }
コード例 #28
0
        private void DetectFace(string filepath, string cardfile)
        {
            var filename    = Tools.GetFileName(filepath);
            var base64Image = filepath.FileToBase64();
            var sb          = new StringBuilder();

            sb.Append("imgData".ElementImage(base64Image));
            sb.Append("threshold".ElementText(threshold));
            sb.Append("maxImageCount".ElementText(facemax));
            var xmlcontent = sb.ToString();

            var       sendxml = XmlParse.GetXml("staticDetect", xmlcontent);
            Stopwatch sw      = Stopwatch.StartNew();
            var       content = IceApp.facePxy.send(sendxml);

            sw.Stop();

            if (content.IsEmpty())
            {
                return;
            }
            var facecount = 0;
            var doc       = XmlParse.LoadXml(content);
            var code      = doc.GetNodeText("code");

            if (code.ToInt32() != status_ok)
            {
                var data = string.Format(detect_logtemplate, filename, facecount, sw.ElapsedMilliseconds, "0.00f");
                log.Info(data);
                return;
            }
            var persons = doc.SelectNodes("/xml/persons/person");

            facecount = persons.Count;

            List <string> logs           = new List <string>();
            var           bestSimilarity = CompareFaces(persons, filename, cardfile, logs);
            //检测日志
            var temp = string.Format(detect_logtemplate, filename, facecount, sw.ElapsedMilliseconds, bestSimilarity);

            log.Info(temp);

            foreach (var facecomparelog in logs)
            {
                log.Info(facecomparelog);
            }
        }
コード例 #29
0
        private void WeaponAddEffectDamage(XElement effectDamageElement, UnitWeapon weapon)
        {
            // parent lookup
            string?parentValue = effectDamageElement.Attribute("parent")?.Value;

            if (!string.IsNullOrEmpty(parentValue))
            {
                XElement?parentElement = GameData.MergeXmlElements(_gameData.Elements("CEffectDamage").Where(x => x.Attribute("id")?.Value == parentValue));
                if (parentElement != null)
                {
                    WeaponAddEffectDamage(parentElement, weapon);
                }
            }

            foreach (XElement element in effectDamageElement.Elements())
            {
                string elementName = element.Name.LocalName.ToUpperInvariant();

                if (elementName == "AMOUNT")
                {
                    weapon.Damage = XmlParse.GetDoubleValue(weapon.WeaponNameId, element, _gameData);
                }
                else if (elementName == "ATTRIBUTEFACTOR")
                {
                    string?index = element.Attribute("index")?.Value;
                    string?value = element.Attribute("value")?.Value;

                    WeaponAttributeFactor attributeFactor = new WeaponAttributeFactor();

                    if (!string.IsNullOrEmpty(index) && !string.IsNullOrEmpty(value))
                    {
                        attributeFactor.Type  = index;
                        attributeFactor.Value = XmlParse.GetDoubleValue(weapon.WeaponNameId, element, _gameData);

                        weapon.AttributeFactors.Add(attributeFactor);
                    }
                }
            }

            double?scaleValue = _gameData.GetScaleValue(("Effect", effectDamageElement.Attribute("id")?.Value ?? string.Empty, "Amount"));

            if (scaleValue.HasValue)
            {
                weapon.DamageScaling = scaleValue.Value;
            }
        }
コード例 #30
0
        public async IAsyncEnumerable <string> ConnectLive()
        {
            string addr   = XmlParse.parseXml(responseMessage, XmlKeys.ADDR);
            string port   = XmlParse.parseXml(responseMessage, XmlKeys.PORT);
            string thread = XmlParse.parseXml(responseMessage, XmlKeys.THREAD);

            if (addr.NotEmpty() && port.NotEmpty() && thread.NotEmpty())
            {
                IAsyncEnumerable <string> stream = _connectionLogic.ConnectLive(thread, addr, port);
                var first = await stream.FirstAsync();

                await foreach (var response in stream.Skip(1))
                {
                    yield return(response);
                }
            }
        }