예제 #1
0
        public static RunLengthEncoding <T> ParsePartially(string encoding)
        {
            RunLengthEncoding <T> enc = new RunLengthEncoding <T>();

            string[] elements = spaces.Split(encoding);
            enc.totalCount = ulong.Parse(elements[0]);
            for (int i = 1; i < elements.Length; i++)
            {
                if (!elements[i].Equals(string.Empty))
                {
                    enc.encoding.Add(RunLengthEncodingEntry <T> .Parse(elements[i]));
                }
            }
            return(enc);
        }
예제 #2
0
        protected RunLengthEncoding(SerializationInfo info, StreamingContext cntxt)
        {
            string body = info.GetString("a");
            Regex  r    = new Regex(" ");

            string[] items = r.Split(body);
            totalCount = ulong.Parse(items[0]);
            for (int i = 1; i < items.Length; i++)
            {
                if (!items[i].Equals(string.Empty))
                {
                    encoding.Add(RunLengthEncodingEntry <T> .Parse(items[i]));
                }
            }
            TranslationFinished = false;
        }