예제 #1
0
        public bool checkValid()
        {
            if (SourceType == SourceTypeConverter.SourceTypeSection)
            {
                if (CodeSection.Parse(Source).Count == 0)
                {
                    return(false);
                }
            }

            return(true);
        }
예제 #2
0
        public static string CheckValid(string SourceType, int codepage, string text)
        {
            if (SourceType == SourceTypeConverter.SourceTypeSection)
            {
                List <CodeSection> list = CodeSection.Parse(text);
                text = "";
                for (int i = 0; i < list.Count; i++)
                {
                    if (i > 0)
                    {
                        text += ",";
                    }
                    if (list[i].range != null)
                    {
                        text += "0x" + list[i].range.first_hh.ToString("X2").ToUpper() + ":" + list[i].range.first_ll.ToString("X2").ToUpper()
                                + "-" + "0x" + list[i].range.last_hh.ToString("X2").ToUpper() + ":" + list[i].range.last_ll.ToString("X2").ToUpper();
                    }
                    else
                    {
                        text += "0x" + list[i].first.ToString("X4").ToUpper() + "-0x" + list[i].last.ToString("X4").ToUpper();
                    }
                }
            }
            else
            {
                List <UInt16> list = new List <UInt16>();

                for (int i = 0; i < text.Length; i++)
                {
                    string strTmp = text.Substring(i, 1);
                    if (strTmp.Length > 0)
                    {
                        list.Add(MySource.EncodingGetUint16(codepage, strTmp));
                    }
                }
                list.Sort();
                text = "";
                for (int i = 0; i < list.Count; i++)
                {
                    if (i > 0)
                    {
                        if (list[i] == list[i - 1])
                        {
                            continue;
                        }
                    }
                    text += MySource.EncodingGetString(codepage, list[i]);
                }
            }

            return(text);
        }