示例#1
0
        public IStreamRun DeserializeRun(string content, ModelDelta token)
        {
            var uncompressed = new List <byte>();

            foreach (var textByte in content.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries))
            {
                if (byte.TryParse(textByte, NumberStyles.HexNumber, CultureInfo.CurrentCulture, out byte value))
                {
                    uncompressed.Add(value);
                }
            }
            var        compressed = Compress(uncompressed, 0, uncompressed.Count);
            IStreamRun run        = this;

            if (compressed.Count > Length)
            {
                run = (IStreamRun)Model.RelocateForExpansion(token, this, compressed.Count);
            }
            for (int i = 0; i < compressed.Count; i++)
            {
                token.ChangeData(Model, run.Start + i, compressed[i]);
            }
            for (int i = compressed.Count; i < Length; i++)
            {
                token.ChangeData(Model, run.Start + i, 0xFF);
            }
            return((LZRun)Duplicate(run.Start, PointerSources));
        }
 public static IStreamRun DeserializeRun(this IStreamRun streamRun, string content, ModelDelta token) => streamRun.DeserializeRun(content, token, out var _);