Esempio n. 1
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);
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
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);
                    }
                }
            }
        }
Esempio n. 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);
            }
        }