Beispiel #1
0
        public static bool IndexExist(string name, HHI_Prefix prefix, out string index)
        {
            string studentIndex = "";

            try {
                studentIndex = HHI_Module.FileNameToIndex(name);
            } catch (Exception e) {
                MessageBox.Show("路径:" + studentIndex + "未知错误\n\n" + e.ToString());
            }
            if (studentIndex == "")
            {
                MessageBox.Show("未检测到文件夹名种有学号 \n 学号有误,请重新检查", "错误");
                index = studentIndex;
                return(false);
            }
            int nStudentIndex = Convert.ToInt32(studentIndex);

            index = studentIndex;
            if (!stLib_CS.Generic.ListHelper.IsIn(HHI_Module.GetPrefixIndexList(prefix), nStudentIndex))
            {
                MessageBox.Show("目前的学号为:" + studentIndex + " 学号有误,请重新检查", "错误");
                return(false);
            }
            return(true);
        }
Beispiel #2
0
        public static List <int> GetPrefixIndexList(HHI_Prefix prefix)
        {
            List <int> digit = new List <int>();

            for (int i = 0; i < (prefix.End - prefix.Start + 1); i++)
            {
                digit.Add(prefix.Start + i);
            }
            string[] includeIndexs = prefix.Include.Split(';');
            string[] excludeIndexs = prefix.Exclude.Split(';');

            for (int i = 0; i < digit.Count; i++)
            {
                for (int j = 0; j < excludeIndexs.Count(); j++)
                {
                    if (Convert.ToInt32(excludeIndexs[j]) == digit[i])
                    {
                        digit.RemoveAt(i);
                        break;
                    }
                }
            }

            foreach (var item in includeIndexs)
            {
                digit.Add(Convert.ToInt32(item));
            }

            return(digit);
        }
Beispiel #3
0
        public static List <int> GetUnAttachedWorkIndexs(HHI_HandIn hi, HHI_Prefix prefix)
        {
            List <int>    digit = GetPrefixIndexList(prefix);
            List <string> files = GetFileNames(hi);

            foreach (var file in files)
            {
                string strRet = FileNameToIndex(file);
                if (strRet.Equals(""))
                {
                    continue;
                }
                for (int j = 0; j < digit.Count; ++j)
                {
                    if (digit[j] == Convert.ToInt32(strRet))
                    {
                        digit.Remove(digit[j]);
                        break;
                    }
                }
            }
            return(digit);
        }
Beispiel #4
0
        public static void LoadPrefixs()
        {
            m_prefixxml.Load(m_prefixPath);
            //<prefixs>
            XmlNode     rootNode           = m_prefixxml.SelectSingleNode("prefixs");
            XmlNodeList firstLevelNodeList = rootNode.ChildNodes;
            //<prefix>
            int i = 0;

            foreach (XmlNode node in firstLevelNodeList)
            {
                HHI_Prefix tmp = new HHI_Prefix();
                tmp.Name = node.Attributes["name"].Value;
                // get infos
                XmlNodeList prefixInfos = node.ChildNodes;
                tmp.Start   = Convert.ToInt32(prefixInfos.Item(0).InnerText);
                tmp.End     = Convert.ToInt32(prefixInfos.Item(1).InnerText);
                tmp.Include = prefixInfos.Item(2).InnerText;
                tmp.Exclude = prefixInfos.Item(3).InnerText;
                tmp.ID      = i;
                listPrefixes.Add(tmp);
                ++i;
            }
        }
        private static void loadPrefix()
        {
            XmlNode     rootNode           = m_prefixxml.SelectSingleNode(PrefixRootNodeName);
            XmlNodeList firstLevelNodeList = rootNode.ChildNodes;
            //<prefix>
            int i = 0;

            foreach (XmlNode node in firstLevelNodeList)
            {
                HHI_Prefix tmp = new HHI_Prefix();
                tmp.Name = node.Attributes["name"].Value;
                string[] names = node.Attributes["namelist"].Value.Split(';');
                tmp.AllMemberName = new List <string>(names);
                // get infos
                XmlNodeList prefixInfos = node.ChildNodes;
                tmp.Start   = Convert.ToInt32(prefixInfos.Item(0).InnerText);
                tmp.End     = Convert.ToInt32(prefixInfos.Item(1).InnerText);
                tmp.Include = prefixInfos.Item(2).InnerText;
                tmp.Exclude = prefixInfos.Item(3).InnerText;
                tmp.ID      = i;
                listPrefixes.Add(tmp);
                ++i;
            }
        }