|
@@ -92,6 +92,8 @@ namespace LOTRO_DAT {
|
|
|
}
|
|
|
|
|
|
DatOperationResult<> DatFile::Initialise(const std::string &filename, long long dat_id) {
|
|
|
+ status_->SetStatus(DatStatus::E_INITIALISING);
|
|
|
+
|
|
|
dat_id_ = dat_id;
|
|
|
|
|
|
if (initialized_ && io_->GetFilename().result == SUCCESS && io_->GetFilename().value == filename)
|
|
@@ -99,18 +101,25 @@ namespace LOTRO_DAT {
|
|
|
|
|
|
|
|
|
auto operation = io_->Init(filename);
|
|
|
- if (operation.result != SUCCESS)
|
|
|
+ if (operation.result != SUCCESS) {
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>(ERROR, "DATINIT: Error, cannot initialize dat");
|
|
|
+ }
|
|
|
|
|
|
operation = fileSystem_->Init();
|
|
|
- if (operation.result != SUCCESS)
|
|
|
+ if (operation.result != SUCCESS) {
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>(ERROR, "DATINIT: Error, cannot initialize dat");
|
|
|
+ }
|
|
|
|
|
|
operation = localeManager_->Init();
|
|
|
- if (operation.result != SUCCESS)
|
|
|
+ if (operation.result != SUCCESS) {
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>(ERROR, "DATINIT: Error, cannot initialize dat");
|
|
|
+ }
|
|
|
|
|
|
initialized_ = true;
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>();
|
|
|
}
|
|
|
|
|
@@ -119,6 +128,8 @@ namespace LOTRO_DAT {
|
|
|
if (!out)
|
|
|
return DatOperationResult<>(ERROR, "GATHERDATINFO: Cannot open file " + output_filename);
|
|
|
|
|
|
+ status_->SetStatus(DatStatus::E_GATHERING_INFO);
|
|
|
+
|
|
|
fprintf(out, "########################################################################################\n"
|
|
|
"# LOTRO Dat library version: %8s #\n"
|
|
|
"# Author: Gi1dor (e1.gildor@gmail.com) #\n"
|
|
@@ -132,6 +143,7 @@ namespace LOTRO_DAT {
|
|
|
localeManager_->PrintInformaion(out);
|
|
|
|
|
|
fclose(out);
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>(SUCCESS);
|
|
|
}
|
|
|
|
|
@@ -139,20 +151,28 @@ namespace LOTRO_DAT {
|
|
|
if (!initialized_)
|
|
|
return DatOperationResult<>();
|
|
|
|
|
|
+ status_->SetStatus(DatStatus::E_COMMITING);
|
|
|
+
|
|
|
auto operation = localeManager_->DeInit();
|
|
|
- if (operation.result != SUCCESS)
|
|
|
+ if (operation.result != SUCCESS) {
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>(ERROR, "DATDEINIT: Error, cannot deinitialize. msg: " + operation.msg);
|
|
|
+ }
|
|
|
|
|
|
operation = fileSystem_->DeInit();
|
|
|
- if (operation.result != SUCCESS)
|
|
|
+ if (operation.result != SUCCESS) {
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>(ERROR, "DATDEINIT: Error, cannot deinitialize. msg: " + operation.msg);
|
|
|
+ }
|
|
|
|
|
|
operation = io_->DeInit();
|
|
|
- if (operation.result != SUCCESS)
|
|
|
+ if (operation.result != SUCCESS) {
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>(ERROR, "DATDEINIT: Error, cannot deinitialize. msg: " + operation.msg);
|
|
|
+ }
|
|
|
|
|
|
initialized_ = false;
|
|
|
-
|
|
|
+ status_->ClearAll();
|
|
|
return DatOperationResult<>();
|
|
|
}
|
|
|
|