--- /dev/null
+<options>\r
+ <source>file://C:\Programmieren\reactos\rosapps\packmgr\tree\</source>\r
+ <source>http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/tree/</source>\r
+</options>
\ No newline at end of file
This is the online help. You can show it at any time by clicking on the the Questionmark Icon above.\r
\r
You can use this package manager like this: click on the \r
-You can also use the Buttons [ctrl] + [0] to [4] to set the action.\r
-\r
+You can also use the Buttons [ctrl] + [0] to [4] to set the action.
\ No newline at end of file
for(i=0; i<2000; i++)\r
{\r
buffer[i] = getc(file);\r
- if(!buffer[i]) break;\r
+ if(buffer[i]==EOF) break;\r
}\r
+ buffer[i] = 0;\r
\r
SetText(buffer);\r
}\r
{\r
buffer[j] = text[i];\r
if(buffer[j] == '\n')\r
- buffer[++j] = '\r';\r
+ {\r
+ buffer[j] = '\r';\r
+ buffer[++j] = '\n';\r
+ }\r
}\r
- buffer[i] = 0;\r
+ buffer[j] = 0;\r
\r
SetWindowTextA(hEdit, buffer);\r
\r
--- /dev/null
+<options>\r
+ <source>file://C:\Programmieren\reactos\rosapps\packmgr\tree\</source>\r
+ <source>http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/tree/</source>\r
+</options>
\ No newline at end of file
#include "log.h"\r
#include <wine/urlmon.h>\r
\r
-// Server there all the files lie\r
-const char* tree_server = "http://svn.reactos.com/viewcvs/*checkout*/trunk/rosapps/packmgr/tree/"; \r
-\r
HRESULT WINAPI URLDownloadToFileA( \r
LPUNKNOWN pCaller,\r
LPCSTR szURL,\r
int FindCount (string What, string Where, int start = 0, int end = -1);\r
\r
\r
-// Download a file\r
-char* PML_Download (const char* url, const char* server = "tree", const char* filename = NULL) \r
+// Download a file \r
+char* PML_Download (pTree tree, const char* url, const char* server = "tree", const char* filename = NULL) \r
{\r
- char downl [MAX_PATH];\r
- static char path [MAX_PATH];\r
+ UINT i;\r
+ static char downl [MAX_PATH]; // the full url\r
+ static char path [MAX_PATH]; // the full resulting Path\r
+\r
+ // It goes to the temp folder when no other path is entered (or even compleatly no filename)\r
+ // If server == "tree" it will be downloaded from the server speficied in option.xml\r
+ // File:// links are possible too\r
\r
// get temp dir\r
if(!filename)\r
GetTempFileNameA (path, "pml", 0, path); \r
\r
// get the url\r
- \r
if (!server)\r
strcpy(downl, "");\r
\r
else if(!strcmp(server, "tree")) \r
- strcpy(downl, tree_server);\r
+ {\r
+ char* ret;\r
+ for (i=0; i<tree->sources.size(); i++)\r
+ {\r
+ ret = PML_Download(tree, url, tree->sources[i], filename);\r
+ if(ret)\r
+ return ret;\r
+ }\r
+ return NULL;\r
+ }\r
\r
else \r
strcpy(downl, server);\r
\r
strcat(downl, url);\r
\r
+ // is this a file link ?\r
+ if (strstr(downl, "file://") || strstr(downl, "File://"))\r
+ {/*\r
+ if(downl[strlen(downl)] == '\')\r
+ downl[strlen(downl)] = '\0';\r
+ */\r
+ if(!filename)\r
+ return &downl[7];\r
+\r
+ else\r
+ {\r
+ CopyFileA(filename, &downl[7], FALSE);\r
+ return (char*)filename;\r
+ }\r
+ }\r
+\r
// download the file\r
if(URLDownloadToFileA (NULL, downl, path, 0, NULL) != S_OK)\r
{\r
}\r
\r
// Download and prozess a xml file\r
-int PML_XmlDownload (const char* url, void* usrdata, XML_StartElementHandler start, \r
- XML_EndElementHandler end, XML_CharacterDataHandler text) \r
+int PML_XmlDownload (pTree tree, const char* url, void* usrdata,\r
+ XML_StartElementHandler start, XML_EndElementHandler end, XML_CharacterDataHandler text) \r
{\r
- char buffer[255];\r
int done = 0;\r
+ char buffer[255];\r
+ char* filename = 0;\r
\r
// logging\r
Log("* prozess the xml file: ");\r
LogAdd(url);\r
\r
// download the file\r
- char* filename = PML_Download(url);\r
+ if(strstr(url, "file://"))\r
+ filename = PML_Download(tree, url, NULL);\r
+\r
+ else\r
+ filename = PML_Download(tree, url);\r
+\r
\r
if(!filename) \r
{\r
FILE* file = fopen(filename, "r");\r
if(!file) \r
{\r
- Log("! ERROR: Could not open the xml file");\r
+ MessageBoxA(0,filename,0,0);\r
+ Log("! ERROR: Could not open the xml file \"");\r
+ LogAdd(filename);\r
return ERR_GENERIC;\r
}\r
\r
#include "log.h"\r
\r
extern const char* tree_server;\r
-char* PML_Download (const char* url, const char* server, const char* filename);\r
+char* PML_Download (pTree, const char* url, const char* server, const char* filename);\r
\r
\r
int debuglog (int argc, char* argv[])\r
char* result;\r
\r
if (argc==3)\r
- result = PML_Download(argv[1], argv[3], argv[2]);\r
+ result = PML_Download(NULL, argv[1], argv[3], argv[2]);\r
\r
else if (argc==2)\r
- result = PML_Download(argv[1], NULL, argv[2]);\r
+ result = PML_Download(NULL, argv[1], NULL, argv[2]);\r
\r
else \r
return ERR_GENERIC;\r
HANDLE hThread = NULL;\r
BOOL thread_abort = FALSE;\r
\r
-char* PML_Download (const char* url, const char* server = "tree", const char* filename = NULL);\r
+char* PML_Download (pTree, const char* url, const char* server = "tree", const char* filename = NULL);\r
\r
\r
// Abort other thread\r
{\r
SCRIPT* script;\r
\r
- char* path = PML_Download(tree->todo[i]);\r
+ char* path = PML_Download(tree, tree->todo[i]);\r
\r
if(RPS_Load(&script, path) == ERR_OK)\r
scripts.push_back(script);\r
\r
TARGET_SDKLIBS = kernel32.a shell32.a user32.a package.a expat.a urlmon.a\r
\r
-TARGET_OBJECTS = main.o tree.o package.o download.o script.o functions.o log.o\r
+TARGET_OBJECTS = main.o tree.o package.o download.o script.o functions.o options.o log.o\r
\r
TARGET_GCCLIBS = stdc++ uuid\r
\r
#include "expat.h"\r
#include "log.h"\r
\r
-int PML_XmlDownload (const char* url, void* usrdata, XML_StartElementHandler start, \r
- XML_EndElementHandler end, XML_CharacterDataHandler text=0);\r
+int PML_XmlDownload (pTree, const char* url, void* usrdata, XML_StartElementHandler start, \r
+ XML_EndElementHandler end, XML_CharacterDataHandler text=0);\r
\r
\r
// expat callback for start of a package tag\r
\r
if(!pack->loaded)\r
{\r
- PML_XmlDownload (pack->path, (void*)pack, pack_start, pack_end, pack_text);\r
+ PML_XmlDownload (tree, pack->path, (void*)pack, pack_start, pack_end, pack_text);\r
pack->loaded = TRUE;\r
}\r
\r
// load it if it's not loaded yet\r
else if (!pack->loaded && pack->path)\r
{\r
- PML_XmlDownload (pack->path, (void*)pack, pack_start, pack_end, pack_text);\r
+ PML_XmlDownload (tree, pack->path, (void*)pack, pack_start, pack_end, pack_text);\r
pack->loaded = TRUE;\r
\r
return PML_SetAction(tree, id, action, SetIcon, Ask);\r
}\r
}\r
\r
- // set action back\r
- pack->action = 0;\r
-\r
// root notes (like network) return here\r
if(!pack->path || pack->action==0)\r
return ret; \r
- \r
+\r
// erase from todo list\r
for(i=0; i<tree->todo.size(); i++)\r
if(!strcmp(tree->todo[i], pack->files[pack->action-1])) // look for right entry\r
tree->todo.erase(tree->todo.begin()+i); // delete it\r
+\r
+ // set action back\r
+ pack->action = 0;\r
}\r
\r
return ret;\r
typedef struct\r
{\r
char* path;\r
+ char* name;\r
+ char* description;\r
+ char** field;\r
+\r
BOOL icon;\r
BOOL loaded;\r
+ vector<int> neededBy;\r
vector<int> children;\r
-\r
- char** field;\r
- char* name;\r
- char* description;\r
vector<char*> depencies;\r
- vector<int> neededBy;\r
\r
int action;\r
char* files [4];\r
\r
typedef struct\r
{\r
- char* xmltree;\r
+ char** field;\r
\r
- vector<char*> descriptionPath;\r
vector<char*> todo;\r
+ vector<char*> sources;\r
+ vector<char*> descriptionPath;\r
vector<PACKAGE> packages;\r
\r
PML_AddItem addItem;\r
\r
vector <int> parents;\r
\r
+int LoadOptions (TREE* tree);\r
+\r
void tree_end (void* tree, const char* tag);\r
void tree_start (void* usrdata, const char* tag, const char** arg);\r
\r
-int PML_XmlDownload (const char* file, void* usrdata, XML_StartElementHandler start, \r
- XML_EndElementHandler end, XML_CharacterDataHandler text=0);\r
+int PML_XmlDownload (pTree tree, const char* file, void* usrdata, XML_StartElementHandler start, \r
+ XML_EndElementHandler end, XML_CharacterDataHandler text=0);\r
\r
\r
// Load the tree\r
// set addItem callback\r
(*tree)->addItem = AddItem;\r
\r
- return PML_XmlDownload (url, (void*)(*tree), tree_start, tree_end);\r
+ LoadOptions(*tree);\r
+\r
+ return PML_XmlDownload (*tree, url, (void*)(*tree), tree_start, tree_end);\r
}\r
\r
// expat callback for start of a "node" tag\r
// delete last item\r
parents.pop_back();\r
}\r
+\r