MCPcopy Create free account
hub / github.com/MultiMC/Launcher / processDownloadedVersionInfo

Method processDownloadedVersionInfo

launcher/updater/DownloadTask.cpp:88–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88void DownloadTask::processDownloadedVersionInfo()
89{
90 VersionFileList m_currentVersionFileList;
91 VersionFileList m_newVersionFileList;
92
93 setStatus(tr("Reading file list for new version..."));
94 qDebug() << "Reading file list for new version...";
95 QString error;
96 if (!parseVersionInfo(newVersionFileListData, m_newVersionFileList, error))
97 {
98 qCritical() << error;
99 emitFailed(error);
100 return;
101 }
102
103 // if we have the current version info, use it.
104 if (m_currentVersionFileListDownload && m_currentVersionFileListDownload->wasSuccessful())
105 {
106 setStatus(tr("Reading file list for current version..."));
107 qDebug() << "Reading file list for current version...";
108 // if this fails, it's not a complete loss.
109 QString error;
110 if(!parseVersionInfo( currentVersionFileListData, m_currentVersionFileList, error))
111 {
112 qDebug() << error << "This is not a fatal error.";
113 }
114 }
115
116 // We don't need this any more.
117 m_currentVersionFileListDownload.reset();
118 m_newVersionFileListDownload.reset();
119 m_vinfoNetJob.reset();
120
121 setStatus(tr("Processing file lists - figuring out how to install the update..."));
122
123 // make a new netjob for the actual update files
124 NetJob::Ptr netJob = new NetJob("Update Files", m_network);
125
126 // fill netJob and operationList
127 if (!processFileLists(m_currentVersionFileList, m_newVersionFileList, m_status.rootPath, m_updateFilesDir.path(), netJob, m_operations))
128 {
129 emitFailed(tr("Failed to process update lists..."));
130 return;
131 }
132
133 // Now start the download.
134 QObject::connect(netJob.get(), &NetJob::succeeded, this, &DownloadTask::fileDownloadFinished);
135 QObject::connect(netJob.get(), &NetJob::progress, this, &DownloadTask::fileDownloadProgressChanged);
136 QObject::connect(netJob.get(), &NetJob::failed, this, &DownloadTask::fileDownloadFailed);
137
138 if(netJob->size() == 1) // Translation issues... see https://github.com/MultiMC/Launcher/issues/1701
139 {
140 setStatus(tr("Downloading one update file."));
141 }
142 else
143 {
144 setStatus(tr("Downloading %1 update files.").arg(QString::number(netJob->size())));
145 }

Callers

nothing calls this directly

Calls 8

parseVersionInfoFunction · 0.85
processFileListsFunction · 0.85
pathMethod · 0.80
wasSuccessfulMethod · 0.45
resetMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
startMethod · 0.45

Tested by

no test coverage detected