Exemplo n.º 1
0
        private void getNewChapter(object sender, System.EventArgs e)
        {
            lock (lockObj) {
                //获取更新的书籍信息
                List <Book> bookList = ReadXml.GetBooksData();

                //遍历每一本书籍
                foreach (Book book in bookList)
                {
                    //起点最新章节
                    Chapter newChapter = getCatalog(book.Id);

                    //本地存储的最新章节
                    Chapter latestChapter = readLatestChapter(book.Code);

                    //如果起点的最新章节发布时间要大于本地的最新章节发布时间,说明已更新
                    if (latestChapter == null || DateTime.Parse(newChapter.ChapterTime) > DateTime.Parse(latestChapter.ChapterTime))
                    {
                        foreach (Group g in book.Group)
                        {
                            CQApi.SendGroupMessage(long.Parse(g.GroupNo), (g.IsAtAll ? CQApi.CQCode_AtAll().ToSendString() + "\n" : string.Empty) + (g.IsSendImage ? CQApi.CQCode_Image(g.ImageName).ToSendString() + "\n" : string.Empty) + "最新章节:\"" + newChapter.ChapterName + "\" \n发布时间:" + newChapter.ChapterTime + " \n本章字数:" + newChapter.WordNumber);
                        }
                        //把最新章节信息写入本地
                        writeLatestChapter(newChapter, book.Code);
                    }

                    //本次获取的最新章节名称
                    LogHelper.WriteMsgInLog("书名:" + book.Name + ",章节名称:" + newChapter.ChapterName, book.Code);
                }
            }
        }
        private DataGridViewRow AddAPkgFlagsRow(string RepoName, string XmlData)
        {
            DataGridViewCheckBoxCell Buildi586 = new DataGridViewCheckBoxCell(true), Publishi586 = new DataGridViewCheckBoxCell(true),
                                     Build64 = new DataGridViewCheckBoxCell(true), Publish64 = new DataGridViewCheckBoxCell(true);
            DataGridViewTextBoxCell RepoCell = new DataGridViewTextBoxCell();

            RepoCell.Value       = RepoName;
            RepoCell.ToolTipText = RepoName;

            Buildi586.Value   = ReadXml.GetChkState(XmlData, "package", "build", RepoName, "i586");
            Build64.Value     = ReadXml.GetChkState(XmlData, "package", "build", RepoName, "x86_64");
            Publishi586.Value = ReadXml.GetChkState(XmlData, "package", "publish", RepoName, "i586");
            Publish64.Value   = ReadXml.GetChkState(XmlData, "package", "publish", RepoName, "x86_64");
            Buildi586.Tag     = "i586";
            Build64.Tag       = "x86_64";
            Publishi586.Tag   = "i586";
            Publish64.Tag     = "x86_64";
            ChangeChkColor(ref Buildi586, RepoName, false, string.Empty);
            ChangeChkColor(ref Build64, RepoName, false, string.Empty);
            ChangeChkColor(ref Publishi586, RepoName, false, string.Empty);
            ChangeChkColor(ref Publish64, RepoName, false, string.Empty);
            DataGridViewRow TheRow = new DataGridViewRow();

            TheRow.Cells.AddRange(RepoCell, Buildi586, Publishi586, Build64, Publish64);
            return(TheRow);
        }
Exemplo n.º 3
0
        public void TestBigXml()
        {
            Stopwatch sw = new Stopwatch();

            sw.Start();
            ReadXml r = new ReadXml
            {
                StringPath = @"C:\Users\dor\source\repos\xmlTest\XmlParser\test2.xml"
            };

            XmlParser parser = new AdvancedXmlParser
            {
                Document = r.ReadFile(),

                ParserConfig = new Config
                {
                    Paths = new List <string>(new string[] { "rows/head", "rows", "rows/head/property", "bla", "rows/row" }),
                }
            };

            parser.ParseData(LoggerType.DEBUG);
            sw.Stop();
            using (parser.Log = LoggerFactory.GetLogger(LoggerType.DEBUG))
            {
                parser.Log.LogMessage("Time total: " + sw.Elapsed);
            }
            Assert.IsTrue(sw.Elapsed.TotalSeconds < 1, String.Format("Took more than a second {0} for 1000 line XML, not good enough", sw.Elapsed));
        }
 private void SetListPkg(StringBuilder XmlListPkg)
 {
     // InvokeRequired required compares the thread ID of the
     // calling thread to the thread ID of the creating thread.
     // If these threads are different, it returns true.
     if (this.listViewPckg.InvokeRequired)
     {
         SetListPkgCallback d = new SetListPkgCallback(SetListPkg);
         this.listViewPckg.Invoke(d, XmlListPkg);
     }
     else
     {
         //if(!VarGlobal.LessVerbose)Console.WriteLine(XmlListPkg.ToString());
         List <string> Result = ReadXml.GetValue(XmlListPkg.ToString(), "directory", "entry");
         VarGlobale.PkgList = (object[])Result.ToArray();
         if (Result.Count > 0)
         {
             listViewPckg.Items.Clear();
             foreach (string item in Result)
             {
                 listViewPckg.Items.Add(item);
             }
         }
         BckGrdWorkerDll.RunWorkerAsync("buildRepositoriesMeta");
         FontSkinManager();
     }
 }
Exemplo n.º 5
0
        public static string GetSelectList(string type, XElement element)
        {
            string jsonData = "";

            if (type == "fix")
            {
                var items = element.Elements("item").Select(i => new { value = i.Attribute("value").Value, text = i.Value }).ToList();
                jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(items);
            }
            if (type == "dictionary")
            {
                string         CodeType    = element.Value;
                List <dynamic> SysCodelist = new List <dynamic>();
                using (var db = Db.Context("Sys"))
                {
                    SysCodelist = db.Sql(string.Format("select Value as value,Text as text,CodeType as codetype from sys_code where CodeType='{0}'", CodeType)).QueryMany <dynamic>();
                }
                jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(SysCodelist);
            }
            if (type == "single")
            {
                var            connName    = ReadXml.getXmlElementAttr(element, "connName");
                var            tableName   = ReadXml.getXmlElementAttr(element, "tableName");
                var            selectField = ReadXml.getXmlElementAttr(element, "selectField");
                var            whereSql    = ReadXml.getXmlElementAttr(element, "whereSql", "1=1");
                List <dynamic> SingleList  = new List <dynamic>();
                using (var db = Db.Context(connName))
                {
                    string SearchSql = string.Format(@"select {0} from {1} where {2}", selectField, tableName, whereSql);
                    SingleList = db.Sql(SearchSql).QueryMany <dynamic>();
                }
                jsonData = Newtonsoft.Json.JsonConvert.SerializeObject(SingleList);
            }
            return(jsonData);
        }
Exemplo n.º 6
0
#pragma warning disable 0169
        private void OldTest()
        {
            StringBuilder XmlRes = About.GetAbout();
            List <string> Result = ReadXml.GetValue(XmlRes.ToString(), "about", "title");

            if (Result.Count > 0)
            {
                if (!VarGlobal.LessVerbose)
                {
                    Console.WriteLine("Title : " + Result[0]);
                }
            }

            /*GetPubkey.GetKey();
            *  PutPubkey.PUTNewKey();
            *  GetPubkey.GetKey();*/
            XmlRes = GetAllProject.GetProjectsList();
            Result = ReadXml.GetValue(XmlRes.ToString(), "directory", "count");
            if (Result.Count > 0)
            {
                if (!VarGlobal.LessVerbose)
                {
                    Console.WriteLine("count : " + Result[0]);
                }
            }
            Result = ReadXml.GetValue(XmlRes.ToString(), "directory", "entry");
            if (Result.Count > 0)
            {
                if (!VarGlobal.LessVerbose)
                {
                    Console.WriteLine("Project : " + Result[0]);
                }
            }
        }
Exemplo n.º 7
0
        public void OpenDialogeBox()
        {
            var xmlReader = new ReadXml();

            if (xmlReader.checkXmlPath())
            {
                var drawingList = new List <string>();

                using (var _form = new PurgeAttributeForm())
                {
                    _form.SetTabIndex(1);

                    var result = _form.ShowDialog();

                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        drawingList = _form.AttributeDrawingList;
                    }
                    if (result == System.Windows.Forms.DialogResult.None)
                    {
                        return;
                    }

                    ReplaceStringValue(drawingList, _form.AttBlockname, _form.LinkattAttributeName, _form.LinkAttValue, _form.ChangeattAttributeName, _form.ChangeAttValue);
                }
            }
        }
        /// <summary>
        /// will show the request itself, and generate a diff for review, if used with the --diff option.
        /// </summary>
        /// <param name="ID">
        /// A <see cref="System.String"/>
        /// </param>
        /// <param name="ShowDiff">
        /// A <see cref="System.Boolean"/>
        /// </param>
        /// <returns>
        /// A <see cref="StringBuilder"/>
        /// </returns>
        public static StringBuilder GetSubmitreqShow(string ID, bool ShowDiff)
        {
            StringBuilder Result = new StringBuilder();

            Result = GET.Getit("request/" + ID, VarGlobal.User, VarGlobal.Password);
            try
            {
                if (ShowDiff)
                {
                    string SrcePrj = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/source", "project");
                    string SrcePkg = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/source", "package");
                    string DestPrj = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/target", "project");
                    string DestPkg = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/target", "package");
                    string Rev     = ReadXml.ReadAttrValue(Result.ToString(), "/request/submit/source", "rev");
                    Result.Append(PostSourceRequestDiff.PostRequestDiff(SrcePrj, SrcePkg, DestPrj,
                                                                        DestPkg, Rev).ToString());
                }
            }
            catch (Exception Ex)
            {
                if (!VarGlobal.LessVerbose)
                {
                    Console.WriteLine("{0}{1}{2}", Ex.Message, Environment.NewLine, Ex.StackTrace);
                }
            }
            return(Result);
        }
Exemplo n.º 9
0
 /// <summary>
 /// 接受到js传递的message (窗帘信息)
 /// </summary>
 /// <param name="data"></param>
 public void ReceiveCurtainMessage(string data)
 {
     //TODO:解析XML数据(主要确定传递数据类型)
     CurtainDataList = ReadXml.ReadInfo(1, data);
     PictureList.SetActive(true);
     //_LoadDataScript.ReceiveMessage(CurtainDataList);
 }
Exemplo n.º 10
0
        public void CheckForNullPath()
        {
            ReadXml r = new ReadXml();

            r.StringPath = null;

            r.ReadFile();
        }
Exemplo n.º 11
0
        public void CheckIfFileExists()
        {
            ReadXml r = new ReadXml();

            r.StringPath = @"bla.xml";

            XDocument doc = r.ReadFile();
        }
Exemplo n.º 12
0
        private System.Drawing.Size GetPageSize(string xml)
        {
            ReadXml r = new ReadXml(xml);
            int     w = Convert.ToInt16(r.Read("Page/Width"));
            int     h = Convert.ToInt16(r.Read("Page/Height"));

            return(new System.Drawing.Size(w, h));
        }
Exemplo n.º 13
0
        private void BckGrWork_DoWork(object sender, DoWorkEventArgs e)
        {
            ProgressStruc ToSend = new ProgressStruc();

            BckGrWork.ReportProgress(0, SetProgressStruc(ToSend, "Total", "I will Create the link", 1));
            Branch.PostBranch(CmBxSubPrjText, CmBxSubPkgText, CmbxCurSubPrjText, TxtPkgDestText);
            BckGrWork.ReportProgress(1, SetProgressStruc(ToSend, "Total", "Link created", 1));

            if (MessageBox.Show(string.Format("Done! Do you want to imediatly branch also all files of {0} in {1}",
                                              CmBxSubPrjText + ":" + CmBxSubPkgText, CmbxCurSubPrjText + ":" +
                                              TxtPkgDestText), "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) ==
                DialogResult.Yes)
            {
                BckGrWork.ReportProgress(1, SetProgressStruc(ToSend, "Total", "Get the list of file(s)", 3));
                string PkgSourceDir = VarGlobal.MonoOBSFrameworkTmpDir + CmBxSubPkgText +
                                      Path.DirectorySeparatorChar.ToString();
                if (!Directory.Exists(PkgSourceDir))
                {
                    Directory.CreateDirectory(PkgSourceDir);
                }
                StringBuilder Result = GetSourceProjectPackage.GetFileList(CmBxSubPrjText,
                                                                           CmBxSubPkgText);
                List <string> FsLs = ReadXml.GetAllFirstAttrValue(Result.ToString(),
                                                                  "directory", "name");
                BckGrWork.ReportProgress(2, SetProgressStruc(ToSend, "Total", "Find " + FsLs.Count +
                                                             " file(s)", 3));

                int Cnt = 1;
                if (FsLs.Count > 0)
                {
                    List <string> CurItem = new List <string>();
                    foreach (string item in FsLs)
                    {
                        BckGrWork.ReportProgress(Cnt, SetProgressStruc(ToSend, "Cur"
                                                                       , string.Format("Download file {0} {1}/{2}", item, Cnt, FsLs.Count), FsLs.Count));
                        Cnt += 1;
                        CurItem.Clear();
                        CurItem.Add(item);
                        SourceProjectPackageFile.GetSourceProjectPackageFiles(
                            CmBxSubPrjText, CmBxSubPkgText, CurItem, PkgSourceDir, 4096);
                        BckGrWork.ReportProgress(Cnt, SetProgressStruc(ToSend, "Cur"
                                                                       , "File downloaded", FsLs.Count));
                    }

                    Cnt = 1;
                    foreach (string FsPathName in Directory.GetFiles(PkgSourceDir))
                    {
                        BckGrWork.ReportProgress(Cnt, SetProgressStruc(ToSend, "Cur"
                                                                       , string.Format("Upload file {0} {1}/{2}", FsLs[Cnt], Cnt, FsLs.Count), FsLs.Count));
                        Cnt += 1;
                        PutSourceProjectPackageFile.PutFile(CmbxCurSubPrjText, TxtPkgDestText, FsPathName);
                        BckGrWork.ReportProgress(Cnt, SetProgressStruc(ToSend, "Cur"
                                                                       , "Uploaded !", FsLs.Count));
                    }
                }
                BckGrWork.ReportProgress(3, SetProgressStruc(ToSend, "Total", "Done !", 3));
            }
        }
Exemplo n.º 14
0
        private void ChkBxStates()
        {
            string XmlData = File.ReadAllText(VarGlobale.MetaPrjXmlFs);

            this.ChkBxI586Build.CheckState     = ReadXml.GetChkState(XmlData, "project", "build", this.LblDistro.Text, "i586");
            this.ChkBxX86_64Build.CheckState   = ReadXml.GetChkState(XmlData, "project", "build", this.LblDistro.Text, "x86_64");
            this.ChkBxI586Publish.CheckState   = ReadXml.GetChkState(XmlData, "project", "publish", this.LblDistro.Text, "i586");
            this.ChkBxX86_64Publish.CheckState = ReadXml.GetChkState(XmlData, "project", "publish", this.LblDistro.Text, "x86_64");
        }
Exemplo n.º 15
0
    IEnumerator InitHouse(string XML)
    {
        WWW www = new WWW(XML);

        yield return(www);

        _Data = ReadXml.ReadHouseXml(www.text);
        StartCoroutine(LoadMap(MsgCenter._instance.WWWURL + _Data[0].Map));
    }
Exemplo n.º 16
0
    static void OpenWindow()
    {
        CustomWindow window = (CustomWindow)EditorWindow.GetWindow(typeof(CustomWindow));

        window.Show();
        data.Clear();
        filePath = "file://" + Application.dataPath + "/Resources/Role.xml";
        data     = ReadXml <Role> .Load(filePath);
    }
Exemplo n.º 17
0
        public void TryReadingXmlFile()
        {
            ReadXml r = new ReadXml();

            r.StringPath = @"C:\Users\dor\source\repos\xmlTest\XmlParser\test.xml";

            XmlParser parser = new SimpleXmlParser();

            parser.Document = r.ReadFile();
        }
Exemplo n.º 18
0
    private IEnumerator InitScene(string p, int ID)
    {
        WWW www = new WWW(p);

        yield return(www);

        List <SceneManager> SceneData = ReadXml.ReadSceneXml(ID, www.text);

        LoadDataFromList._Instand.ReceiveMessage(SceneData);
    }
Exemplo n.º 19
0
        private void Fill_Dgv()
        {
            this.dgvCopyDbList.Rows.Clear();
            List <CopyDBClass> copyDbClassList = ReadXml.SelectCopyDBClass((string)null, (string)null);

            for (int index = 0; index < copyDbClassList.Count; ++index)
            {
                this.dgvCopyDbList.Rows.Add((object)copyDbClassList[index].Id, (object)(index + 1), (object)copyDbClassList[index].Display, (object)copyDbClassList[index].Vaqt);
            }
        }
Exemplo n.º 20
0
        public static MvcHtmlString GetDataGridColumns(this HtmlHelper htmlHelper, string xmlName)
        {
            XElement        targetXml = CommonSearchDialog.GetSearchXml(xmlName);
            List <XElement> fieldList = targetXml.Element("ColumnList").Elements("column").ToList();
            List <Dictionary <string, object> > columsList = new List <Dictionary <string, object> >();
            Dictionary <string, string>         form       = new Dictionary <string, string>();
            StringBuilder sb = new StringBuilder();

            sb.AppendFormat("<table id='CommonDialogForm' data-bind='datagrid:gridSetting'>");
            sb.AppendFormat("<thead><tr>");
            foreach (var item in fieldList)
            {
                string title      = ReadXml.getXmlElementAttr(item, "title");
                string field      = ReadXml.getXmlElementAttr(item, "field");
                string hidden     = ReadXml.getXmlElementAttr(item, "hidden");
                string align      = ReadXml.getXmlElementAttr(item, "align");
                string sortable   = ReadXml.getXmlElementAttr(item, "sortable");
                string width      = ReadXml.getXmlElementAttr(item, "width");
                string formatter  = ReadXml.getXmlElementAttr(item, "formatter");
                string checkbox   = ReadXml.getXmlElementAttr(item, "checkbox");
                string gridFormat = "";
                string gridEditor = ReadXml.getXmlElementValue(item, "gridEditor");
                if (formatter != "")
                {
                    if (formatter == "gridFormat")
                    {
                        gridFormat = ReadXml.getXmlElementValue(item, "gridFormat");
                        formatter  = "";
                    }
                    else
                    {
                        formatter = string.Format("formatter='{0}'", formatter);
                    }
                }
                if (hidden != "")
                {
                    hidden = string.Format("hidden='{0}'", hidden);
                }
                if (sortable != "")
                {
                    sortable = string.Format("sortable='{0}'", sortable);
                }
                if (checkbox != "")
                {
                    checkbox = string.Format("checkbox='{0}'", checkbox);
                }
                if (!string.IsNullOrWhiteSpace(gridEditor))
                {
                    gridEditor = string.Format("editor=\"{0}\"", gridEditor);
                }
                sb.AppendFormat("<th field='{0}' {1} align='{2}' width='{3}' {4} {6} {7} {8} {9}>{5}</th>", field, sortable, align, width, formatter, title, checkbox, gridFormat, hidden, gridEditor);
            }
            sb.AppendFormat("</tr></thead></table>");
            return(MvcHtmlString.Create(sb.ToString()));
        }
Exemplo n.º 21
0
        //已经关注的用户扫描二维码参数
        public void DoSubCode(Dictionary <string, string> model)
        {
            SText mT = new SText();

            mT.Content      = ReadXml.Menu();
            mT.FromUserName = ReadXml.ReadModel("ToUserName", model);
            mT.ToUserName   = ReadXml.ReadModel("FromUserName", model);
            mT.MsgType      = "text";
            mT.CreateTime   = long.Parse(ReadXml.ReadModel("CreateTime", model));
            ReadXml.ResponseToEnd(DALWei.SendText(mT));
        }
        public SostavShablon()
        {
            cbLavozim = new ComboBox();
            List <Lavozim> Llist = ReadXml.SelectLavozim(null, null);

            cbLavozim.DisplayMemberPath = "Nom";
            cbLavozim.ItemsSource       = Llist.OrderBy(x => x.tarif_raziryad).Select(x => x).ToList <Lavozim>();
            Koef = 1.ToString();
            Son  = 1.ToString();
            OV   = "168";
            Id   = "0";
        }
Exemplo n.º 23
0
        public void Judge(string xmlTrace)
        {
            string oringinPath = System.AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
            //"C:\\Users\\wangnan\\Desktop\\EMC_Project\\FinalCode6\\1st_ctrl\\WI_Wrapper\\GetPointOfContainOneDiffractionPathTest\\bin\\Debug"
            string xmlPath = oringinPath.Substring(0, oringinPath.LastIndexOf("\\"));

            xmlPath = oringinPath.Substring(0, xmlPath.LastIndexOf("\\"));
            xmlPath = oringinPath.Substring(0, xmlPath.LastIndexOf("\\"));
            xmlPath = xmlPath + "\\" + "CreateXml" + "\\" + "CreateXml\\bin\\" + xmlTrace;
            ////初始化xml实例
            //XmlDocument doc = new XmlDocument();
            ////加载xml文件
            //doc.Load(xmlTrace);
            ////获取文件的根节点
            //XmlNode rootNode = doc.SelectSingleNode("TheCollectionOfTestCases");
            ////分别获得该节点的InnerXml和OuterXml信息
            //string innerXmlInfo = rootNode.InnerXml.ToString();
            //string outerXmlInfo = rootNode.OuterXml.ToString();
            ////获得第一层子节点
            //XmlNodeList firstLevelNodelist = rootNode.ChildNodes;
            ////设置node变量
            ////Node node1 = new Node();
            List <Node>  nodes    = new List <Node>();  //声明nodes
            List <Point> expected = new List <Point>(); //声明接收点集合
            //XmlAttributeCollection xmlAttributeCol = firstLevelNodelist[0].Attributes;
            //   //获得节点属性
            //   string path = xmlAttributeCol[0].Value;
            //   string havePath = xmlAttributeCol[1].Value;
            int  i    = 0;
            bool flag = true;

            nodes = ReadXml.getNodesFromXml(xmlTrace, ref expected, ref i);//调用方法得到nodes,运用ref得到expected点集
            Path_Accessor target = new Path_Accessor(nodes);

            List <Point> actual = new List <Point>();

            actual = target.GetPointsOfContainOneDiffractPath(i);//生成实际预测点集
            if (actual.Count == 0)
            {
                Assert.IsTrue(true);
            }
            else
            {
                for (int j = 0; j < actual.Count; j++)
                {
                    if (!expected[j].equal(actual[j]))
                    {
                        flag = false;
                    }
                }
                Assert.IsTrue(flag);
            }
        }
Exemplo n.º 24
0
        private void BtnRefresh_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            CmbxPkgList.Items.Clear();
            List <string> Result = ReadXml.GetValue(UserPackageList.GetUserPackageList().ToString(), "directory", "entry");

            CmbxPkgList.Items.AddRange((object[])Result.ToArray());
            if (CmbxPkgList.Items.Count > 0)
            {
                CmbxPkgList.SelectedIndex = 0;
            }
            Cursor = Cursors.Default;
        }
Exemplo n.º 25
0
 public IActionResult Get()
 {
     try
     {
         var xml    = ReadXml.GetObjectByXml();
         var format = new FormatDataXml();
         return(Ok(format.GetWordsHighestRelevanceByPostAndTotal(xml)));
     }
     catch (Exception e)
     {
         return(StatusCode(500, new Exception(e.Message)));
     }
 }
Exemplo n.º 26
0
        private void WriteOutTxt(StringBuilder XmlRes, string Root, string Key)
        {
            List <string> Result = ReadXml.GetValue(XmlRes.ToString(), Root, Key);

            if (Result.Count > 0)
            {
                StringBuilder Buffer = new StringBuilder();
                foreach (string CurVal in Result)
                {
                    Buffer.AppendLine(Key + " : " + CurVal);
                }
                this.TxtOut.AppendText(Buffer.ToString());
            }
        }
Exemplo n.º 27
0
 private void BtnRefreshSubPrj_Click(object sender, EventArgs e)
 {
     SaveParam();
     //We are ready to fetch the list of subproject
     if (MessageBox.Show("Should i try to fetch subproject list ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         StringBuilder XmlDt  = SubProjectList.GetSubProjectList(TxtPrefix.Text);
         List <string> Result = ReadXml.GetValue(XmlDt.ToString(), "collection", "project");
         VarGlobale.SubProject = Result;
         CmBxSubPrj.Items.Clear();
         CmBxSubPrj.Items.AddRange(VarGlobale.SubProject.ToArray());
         CmBxSubPrj.Text = VarGlobal.PrefixUserName;
     }
 }
Exemplo n.º 28
0
 private void BtnCurSubPrj_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Should i try to fetch subproject list ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Cursor = Cursors.AppStarting;
         Application.DoEvents();
         StringBuilder XmlDt = SubProjectList.GetSubProjectList(VarGlobal.PrefixUserName);
         Application.DoEvents();
         List <string> Result = ReadXml.GetValue(XmlDt.ToString(), "collection", "project");
         VarGlobale.SubProject = Result;
         CmbxCurSubPrj.Items.Clear();
         CmbxCurSubPrj.Items.AddRange(VarGlobale.SubProject.ToArray());
         CmbxCurSubPrj.Text = VarGlobal.PrefixUserName;
         Cursor             = Cursors.Default;
     }
 }
        private void SetStatus(StringBuilder XmlStatus)
        {
            try
            {
                // InvokeRequired required compares the thread ID of the
                // calling thread to the thread ID of the creating thread.
                // If these threads are different, it returns true.
                if (LblStatus.InvokeRequired)
                {
                    SetStatusCallback d = new SetStatusCallback(SetStatus);
                    LblStatus.Invoke(d, XmlStatus);
                }
                else
                {
                    //if(!VarGlobal.LessVerbose)Console.WriteLine(XmlStatus.ToString());
                    List <string> Result = ReadXml.GetValue(XmlStatus.ToString(), "status", "code");
                    if (Result.Count > 0)
                    {
                        string        Res    = Result[0];
                        List <string> Detail = ReadXml.GetValue(XmlStatus.ToString(), "status", "details");
                        if (Detail.Count > 0)
                        {
                            Res += " " + Detail[0];
                        }


                        LblStatus.Text = Res;
                        if (Res.IndexOf("succeeded", StringComparison.InvariantCultureIgnoreCase) > -1)
                        {
                            LblStatus.ForeColor = Color.Green;
                        }
                        if (Res.IndexOf("failed", StringComparison.InvariantCultureIgnoreCase) > -1)
                        {
                            LblStatus.ForeColor = Color.Red;
                        }
                    }
                    backgroundWorkerBuildStatus.RunWorkerAsync("FsList");
                }
            }
            catch (Exception Ex)
            {
                if (!VarGlobal.LessVerbose)
                {
                    Console.WriteLine(Ex.Message + Environment.NewLine + Ex.StackTrace);
                }
            }
        }
Exemplo n.º 30
0
        private static Dictionary <string, List <Tag> > init()
        {
            ReadXml r = new ReadXml
            {
                StringPath = @"C:\Users\dor\source\repos\xmlTest\XmlParser\test2.xml"
            };

            XmlParser parser = new AdvancedXmlParser();

            try
            {
                parser.Document     = r.ReadFile();
                parser.ParserConfig = new Config
                {
                    Paths = new List <string>(new string[] { "rows/head", "rows/row" }),
                };

                parser.ParseData(LoggerType.DEBUG);
                return(parser.ParsedData);
            } catch (FileNotFoundException fnfException)
            {
                Console.WriteLine(fnfException.Message + " " + fnfException.FileName);
                Console.WriteLine("Click any key to exit the program");
                Console.ReadKey();
                Environment.Exit(1);
            } catch (XmlException xmlException)
            {
                Console.WriteLine(xmlException.Message);
                Console.WriteLine("Click any key to exit the program");
                Console.ReadKey();
                Environment.Exit(1);
            } catch (ArgumentNullException anException)
            {
                Console.WriteLine(anException.Message);
                Console.WriteLine("Click any key to exit the program");
                Console.ReadKey();
                Environment.Exit(1);
            } catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine("Click any key to exit the program");
                Console.ReadKey();
                Environment.Exit(1);
            }
            return(null);
        }