mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
#4143 First implementation of export sector model
This commit is contained in:
@@ -35,6 +35,7 @@
|
||||
|
||||
#include "cvfMath.h"
|
||||
|
||||
#include <QCryptographicHash>
|
||||
#include <QFileInfo>
|
||||
#include <QDebug>
|
||||
|
||||
@@ -282,6 +283,25 @@ bool RifEclipseOutputFileTools::isValidEclipseFileName(const QString& fileName)
|
||||
return ecl_util_valid_basename(RiaStringEncodingTools::toNativeEncoded(fileNameBase).data());
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QByteArray RifEclipseOutputFileTools::md5sum(const QString& fileName)
|
||||
{
|
||||
QFile file(fileName);
|
||||
if (file.open(QFile::ReadOnly))
|
||||
{
|
||||
QCryptographicHash hash(QCryptographicHash::Md5);
|
||||
QByteArray fileContent = file.readAll();
|
||||
if (!fileContent.isEmpty())
|
||||
{
|
||||
hash.addData(fileContent);
|
||||
return hash.result();
|
||||
}
|
||||
}
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Get set of Eclipse files based on an input file and its path
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -524,6 +544,26 @@ ecl_kw_type* RifEclipseOutputFileTools::createActnumFromPorv(ecl_file_type* ecl_
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
/// Convenience method to hide C fopen calls in #pragma declarations to avoid warnings on Windows
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
FILE* RifEclipseOutputFileTools::fopen(const QString& filePath, const QString& mode)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996)
|
||||
#endif
|
||||
|
||||
FILE* filePtr = std::fopen(RiaStringEncodingTools::toNativeEncoded(filePath).data(), RiaStringEncodingTools::toNativeEncoded(mode).data());
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
return filePtr;
|
||||
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user