/[Sims3RigEditor]/trunk/gr2lib_cpp_UnitTest/gr2lib_cpp_UnitTest.cpp
ViewVC logotype

Diff of /trunk/gr2lib_cpp_UnitTest/gr2lib_cpp_UnitTest.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/gr2lib_cpp_UnitTest/gr2lib_cpp_UnitTest.cpp	2010/07/29 14:46:07	4
+++ trunk/gr2lib_cpp_UnitTest/gr2lib_cpp_UnitTest.cpp	2010/07/29 17:25:37	5
@@ -21,28 +21,57 @@
 int main(int argc, char const* argv[])
 {
 
-	granny2apiversion* api_checker = new granny2apiversion();
+	grannyfile* grn_file = new grannyfile("C:\\temp\\S3_motorcycleChopper.gr2");
 
-	if (!api_checker->APIVersionsMatch())
+	if (!grn_file->GrannyAPIVersion->APIVersionsMatch())
 	{
-		printf("Warning:\n\t Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",api_checker->LoadedAPIVersion().c_str(),api_checker->ExpectedAPIVersion().c_str());
+		printf("Warning:\n\t Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",grn_file->GrannyAPIVersion->LoadedAPIVersion().c_str(),grn_file->GrannyAPIVersion->ExpectedAPIVersion().c_str());
         return EXIT_FAILURE;
 	}
 	else
 	{
-		printf("Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",api_checker->LoadedAPIVersion().c_str(),api_checker->ExpectedAPIVersion().c_str());
-	}
+		printf("Loaded Granny2 DLL Version: %s\n\t Expected Version: %s",grn_file->GrannyAPIVersion->LoadedAPIVersion().c_str(),grn_file->GrannyAPIVersion->ExpectedAPIVersion().c_str());
+
+		if (grn_file->_grn_file == 0)
+		{
+			printf("Error: unable to load %s as a Granny file.\n", grn_file->GrannyFilename());
+			return EXIT_FAILURE;
+		}
+		else
+		{
+			if (grn_file->GrannyFileInfo == 0)
+			{
+				printf("Could not extract a granny_file_info from the file.\n");
+				return EXIT_FAILURE;
+			}
+			else
+			{
+				if (grn_file->GrannyFileInfo->ArtToolInfo)
+				{
+					 printf("\nFile created by %s (%d.%d)\n",
+						   grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName,
+						   grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMajorRevision,
+						   grn_file->GrannyFileInfo->ArtToolInfo->ArtToolMinorRevision);
+					printf("  Coordinate system\n"
+						   "    Units per meter: %f\n"
+						   "       Right Vector: (%f %f %f)\n"
+						   "          Up Vector: (%f %f %f)\n"
+						   "        Back Vector: (%f %f %f)\n\n",
+						   grn_file->GrannyFileInfo->ArtToolInfo->UnitsPerMeter,
+						   grn_file->GrannyFileInfo->ArtToolInfo->RightVector[0], grn_file->GrannyFileInfo->ArtToolInfo->RightVector[1], grn_file->GrannyFileInfo->ArtToolInfo->RightVector[2],
+						   grn_file->GrannyFileInfo->ArtToolInfo->UpVector[0],    grn_file->GrannyFileInfo->ArtToolInfo->UpVector[1],    grn_file->GrannyFileInfo->ArtToolInfo->UpVector[2],
+						   grn_file->GrannyFileInfo->ArtToolInfo->BackVector[0],  grn_file->GrannyFileInfo->ArtToolInfo->BackVector[1],  grn_file->GrannyFileInfo->ArtToolInfo->BackVector[2]);
+				}
+
+				gr2lib::core::rigeditor::gr2lib_rigeditor_frm^ _editor = gcnew gr2lib::core::rigeditor::gr2lib_rigeditor_frm(grn_file);
+				_editor->ShowDialog();
+				printf("Art Tool Name: %s",   grn_file->GrannyFileInfo->ArtToolInfo->FromArtToolName);
+			}
+		}
 
-	/*if (!GrannyVersionsMatch)
-	{
-		  printf("Warning: the Granny DLL currently loaded "
-               "doesn't match the .h file used during compilation\n");
-        return EXIT_FAILURE;
 	}
-	else
-	{
-		printf("\nLoaded Granny2 DLL Version: %s", GrannyGetVersionString());
-	}*/
+
+
 	wait();
     return 0;
 }

 

  ViewVC Help
Powered by ViewVC 1.1.22