Пример #1
0
        public void Read()
        {
            Logger.Trace("Reading header...");
            var header = Header.ReadFrom(_stream, OutputDirectory);

            Logger.Trace("Header was read:");
            Logger.Trace("Signature: {0}, Unknown: {1}, ParametersSize: {2}, IsValid: {3}", header.Signature,
                         header.Unknown,
                         header.ParametersSize, header.IsValid);
            if (!header.IsValid)
            {
                return;
            }

            Logger.Trace("Reading parameter offsets...");
            var parametersStream = StreamBlock(_stream, (int)header.ParametersSize);

            Logger.Trace("Parameter offsets were read from file");
            Logger.Trace("Reading parameters descriptor...");
            var mainParam = Parameter.ReadFrom(parametersStream);

            Logger.Trace("Parameters descriptor was read:");
            var parametrsTableLength = mainParam.Children[0].Value;
            var imagesCount          = mainParam.Children[1].Value;

            Logger.Trace($"ParametrsTableLength: {parametrsTableLength}, ImagesCount: {imagesCount}");

            Logger.Trace("Reading parameters locations...");
            var parametersLocations = Parameter.ReadList(parametersStream);

            Logger.Trace("Watch face parameters locations were read:");

            Parameters = ReadParameters(parametrsTableLength, parametersLocations);
            Resources  = new Resources.Reader(_stream).Read((uint)imagesCount);
        }
Пример #2
0
        public void Read()
        {
            Logger.Trace("阅读头文件...");
            var header = Header.ReadFrom(_stream);

            Logger.Trace("已读:");
            Logger.Trace("已签名: {0}, 未知: {1}, 参数大小: {2}, 错误(非法): {3}", header.Signature,
                         header.Unknown,
                         header.ParametersSize, header.IsValid);
            if (!header.IsValid)
            {
                return;
            }

            Logger.Trace("读取偏移参数...");
            var parametersStream = StreamBlock(_stream, (int)header.ParametersSize);

            Logger.Trace("偏移参数已从文件读取");

            Logger.Trace("读取参数标识符...");
            var mainParam = Parameter.ReadFrom(parametersStream);

            Logger.Trace("参数标识符已读取:");
            var parametrsTableLength = mainParam.Children[0].Value;
            var imagesCount          = mainParam.Children[1].Value;

            Logger.Trace($"参数表长: {parametrsTableLength}, 图像数: {imagesCount}");

            Logger.Trace("读取位置参数...");
            var parametersLocations = Parameter.ReadList(parametersStream);

            Logger.Trace("表盘位置参数读取已读取:");

            Parameters = ReadParameters(parametrsTableLength, parametersLocations);
            Resources  = new Resources.Reader(_stream).Read((uint)imagesCount);
        }