mirror of
https://github.com/reactos/reactos.git
synced 2025-08-07 03:22:58 +00:00
update SVN properties
svn path=/trunk/; revision=17143
This commit is contained in:
parent
100b8232d0
commit
4f8cc9596c
69 changed files with 14676 additions and 14676 deletions
|
@ -1,101 +1,101 @@
|
|||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// options.cpp
|
||||
//
|
||||
// Settting and Loading Options
|
||||
//
|
||||
//
|
||||
// Maarten Bosma, 09.01.2004
|
||||
// maarten.paul@bosma.de
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "package.hpp"
|
||||
#include "log.h"
|
||||
#include "expat.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
||||
int PML_XmlDownload (pTree tree, const char* url, void* usrdata,
|
||||
XML_StartElementHandler start, XML_EndElementHandler end, XML_CharacterDataHandler text) ;
|
||||
|
||||
|
||||
// expat callback for start of a "node" tag
|
||||
void opt_start (void* usrdata, const char* tag, const char** arg)
|
||||
{
|
||||
TREE* tree = (TREE*)usrdata;
|
||||
|
||||
if (!strcmp(tag, "source"))
|
||||
{
|
||||
tree->sources.push_back((char*)NULL);
|
||||
tree->field = &tree->sources.back();
|
||||
}
|
||||
}
|
||||
|
||||
// expat callback for end of a "node" tag
|
||||
void opt_end (void* usrdata, const char* tag)
|
||||
{
|
||||
TREE* tree = (TREE*)usrdata;
|
||||
|
||||
tree->field = NULL;
|
||||
}
|
||||
|
||||
// expat callback for end of a "node" tag
|
||||
void opt_text (void* usrdata, const char* data, int len)
|
||||
{
|
||||
TREE* tree = (TREE*)usrdata;
|
||||
|
||||
if(!tree->field)
|
||||
return;
|
||||
|
||||
*tree->field = new char[len+1];
|
||||
strncpy(*tree->field, data, len);
|
||||
(*tree->field)[len] = '\0';
|
||||
}
|
||||
|
||||
|
||||
// ! ! ! F I X M E ! ! ! //
|
||||
/*
|
||||
int CreateOptions (TREE* tree)
|
||||
{
|
||||
ofstream file ("options.xml");
|
||||
|
||||
Log("* Creating options.xml from Resources");
|
||||
|
||||
HRSRC hres = FindResource(GetModuleHandle(L"package"), MAKEINTRESOURCE(123), RT_RCDATA);
|
||||
if (!hres)
|
||||
{
|
||||
Log("! ERROR: Could not load it !");
|
||||
return ERR_GENERIC;
|
||||
}
|
||||
|
||||
MessageBox(0,(WCHAR*)LockResource(LoadResource(NULL, hres)), 0, 0); // is empty
|
||||
//file << (WCHAR*)LockResource(LoadResource(NULL, hres));
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
char* PML_Download (pTree, const char* url, const char* server, const char* filename);
|
||||
|
||||
int CreateOptions (TREE* tree)
|
||||
{
|
||||
Log("* Load options.xml from the Internet (Temporary Hack)");
|
||||
|
||||
CopyFileA( PML_Download(tree, "http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/lib/options.xml", NULL, "options.xml"), "options.xml", TRUE);
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int LoadOptions (TREE* tree)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = PML_XmlDownload(tree, "file://options.xml", (void*)tree, opt_start, opt_end, opt_text);
|
||||
if(!error)
|
||||
return ERR_OK;
|
||||
|
||||
CreateOptions(tree);
|
||||
return PML_XmlDownload(tree, "file://options.xml", (void*)tree, opt_start, opt_end, opt_text);
|
||||
}
|
||||
////////////////////////////////////////////////////////
|
||||
//
|
||||
// options.cpp
|
||||
//
|
||||
// Settting and Loading Options
|
||||
//
|
||||
//
|
||||
// Maarten Bosma, 09.01.2004
|
||||
// maarten.paul@bosma.de
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "package.hpp"
|
||||
#include "log.h"
|
||||
#include "expat.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
|
||||
int PML_XmlDownload (pTree tree, const char* url, void* usrdata,
|
||||
XML_StartElementHandler start, XML_EndElementHandler end, XML_CharacterDataHandler text) ;
|
||||
|
||||
|
||||
// expat callback for start of a "node" tag
|
||||
void opt_start (void* usrdata, const char* tag, const char** arg)
|
||||
{
|
||||
TREE* tree = (TREE*)usrdata;
|
||||
|
||||
if (!strcmp(tag, "source"))
|
||||
{
|
||||
tree->sources.push_back((char*)NULL);
|
||||
tree->field = &tree->sources.back();
|
||||
}
|
||||
}
|
||||
|
||||
// expat callback for end of a "node" tag
|
||||
void opt_end (void* usrdata, const char* tag)
|
||||
{
|
||||
TREE* tree = (TREE*)usrdata;
|
||||
|
||||
tree->field = NULL;
|
||||
}
|
||||
|
||||
// expat callback for end of a "node" tag
|
||||
void opt_text (void* usrdata, const char* data, int len)
|
||||
{
|
||||
TREE* tree = (TREE*)usrdata;
|
||||
|
||||
if(!tree->field)
|
||||
return;
|
||||
|
||||
*tree->field = new char[len+1];
|
||||
strncpy(*tree->field, data, len);
|
||||
(*tree->field)[len] = '\0';
|
||||
}
|
||||
|
||||
|
||||
// ! ! ! F I X M E ! ! ! //
|
||||
/*
|
||||
int CreateOptions (TREE* tree)
|
||||
{
|
||||
ofstream file ("options.xml");
|
||||
|
||||
Log("* Creating options.xml from Resources");
|
||||
|
||||
HRSRC hres = FindResource(GetModuleHandle(L"package"), MAKEINTRESOURCE(123), RT_RCDATA);
|
||||
if (!hres)
|
||||
{
|
||||
Log("! ERROR: Could not load it !");
|
||||
return ERR_GENERIC;
|
||||
}
|
||||
|
||||
MessageBox(0,(WCHAR*)LockResource(LoadResource(NULL, hres)), 0, 0); // is empty
|
||||
//file << (WCHAR*)LockResource(LoadResource(NULL, hres));
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
*/
|
||||
|
||||
char* PML_Download (pTree, const char* url, const char* server, const char* filename);
|
||||
|
||||
int CreateOptions (TREE* tree)
|
||||
{
|
||||
Log("* Load options.xml from the Internet (Temporary Hack)");
|
||||
|
||||
CopyFileA( PML_Download(tree, "http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/lib/options.xml", NULL, "options.xml"), "options.xml", TRUE);
|
||||
|
||||
return ERR_OK;
|
||||
}
|
||||
|
||||
int LoadOptions (TREE* tree)
|
||||
{
|
||||
int error;
|
||||
|
||||
error = PML_XmlDownload(tree, "file://options.xml", (void*)tree, opt_start, opt_end, opt_text);
|
||||
if(!error)
|
||||
return ERR_OK;
|
||||
|
||||
CreateOptions(tree);
|
||||
return PML_XmlDownload(tree, "file://options.xml", (void*)tree, opt_start, opt_end, opt_text);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue