Example #1
0
 /// <summary>
 /// 查询按钮、重置按钮点击事件
 /// </summary>
 /// <param name="sender">发送者</param>
 /// <param name="mp">坐标</param>
 /// <param name="button">按钮</param>
 /// <param name="clicks">点击事件</param>
 /// <param name="delta">滚轮滚动值</param>
 private void ClickButton(object sender, POINT mp, MouseButtonsA button, int clicks, int delta)
 {
     if (button == MouseButtonsA.Left && clicks == 1)
     {
         ControlA control = sender as ControlA;
         String   name    = control.Name;
         if (name == "btnSelectCodeDir")
         {
             FolderBrowserDialog fbd = new FolderBrowserDialog();
             if (DialogResult.OK == fbd.ShowDialog())
             {
                 GetTextBox("txtCodeDir").Text = fbd.SelectedPath;
                 String codeDirCacheDir = DataCenter.GetAppPath() + "\\CODEDIR.txt";
                 CFileA.Write(codeDirCacheDir, fbd.SelectedPath);
                 Native.Invalidate();
             }
             fbd.Dispose();
         }
         else if (name == "btnSelectDataDir")
         {
             FolderBrowserDialog fbd = new FolderBrowserDialog();
             if (DialogResult.OK == fbd.ShowDialog())
             {
                 GetTextBox("txtDataDir").Text = fbd.SelectedPath;
                 String dataDirCacheDir = DataCenter.GetAppPath() + "\\DATADIR.txt";
                 CFileA.Write(dataDirCacheDir, fbd.SelectedPath);
                 Native.Invalidate();
             }
             fbd.Dispose();
         }
         else if (name == "btnGenerate")
         {
             //GAIA_FUTURE_CPP_S1:PengChen,100%;
             String        codeDir = GetTextBox("txtCodeDir").Text;
             String        dataDir = GetTextBox("txtDataDir").Text;
             ProjectJidian pJidian = new ProjectJidian();
             DataCenter.JidianService.Dir = codeDir;
             DataCenter.JidianService.GetJidian(ref pJidian);
             if (pJidian.Lines > 0)
             {
                 CFileA.Write(dataDir + "\\" + DateTime.Now.ToString("yyyyMMdd") + ".jidian", pJidian.ToString());
                 GetTextBox("txtResults").Text = pJidian.ToString();
                 Native.Invalidate();
             }
         }
     }
 }
Example #2
0
 /// <summary>
 /// 获取基点
 /// </summary>
 /// <param name="path">路径</param>
 /// <param name="projectJidian">项目基点</param>
 /// <returns></returns>
 public int GetJidian(ref ProjectJidian projectJidian)
 {
     Analysis(m_dir, ref projectJidian);
     return(1);
 }
Example #3
0
        /// <summary>
        /// 分析基点
        /// </summary>
        /// <param name="dir">目录</param>
        private void Analysis(String dir, ref ProjectJidian projectJidian)
        {
            List <String> dirs = new List <String>();

            CFileA.GetDirectories(dir, dirs);
            int dirsSize = dirs.Count;

            for (int i = 0; i < dirsSize; i++)
            {
                Analysis(dirs[i], ref projectJidian);
            }
            List <String> files = new List <String>();

            CFileA.GetFiles(dir, files);
            int filesSize = files.Count;

            for (int i = 0; i < filesSize; i++)
            {
                String file    = files[i];
                String content = "";
                CFileA.Read(file, ref content);
                String[] strs     = content.Split(new String[] { "\n" }, StringSplitOptions.RemoveEmptyEntries);
                int      strsSize = strs.Length;
                if (strsSize > 0)
                {
                    String fline = strs[0];
                    if (fline.StartsWith("//GAIA"))
                    {
                        FileJidian fileJidian = new FileJidian();
                        fileJidian.Lines     = strsSize;
                        projectJidian.Lines += strsSize;
                        fileJidian.Path      = file.Replace(m_dir + "\\", "");
                        String[] subStrs  = fline.Split(new String[] { ":" }, StringSplitOptions.RemoveEmptyEntries);
                        String[] subStrs2 = subStrs[0].Split(new String[] { "_" }, StringSplitOptions.RemoveEmptyEntries);
                        fileJidian.PID         = subStrs2[1];
                        fileJidian.CodeType    = subStrs2[2];
                        fileJidian.Level       = Convert.ToInt32(subStrs2[3].Replace("S", ""));
                        fileJidian.Scores      = fileJidian.Lines * fileJidian.Level;
                        projectJidian.Scores  += fileJidian.Scores;
                        projectJidian.AvgLevel = (double)(projectJidian.Files * projectJidian.AvgLevel + fileJidian.Level) / (projectJidian.Files + 1);
                        projectJidian.Files++;
                        String[] sunStrs = subStrs[1].Split(new String[] { ";" }, StringSplitOptions.RemoveEmptyEntries);
                        for (int j = 0; j < sunStrs.Length; j++)
                        {
                            String[] csunStrs = sunStrs[j].Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
                            if (csunStrs.Length >= 2)
                            {
                                MemberJidian memberJidian = new MemberJidian();
                                memberJidian.Name  = csunStrs[0];
                                memberJidian.Rates = (double)Convert.ToInt32(csunStrs[1].Replace("%", "")) / 100;
                                memberJidian.Lines = (int)(strsSize * memberJidian.Rates);
                                fileJidian.MemberJidians.Add(memberJidian);
                            }
                        }
                        projectJidian.FileJidians.Add(fileJidian);
                    }
                }
            }
            dirs.Clear();
            files.Clear();
        }