示例#1
0
文件: Form1.cs 项目: kipper44/SvnTool
 private void btnAuthDirAdd_Click(object sender, EventArgs e)
 {
     if ("" != txtAuthDir.Text.Trim())
     {
         var cAddAuth = new SVNAuthInfo();
         cAddAuth.lstAuth = new List <SVNAuthValue>();
         cAddAuth.strDir  = txtAuthDir.Text.Trim();
         lstAuth.Items.Add(cAddAuth);
     }
 }
示例#2
0
文件: Form1.cs 项目: kipper44/SvnTool
        private void SetGroupFile(string strGroupFile)
        {
            string[] lines = System.IO.File.ReadAllLines(strGroupFile, Encoding.Default);
            //List<string> lstGroup = new List<string>();
            string strAuthDir  = "";
            bool   bStartGroup = false;
            bool   bAuth       = false;

            foreach (var line in lines)
            {
                if (0 >= line.Length)
                {
                    continue;
                }
                if ('#' == line[0])
                {
                    continue;                 //주석
                }
                if ('[' == line[0])
                {
                    if (-1 != line.IndexOf("[groups]")) //그룹셋팅
                    {
                        bStartGroup = true;
                    }
                    if ('/' == line[1])
                    {
                        bAuth       = true;
                        bStartGroup = false;
                        strAuthDir  = line.Trim();
                        continue;
                    }
                }
                if (bStartGroup)
                {
                    var cGroup = new GroupInfo();
                    cGroup.lstUsers = new List <string>();
                    var iIndex = line.IndexOf('=');
                    if (-1 == iIndex)
                    {
                        continue;
                    }
                    cGroup.strName = line.Substring(0, iIndex);
                    lstGroup.Items.Add(cGroup);
                    var      struser = line.Substring(iIndex + 1, line.Length - (iIndex + 1));
                    string[] values  = struser.Split(',');
                    foreach (var cuser in values)
                    {
                        var idx = lstUsers.FindString(cuser.Trim());
                        if (-1 != idx)
                        {
                            cGroup.lstUsers.Add(cuser.Trim());
                        }
                        else
                        {
                            MessageBox.Show("NOT FOUND USER : "******"strDir";
                    }
                    else
                    {
                        var      cAddAuth      = (SVNAuthInfo)(lstAuth.Items[iIndex]);
                        var      cAddAuthValue = new SVNAuthValue();
                        string[] values        = line.Split('=');
                        cAddAuthValue.strgroup = values[0].Trim();
                        cAddAuthValue.strAuth  = values[1].Trim();
                        cAddAuth.lstAuth.Add(cAddAuthValue);
                    }
                    continue;
                }
            }
            lstGroup.DisplayMember = "strName";
            lstGroup.SelectedIndex = 0;
            SelectGroup();

            lstAuth.SelectedIndex = 0;
            SelectAuthList();
        }