@ -1,5 +1,5 @@
// main.c
// main.c
// Jedi Academy Server Log Converter - Version 1.1
// Jedi Academy Server Log Converter - Version 2.0
//
//
// Created By Steven Mattera on August 30th 2010.
// Created By Steven Mattera on August 30th 2010.
// Copyright (c) 2010 Steven Mattera <stevenmattera@gmail.com>
// Copyright (c) 2010 Steven Mattera <stevenmattera@gmail.com>
@ -23,194 +23,432 @@
# include <stdio.h>
# include <stdio.h>
# include <stdlib.h>
# include <stdlib.h>
# include <string.h>
# include <string.h>
# include <limits.h>
# include <windows.h>
# include <unistd.h>
# include "resource.h"
FILE * openLogFile ( char * path ) ;
enum {
FILE * openConvFile ( char * argv [ ] ) ;
ID_LOADEDIT = 1 ,
ID_LOADBUTTON ,
int main ( int argc , char * argv [ ] ) {
ID_SAVEEDIT ,
FILE * logFile ;
ID_SAVEBUTTON ,
FILE * convFile ;
ID_CONVERTBUTTON
} ;
printf ( " Jedi Academy Server Log Converter \n " ) ;
printf ( " Copyright (c) 2010 Steven Mattera <stevenmattera@gmail.com> \n \n " ) ;
LRESULT CALLBACK WndProc ( HWND hwnd , UINT msg , WPARAM wParam , LPARAM lParam ) ;
printf ( " Jedi Academy Server Log Converter is free software; you can redistribute it \n " ) ;
printf ( " and/or modify it under the terms of the GNU General Public License as published \n " ) ;
int WINAPI WinMain ( HINSTANCE hInstance , HINSTANCE hPrevInstance , LPSTR lpCmdLine , int nCmdShow ) {
printf ( " by the Free Software Foundation; either version 2 of the License, or (at your \n " ) ;
WNDCLASSEX wc ;
printf ( " option) any later version. \n \n " ) ;
MSG Msg ;
printf ( " Jedi Academy Server Log Converter is distributed in the hope that it will be \n " ) ;
HWND hwnd ;
printf ( " useful, but WITHOUT ANY WARRENTY; without even the implied warrenty of \n " ) ;
printf ( " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public \n " ) ;
wc . cbSize = sizeof ( WNDCLASSEX ) ;
printf ( " License for more deails. \n \n " ) ;
wc . style = 0 ;
printf ( " You should have received a copy of the GNU General Public License along with \n " ) ;
wc . lpfnWndProc = WndProc ;
printf ( " Jedi Academy Server Log Converter; if not, write to the Free Software \n " ) ;
wc . cbClsExtra = 0 ;
printf ( " Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA \n \n " ) ;
wc . cbWndExtra = 0 ;
wc . hInstance = hInstance ;
if ( argc ! = 2 ) {
wc . hIcon = LoadIcon ( GetModuleHandle ( NULL ) , MAKEINTRESOURCE ( IDI_MYICON ) ) ;
printf ( " Usage: JALOG_CONV.EXE <PATH_TO_LOG> \n " ) ;
wc . hCursor = LoadCursor ( NULL , IDC_ARROW ) ;
system ( " pause " ) ;
wc . hbrBackground = GetSysColorBrush ( COLOR_3DFACE ) ;
wc . lpszMenuName = NULL ;
return - 1 ;
wc . lpszClassName = " mainWindow " ;
wc . hIconSm = ( HICON ) LoadImage ( GetModuleHandle ( NULL ) , MAKEINTRESOURCE ( IDI_MYICON ) , IMAGE_ICON , 16 , 16 , 0 ) ;
if ( ! RegisterClassEx ( & wc ) ) {
MessageBox ( NULL , " Window Registration Failed! " , " Error " , MB_ICONEXCLAMATION | MB_OK ) ;
return 0 ;
}
}
logFile = openLogFile ( argv [ 1 ] ) ;
hwnd = CreateWindowEx ( 0 , " mainWindow " , " Jedi Academy Server Log Converter " , WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX , ( GetSystemMetrics ( SM_CXSCREEN ) - 500 ) / 2 , ( GetSystemMetrics ( SM_CYSCREEN ) - 72 ) / 2 , 500 , 100 , NULL , NULL , hInstance , NULL ) ;
if ( logFile = = NULL ) return - 1 ;
if ( hwnd = = NULL ) {
convFile = openConvFile ( argv ) ;
MessageBox ( NULL , " Window Creation Failed! " , " Error " , MB_ICONEXCLAMATION | MB_OK ) ;
if ( convFile = = NULL ) return - 1 ;
return 0 ;
}
fputs ( " <html><head><style>body{background-color:gray}b{font-weight:normal}.r{color:red}.g{color:green}.y{color:yellow}.b{color:blue}.c{color:cyan}.m{color:magenta}.w{color:white}.l{color:black}</style></head><body><span class='w'> " , convFile ) ;
ShowWindow ( hwnd , nCmdShow ) ;
char * line ;
UpdateWindow ( hwnd ) ;
char * lineProcessing ;
char * convLine ;
MessageBox ( hwnd , " Jedi Academy Server Log Converter \n Copyright (c) 2010 Steven Mattera <stevenmattera@gmail.com> \n \n Jedi Academy Server Log Converter is free software; you can redistribute it \n and/or modify it under the terms of the GNU General Public License as published \n by the Free Software Foundation; either version 2 of the License, or (at your \n option) any later version. \n \n Jedi Academy Server Log Converter is distributed in the hope that it will be \n useful, but WITHOUT ANY WARRENTY; without even the implied warrenty of \n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public \n License for more deails. \n \n You should have received a copy of the GNU General Public License along with \n Jedi Academy Server Log Converter; if not, write to the Free Software \n Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA " , " Welcome to Jedi Academy Server Log Converter " , MB_OK ) ;
size_t currentPosition ;
int color = 7 ;
while ( GetMessage ( & Msg , NULL , 0 , 0 ) > 0 ) {
TranslateMessage ( & Msg ) ;
while ( ! feof ( logFile ) ) {
DispatchMessage ( & Msg ) ;
line = ( char * ) malloc ( sizeof ( char ) * 512 ) ;
}
memset ( line , ' \0 ' , sizeof ( char ) * 512 ) ;
return Msg . wParam ;
fgets ( line , 512 , logFile ) ;
}
if ( color ! = 7 ) {
fputs ( " </b><b class=w> " , convFile ) ;
LRESULT CALLBACK WndProc ( HWND hwnd , UINT msg , WPARAM wParam , LPARAM lParam ) {
color = 7 ;
char szFileName [ MAX_PATH ] = " " ;
}
OPENFILENAME ofn ;
int n ;
switch ( msg ) {
for ( n = 0 ; n < strlen ( line ) ; n + + ) {
case WM_CREATE :
if ( line [ n ] = = ' ^ ' ) {
HFONT hfDefault ;
switch ( atoi ( & line [ n + 1 ] ) ) {
HWND hLoadEdit ;
case 1 :
HWND hLoadButton ;
if ( color ! = 1 ) {
HWND hSaveEdit ;
color = 1 ;
HWND hSaveButton ;
fputs ( " </b><b class='r'> " , convFile ) ;
HWND hConvertButton ;
}
break ;
hLoadEdit = CreateWindowEx ( WS_EX_CLIENTEDGE , " EDIT " , " " , WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL , 10 , 10 , 300 , 21 , hwnd , ( HMENU ) ID_LOADEDIT , GetModuleHandle ( NULL ) , NULL ) ;
case 2 :
hLoadButton = CreateWindowEx ( 0 , " BUTTON " , " Input " , WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON , 320 , 10 , 70 , 21 , hwnd , ( HMENU ) ID_LOADBUTTON , GetModuleHandle ( NULL ) , NULL ) ;
if ( color ! = 2 ) {
hSaveEdit = CreateWindowEx ( WS_EX_CLIENTEDGE , " EDIT " , " " , WS_CHILD | WS_VISIBLE | ES_AUTOHSCROLL , 10 , 41 , 300 , 21 , hwnd , ( HMENU ) ID_SAVEEDIT , GetModuleHandle ( NULL ) , NULL ) ;
color = 2 ;
hSaveButton = CreateWindowEx ( 0 , " BUTTON " , " Output " , WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON , 320 , 41 , 70 , 21 , hwnd , ( HMENU ) ID_SAVEBUTTON , GetModuleHandle ( NULL ) , NULL ) ;
fputs ( " </b><b class='g'> " , convFile ) ;
hConvertButton = CreateWindowEx ( 0 , " BUTTON " , " Convert " , WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON , 400 , 10 , 80 , 52 , hwnd , ( HMENU ) ID_CONVERTBUTTON , GetModuleHandle ( NULL ) , NULL ) ;
}
break ;
hfDefault = ( HFONT ) GetStockObject ( DEFAULT_GUI_FONT ) ;
case 3 :
SendMessage ( hLoadEdit , WM_SETFONT , ( WPARAM ) hfDefault , MAKELPARAM ( FALSE , 0 ) ) ;
if ( color ! = 3 ) {
SendMessage ( hLoadButton , WM_SETFONT , ( WPARAM ) hfDefault , MAKELPARAM ( FALSE , 0 ) ) ;
color = 3 ;
SendMessage ( hSaveEdit , WM_SETFONT , ( WPARAM ) hfDefault , MAKELPARAM ( FALSE , 0 ) ) ;
fputs ( " </b><b class=y'> " , convFile ) ;
SendMessage ( hSaveButton , WM_SETFONT , ( WPARAM ) hfDefault , MAKELPARAM ( FALSE , 0 ) ) ;
}
SendMessage ( hConvertButton , WM_SETFONT , ( WPARAM ) hfDefault , MAKELPARAM ( FALSE , 0 ) ) ;
break ;
break ;
case 4 :
case WM_CLOSE :
if ( color ! = 4 ) {
DestroyWindow ( hwnd ) ;
color = 4 ;
break ;
fputs ( " </b><b class='b'> " , convFile ) ;
case WM_DESTROY :
}
PostQuitMessage ( 0 ) ;
break ;
break ;
case 5 :
case WM_COMMAND :
if ( color ! = 5 ) {
switch ( wParam ) {
color = 5 ;
case ID_LOADBUTTON :
fputs ( " </b><b class='c'> " , convFile ) ;
ZeroMemory ( & ofn , sizeof ( ofn ) ) ;
}
break ;
ofn . lStructSize = sizeof ( ofn ) ;
case 6 :
ofn . hwndOwner = hwnd ;
if ( color ! = 6 ) {
ofn . lpstrFilter = " Log Files (*.log) \0 *.log \0 Log Files (*.txt) \0 *.txt \0 All Files (*.*) \0 *.* \0 " ;
color = 6 ;
ofn . lpstrFile = szFileName ;
fputs ( " </b><b class='m'> " , convFile ) ;
ofn . nMaxFile = MAX_PATH ;
}
ofn . Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY ;
break ;
ofn . lpstrDefExt = " log " ;
case 7 :
if ( color ! = 7 ) {
if ( GetOpenFileName ( & ofn ) ) {
color = 7 ;
HWND hLoadEdit = GetDlgItem ( hwnd , ID_LOADEDIT ) ;
fputs ( " </b><b class='w'> " , convFile ) ;
SetWindowText ( hLoadEdit , szFileName ) ;
}
}
break ;
case ID_SAVEBUTTON :
ZeroMemory ( & ofn , sizeof ( ofn ) ) ;
ofn . lStructSize = sizeof ( ofn ) ;
ofn . hwndOwner = hwnd ;
ofn . lpstrFilter = " HTML Files (*.html) \0 *.html \0 RTF Files (*.rtf) \0 *.rtf \0 Text Files (*.txt) \0 *.txt \0 " ;
ofn . lpstrFile = szFileName ;
ofn . nMaxFile = MAX_PATH ;
ofn . Flags = OFN_EXPLORER | OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT ;
ofn . lpstrDefExt = " html " ;
if ( GetSaveFileName ( & ofn ) ) {
HWND hSaveEdit = GetDlgItem ( hwnd , ID_SAVEEDIT ) ;
SetWindowText ( hSaveEdit , szFileName ) ;
}
break ;
case ID_CONVERTBUTTON :
HWND hLoadEdit = GetDlgItem ( hwnd , ID_LOADEDIT ) ;
HWND hLoadButton = GetDlgItem ( hwnd , ID_LOADBUTTON ) ;
HWND hSaveEdit = GetDlgItem ( hwnd , ID_SAVEEDIT ) ;
HWND hSaveButton = GetDlgItem ( hwnd , ID_SAVEBUTTON ) ;
char loadFilename [ MAX_PATH ] = " " ;
char saveFilename [ MAX_PATH ] = " " ;
FILE * loadFile , * saveFile ;
GetWindowText ( hLoadEdit , loadFilename , MAX_PATH ) ;
GetWindowText ( hSaveEdit , saveFilename , MAX_PATH ) ;
if ( strcmp ( loadFilename , saveFilename ) = = 0 ) {
MessageBox ( hwnd , " Can not overwrite input file with output file. " , " Error " , MB_ICONEXCLAMATION | MB_OK ) ;
break ;
break ;
case 0 :
}
if ( color ! = 8 ) {
color = 8 ;
loadFile = fopen ( loadFilename , " r " ) ;
fputs ( " </b><b class='l'> " , convFile ) ;
if ( loadFile = = NULL ) {
}
MessageBox ( hwnd , " Opening file stream. " , " Error " , MB_ICONEXCLAMATION | MB_OK ) ;
break ;
break ;
default :
}
fputc ( ' ^ ' , convFile ) ;
fputc ( line [ n + 1 ] , convFile ) ;
saveFile = fopen ( saveFilename , " w+ " ) ;
if ( saveFile = = NULL ) {
MessageBox ( hwnd , " Opening file stream. " , " Error " , MB_ICONEXCLAMATION | MB_OK ) ;
fclose ( loadFile ) ;
break ;
break ;
}
}
n + + ;
}
else if ( line [ n ] = = ' : ' & & color ! = 7 ) {
fputs ( " </b><b class='w'> " , convFile ) ;
fputc ( ' : ' , convFile ) ;
}
else if ( line [ n ] = = ' \\ ' & & color ! = 7 ) {
fputs ( " </b><b class='w'> " , convFile ) ;
fputc ( ' \\ ' , convFile ) ;
}
else if ( line [ n ] = = ' ' & & line [ n + 1 ] = = ' k ' & & line [ n + 2 ] = = ' i ' & & line [ n + 3 ] = = ' l ' & & line [ n + 4 ] = = ' l ' & & line [ n + 5 ] = = ' e ' & & line [ n + 6 ] = = ' d ' & & line [ n + 7 ] = = ' ' & & color ! = 7 ) {
fputs ( " </b><b class='w'> " , convFile ) ;
fputc ( ' ' , convFile ) ;
}
else if ( line [ n ] = = ' ' & & line [ n + 1 ] = = ' b ' & & line [ n + 2 ] = = ' y ' & & line [ n + 3 ] = = ' ' & & color ! = 7 ) {
fputs ( " </b><b class='w'> " , convFile ) ;
fputc ( ' ' , convFile ) ;
}
else if ( line [ n ] = = ' < ' ) {
fputs ( " < " , convFile ) ;
}
else if ( line [ n ] = = ' > ' ) {
fputs ( " > " , convFile ) ;
}
else if ( line [ n ] = = ' & ' ) {
fputs ( " & " , convFile ) ;
}
else if ( line [ n ] ! = ' \n ' | | line [ n ] ! = ' \r ' ) {
fputc ( line [ n ] , convFile ) ;
}
}
fputs ( " <br> " , convFile ) ;
char * saveFileExt = strrchr ( saveFilename , ' . ' ) ;
char * line ;
int color = 7 ;
free ( line ) ;
if ( strcmp ( saveFileExt , " .html " ) = = 0 ) {
}
fputs ( " <html><head><style>body{background-color:gray}b{font-weight:normal}.r{color:red}.g{color:green}.y{color:yellow}.b{color:blue}.c{color:cyan}.m{color:magenta}.w{color:white}.l{color:black}</style></head><body><span class='w'> " , saveFile ) ;
fputs ( " </body></html> " , convFile ) ;
while ( ! feof ( loadFile ) ) {
line = ( char * ) malloc ( sizeof ( char ) * 512 ) ;
memset ( line , ' \0 ' , sizeof ( char ) * 512 ) ;
fclose ( convFile ) ;
fgets ( line , 512 , loadFile ) ;
fclose ( logFile ) ;
if ( color ! = 7 ) {
fputs ( " </b><b class=w> " , saveFile ) ;
color = 7 ;
}
return 0 ;
int n ;
}
for ( n = 0 ; n < strlen ( line ) ; n + + ) {
if ( line [ n ] = = ' ^ ' ) {
switch ( atoi ( & line [ n + 1 ] ) ) {
case 1 :
if ( color ! = 1 ) {
color = 1 ;
fputs ( " </b><b class=r> " , saveFile ) ;
}
break ;
case 2 :
if ( color ! = 2 ) {
color = 2 ;
fputs ( " </b><b class=g> " , saveFile ) ;
}
break ;
case 3 :
if ( color ! = 3 ) {
color = 3 ;
fputs ( " </b><b class=y> " , saveFile ) ;
}
break ;
case 4 :
if ( color ! = 4 ) {
color = 4 ;
fputs ( " </b><b class=b> " , saveFile ) ;
}
break ;
case 5 :
if ( color ! = 5 ) {
color = 5 ;
fputs ( " </b><b class=c> " , saveFile ) ;
}
break ;
case 6 :
if ( color ! = 6 ) {
color = 6 ;
fputs ( " </b><b class=m> " , saveFile ) ;
}
break ;
case 7 :
if ( color ! = 7 ) {
color = 7 ;
fputs ( " </b><b class=w> " , saveFile ) ;
}
break ;
case 0 :
if ( color ! = 8 ) {
color = 8 ;
fputs ( " </b><b class=l> " , saveFile ) ;
}
break ;
default :
fputc ( ' ^ ' , saveFile ) ;
fputc ( line [ n + 1 ] , saveFile ) ;
break ;
}
n + + ;
}
else if ( line [ n ] = = ' : ' & & color ! = 7 ) {
fputs ( " </b><b class=w> " , saveFile ) ;
fputc ( ' : ' , saveFile ) ;
}
else if ( line [ n ] = = ' \\ ' & & color ! = 7 ) {
fputs ( " </b><b class=w> " , saveFile ) ;
fputc ( ' \\ ' , saveFile ) ;
}
else if ( line [ n ] = = ' ' & & line [ n + 1 ] = = ' k ' & & line [ n + 2 ] = = ' i ' & & line [ n + 3 ] = = ' l ' & & line [ n + 4 ] = = ' l ' & & line [ n + 5 ] = = ' e ' & & line [ n + 6 ] = = ' d ' & & line [ n + 7 ] = = ' ' & & color ! = 7 ) {
fputs ( " </b><b class=w> " , saveFile ) ;
fputc ( ' ' , saveFile ) ;
}
else if ( line [ n ] = = ' ' & & line [ n + 1 ] = = ' b ' & & line [ n + 2 ] = = ' y ' & & line [ n + 3 ] = = ' ' & & color ! = 7 ) {
fputs ( " </b><b class=w> " , saveFile ) ;
fputc ( ' ' , saveFile ) ;
}
else if ( line [ n ] = = ' < ' ) {
fputs ( " < " , saveFile ) ;
}
else if ( line [ n ] = = ' > ' ) {
fputs ( " > " , saveFile ) ;
}
else if ( line [ n ] = = ' & ' ) {
fputs ( " & " , saveFile ) ;
}
else if ( line [ n ] ! = ' \n ' & & line [ n ] ! = ' \r ' ) {
fputc ( line [ n ] , saveFile ) ;
}
}
FILE * openLogFile ( char * path ) {
fputs ( " <br> " , saveFile ) ;
FILE * logFile = fopen ( path , " r " ) ;
if ( logFile = = NULL ) {
free ( line ) ;
printf ( " Error: Opening reading stream. \n \n " ) ;
}
system ( " pause " ) ;
return NULL ;
fputs ( " </body></html> " , saveFile ) ;
}
}
else if ( strcmp ( saveFileExt , " .rtf " ) = = 0 ) {
fputs ( " { \\ rtf1 \\ ansi \\ ansicpg1252 \\ deff0 \\ deflang1033{ \\ fonttbl{ \\ f0 \\ fswiss \\ fcharset0 Arial;}}{ \\ colortbl ; \\ red255 \\ green0 \\ blue0; \\ red0 \\ green255 \\ blue0; \\ red255 \\ green255 \\ blue0; \\ red0 \\ green0 \\ blue255; \\ red255 \\ green0 \\ blue255; \\ red0 \\ green255 \\ blue255; \\ red255 \\ green255 \\ blue255;} \\ margl1440 \\ margr1440 \\ vieww9000 \\ viewh8400 \\ viewkind0{ \\ * \\ background { \\ shp{ \\ * \\ shpinst \\ shpleft0 \\ shptop0 \\ shpright0 \\ shpbottom0 \\ shpfhdr0 \\ shpbxmargin \\ shpbymargin \\ shpwr0 \\ shpwrk0 \\ shpfblwtxt1 \\ shpz0 \\ shplid1025{ \\ sp{ \\ sn shapeType}{ \\ sv 1}}{ \\ sp{ \\ sn fFlipH}{ \\ sv 0}}{ \\ sp{ \\ sn fFlipV}{ \\ sv 0}}{ \\ sp{ \\ sn fillColor}{ \\ sv 12237498}}{ \\ sp{ \\ sn fFilled}{ \\ sv 1}}{ \\ sp{ \\ sn lineWidth}{ \\ sv 0}}{ \\ sp{ \\ sn fLine}{ \\ sv 0}}{ \\ sp{ \\ sn bWMode}{ \\ sv 9}}{ \\ sp{ \\ sn fBackground}{ \\ sv 1}}}}} \\ pard \\ tx720 \\ tx1440 \\ tx2160 \\ tx2880 \\ tx3600 \\ tx4320 \\ tx5040 \\ tx5760 \\ tx6480 \\ tx7200 \\ tx7920 \\ tx8640 \\ ql \\ qnatural \\ pardirnatural \\ f0 \\ cf7 " , saveFile ) ;
return logFile ;
while ( ! feof ( loadFile ) ) {
}
line = ( char * ) malloc ( sizeof ( char ) * 512 ) ;
memset ( line , ' \0 ' , sizeof ( char ) * 512 ) ;
FILE * openConvFile ( char * argv [ ] ) {
fgets ( line , 512 , loadFile ) ;
char abs_exe_path [ MAX_PATH ] ;
if ( color ! = 7 ) {
fputs ( " \\ cf7 " , saveFile ) ;
color = 7 ;
}
char * pch = strrchr ( argv [ 0 ] , ' \\ ' ) ;
int n ;
strncpy ( abs_exe_path , argv [ 0 ] , pch - argv [ 0 ] + 1 ) ;
for ( n = 0 ; n < strlen ( line ) ; n + + ) {
free ( pch ) ;
if ( line [ n ] = = ' ^ ' ) {
switch ( atoi ( & line [ n + 1 ] ) ) {
case 1 :
if ( color ! = 1 ) {
color = 1 ;
fputs ( " \\ cf1 " , saveFile ) ;
}
break ;
case 2 :
if ( color ! = 2 ) {
color = 2 ;
fputs ( " \\ cf2 " , saveFile ) ;
}
break ;
case 3 :
if ( color ! = 3 ) {
color = 3 ;
fputs ( " \\ cf3 " , saveFile ) ;
}
break ;
case 4 :
if ( color ! = 4 ) {
color = 4 ;
fputs ( " \\ cf4 " , saveFile ) ;
}
break ;
case 5 :
if ( color ! = 5 ) {
color = 5 ;
fputs ( " \\ cf5 " , saveFile ) ;
}
break ;
case 6 :
if ( color ! = 6 ) {
color = 6 ;
fputs ( " \\ cf6 " , saveFile ) ;
}
break ;
case 7 :
if ( color ! = 7 ) {
color = 7 ;
fputs ( " \\ cf7 " , saveFile ) ;
}
break ;
case 0 :
if ( color ! = 8 ) {
color = 8 ;
fputs ( " \\ cf8 " , saveFile ) ;
}
break ;
default :
fputc ( ' ^ ' , saveFile ) ;
fputc ( line [ n + 1 ] , saveFile ) ;
break ;
}
n + + ;
}
else if ( line [ n ] = = ' : ' & & color ! = 7 ) {
fputs ( " \\ cf7 " , saveFile ) ;
fputc ( ' : ' , saveFile ) ;
}
else if ( line [ n ] = = ' \\ ' ) {
if ( color ! = 7 ) fputs ( " \\ cf7 \\ \\ " , saveFile ) ;
else fputs ( " \\ \\ " , saveFile ) ;
}
else if ( line [ n ] = = ' ' & & line [ n + 1 ] = = ' k ' & & line [ n + 2 ] = = ' i ' & & line [ n + 3 ] = = ' l ' & & line [ n + 4 ] = = ' l ' & & line [ n + 5 ] = = ' e ' & & line [ n + 6 ] = = ' d ' & & line [ n + 7 ] = = ' ' & & color ! = 7 ) {
fputs ( " \\ cf7 " , saveFile ) ;
}
else if ( line [ n ] = = ' ' & & line [ n + 1 ] = = ' b ' & & line [ n + 2 ] = = ' y ' & & line [ n + 3 ] = = ' ' & & color ! = 7 ) {
fputs ( " \\ cf7 " , saveFile ) ;
}
else if ( line [ n ] ! = ' \n ' & & line [ n ] ! = ' \r ' ) {
fputc ( line [ n ] , saveFile ) ;
}
}
char convPath [ PATH_MAX ] ;
fputs ( " \\ par " , saveFile ) ;
sprintf ( convPath , " %sJALOG_CONV.HTML " , abs_exe_path ) ;
FILE * convFile = fopen ( convPath , " w+ " ) ;
free ( line ) ;
}
fputs ( " } " , saveFile ) ;
}
else {
while ( ! feof ( loadFile ) ) {
line = ( char * ) malloc ( sizeof ( char ) * 513 ) ;
memset ( line , ' \0 ' , sizeof ( char ) * 513 ) ;
fgets ( line , 512 , loadFile ) ;
if ( convFile = = NULL ) {
int n ;
printf ( " Error: Opening writing stream. \n \n " ) ;
for ( n = 0 ; n < strlen ( line ) ; n + + ) {
system ( " pause " ) ;
if ( line [ n ] = = ' ^ ' ) {
switch ( atoi ( & line [ n + 1 ] ) ) {
case 1 :
//Skip and don't put anything.
break ;
case 2 :
//Skip and don't put anything.
break ;
case 3 :
//Skip and don't put anything.
break ;
case 4 :
//Skip and don't put anything.
break ;
case 5 :
//Skip and don't put anything.
break ;
case 6 :
//Skip and don't put anything.
break ;
case 7 :
//Skip and don't put anything.
break ;
case 0 :
//Skip and don't put anything.
break ;
default :
fputc ( ' ^ ' , saveFile ) ;
fputc ( line [ n + 1 ] , saveFile ) ;
break ;
}
n + + ;
}
else {
fputc ( line [ n ] , saveFile ) ;
}
}
free ( line ) ;
}
}
return NULL ;
fclose ( loadFile ) ;
fclose ( saveFile ) ;
MessageBox ( NULL , " Server log successfully converted. " , " Conversion Complete " , MB_ICONASTERISK | MB_OK ) ;
break ;
}
break ;
default :
return DefWindowProc ( hwnd , msg , wParam , lParam ) ;
}
}
return convFile ;
return 0 ;
}
}