Exemple #1
0
        public override void executeTest( )
        {
            Console.WriteLine("Test Case: Change Encoding of the xml file to UTF -7");
            try
            {
                string holodeckPath;
                holodeckPath = (string) Registry.LocalMachine.OpenSubKey ("Software\\HolodeckEE", true).GetValue ("InstallPath");

                FunctionsXMLFilePath = string.Concat(holodeckPath,"\\function_db\\functions.xml");

                FunctionsXMLBackupFilePath = string.Concat(FunctionsXMLFilePath,".bak");

                modifyThisFile = new FileInfo(FunctionsXMLFilePath);
                modifyThisFile.Attributes = FileAttributes.Normal;
                modifyThisFile.CopyTo(FunctionsXMLBackupFilePath);

                //modify xml here
                FunctionXMLNavigator FuncXMLNav = new FunctionXMLNavigator();
                FunctionsXMLFilePath = modifyThisFile.FullName;
                FuncXMLNav.ValidateXmlDocument(FunctionsXMLFilePath);
                FuncXMLNav.parseXmlDocument(FunctionsXMLFilePath);

                //saving the functions.xml
                FuncXMLNav.saveFunctionXmlDocument(FuncXMLNav,FunctionsXMLFilePath,"UTF-7",true);

                try
                {	//add code here which will launch Holodeck
                    Holodeck.HolodeckProcess.Start();
                }
                catch(Holodeck.HolodeckExceptions.CannotStartHolodeckException ex)
                {
                    Console.WriteLine("Cannot Start Holodeck Exception thrown ");
                    Console.WriteLine(ex.Message);
                }

            }
            catch(HolodeckExceptions.IncorrectRegistryException e)
            {
                Console.WriteLine(" Incorrect Registry Exception caught.... : " + e.Message);
                Console.WriteLine("Details: " + e.StackTrace);
            }
            catch(FileNotFoundException f)
            {
                Console.WriteLine(" File Not Found Exception caught.... : " + f.Message);
                Console.WriteLine("Details: " + f.StackTrace);
            }
            finally
            {
                if(Holodeck.HolodeckProcess.IsRunning ())
                {
                    Holodeck.HolodeckProcess.Stop();
                }
                //reverting back to original
                modifyThisFile.Delete();

                FileInfo regainOriginal = new FileInfo(FunctionsXMLBackupFilePath);
                regainOriginal.MoveTo(FunctionsXMLFilePath);

            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("This is Test Appliacation to test Function.xml");
            FunctionXMLNavigator FuncXMLNav = new FunctionXMLNavigator();
            string FunctionXMLFilePath = @"E:\Fall2003\Holodeck xml files\functions.xml";
            FuncXMLNav.parseXmlDocument(FunctionXMLFilePath);

            //modifying function here
            Function modifyThis = FuncXMLNav.GetFunctionByName( "bind" );
            modifyThis.OriginalDll = "TESTws2_32.dll";
            modifyThis.InterceptedDll = "TESTws2_32replacementlibrary.dll";
            modifyThis.ReplacementFunctionName = "TESTbindReplacement";
            modifyThis.ReturnType = "TESTint";
            modifyThis.Modifiers[0] = "TESTWINSOCK_API_LINKAGE";
            modifyThis.Modifiers[1] = "TESTWSAAPI";
            modifyThis.Category = "TESTNETWORK";
            modifyThis.ReturnValueDescription = "TESTOn success returns zero. On failure returns SOCKET_ERROR (-1).";

            Parameter modifiedParam = new Parameter();
            modifiedParam.Name ="TESTs" ;
            modifiedParam.Index = 01;
            modifiedParam.Type ="TESTSOCKET" ;
            modifiedParam.CompareAs ="TESTPointerType" ;
            modifiedParam.Access ="TESTIN" ;
            modifyThis.Parameter[0] = modifiedParam;

            Parameter modifiedParam1 = new Parameter();
            modifiedParam1.Name ="TESTname" ;
            modifiedParam1.Index = 11;
            modifiedParam1.Type ="TESTconst struct sockaddr FAR *" ;
            modifiedParam1.CompareAs ="TESTPointerType" ;
            modifiedParam1.Access ="TESTIN" ;
            modifyThis.Parameter[1] = modifiedParam1;

            Parameter modifiedParam2 = new Parameter();
            modifiedParam2.Name = "TESTnamelen" ;
            modifiedParam2.Index = 22;
            modifiedParam2.Type ="TESTint" ;
            modifiedParam2.CompareAs ="TESTIntegerType" ;
            modifiedParam2.Access ="TESTIN" ;
            modifyThis.Parameter[2] = modifiedParam2;

            FuncXMLNav.UpdateFunctionByName("bind",modifyThis);

            //saving the function.xml
            FuncXMLNav.saveFunctionXmlDocument(FuncXMLNav,"functions.xml");

            // DotNetFunctions.xml
            Console.WriteLine("This is Test Appliacation to test DotNetFunctions.xml");
            FunctionXMLNavigator DotNetFuncXMLNav = new FunctionXMLNavigator();
            string DotNetFunctionXMLFilePath = @"E:\Fall2003\Holodeck xml files\DotNetFunctions.xml";
            DotNetFuncXMLNav.parseXmlDocument(DotNetFunctionXMLFilePath);
            DotNetFuncXMLNav.saveFunctionXmlDocument(DotNetFuncXMLNav,"DotNetFunctions.xml");
        }
Exemple #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("This is Test Appliacation to test Functions.xml");
            try
            {
                FunctionXMLNavigator FuncXMLNav = new FunctionXMLNavigator();


                //enter the "Function.xml" path
                string FunctionXMLFilePath = @"E:\Fall2003\Holodeck xml files\holo 2.5\functions.xml";
                FuncXMLNav.ValidateXmlDocument(FunctionXMLFilePath);
                FuncXMLNav.parseXmlDocument(FunctionXMLFilePath);

                //modifying function here
                Function modifyThis = FuncXMLNav.GetFunctionByName("bind");

                //if function not found in original finctions.xml file then it we cannot modify it
                // nor we can add new function to the file
                if (modifyThis != null)
                {
                    modifyThis.OriginalDll             = "TESTws2_32.dll";
                    modifyThis.InterceptedDll          = "TESTws2_32replacementlibrary.dll";
                    modifyThis.ReplacementFunctionName = "TESTbindReplacement";
                    modifyThis.ReturnType   = "TESTint";
                    modifyThis.Modifiers[0] = "TESTWINSOCK_API_LINKAGE";
                    modifyThis.Modifiers[1] = "TESTWSAAPI";
                    modifyThis.Category     = "TESTNETWORK";

                    ReturnValue modifiedReturnValue_0 = new ReturnValue();
                    modifiedReturnValue_0.NodeValue = "TEST_0";
                    modifiedReturnValue_0.Type      = "TEST_Success";
                    modifyThis.ReturnValue[0]       = modifiedReturnValue_0;

                    ReturnValue modifiedReturnValue_1 = new ReturnValue();
                    modifiedReturnValue_1.NodeValue = "TEST_-1(SOCKET_ERROR)";
                    modifiedReturnValue_0.Type      = "TEST_Error";
                    modifyThis.ReturnValue[1]       = modifiedReturnValue_1;

                    modifyThis.HelpLink = @"TEST_http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/bind_2.asp";

                    Parameter modifiedParam = new Parameter();
                    modifiedParam.Name      = "TESTs";
                    modifiedParam.Index     = 01;
                    modifiedParam.Type      = "TESTSOCKET";
                    modifiedParam.CompareAs = "TESTPointerType";
                    modifiedParam.Access    = "TESTIN";
                    modifyThis.Parameter[0] = modifiedParam;

                    Parameter modifiedParam1 = new Parameter();
                    modifiedParam1.Name      = "TESTname";
                    modifiedParam1.Index     = 11;
                    modifiedParam1.Type      = "TESTconst struct sockaddr FAR *";
                    modifiedParam1.CompareAs = "TESTPointerType";
                    modifiedParam1.Access    = "TESTIN";
                    modifyThis.Parameter[1]  = modifiedParam1;

                    Parameter modifiedParam2 = new Parameter();
                    modifiedParam2.Name      = "TESTnamelen";
                    modifiedParam2.Index     = 22;
                    modifiedParam2.Type      = "TESTint";
                    modifiedParam2.CompareAs = "TESTIntegerType";
                    modifiedParam2.Access    = "TESTIN";
                    modifyThis.Parameter[2]  = modifiedParam2;

                    FuncXMLNav.UpdateFunctionByName("bind", modifyThis);
                }

                //saving the functions.xml
                FuncXMLNav.saveFunctionXmlDocument(FuncXMLNav, "functions.xml", "", true);

                ///cannot use DotNetFunctions.xml as new version 2.5 file is not available.
                //			// DotNetFunctions.xml
                //			Console.WriteLine("This is Test Appliacation to test DotNetFunctions.xml");
                //			FunctionXMLNavigator DotNetFuncXMLNav = new FunctionXMLNavigator();
                //			string DotNetFunctionXMLFilePath = @"E:\Fall2003\Holodeck xml files\DotNetFunctions.xml";
                //			DotNetFuncXMLNav.parseXmlDocument(DotNetFunctionXMLFilePath);
                //			DotNetFuncXMLNav.saveFunctionXmlDocument(DotNetFuncXMLNav,"DotNetFunctions.xml");
            }

            catch (FileNotFoundException f)
            {
                Console.WriteLine(" File Not Found Exception caught.... : " + f.Message);
                Console.WriteLine("Details: " + f.StackTrace);
            }
            catch (SystemException e)
            {
                Console.WriteLine("Caught  System Exception .... : " + e.Message);
                Console.WriteLine("Details: " + e.StackTrace);
            }

            EditValues test = new EditValues();
            //string vp = "abc?ejj1@3%";
            string vp = "abc__ejj1@3%";

            Console.WriteLine(vp);
            Console.WriteLine(test.ToLower(vp));
            Console.WriteLine(test.ToUpper(vp));
            Console.WriteLine(test.InsertAtStart(vp, "pppp"));
            Console.WriteLine(test.InsetAtEnd(vp, "PPPP"));
            Console.WriteLine("SplitString:" + test.SplitString(vp));
            Console.WriteLine(test.SubstituteToNull(vp));
            foreach (string sp in test.SpecialCharacters)
            {
                Console.WriteLine(sp);
            }

            Console.WriteLine(test.changeEncodingToASCII(vp));
            Console.WriteLine(test.changeEncodingToUnicode(vp));
            Console.WriteLine(test.changeEncodingToUTF7(vp));
            Console.WriteLine(test.changeEncodingToUTF8(vp));
        }
Exemple #4
0
        ///*************************************************************************
        /// Method:		WriteFile
        /// Description: Reads from the xml and gets the hashTable
        ///
        ///	Parameters: None
        ///
        ///  Return Value:  None
        ///*************************************************************************
        public void WriteFile()
        {
            FunctionXMLNavigator XMLreader = new FunctionXMLNavigator();
            XMLreader.ValidateXmlDocument(filePath);
            XMLreader.parseXmlDocument(filePath);
            Hashtable funcInfo = (Hashtable)XMLreader.FunctionTableByName.Clone();
            IDictionaryEnumerator funcDetails = funcInfo.GetEnumerator();
            Function func = null;

            while(funcDetails.MoveNext())
            {
                func = (Function)funcDetails.Value;
                string fileName = string.Concat(func.FunctionName,".cs");
                generateFile(fileName, func);
            }
        }
Exemple #5
0
        /// <summary>
        /// 
        /// </summary>
        public void searchResult(bool logExportComplete)
        {
            string holodeckPath;
            holodeckPath = (string) Registry.LocalMachine.OpenSubKey ("Software\\HolodeckEE", true).GetValue ("InstallPath");

            string holodeckFunctionDBPath = string.Concat(holodeckPath,"\\function_db");
            string FunctionsXMLPath = string.Concat(holodeckPath,"\\function_db\\functions.xml");

            //storing functions.xml in datastructure
            FunctionXMLNavigator myFunctionXMLNavigator = new FunctionXMLNavigator();
            //myFunctionXMLNavigator.ValidateXmlDocument(FunctionsXMLPath);
            myFunctionXMLNavigator.parseXmlDocument(FunctionsXMLPath);

            //string myHDLPath = hdlPath;
            string myExportLogPath = ExportLogPath;

            foreach(string functionName in myFunctionXMLNavigator.FunctionList)
            {

                if(logExportComplete)
                {
                    System.Diagnostics.Process myProc = new System.Diagnostics.Process( );
                    string systemDir = System.Environment.SystemDirectory;

                    myProc.StartInfo.FileName = systemDir + "\\findstr.exe";
                    myProc.StartInfo.Arguments =  functionName  + " " +myExportLogPath;

                    myProc.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
                    myProc.Start( );

                    // Wait for execution to finish...
                    myProc.WaitForExit( );

                    if(myProc.ExitCode == 1)
                    {
                        failedFunctionList.Add(functionName);
                    }
                    else
                    {
                        Console.WriteLine(functionName);
                    }

                }
            }
        }
Exemple #6
0
        static void Main(string[] args)
        {
            Console.WriteLine("This is Test Appliacation to test Function.xml");
            FunctionXMLNavigator FuncXMLNav = new FunctionXMLNavigator();
            string FunctionXMLFilePath      = @"E:\Fall2003\Holodeck xml files\functions.xml";

            FuncXMLNav.parseXmlDocument(FunctionXMLFilePath);

            //modifying function here
            Function modifyThis = FuncXMLNav.GetFunctionByName("bind");

            modifyThis.OriginalDll             = "TESTws2_32.dll";
            modifyThis.InterceptedDll          = "TESTws2_32replacementlibrary.dll";
            modifyThis.ReplacementFunctionName = "TESTbindReplacement";
            modifyThis.ReturnType             = "TESTint";
            modifyThis.Modifiers[0]           = "TESTWINSOCK_API_LINKAGE";
            modifyThis.Modifiers[1]           = "TESTWSAAPI";
            modifyThis.Category               = "TESTNETWORK";
            modifyThis.ReturnValueDescription = "TESTOn success returns zero. On failure returns SOCKET_ERROR (-1).";

            Parameter modifiedParam = new Parameter();

            modifiedParam.Name      = "TESTs";
            modifiedParam.Index     = 01;
            modifiedParam.Type      = "TESTSOCKET";
            modifiedParam.CompareAs = "TESTPointerType";
            modifiedParam.Access    = "TESTIN";
            modifyThis.Parameter[0] = modifiedParam;

            Parameter modifiedParam1 = new Parameter();

            modifiedParam1.Name      = "TESTname";
            modifiedParam1.Index     = 11;
            modifiedParam1.Type      = "TESTconst struct sockaddr FAR *";
            modifiedParam1.CompareAs = "TESTPointerType";
            modifiedParam1.Access    = "TESTIN";
            modifyThis.Parameter[1]  = modifiedParam1;

            Parameter modifiedParam2 = new Parameter();

            modifiedParam2.Name      = "TESTnamelen";
            modifiedParam2.Index     = 22;
            modifiedParam2.Type      = "TESTint";
            modifiedParam2.CompareAs = "TESTIntegerType";
            modifiedParam2.Access    = "TESTIN";
            modifyThis.Parameter[2]  = modifiedParam2;

            FuncXMLNav.UpdateFunctionByName("bind", modifyThis);

            //saving the function.xml
            FuncXMLNav.saveFunctionXmlDocument(FuncXMLNav, "functions.xml");


            // DotNetFunctions.xml
            Console.WriteLine("This is Test Appliacation to test DotNetFunctions.xml");
            FunctionXMLNavigator DotNetFuncXMLNav = new FunctionXMLNavigator();
            string DotNetFunctionXMLFilePath      = @"E:\Fall2003\Holodeck xml files\DotNetFunctions.xml";

            DotNetFuncXMLNav.parseXmlDocument(DotNetFunctionXMLFilePath);
            DotNetFuncXMLNav.saveFunctionXmlDocument(DotNetFuncXMLNav, "DotNetFunctions.xml");
        }
Exemple #7
0
        static void Main(string[] args)
        {
            Console.WriteLine("This is Test Appliacation to test Functions.xml");
            try
            {
                FunctionXMLNavigator FuncXMLNav = new FunctionXMLNavigator();

                //enter the "Function.xml" path
                string FunctionXMLFilePath = @"E:\Fall2003\Holodeck xml files\holo 2.5\functions.xml";
                FuncXMLNav.ValidateXmlDocument(FunctionXMLFilePath);
                FuncXMLNav.parseXmlDocument(FunctionXMLFilePath);

                //modifying function here
                Function modifyThis = FuncXMLNav.GetFunctionByName( "bind" );

                //if function not found in original finctions.xml file then it we cannot modify it
                // nor we can add new function to the file
                if(modifyThis != null)
                {
                    modifyThis.OriginalDll = "TESTws2_32.dll";
                    modifyThis.InterceptedDll = "TESTws2_32replacementlibrary.dll";
                    modifyThis.ReplacementFunctionName = "TESTbindReplacement";
                    modifyThis.ReturnType = "TESTint";
                    modifyThis.Modifiers[0] = "TESTWINSOCK_API_LINKAGE";
                    modifyThis.Modifiers[1] = "TESTWSAAPI";
                    modifyThis.Category = "TESTNETWORK";

                    ReturnValue modifiedReturnValue_0 = new ReturnValue();
                    modifiedReturnValue_0.NodeValue = "TEST_0";
                    modifiedReturnValue_0.Type = "TEST_Success";
                    modifyThis.ReturnValue[0] = modifiedReturnValue_0;

                    ReturnValue modifiedReturnValue_1 = new ReturnValue();
                    modifiedReturnValue_1.NodeValue = "TEST_-1(SOCKET_ERROR)";
                    modifiedReturnValue_0.Type= "TEST_Error";
                    modifyThis.ReturnValue[1] = modifiedReturnValue_1;

                    modifyThis.HelpLink = @"TEST_http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winsock/winsock/bind_2.asp";

                    Parameter modifiedParam = new Parameter();
                    modifiedParam.Name ="TESTs" ;
                    modifiedParam.Index = 01;
                    modifiedParam.Type ="TESTSOCKET" ;
                    modifiedParam.CompareAs ="TESTPointerType" ;
                    modifiedParam.Access ="TESTIN" ;
                    modifyThis.Parameter[0] = modifiedParam;

                    Parameter modifiedParam1 = new Parameter();
                    modifiedParam1.Name ="TESTname" ;
                    modifiedParam1.Index = 11;
                    modifiedParam1.Type ="TESTconst struct sockaddr FAR *" ;
                    modifiedParam1.CompareAs ="TESTPointerType" ;
                    modifiedParam1.Access ="TESTIN" ;
                    modifyThis.Parameter[1] = modifiedParam1;

                    Parameter modifiedParam2 = new Parameter();
                    modifiedParam2.Name = "TESTnamelen" ;
                    modifiedParam2.Index = 22;
                    modifiedParam2.Type ="TESTint" ;
                    modifiedParam2.CompareAs ="TESTIntegerType" ;
                    modifiedParam2.Access ="TESTIN" ;
                    modifyThis.Parameter[2] = modifiedParam2;

                    FuncXMLNav.UpdateFunctionByName("bind",modifyThis);
                }

                //saving the functions.xml
                FuncXMLNav.saveFunctionXmlDocument(FuncXMLNav,"functions.xml","",true);

                ///cannot use DotNetFunctions.xml as new version 2.5 file is not available.
                //			// DotNetFunctions.xml
                //			Console.WriteLine("This is Test Appliacation to test DotNetFunctions.xml");
                //			FunctionXMLNavigator DotNetFuncXMLNav = new FunctionXMLNavigator();
                //			string DotNetFunctionXMLFilePath = @"E:\Fall2003\Holodeck xml files\DotNetFunctions.xml";
                //			DotNetFuncXMLNav.parseXmlDocument(DotNetFunctionXMLFilePath);
                //			DotNetFuncXMLNav.saveFunctionXmlDocument(DotNetFuncXMLNav,"DotNetFunctions.xml");

            }

            catch(FileNotFoundException f)
            {
                Console.WriteLine(" File Not Found Exception caught.... : " + f.Message);
                Console.WriteLine("Details: " + f.StackTrace);
            }
            catch(SystemException e)
            {
                Console.WriteLine("Caught  System Exception .... : " + e.Message);
                Console.WriteLine("Details: " + e.StackTrace);
            }

            EditValues test = new EditValues();
            //string vp = "abc?ejj1@3%";
            string vp = "abc__ejj1@3%";
            Console.WriteLine(vp);
            Console.WriteLine(test.ToLower(vp));
            Console.WriteLine(test.ToUpper(vp));
            Console.WriteLine(test.InsertAtStart(vp,"pppp"));
            Console.WriteLine(test.InsetAtEnd(vp,"PPPP"));
            Console.WriteLine("SplitString:" +test.SplitString(vp));
            Console.WriteLine(test.SubstituteToNull(vp));
            foreach(string sp in test.SpecialCharacters)
            {
                Console.WriteLine(sp);

            }

            Console.WriteLine(test.changeEncodingToASCII(vp));
            Console.WriteLine(test.changeEncodingToUnicode(vp));
            Console.WriteLine(test.changeEncodingToUTF7(vp));
            Console.WriteLine(test.changeEncodingToUTF8(vp));
        }
Exemple #8
0
        /// *****************************************************************************************
        /// method name: fileWriter()
        /// 
        /// Collects all the information from the FuctionXMLNavigator which is the XML parser
        /// receives HashTable htemp which has the collection of all the Function Objects
        ///  
        /// *****************************************************************************************
        public void fileWriter()
        {
            string holodeckPath;
            holodeckPath = (string) Registry.LocalMachine.OpenSubKey ("Software\\HolodeckEE", true).GetValue ("InstallPath");

            string holodeckFunctionDBPath = string.Concat(holodeckPath,"\\function_db");
            string FunctionsXMLFilePath = string.Concat(holodeckPath,"\\function_db\\functions.xml");

            FunctionXMLNavigator FuncXMLNav = new FunctionXMLNavigator();

            FuncXMLNav.ValidateXmlDocument(FunctionsXMLFilePath);
            FuncXMLNav.parseXmlDocument(FunctionsXMLFilePath);
            Hashtable htemp = (Hashtable)FuncXMLNav.FunctionTableByName.Clone();

            IDictionaryEnumerator HashFuctionNames = htemp.GetEnumerator();
            Function ftemp=null;
            while(HashFuctionNames.MoveNext())
            {
                ftemp = (Function)HashFuctionNames.Value;

                //create Win32CodeGeneratorDump Folder
                string Win32CodeGeneratorDumpDirPath = string.Concat(holodeckFunctionDBPath,"\\Win32CodeGeneratorDump");

                if (!Directory.Exists(Win32CodeGeneratorDumpDirPath))
                {
                    DirectoryInfo di = Directory.CreateDirectory(Win32CodeGeneratorDumpDirPath);
                }

                string cfile = string.Concat(Win32CodeGeneratorDumpDirPath,"\\", ftemp.FunctionName);
                cfile = string.Concat(cfile,".cpp");
                createCFile(cfile,ftemp);

            }
        }