Beispiel #1
0
        /// <summary>
        /// HTML 태그로 구성된 문자열은 BR, P 등을 행의 구분자로,
        /// 일반 텍스트 문자열은 줄바꿈을 구분자로 취급해서 각 행을 항목으로 하는 배열을 리턴함.
        /// </summary>
        /// <param name="Value">문자열</param>
        /// <param name="MaxColumnCount">한글을 2Byte로 취급하는 최대 열너비(이 값을 초과한 문자열은 같은 줄에 있어도 다음 줄로 인식됨)</param>
        /// <param name="Include_BR_P_AsSeparator">BR, P 태그를 행 구분자로 취급할 지 여부</param>
        /// <returns>각 행을 항목으로 하는 배열</returns>
        /// <example>
        /// <code>
        /// <![CDATA[
        /// string Html = "1줄<br>2줄<p>3줄";
        ///
        /// string[] aHtml = CHtml.SplitLine(Html, 2, true);
        /// Console.WriteLine(aHtml[0]); // "1"
        ///
        /// string[] aHtml2 = CHtml.SplitLine(Html, 3, true);
        /// Console.WriteLine(aHtml2[0]); // "1줄"
        /// ]]>
        /// </code>
        /// </example>
        public static string[] SplitLine(string Value, int MaxColumnCount, bool Include_BR_P_AsSeparator)
        {
            List <string> aValueList = new List <string>();

            string[] aLineSep = null;
            if (Include_BR_P_AsSeparator)
            {
                aLineSep = new string[] { "<p>", "<p/>", "<p />", "<br>", "<br/>", "<br />" };
            }
            else
            {
                Value    = Value.Replace("\r", "");
                aLineSep = new string[] { "\n" };
            }

            string[] aValue = Value.Split(aLineSep, StringSplitOptions.None);
            for (int i = 0, i2 = aValue.Length; i < i2; i++)
            {
                if (MaxColumnCount != 0)
                {
                    string[] aValueInner = CArray.SplitByLength(aValue[i], MaxColumnCount, true);
                    if (aValueInner.Length > 1)
                    {
                        for (int j = 0, j2 = aValueInner.Length; j < j2; j++)
                        {
                            aValueList.Add(aValueInner[j]);
                        }
                    }
                    else
                    {
                        aValueList.Add(aValue[i]);
                    }
                }
                else
                {
                    aValueList.Add(aValue[i]);
                }
            }

            return(aValueList.ToArray());
        }
Beispiel #2
0
        private static Version GetVersion(XmlDocument XDoc)
        {
            XmlAttribute Attr = XDoc.DocumentElement.Attributes["FileVersion"];

            if (Attr == null)
            {
                return(new Version());
            }

            int Version = CFindRep.IfNotNumberThen0(Attr.Value);

            if (Version > 0)
            {
                //4255 -> 4.2.5.5
                string[] aVersion = CArray.SplitByLength(Attr.Value, 1);
                return(new Version(Convert.ToInt32(aVersion[0]), Convert.ToInt32(aVersion[1]), Convert.ToInt32(aVersion[2]), Convert.ToInt32(aVersion[3])));
            }
            else
            {
                return(new Version(Attr.Value));
            }
        }