| 4101 | } |
| 4102 | |
| 4103 | UINT8 FfsEngine::reconstruct(const QModelIndex &index, QByteArray& reconstructed) |
| 4104 | { |
| 4105 | if (!index.isValid()) |
| 4106 | return ERR_SUCCESS; |
| 4107 | |
| 4108 | UINT8 result; |
| 4109 | |
| 4110 | switch (model->type(index)) { |
| 4111 | case Types::Image: |
| 4112 | if (model->subtype(index) == Subtypes::IntelImage) { |
| 4113 | result = reconstructIntelImage(index, reconstructed); |
| 4114 | if (result) |
| 4115 | return result; |
| 4116 | } |
| 4117 | else { |
| 4118 | //Other images types can be reconstructed like regions |
| 4119 | result = reconstructRegion(index, reconstructed); |
| 4120 | if (result) |
| 4121 | return result; |
| 4122 | } |
| 4123 | break; |
| 4124 | |
| 4125 | case Types::Capsule: |
| 4126 | // Capsules can be reconstructed like regions |
| 4127 | result = reconstructRegion(index, reconstructed); |
| 4128 | if (result) |
| 4129 | return result; |
| 4130 | break; |
| 4131 | |
| 4132 | case Types::Region: |
| 4133 | result = reconstructRegion(index, reconstructed); |
| 4134 | if (result) |
| 4135 | return result; |
| 4136 | break; |
| 4137 | |
| 4138 | case Types::Padding: |
| 4139 | result = reconstructPadding(index, reconstructed); |
| 4140 | if (result) |
| 4141 | return result; |
| 4142 | break; |
| 4143 | |
| 4144 | case Types::Volume: |
| 4145 | result = reconstructVolume(index, reconstructed); |
| 4146 | if (result) |
| 4147 | return result; |
| 4148 | break; |
| 4149 | |
| 4150 | case Types::File: //Must not be called that way |
| 4151 | msg(tr("reconstruct: call of generic function is not supported for files").arg(model->type(index)), index); |
| 4152 | return ERR_GENERIC_CALL_NOT_SUPPORTED; |
| 4153 | break; |
| 4154 | |
| 4155 | case Types::Section: |
| 4156 | result = reconstructSection(index, 0, reconstructed); |
| 4157 | if (result) |
| 4158 | return result; |
| 4159 | break; |
| 4160 | default: |