mirror of
https://github.com/sfall-team/int2ssl.git
synced 2026-07-27 16:52:42 -07:00
Code formating
This commit is contained in:
@@ -26,6 +26,5 @@ ULONG CArchive::Read(char *buffer, ULONG size)
|
||||
{
|
||||
ULONG count;
|
||||
count = _file->_istream.readsome(buffer, size);
|
||||
//_file->_istream.seekg(_file->_istream.tellg(), std::ios_base::beg);
|
||||
return count;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// int2ssl.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
#include "stdafx.h"
|
||||
#include "FalloutScript.h"
|
||||
#include "XGetopt.h"
|
||||
@@ -7,11 +5,7 @@
|
||||
|
||||
using namespace std;
|
||||
|
||||
// The one and only application object
|
||||
|
||||
// Globals
|
||||
|
||||
|
||||
BOOL g_bDump = FALSE;
|
||||
int g_nFalloutVersion = 2;
|
||||
CString g_strIndentFill("\t");
|
||||
@@ -47,25 +41,46 @@ int main(int argc, char* argv[])
|
||||
printf(" --: end of options\n");
|
||||
printf("\n");
|
||||
|
||||
//if (argc < 2) {
|
||||
// PrintUsage(argv[0]);
|
||||
// cin.get();
|
||||
// return 1;
|
||||
//}
|
||||
// if (argc < 2)
|
||||
// {
|
||||
// PrintUsage(argv[0]);
|
||||
// cin.get();
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
//if (!ProcessCommandLine(argc, argv)) {
|
||||
// return 1;
|
||||
//}
|
||||
// if (!ProcessCommandLine(argc, argv))
|
||||
// {
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
CFile fileInput;
|
||||
CFile fileOutput;
|
||||
|
||||
//if (fileInput.Open(g_strInputFileName, CFile::modeRead | CFile::shareDenyWrite)) {
|
||||
if (fileInput.Open(CString("BECA.int"), CFile::modeRead | CFile::shareDenyWrite))
|
||||
g_strInputFileName = "BECA.int";
|
||||
g_strOutputFileName = "BECA.int.ssl";
|
||||
|
||||
if (!fileInput.Open(g_strInputFileName, CFile::modeRead | CFile::shareDenyWrite))
|
||||
{
|
||||
//if (fileOutput.Open(g_strOutputFileName, CFile::modeCreate | CFile::modeWrite | CFile::typeText | CFile::shareDenyWrite)) {
|
||||
if (fileOutput.Open(CString("BECA.int.ssl"), CFile::modeCreate | CFile::modeWrite | CFile::typeText | CFile::shareDenyWrite))
|
||||
printf("Error: Unable open input file %s.\n", g_strInputFileName.c_str());
|
||||
if (g_bStopOnError == TRUE)
|
||||
{
|
||||
printf("Press ENTER to continue.\n");
|
||||
cin.get();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (!fileOutput.Open(g_strOutputFileName, CFile::modeCreate | CFile::modeWrite | CFile::typeText | CFile::shareDenyWrite))
|
||||
{
|
||||
printf("Error: Unable open output file %s.\n", g_strOutputFileName.c_str());
|
||||
if (g_bStopOnError == TRUE)
|
||||
{
|
||||
printf("Press ENTER to continue.\n");
|
||||
cin.get();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
CArchive arInput(&fileInput, CArchive::load);
|
||||
@@ -80,7 +95,6 @@ int main(int argc, char* argv[])
|
||||
CArchive arOutput(&fileOutput, CArchive::store);
|
||||
|
||||
if (g_bDump)
|
||||
//if (true)
|
||||
{
|
||||
printf("Dumping...\n", g_strInputFileName.c_str());
|
||||
Script.Dump(arOutput);
|
||||
@@ -106,47 +120,31 @@ int main(int argc, char* argv[])
|
||||
catch (const UserException& e)
|
||||
{
|
||||
// Error message already displayed
|
||||
if (g_bStopOnError == TRUE) {
|
||||
if (g_bStopOnError == TRUE)
|
||||
{
|
||||
printf("Press ENTER to continue.\n");
|
||||
cin.get();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
catch(...) {
|
||||
catch(...)
|
||||
{
|
||||
return 1;
|
||||
/*
|
||||
const int c_nErrMsgLen = 1024;
|
||||
TCHAR lpszErrMsg[c_nErrMsgLen];
|
||||
e->GetErrorMessage(lpszErrMsg, c_nErrMsgLen);
|
||||
printf("Error: %s.\n", lpszErrMsg);
|
||||
if (g_bStopOnError == TRUE) {
|
||||
printf("Press ENTER to continue.\n");
|
||||
cin.get();
|
||||
}
|
||||
return 1;*/
|
||||
|
||||
// const int c_nErrMsgLen = 1024;
|
||||
// TCHAR lpszErrMsg[c_nErrMsgLen];
|
||||
// e->GetErrorMessage(lpszErrMsg, c_nErrMsgLen);
|
||||
// printf("Error: %s.\n", lpszErrMsg);
|
||||
// if (g_bStopOnError == TRUE)
|
||||
// {
|
||||
// printf("Press ENTER to continue.\n");
|
||||
// cin.get();
|
||||
// }
|
||||
// return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
else {
|
||||
printf("Error: Unable open file %s.\n", g_strOutputFileName.c_str());
|
||||
if (g_bStopOnError == TRUE) {
|
||||
printf("Press ENTER to continue.\n");
|
||||
cin.get();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
printf("Error: Unable open file %s.\n", g_strInputFileName.c_str());
|
||||
if (g_bStopOnError == TRUE) {
|
||||
printf("Press ENTER to continue.\n");
|
||||
cin.get();
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PrintUsage(char* lpszFileName)
|
||||
@@ -169,8 +167,10 @@ BOOL ProcessCommandLine(int argc, char* argv[])
|
||||
int c;
|
||||
int nIndentWidth;
|
||||
|
||||
while((c = getopt(argc, argv, "d1abes:")) != EOF) {
|
||||
switch (c) {
|
||||
while((c = getopt(argc, argv, "d1abes:")) != EOF)
|
||||
{
|
||||
switch (c)
|
||||
{
|
||||
case 'd':
|
||||
g_bDump = TRUE;
|
||||
printf("dump file is on.\n");
|
||||
@@ -199,7 +199,8 @@ BOOL ProcessCommandLine(int argc, char* argv[])
|
||||
case 's':
|
||||
nIndentWidth = atoi(optarg);
|
||||
|
||||
if (nIndentWidth <= 0) {
|
||||
if (nIndentWidth <= 0)
|
||||
{
|
||||
printf("Warning: Invalid indent width. Indent set 3\n");
|
||||
nIndentWidth = 3;
|
||||
}
|
||||
@@ -207,15 +208,18 @@ BOOL ProcessCommandLine(int argc, char* argv[])
|
||||
g_strIndentFill = "";
|
||||
|
||||
for(; nIndentWidth > 0; nIndentWidth--)
|
||||
{
|
||||
g_strIndentFill += " ";
|
||||
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (optind == argc) {
|
||||
if (optind == argc)
|
||||
{
|
||||
printf("Error: Input file name omitted\n");
|
||||
if (g_bStopOnError == TRUE) {
|
||||
if (g_bStopOnError == TRUE)
|
||||
{
|
||||
printf("Press ENTER to continue.\n");
|
||||
cin.get();
|
||||
}
|
||||
@@ -225,22 +229,25 @@ BOOL ProcessCommandLine(int argc, char* argv[])
|
||||
g_strInputFileName = argv[optind];
|
||||
optind++;
|
||||
|
||||
if (optind < argc) {
|
||||
if (optind < argc)
|
||||
{
|
||||
g_strOutputFileName = argv[optind];
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
g_strOutputFileName = g_strInputFileName;
|
||||
|
||||
/*
|
||||
if (g_strOutputFileName.Right(4).MakeLower() == ".int") {
|
||||
g_strOutputFileName = g_strOutputFileName.Left(g_strOutputFileName.GetLength() - 4);
|
||||
}
|
||||
*/
|
||||
// if (g_strOutputFileName.Right(4).MakeLower() == ".int")
|
||||
// {
|
||||
// g_strOutputFileName = g_strOutputFileName.Left(g_strOutputFileName.GetLength() - 4);
|
||||
// }
|
||||
|
||||
if (g_bDump) {
|
||||
if (g_bDump)
|
||||
{
|
||||
g_strOutputFileName += ".dump";
|
||||
}
|
||||
else {
|
||||
else
|
||||
{
|
||||
g_strOutputFileName += ".ssl";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user