Beispiel #1
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]);
                }
            }
        }
 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();
     }
 }
Beispiel #3
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;
        }
Beispiel #4
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;
     }
 }
Beispiel #5
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());
            }
        }
Beispiel #6
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);
                }
            }
        }
Beispiel #8
0
 private void BtnGetList_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show("Should i try to fetch project list (this could take few minutes) ?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         Cursor = Cursors.AppStarting;
         Application.DoEvents();
         StringBuilder XmlDt = SubProjectList.GetSubProjectList(string.Empty);
         Application.DoEvents();
         List <string> Result = ReadXml.GetValue(XmlDt.ToString(), "collection", "project");
         CmBxSubPrj.Items.Clear();
         CmBxSubPrj.Items.AddRange(Result.ToArray());
         if (CmBxSubPrj.Items.Count > 0)
         {
             CmBxSubPrj.SelectedIndex = 0;
         }
         Cursor = Cursors.Default;
     }
 }
Beispiel #9
0
        private void BtnGetListPkg_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.AppStarting;
            Application.DoEvents();
            StringBuilder XmlRes = UserPackageList.GetUserPackageList(CmBxSubPrj.Text);

            Application.DoEvents();
            List <string> Result = ReadXml.GetValue(XmlRes.ToString(), "directory", "entry");

            if (Result.Count > 0)
            {
                CmBxSubPkg.Items.Clear();
                CmBxSubPkg.Items.AddRange(Result.ToArray());
                if (CmBxSubPkg.Items.Count > 0)
                {
                    CmBxSubPkg.SelectedIndex = 0;
                }
            }
            Cursor = Cursors.Default;
        }
        private void SetbuildRepositoriesMeta(StringBuilder XmlbuildRepositoriesMeta)
        {
            // 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.splitContainer1.Panel2.InvokeRequired)
            {
                SetbuildRepositoriesMetaCallback d = new SetbuildRepositoriesMetaCallback(SetbuildRepositoriesMeta);
                this.splitContainer1.Panel2.Invoke(d, XmlbuildRepositoriesMeta);
            }
            else
            {
                try
                {
                    //if(!VarGlobal.LessVerbose)Console.WriteLine(XmlbuildRepositoriesMeta.ToString());
                    List <string> Result = ReadXml.GetValue(XmlbuildRepositoriesMeta.ToString(), "project", "repository");
                    if (Result.Count > 0)
                    {
                        AllRepository.Clear();
                        foreach (string item in Result)
                        {
                            Dictionary <string, string> SubResult = ReadXml.GetValue(XmlbuildRepositoriesMeta.ToString(), "project", "name", item, false);
                            string PathRepository = SubResult["project"] + "/" + SubResult["repository"];
                            bool   i586           = false;
                            bool   x86_64         = false;
                            foreach (string Arch in SubResult.Values)
                            {
                                switch (Arch)
                                {
                                case "i586":
                                    i586 = true;
                                    break;

                                case "x86_64":
                                    x86_64 = true;
                                    break;

                                default:
                                    break;
                                }
                            }
                            string            RepoEndUrl = VarGlobal.PrefixUserName + "/" + item;
                            BuildRepositories CurCtrl    = new BuildRepositories(item, PathRepository, i586, x86_64, RepoEndUrl);
                            //CurCtrl.Top = CurCtrl.Height * splitContainer1.Panel2.Controls.Count;
                            CurCtrl.Top = CurCtrl.Height * panelProjects.Controls.Count;
                            //splitContainer1.Panel2.Controls.Add(CurCtrl);
                            panelProjects.Controls.Add(CurCtrl);
                            CurCtrl.BuildRepositoriesDelEvent += new
                                                                 BuildRepositories.BuildRepositoriesDelEventHandler(
                                CurCtrl_BuildRepositoriesDelEvent);
                            SubResult.Add("ItemInfo", item);
                            AllRepository.Add(SubResult);
                        }
                    }
                    // AddPkgTab();
                    AddPrjInf(ReadXml.GetValue(XmlbuildRepositoriesMeta.ToString(), "project", "name", VarGlobal.PrefixUserName, true));
                    FontSkinManager();
                }
                catch (Exception ex)
                {
                    if (!VarGlobal.LessVerbose)
                    {
                        Console.WriteLine(ex.Message + Environment.NewLine + ex.StackTrace);
                    }
                }
            }
        }
Beispiel #11
0
        private void ValidChanges()
        {
            #region Create an XmlDoc to work on
            string      XmlFs = VarGlobale.MetaPrjXmlFs;
            XmlDocument doc   = new XmlDocument();
            try
            {
                doc.Load(XmlFs);
            }
            catch (Exception Ex)
            {
                if (!VarGlobal.LessVerbose)
                {
                    Console.WriteLine("{0}{1}{2}", Ex.Message, Environment.NewLine, Ex.StackTrace);
                }
            }
            #endregion

            if (File.Exists(XmlFs))
            {
                #region Remove all existing repository node in the XML meta
                List <string> Result = ReadXml.GetValue(doc.InnerXml, "project", "repository");
                if (Result.Count > 0)
                {
                    Dictionary <string, string> AttribList = new Dictionary <string, string>();
                    foreach (string item in Result)
                    {
                        AttribList.Clear();
                        AttribList.Add("repository", item);
                        AttribList.Add("arch", "x86_64");
                        WriteXml.RemoveNode(XmlFs, "project", "build", AttribList);
                        WriteXml.RemoveNode(XmlFs, "project", "publish", AttribList);
                        AttribList["arch"] = "i586";
                        WriteXml.RemoveNode(XmlFs, "project", "build", AttribList);
                        WriteXml.RemoveNode(XmlFs, "project", "publish", AttribList);

                        if (WriteXml.RemoveNode(XmlFs, "project", "repository",
                                                "name", item))
                        {
                        }
                    }
                }
                #endregion

                #region Refresh the Xml Data
                try
                {
                    doc.Load(XmlFs);
                }
                catch (Exception Ex)
                {
                    if (!VarGlobal.LessVerbose)
                    {
                        Console.WriteLine("{0}{1}{2}", Ex.Message, Environment.NewLine, Ex.StackTrace);
                    }
                }
                #endregion

                #region Add all nodes from Treeview in the Xml Data and write it
                XmlNode RootNde = doc.DocumentElement;
                if (this.treeViewRepo.Nodes.Count > 0 && null != RootNde)
                {
                    foreach (TreeNode item in this.treeViewRepo.Nodes[0].Nodes)
                    {
                        XmlElement elemtoadd = doc.CreateElement(item.Text);
                        XmlElement Lastelem  = elemtoadd;

                        foreach (TreeNode TrNde in item.Nodes)
                        {
                            switch (TrNde.Text)
                            {
                            case "name":
                            case "repository":
                            case "project":
                                XmlAttribute Attrib = doc.CreateAttribute(TrNde.Text);
                                if (TrNde.Nodes.Count > 0)
                                {
                                    Attrib.InnerText = TrNde.Nodes[0].Text;
                                }
                                elemtoadd.Attributes.Append(Attrib);
                                break;

                            default:
                                XmlElement elem = doc.CreateElement(TrNde.Text);
                                if (TrNde.Nodes.Count == 1)
                                {
                                    elem.InnerText = TrNde.Nodes[0].Text;
                                }
                                else
                                {
                                    foreach (TreeNode AttribNde in TrNde.Nodes)
                                    {
                                        XmlAttribute Attrib2 = doc.CreateAttribute(AttribNde.Text);
                                        if (AttribNde.Nodes.Count > 0)
                                        {
                                            Attrib2.InnerText = AttribNde.Nodes[0].Text;
                                        }
                                        elem.Attributes.Append(Attrib2);
                                    }
                                }
                                elemtoadd.AppendChild(elem);

                                break;
                            }
                        }
                        RootNde.AppendChild(elemtoadd);
                    }
                }
                doc.Save(XmlFs);
                #endregion
            }
        }