本文整理汇总了C++中TFileStream类的典型用法代码示例。如果您正苦于以下问题:C++ TFileStream类的具体用法?C++ TFileStream怎么用?C++ TFileStream使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TFileStream类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: vector3
void Global::LoadIniFile(AnsiString asFileName)
{
int i;
for (i = 0; i < 10; ++i)
{ // zerowanie pozycji kamer
pFreeCameraInit[i] = vector3(0, 0, 0); // wspó³rzêdne w scenerii
pFreeCameraInitAngle[i] = vector3(0, 0, 0); // k¹ty obrotu w radianach
}
TFileStream *fs;
fs = new TFileStream(asFileName, fmOpenRead | fmShareCompat);
if (!fs)
return;
AnsiString str = "";
int size = fs->Size;
str.SetLength(size);
fs->Read(str.c_str(), size);
// str+="";
delete fs;
TQueryParserComp *Parser;
Parser = new TQueryParserComp(NULL);
Parser->TextToParse = str;
// Parser->LoadStringToParse(asFile);
Parser->First();
ConfigParse(Parser);
delete Parser; // Ra: tego jak zwykle nie by³o wczeœniej :]
};
示例2: TFileStream
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString s;
TFileStream* fs;
int i;
s = "";
if (lbTables->SelCount > 0)
for (i = 0; i < lbTables->Items->Count; i++)
if (lbTables->Selected[i])
{
ACRTable1->TableName = lbTables->Items->Strings[i];
s = s + ACRTable1->ExportTableToSQL(
cbExportStructure->Checked,
cbAddDROPTable->Checked,
cbExportIndexes->Checked,
cbAddDROPIndex->Checked,
cbExportData->Checked,
cbExportBLOBFields->Checked,
cbUseBrackets->Checked);
};
Memo1->Text = s;
fs = new TFileStream("test.sql",fmCreate);
fs->WriteBuffer(&s[1],s.Length());
delete fs;
}
示例3: Save_Base
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
void Save_Base(TProgType aProgType, AnsiString aFileName, TTreeView *tv1, TTreeView *tv2, TTreeView *tv3, TTreeView *tv4)
{
TFileStream* FileStream;
// -------------
try {
FileStream = new TFileStream(aFileName, fmCreate);
} catch ( ... ) {
MessageBox(NULL, " Невозможно записать файл 'Estimate.dat' \n\n Данные на диск не будут записаны", " Ошибка записи файла ...", MB_ICONERROR);
return;
}
// -------------
int FileVersion = 21;
FileStream->Write(&DataFileDescription1, DataFileDescription1[0] + 1);
FileStream->Write(&DataFileDescription2, DataFileDescription2[0] + 1);
FileStream->Write(&DataFileDescription3, DataFileDescription3[0] + 1);
FileStream->Write(&DataFileDescription4, DataFileDescription4[0] + 1);
FileStream->Write(&DataFileDescription5, DataFileDescription5[0] + 1);
FileStream->Write(&FileVersion , sizeof(FileVersion));
// -------------
Save_(FileStream, aProgType, tv1, &GlobalElementCounter);
Save_(FileStream, aProgType, tv2, &GlobalMaterialCounter);
Save_(FileStream, aProgType, tv3, &GlobalMashineCounter);
Save_(FileStream, aProgType, tv4, &GlobalEnergoCounter);
// -------------
delete FileStream;
}
示例4: memset
//---------------------------------------------------------------------------
void __fastcall TForm1::Button4Click(TObject *Sender)
{
memset(file_buf, 0xFF, sizeof(file_buf));
Hex2Bin(edtWorkFilename->Text, false);
if (ComboBox1->ItemIndex == 0)
{
TFileStream * file = new TFileStream(ExtractFilePath(Application->ExeName)+"csp850aupdate.bin", fmCreate);
file->Write(file_buf+0x4000, max_address-0x4000);
delete file;
ShowMessage("生成升级文件");
}
else if (ComboBox1->ItemIndex == 1)
{
TFileStream * file = new TFileStream(ExtractFilePath(Application->ExeName)+"smartpower_update.bin", fmCreate);
//xor 0x87
for (int i=0x4000;i<max_address;i++)
{
file_buf[i] ^= 0x87;
}
file->Write(file_buf+0x4000, max_address-0x4000);
delete file;
ShowMessage("生成升级文件");
}
}
示例5: UserData_PKG_SaveToSEQ
//---------------------------------------------------------------------------
void __fastcall TFrmUserDataView::BtnSavePKGDataClick(TObject *Sender)
{
BtnSavePKGData->Enabled = false;
BtnInputPKGData->Enabled = true;
UserData_PKG_SaveToSEQ();
UserData_PKG_SaveToDB();
UserData_PKG_ReadFromDB();
UserData_PKG_ReadFromSEQ();
TFileStream *File;
TDateTime dt = Now();
String FolderName = dt.FormatString("yyyy-mm-dd");
String FileName = dt.FormatString("yyyy-mm-dd hh-nn-ss");
ForceDirectories("C:\\KOSES\\History\\PKGParamLog\\"+ FolderName);
String FullPath = "C:\\KOSES\\History\\PKGParamLog\\"+ FolderName+"\\"+FileName+".txt";
File = new TFileStream(FullPath, fmCreate | fmOpenReadWrite);
File->Position = 0;
String Strtemp = "PKGParamLog \r\n";
for(int i=0; i<PkgParamGrid->RowCount; i++)
{
Strtemp += " No:"+IntToStr(i)+ ":"+ PkgParamGrid->Cells[3][i+1] +"\r\n";
}
File->Write(Strtemp.c_str(),Strtemp.Length());
delete File;
}
示例6: TFileStream
// ---------------------------------------------------------------------------
//
void __fastcall TForm1::DisplayFromFile(TGdViewer *gv, String sFilePath) {
FullPath = sFilePath;
TFileStream *fs = new TFileStream(sFilePath, fmShareDenyNone);
char *buf = new char[fs->Size];
fs->Read(buf, fs->Size);
long g = fs->Size;
gv->DisplayFromMemory((long) buf, &g);
delete fs;
delete[]buf;
}
示例7: StringFromFile
AnsiString StringFromFile(const AnsiString FileName, __int64& FileSize)
{
TFileStream* fs = new TFileStream(FileName, fmOpenRead);
AnsiString Result;
try
{
FileSize = fs->Size;
Result.SetLength(FileSize);
if (fs->Size > 0)
fs->Read(Result.c_str(), FileSize);
}
__finally
{
delete fs;
}
return Result;
}
示例8: TFileStream
//---------------------------------------------------------------------------
//Carga una lista de funciones desde archivo
bool TFunciones::LoadFromFile(AnsiString FileName)
{
int InfoSize;
TInfoFuncion F;
TInfoInt I;
TFCabecera FCabecera;
TFFuncion FFuncion;
TFIntervalo FIntervalo;
TFileStream *Archivo;
try{
if( !FileExists(FileName) )
return false;
else{
Archivo = new TFileStream(FileName, fmOpenRead|fmShareExclusive);
Archivo->Seek(0, soFromBeginning);
InfoSize = sizeof(TFCabecera);
Archivo->Read(&FCabecera, InfoSize);
if(strcmp(FCabecera.ID, ID) != 0)
throw Exception("Archivo desconocido");
//FCabecera.Version; Contiene la versión del archivo
for( int i = 0; i < FCabecera.NFunciones; i++){
InfoSize = sizeof(TFFuncion);
Archivo->Read(&FFuncion, InfoSize);
strcpy(F.Nombre, FFuncion.Nombre);
F.Graficar = FFuncion.Graficar;
F.Intervalo = NULL;
InfoSize = sizeof(TFIntervalo);
for( int j = 0; j < FFuncion.NIntervalos; j++){
Archivo->Read(&FIntervalo, InfoSize);
I.Min = FIntervalo.Min;
I.Max = FIntervalo.Max;
strcpy(I.Expresion, FIntervalo.Expresion);
I.TipoGrafico = FIntervalo.TipoGrafico;
I.Color = FIntervalo.Color;
I.Grosor = FIntervalo.Grosor;
uIntervaloH::Add(F.Intervalo, I);}
Add(F);
}
FModificado = false;
delete Archivo;
return true;}
}
catch(...){
return false;}
}
示例9: TFileStream
void TUserIniFile::RecreateSections()
{
const String CR = "\n";
String* S;
TFileStream* FileStream = new TFileStream(FileName, fmCreate);
try {
for(int i=0; i < SectionCount(); i++) {
FileStream->Seek(0, soFromEnd);
S = new String();
*S = Format((String)"%s[%s]%s", ARRAYOFCONST((CR, SectionNames[i], CR)));
FileStream->WriteBuffer((const void *)S, S->Length());
delete S;
}
}
__finally {
delete FileStream;
}
}
示例10: TFileStream
bool TCurve::LoadFromFile(AnsiString asName)
{
DecimalSeparator = '.';
TFileStream *fs;
fs = new TFileStream(asName, fmOpenRead | fmShareCompat);
AnsiString str = "xxx";
int size = fs->Size;
str.SetLength(size);
fs->Read(str.c_str(), size);
str += "";
delete fs;
TQueryParserComp *Parser;
Parser = new TQueryParserComp(NULL);
Parser->TextToParse = str;
Parser->First();
Load(Parser);
delete Parser;
DecimalSeparator = ',';
}
示例11: Load_Base
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
AnsiString Load_Base(AnsiString aFileName, TTreeView *tv1, TTreeView *tv2, TTreeView *tv3, TTreeView *tv4)
{
TDateTime t1= Now();
// -------------
TFileStream* FileStream;
try {
FileStream = new TFileStream(aFileName, fmOpenRead);
} catch ( ... ) {
MessageBox(NULL, " Невозможно открыть файл 'Estimate.dat' \n\n Данные файла не будут загружены", " Ошибка открытия файла ...", MB_ICONERROR);
return FloatToStrF((Now().Val - t1.Val)*3600.0*24.0, ffFixed, 15, 3) + "c.";
}
// -------------
ShortString tempString;
int FileVersion = 0;
FileStream->Read(&tempString[0], 1); FileStream->Read(&tempString[1], tempString[0]);
FileStream->Read(&tempString[0], 1); FileStream->Read(&tempString[1], tempString[0]);
FileStream->Read(&tempString[0], 1); FileStream->Read(&tempString[1], tempString[0]);
FileStream->Read(&tempString[0], 1); FileStream->Read(&tempString[1], tempString[0]);
FileStream->Read(&tempString[0], 1); FileStream->Read(&tempString[1], tempString[0]);
FileStream->Read(&FileVersion, sizeof(FileVersion));
Load_(FileStream, tv1, &GlobalElementCounter );
Load_(FileStream, tv2, &GlobalMaterialCounter);
Load_(FileStream, tv3, &GlobalMashineCounter );
Load_(FileStream, tv4, &GlobalEnergoCounter );
// ----------- Создаю список материалов и другой фиговины ---------
PrepareSpecificallArrays();
CreateMaterialList (tv1);
CreateRashodnikList(tv1);
CreateMashineList (tv1);
CreateEnergoList (tv1);
CreateServiseList (tv1);
/* Load_2004_07_14(FileStream, tv1, &GlobalElementCounter);
Load_2004_07_14(FileStream, tv2, &GlobalMaterialCounter);
Load_2004_07_14(FileStream, tv3, &GlobalMashineCounter);
Load_2004_07_14(FileStream, tv4, &GlobalEnergoCounter);*/
// -------------
delete FileStream;
return FloatToStrF((Now().Val - t1.Val)*3600.0*24.0, ffFixed, 15, 3) + "c.";
}
示例12: IncludeTrailingPathDelimiter
//===========================================================================
//スレッド実行
//===========================================================================
void __fastcall TAttacheCaseFileDecrypt1::Execute()
{
int i, c, len;
float ProgressPercentNumF; //進捗パーセンテージ(浮動小数点)
// バッファ
char buffer[BUF_SIZE];
char source_buffer[BUF_SIZE];
char temp_buffer[BUF_SIZE];
char output_buffer[LARGE_BUF_SIZE];
char *headerbuffer;
//パスワード
bool fPasswordOk;
String FilePath, FileName;
// ファイルストリーム
TFileStream *fsIn;
TFileStream *fsOut;
bool fInputFileOpen = false;
bool fOutputFileOpen = false;
float free_space_required;
__int64 CurrentPos, TotalSize;
__int64 CurrentDriveFreeSpaceSize;
//処理する合計サイズ
AllTotalSize = 0;
int ret; //バッファ出力の返値
int FileIndex = 0;
//Blowfish
CBlowFish *bf;
char token[17] = {0, };
const String PrefixString = "Fn_";
const char charTokenString[17] = "_AttacheCaseData"; //復号の正否に使う
String AtcFileTokenString; //暗号化ファイルのトークン(文字列)
String AtcFileCreateDateString; //暗号化ファイルの生成日時(文字列)
//同名ファイル/フォルダーはすべて上書きして復号する
//(ユーザーがダイアログで「すべてはい」を選択したとき = true )
fOverwirteYesToAll = false;
//「復号したファイルを関連付けされたソフトで開く」一時的な設定
fTempOpenFile = fOpenFile;
//フォルダーを一度開いたか(深いフォルダーすべてを開かないように)
fOpenFolderOnce = false;
// 出力するディレクトリ
OutDirPath = IncludeTrailingPathDelimiter(OutDirPath);
String TempRelativePath;
// 暗号化部分のヘッダサイズ
int EncryptHeaderSize = 0;
int DataVersion; // ver.2.00~は "5", ver.2.70~は "6"
int flush, status; // zlib
z_stream z; // zlibライブラリとやりとりするための構造体
bool fInputEnd = false; // 入力ストリームの終了
//ヘッダデータから必要情報を取り出すための
TMemoryStream *pms; // メモリストリーム
int idx;
TStringList *DataList;
TStringList *tsv;
TStringList *FileList = new TStringList(); // 0: ファイル名
__int64 *FileSizeList = 0; // 1: ファイルサイズ(フォルダは-1)
int *FileAttrList = 0; // 2: 属性
int *FileAgeList = 0; // 3: タイムスタンプ
int rest;
int buf_size;
//----------------------------------------------------------------------
// 平文のヘッダ内容チェック
try {
fsIn = new TFileStream(AtcFilePath, fmOpenRead | fmShareDenyNone);
}
catch(...) {
//'復号するファイルを開けません。他のアプリケーションが使用中の可能性があります。'
MsgText = LoadResourceString(&Msgdecrypt::_MSG_ERROR_FILE_OPEN);
MsgType = mtError;
MsgButtons = TMsgDlgButtons() << mbOK;
MsgDefaultButton = mbOK;
Synchronize(&PostConfirmMessageForm);
goto LabelError;
}
fInputFileOpen = true;
//.........这里部分代码省略.........
示例13: TFileStream
BOOL TStripInfo::OpenInfo(CONST TCHAR* szFilePath)
{
TFileStream* outStream = new TFileStream(szFilePath, fmOpenRead);
outStream->ReadBuffer(&_stripVisual->fPRSMarkX, sizeof(INT32));
outStream->ReadBuffer(&_stripVisual->fPRSMarkY, sizeof(INT32));
outStream->ReadBuffer(&_stripVisual->fDeviceSizeX, sizeof(FLOAT));
outStream->ReadBuffer(&_stripVisual->fDeviceSizeY, sizeof(FLOAT));
outStream->ReadBuffer(&_stripVisual->clSelectUnitSheet, sizeof(TColor));
outStream->ReadBuffer(&_stripVisual->clSelectUnitOutline, sizeof(TColor));
outStream->ReadBuffer(&_stripVisual->clDefaultUnitSheet, sizeof(TColor));
outStream->ReadBuffer(&_stripVisual->clDefaultUnitOutline, sizeof(TColor));
outStream->ReadBuffer(&_stripVisual->nAngle, sizeof(INT32));
outStream->ReadBuffer(&_stripVisual->clIndicateLine, sizeof(TColor));
outStream->ReadBuffer(&_stripVisual->nOriginLocation, sizeof(INT32));
outStream->ReadBuffer(&_stripUnits->fUnitXSize, sizeof(FLOAT));
outStream->ReadBuffer(&_stripUnits->fUnitYSize, sizeof(FLOAT));
outStream->ReadBuffer(&_stripUnits->fUnitXPitch, sizeof(FLOAT));
outStream->ReadBuffer(&_stripUnits->fUnitYPitch, sizeof(FLOAT));
outStream->ReadBuffer(&_stripUnits->nUnitXCountPerBlock, sizeof(INT32));
outStream->ReadBuffer(&_stripUnits->nUnitYCountPerBlock, sizeof(INT32));
outStream->ReadBuffer(&_stripUnits->fFirstMarkToUnitCenterX, sizeof(FLOAT));
outStream->ReadBuffer(&_stripUnits->fFirstMarkToUnitCenterY, sizeof(FLOAT));
outStream->ReadBuffer(&_stripBlock->nBlockXCount, sizeof(INT32));
outStream->ReadBuffer(&_stripBlock->nBlockYCount, sizeof(INT32));
outStream->ReadBuffer(&_stripBlock->fBlockXPitch, sizeof(FLOAT));
outStream->ReadBuffer(&_stripBlock->fBlockYPitch, sizeof(FLOAT));
_stripVisual->SetAngle(_stripVisual->nAngle);
delete outStream;
return true;
}
示例14: ZeroMemory
//===========================================================================
// スレッド実行
//===========================================================================
void __fastcall TAttacheCaseFileEncrypt::Execute()
{
int i, c;
int res;
float ProgressPercentNumF; //進捗パーセンテージ(浮動小数点)
z_stream z; // zlibライブラリとやりとりするための構造体
int flush, status; // zlib
//出力する暗号化ファイルのタイムスタンプを元ファイルに合わせる
HANDLE hFile;
//_WIN32_FIND_DATAW first_fd;
ZeroMemory(&first_fd, sizeof(_WIN32_FIND_DATAW));
int len, pos;
int FileIndex;
String FilePath;
int HeaderSize; //ヘッダデータサイズ
__int64 CurrentDriveFreeSpaceSize = -1; //保存するドライブの空き容量
//実行可能形式出力ファイルのデータサイズ
__int64 ExeAllSize = 0;
__int64 ExeSize = 0;
//全体のファイルサイズ
AllTotalSize = 0;
__int64 TotalSize = 0;
//バッファ
char source_buffer[BUF_SIZE];
char read_buffer[BUF_SIZE];
char out_buffer[BUF_SIZE];
char chain_buffer[BUF_SIZE]; // IVなどを格納するチェインバッファ
char margin_buffer[BUF_SIZE];
//ファイルストリーム
TFileStream *fsIn;
TFileStream *fsOut;
TFileStream *fsExe;
//オープン中か
bool fOpenIn;
bool fOpenOut;
//メモリストリーム
TMemoryStream *pms = new TMemoryStream;
// マージンバッファサイズ
int MarginBufSize = MARGIN_BUF_SIZE;
// PKCS #7 Pading num.
unsigned char paddingNum = 0;
//---------------------------------------
// 同名ファイルがあるのでダイアログ表示
//---------------------------------------
if ( fConfirmOverwirte == true && fOverwirteYesToAll == false ) {
if (FileExists(OutFilePath) == true) {
//同名ファイルの上書き確認メッセージダイアログ
MsgText = LoadResourceString(&Msgencrypt::_MSG_CONFIRM_OVER_WRITE_SAME_FILE)+"\n"+OutFilePath;
Synchronize(&PostConfirmOverwriteMessageForm);
if ( MsgReturnVal == mrYes ) {
//上書きOKなのでFilePathはそのまま
}
else if ( MsgReturnVal == mrNo ) {
//別名保存でFilePath文字列が書き換えられてきている
OutFilePath = MsgReturnPath;
}
else if ( MsgReturnVal == mrYesToAll ) {
//すべて上書き(YesToAll)
fOverwirteYesToAll = true;
}
else if ( MsgReturnVal == mrCancel ) {
//キャンセル
delete pms;
goto LabelStop;
}
}
}
//---------------------------------------
// ヘッダ情報の生成&ファイル総サイズ取得
//---------------------------------------
//'暗号化するファイルリストの生成中...'
ProgressStatusText = LoadResourceString(&Msgencrypt::_LABEL_STATUS_TITLE_LISTING);
if ( CreateHeaderData( pms, InputFileList, FilePathList, AllTotalSize) == false ){
if (Terminated == true) {
//ユーザーキャンセルで抜けてきた
delete pms;
goto LabelStop;
}
//.........这里部分代码省略.........
示例15: TFileStream
//---------------------------------------------------------------------------
//загрузка проекта из файла, действия аналогичные, что и в сохранении, только
//в обратном порядке(парсим JSON объект и заполняем пустой проект)
Project & ProjectManager::loadProject(UnicodeString fileName)
{
TFileStream *fs = new TFileStream(fileName, fmOpenRead);
try {
int n = fs->Size;
char *chars = new char[n+1];
fs->Read(chars, n);
chars[n] = '\0';
UnicodeString str(chars);
TJSONObject *js = (TJSONObject*) TJSONObject::ParseJSONValue(str);
closeProject();
currentProject = new Project();
TJSONArray *criteriaNamesJSON = (TJSONArray*) js->Get(L"criteriaNames")->JsonValue;
vector<UnicodeString> &criteriaNames= getCurrentProject().getCriteriaNames();
for (int i = 0; i < criteriaNamesJSON->Size(); ++i) {
criteriaNames.push_back(criteriaNamesJSON->Get(i)->Value());
}
TJSONArray *alternativeNamesJSON = (TJSONArray*) js->Get(L"alternativeNames")->JsonValue;
vector<UnicodeString> &alternativeNames = getCurrentProject().getAlternativeNames();
for (int i = 0; i < alternativeNamesJSON->Size(); ++i) {
alternativeNames.push_back(alternativeNamesJSON->Get(i)->Value());
}
TJSONObject *crteriaEstimatesJSON = (TJSONObject*) js->Get(L"criteriaEstimates")->JsonValue;
TJSONArray *crteriaEstimatesArray = (TJSONArray*) crteriaEstimatesJSON->Get(L"priorities")->JsonValue;
Estimates &criteriaEstimates = currentProject->getCriteriaEstimates();
vector<double> &priorities = criteriaEstimates.getPriorities();
for (int i = 0; i < crteriaEstimatesArray->Size(); ++i) {
priorities.push_back(StrToFloat(crteriaEstimatesArray->Get(i)->Value()));
}
TJSONArray *crteriaRatesTable = (TJSONArray*) crteriaEstimatesJSON->Get(L"rates")->JsonValue;
vector< vector<int> > &rates = criteriaEstimates.getRates();
for (int i = 0; i < crteriaRatesTable->Size(); ++i) {
vector<int> v;
TJSONArray *crteriaRatesRow = (TJSONArray*) crteriaRatesTable->Get(i);
for (int j = 0; j < crteriaRatesRow->Size(); ++j) {
v.push_back(StrToInt(crteriaRatesRow->Get(j)->Value()));
}
rates.push_back(v);
}
TJSONArray *alternativeEstimatesJSON = (TJSONArray*) js->Get(L"alternativeEstimates")->JsonValue;
vector<Estimates> &alternativeEstimates = getCurrentProject().getAlternativeEstimates();
for (int i = 0; i < alternativeEstimatesJSON->Size(); ++i) {
TJSONObject *alternativeJSON = (TJSONObject*) alternativeEstimatesJSON->Get(i);
alternativeEstimates.push_back(Estimates());
TJSONArray *prioritiesJSON = (TJSONArray*) alternativeJSON->Get(L"priorities")->JsonValue;
vector<double> &priorities = alternativeEstimates[i].getPriorities();
for (int j = 0; j < prioritiesJSON->Size(); ++j) {
UnicodeString str = prioritiesJSON->Get(j)->Value();
priorities.push_back(StrToFloat(str));
}
TJSONArray *alternativeRatesTable = (TJSONArray*) alternativeJSON->Get(L"rates")->JsonValue;
vector< vector<int> > &rates = alternativeEstimates[i].getRates();
for (int j = 0; j < alternativeRatesTable->Size(); ++j) {
vector<int> v;
TJSONArray *alternativeRatesRow = (TJSONArray*) alternativeRatesTable->Get(j);
for (int k = 0; k < alternativeRatesRow->Size(); ++k) {
v.push_back(StrToInt(alternativeRatesRow->Get(k)->Value()));
}
rates.push_back(v);
}
}
getCurrentProject().setName(js->Get(L"projectName")->JsonValue->Value());
getCurrentProject().setMethod(StrToInt(js->Get(L"method")->JsonValue->Value()));
delete [] chars;
js->Free();
setIsProjectOpen(true);
setIsCurrentProjectSaved(true);
return getCurrentProject();
} __finally {
fs->Free();
}
return getCurrentProject();
}