Index: /branches/prototype-v0/thirds/saga2zcfg/saga2zcfg.c
===================================================================
--- /branches/prototype-v0/thirds/saga2zcfg/saga2zcfg.c	(revision 900)
+++ /branches/prototype-v0/thirds/saga2zcfg/saga2zcfg.c	(revision 901)
@@ -5,5 +5,5 @@
 
 #include <api_core.h>
-#include <module_library.h>
+#include <saga_api.h>
 
 int Callback(TSG_UI_Callback_ID ID, CSG_UI_Parameter &Param_1, CSG_UI_Parameter &Param_2){
@@ -144,22 +144,41 @@
   static bool g_bShow_Messages = false;
   SG_Set_UI_Callback(Get_Callback());
+#if SAGA_MAJOR_VERSION == 2
   int n = SG_Get_Module_Library_Manager().Add_Directory(wxT(MODULE_LIBRARY_PATH),false);
-  if( SG_Get_Module_Library_Manager().Get_Count() <= 0 ){
+  if( SG_Get_Module_Library_Manager().Get_Count() <= 0 )
+#else
+  int n = SG_Get_Tool_Library_Manager().Add_Directory(wxT(MODULE_LIBRARY_PATH),false);
+  if( SG_Get_Tool_Library_Manager().Get_Count() <= 0 )
+#endif
+  {
     fprintf(stderr,"could not load any tool library");
     return -2;
   }
 
-  for(int i=0;i<SG_Get_Module_Library_Manager().Get_Count();i++){
+#if SAGA_MAJOR_VERSION == 2
+  for(int i=0;i<SG_Get_Module_Library_Manager().Get_Count();i++)
+#else
+  for(int i=0;i<SG_Get_Tool_Library_Manager().Get_Count();i++)
+#endif
+    {
     
+#if SAGA_MAJOR_VERSION == 2
     CSG_Module_Library * library=SG_Get_Module_Library_Manager().Get_Library(i);
+#else
+    CSG_Tool_Library * library=SG_Get_Tool_Library_Manager().Get_Library(i);
+#endif
     int lc=library->Get_Count();
     if(!library->Get_Library_Name().Contains("io_")) {
 
       for(int j=0;j<lc;j++){
+#if SAGA_MAJOR_VERSION == 2
 	CSG_Module * module=library->Get_Module(j);
+#else
+	CSG_Tool * module=library->Get_Tool(j);
+#endif
 	if(module!=NULL && !module->needs_GUI() /*&& !module->is_Interactive()*/ ){
 
 	  mkdir(library->Get_Library_Name().b_str(),0755);
-
+	  
 	  FILE *stdout1=fopen((library->Get_Library_Name()+"/"+module->Get_ID()+".zcfg").b_str(),"w+");
 	  fprintf(stdout1,"[%d]\n",j);
@@ -203,4 +222,12 @@
 	      
 	    }
+	    else if(CSG_String(param->Get_Type_Identifier()).is_Same_As(CSG_String("date"),true)){
+	      printBasicMetadata(stdout1,param,false,true,true);
+	      fprintf(stdout1,"  <LiteralData>\n");
+	      fprintf(stdout1,"   dataType = date\n");
+	      fprintf(stdout1,"   <Default/>\n");
+	      fprintf(stdout1,"  </LiteralData>\n");
+	      
+	    }
 	    else if(CSG_String(param->Get_Type_Identifier()).is_Same_As(CSG_String("range"),true)){
 
@@ -212,5 +239,9 @@
 	      CSG_Parameter_Range *range=param->asRange();
 	      fprintf(stdout1,"   <Default>\n");
+#if SAGA_MAJOR_VERSION == 2
 	      fprintf(stdout1,"    value = %f\n",((CSG_Parameter_Range*)param->Get_Data())->Get_LoVal());
+#else
+	      //fprintf(stdout1,"    value = %f\n",((CSG_Parameter_Range*)param->asDataObject())->Get_Min());	      
+#endif
 	      fprintf(stdout1,"   </Default>\n");
 	      fprintf(stdout1,"  </LiteralData>\n");
@@ -220,5 +251,9 @@
 	      fprintf(stdout1,"   dataType = float\n");
 	      fprintf(stdout1,"   <Default>\n");
+#if SAGA_MAJOR_VERSION == 2
 	      fprintf(stdout1,"    value = %f\n",((CSG_Parameter_Range*)param->Get_Data())->Get_HiVal());
+#else
+	      //fprintf(stdout1,"    value = %f\n",((CSG_Parameter_Range*)param->asDataObject())->Get_Max());	      
+#endif
 	      fprintf(stdout1,"   </Default>\n");
 	      fprintf(stdout1,"  </LiteralData>\n");
@@ -280,7 +315,13 @@
 		fprintf(stdout1,"   dataType = string\n");
 		fprintf(stdout1,"   <Default>\n");
+#if SAGA_MAJOR_VERSION == 2
 		if( !param->Get_Data()->Get_Default().is_Empty() ){
 		  fprintf(stdout1,"    value = %s\n",param->Get_Data()->Get_Default().b_str());
 		}
+#else
+		if( !param->Get_Default().is_Empty() ){
+		  fprintf(stdout1,"    value = %s\n",param->Get_Default().b_str());
+		}
+#endif
 		fprintf(stdout1,"   </Default>\n");
 		fprintf(stdout1,"  </LiteralData>\n");
@@ -299,7 +340,13 @@
 
 		fprintf(stdout1,"   <Default>\n");
+#if SAGA_MAJOR_VERSION == 2
 		if( !param->Get_Data()->Get_Default().is_Empty() ){
 		  fprintf(stdout1,"    value = %s\n",param->Get_Data()->Get_Default().b_str());
 		}
+#else
+		if( !param->Get_Default().is_Empty() ){
+		  fprintf(stdout1,"    value = %s\n",param->Get_Default().b_str());
+		}
+#endif
 		if(param->asValue()->has_Minimum() && param->asValue()->has_Maximum()){
 		  fprintf(stdout1,"    rangeMin = %f\n",param->asValue()->Get_Minimum());
@@ -314,7 +361,13 @@
 		fprintf(stdout1,"   dataType = bool\n");
 		fprintf(stdout1,"   <Default>\n");
+#if SAGA_MAJOR_VERSION == 2
 		if( !param->Get_Data()->Get_Default().is_Empty() ){
 		  fprintf(stdout1,"    value = %s\n",(param->Get_Data()->Get_Default().Contains("0")?"false":"true"));
 		}
+#else
+		if( !param->Get_Default().is_Empty() ){
+		  fprintf(stdout1,"    value = %s\n",(param->Get_Default().Contains("0")?"false":"true"));
+		}
+#endif
 		fprintf(stdout1,"   </Default>\n");
 		fprintf(stdout1,"  </LiteralData>\n");	
@@ -337,7 +390,13 @@
 		  }
 		  fprintf(stdout1,"   <Default>\n");
+#if SAGA_MAJOR_VERSION == 2
 		  if( !param->Get_Data()->Get_Default().is_Empty() ){
 		    fprintf(stdout1,"    value = %s\n",CSG_String(choice->Get_Item(atoi(param->Get_Data()->Get_Default()))).b_str());
 		  }
+#else
+		  if( !param->Get_Default().is_Empty() ){
+		    fprintf(stdout1,"    value = %s\n",CSG_String(choice->Get_Item(atoi(param->Get_Default()))).b_str());
+		  }		  
+#endif
 		  fprintf(stdout1,"   </Default>\n");
 		  fprintf(stdout1,"  </LiteralData>\n");
