2010-09-19 01:16:05 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* Copyright (C) 2009
|
|
|
|
* by Dimok
|
|
|
|
*
|
|
|
|
* This software is provided 'as-is', without any express or implied
|
|
|
|
* warranty. In no event will the authors be held liable for any
|
|
|
|
* damages arising from the use of this software.
|
|
|
|
*
|
|
|
|
* Permission is granted to anyone to use this software for any
|
|
|
|
* purpose, including commercial applications, and to alter it and
|
|
|
|
* redistribute it freely, subject to the following restrictions:
|
|
|
|
*
|
|
|
|
* 1. The origin of this software must not be misrepresented; you
|
|
|
|
* must not claim that you wrote the original software. If you use
|
|
|
|
* this software in a product, an acknowledgment in the product
|
|
|
|
* documentation would be appreciated but is not required.
|
|
|
|
*
|
|
|
|
* 2. Altered source versions must be plainly marked as such, and
|
|
|
|
* must not be misrepresented as being the original software.
|
|
|
|
*
|
|
|
|
* 3. This notice may not be removed or altered from any source
|
|
|
|
* distribution.
|
|
|
|
*
|
|
|
|
* update.cpp
|
|
|
|
*
|
|
|
|
* Update operations
|
|
|
|
* for Wii-Xplorer 2009
|
|
|
|
***************************************************************************/
|
2010-05-30 09:00:29 +02:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <ogcsys.h>
|
|
|
|
|
|
|
|
#include "http.h"
|
|
|
|
#include "networkops.h"
|
|
|
|
#include "HTML_Stream.h"
|
|
|
|
|
|
|
|
/****************************************************************************
|
|
|
|
* Checking if an Update is available
|
|
|
|
***************************************************************************/
|
|
|
|
int CheckForBetaUpdate()
|
|
|
|
{
|
|
|
|
int revnumber = 0;
|
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
HTML_Stream HTML( "http://code.google.com/p/usbloader-gui/downloads/list" );
|
2010-05-30 09:00:29 +02:00
|
|
|
|
|
|
|
const char * HTML_Pos = NULL;
|
|
|
|
|
|
|
|
do
|
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
HTML_Pos = HTML.FindStringEnd( "href='" );
|
|
|
|
char * tmpLink = HTML.CopyString( "'\"" );
|
|
|
|
if ( tmpLink )
|
2010-05-30 09:00:29 +02:00
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
char *fileext = strrchr( tmpLink, '.' );
|
|
|
|
if ( fileext )
|
2010-05-30 09:00:29 +02:00
|
|
|
{
|
2010-09-19 01:16:05 +02:00
|
|
|
if ( strcasecmp( fileext, ".dol" ) == 0 )
|
2010-05-30 09:00:29 +02:00
|
|
|
{
|
|
|
|
char revtxt[80];
|
2010-09-19 01:16:05 +02:00
|
|
|
char *filename = strrchr( tmpLink, '/' ) + 2;
|
2010-05-30 09:00:29 +02:00
|
|
|
u8 n = 0;
|
2010-09-19 01:16:05 +02:00
|
|
|
for ( n = 0; n < strlen( filename ) - 2; n++ )
|
2010-05-30 09:00:29 +02:00
|
|
|
revtxt[n] = filename[n];
|
|
|
|
revtxt[n] = 0;
|
2010-09-19 01:16:05 +02:00
|
|
|
int fileRev = atoi( revtxt );
|
2010-05-30 09:00:29 +02:00
|
|
|
|
2010-09-19 01:16:05 +02:00
|
|
|
if ( fileRev > revnumber )
|
2010-05-30 09:00:29 +02:00
|
|
|
{
|
|
|
|
revnumber = fileRev;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
free( tmpLink );
|
2010-05-30 09:00:29 +02:00
|
|
|
}
|
|
|
|
}
|
2010-09-19 01:16:05 +02:00
|
|
|
while ( HTML_Pos != NULL );
|
2010-05-30 09:00:29 +02:00
|
|
|
|
|
|
|
return revnumber;
|
|
|
|
}
|