示例#1
0
        public override void executeTest( )
        {
            Console.WriteLine("Test Case:Make Functions.xml with Function InterceptedDll Value Edited to InterceptedDllTestName");
            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
                FunctionsXMLFilePath = modifyThisFile.FullName;

                XmlDocument xmlDocument = new XmlDocument( );
                xmlDocument.Load(FunctionsXMLFilePath);

                XmlNode nodeFunction = xmlDocument.SelectSingleNode("/Functions/Function [last()]");

                EditValues editInterceptedDll = new EditValues();
                editInterceptedDll.EditFunction(nodeFunction, testValue, "InterceptedDll");


                xmlDocument.Save(FunctionsXMLFilePath);

                //add code here which will launch Holodeck
                Holodeck.HolodeckProcess.Start();
            }
            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);
            }
        }
示例#2
0
        public override void executeTest( )
        {
            Console.WriteLine("Test Case :Make Faults.xml with Faults Fault ErrorCode Value Edited to \"originalValue + testValue\"");
            try
            {
                string holodeckPath;
                holodeckPath = (string)Registry.LocalMachine.OpenSubKey("Software\\HolodeckEE", true).GetValue("InstallPath");

                FaultsXMLFilePath = string.Concat(holodeckPath, "\\function_db\\faults.xml");

                FaultsXMLBackupFilePath = string.Concat(FaultsXMLFilePath, ".bak");

                modifyThisFile            = new FileInfo(FaultsXMLFilePath);
                modifyThisFile.Attributes = FileAttributes.Normal;
                modifyThisFile.CopyTo(FaultsXMLBackupFilePath, true);

                //modify xml here
                FaultsXMLFilePath = modifyThisFile.FullName;
                XmlDocument xmlDocument = new XmlDocument( );
                xmlDocument.Load(FaultsXMLFilePath);

                XmlNode nodeFault = xmlDocument.SelectSingleNode("/Faults/Fault[@ErrorCode]");

                EditValues editFalutReturnValue = new EditValues();
                editFalutReturnValue.EditFault(nodeFault, testValue, "ErrorCode");

                Console.WriteLine("Editing Fault ErrorCode Attribute of {0} fault to {1}", nodeFault.Attributes["Name"].Value.ToString(), nodeFault.Attributes["ErrorCode"].Value.ToString());

                xmlDocument.Save(FaultsXMLFilePath);

                //add code here which will launch Holodeck
                Holodeck.HolodeckProcess.Start();
            }
            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(FaultsXMLBackupFilePath);
                regainOriginal.MoveTo(FaultsXMLFilePath);
            }
        }
示例#3
0
        public override void executeTest( )
        {
            Console.WriteLine("Test Case :Make Faults.xml with 'Faults Fault Function CheckResource ParamIndex' Value Edited to \"originalValue + testValue\"");
            try
            {
                string holodeckPath;
                holodeckPath = (string)Registry.LocalMachine.OpenSubKey("Software\\HolodeckEE", true).GetValue("InstallPath");

                FaultsXMLFilePath = string.Concat(holodeckPath, "\\function_db\\faults.xml");

                FaultsXMLBackupFilePath = string.Concat(FaultsXMLFilePath, ".bak");

                modifyThisFile            = new FileInfo(FaultsXMLFilePath);
                modifyThisFile.Attributes = FileAttributes.Normal;
                modifyThisFile.CopyTo(FaultsXMLBackupFilePath, true);

                //modify xml here
                FaultsXMLFilePath = modifyThisFile.FullName;
                XmlDocument xmlDocument = new XmlDocument( );
                xmlDocument.Load(FaultsXMLFilePath);

                XmlNode nodeCheckResource = xmlDocument.SelectSingleNode("/Faults/Fault/Function/CheckResource[@ParamIndex]");


                EditValues editParamIndex = new EditValues();
                editParamIndex.EditCheckResource(nodeCheckResource, testValue, "ParamIndex");


                xmlDocument.Save(FaultsXMLFilePath);

                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(FaultsXMLBackupFilePath);
                regainOriginal.MoveTo(FaultsXMLFilePath);
            }
        }
示例#4
0
    static void Init()
    {
        EditValues window = (EditValues)EditorWindow.GetWindow(typeof(EditValues));

        window.Show();
    }