Пример #1
0
        private void BtnTest_Click(object sender, EventArgs e)
        {
            /* bool IsGET = false;
             * IsGET = this.CmBxFunct.Text.StartsWith("GET ", StringComparison.CurrentCultureIgnoreCase);*/
            string        Cmd = this.CmBxFunct.Text;
            StringBuilder XmlRes;

            switch (Cmd)
            {
            case "GET about":
                XmlRes = About.GetAbout();
                WriteOutTxt(XmlRes, "about", "title");
                WriteOutTxt(XmlRes, "about", "description");
                WriteOutTxt(XmlRes, "about", "revision");
                WriteOutTxt(XmlRes, "about", "documentation");
                break;

            case "GET source/home:<UserName>":
                XmlRes = UserPackageList.GetUserPackageList();
                WriteOutTxt(XmlRes, "directory", "count");
                WriteOutTxt(XmlRes, "directory", "entry");
                break;

            case "GET source/home:<UserName>/_pubkey":
                this.TxtOut.AppendText(GetPubkey.GetKey().ToString());
                break;

            case "POST source/home:<UserName>/?cmd=createkey":
                this.TxtOut.AppendText(PostPubkey.PostNewKey().ToString());
                break;

            case "GET source":
                XmlRes = GetAllProject.GetProjectsList();
                WriteOutTxt(XmlRes, "directory", "count");
                WriteOutTxt(XmlRes, "directory", "entry");
                break;

            case "GET source/<project>/_tags":
                XmlRes = GetSourceProjectTags.GetTags();
                WriteOutTxt(XmlRes, "tags", "title");
                WriteOutTxt(XmlRes, "tags", "user");
                WriteOutTxt(XmlRes, "tags", "package");
                WriteOutTxt(XmlRes, "tags", "project");
                break;

            case "GET /source/<project>/_meta":
                this.TxtOut.AppendText(GetSourceProjectMeta.GetProjectMeta().ToString());
                break;

            default:
                break;
            }
        }
        private void BckGrdWorkerDll_DoWork(object sender, DoWorkEventArgs e)
        {
            if (BckGrdWorkerDll.CancellationPending == true)
            {
                return;
            }
            switch (e.Argument.ToString())
            {
            case "PkgList":
                e.Result = "PkgList";
                XmlRes   = UserPackageList.GetUserPackageList();
                break;

            case "buildRepositoriesMeta":
                e.Result = "buildRepositoriesMeta";
                XmlRes   = GetSourceProjectMeta.GetProjectMeta();
                File.WriteAllText(VarGlobale.MetaPrjXmlFs, XmlRes.ToString());
                break;

            default:
                break;
            }
        }