コード例 #1
0
ファイル: JSONParser.cs プロジェクト: KaminFay/CSE687
        /*
         * ----< Function > dllFunctionToJSON
         * ----< Description >
         * Static function that will convert from a dllFunction object to a JSON object
         * ----< Description >
         * @Param dllFunction func -- Object containing function data
         * @Return JOBject -- JSON object containig all of the info from the dllFunction object.
         */
        public static JObject dllFunctionToJSON(dllFunction func)
        {
            JObject jObject = (JObject)JToken.FromObject(func);

            Debug.WriteLine(jObject);
            return(jObject);
        }
コード例 #2
0
 /*
  * ----< Function > AddFunctionSendMessage
  * ----< Description >
  * Add a log message describing the function being sent
  * ----< Description >
  * @Param dllFunction dllFunc -- Function being sent
  * @Return None
  */
 public void AddFunctionSendMessage(dllFunction dllFunc)
 {
     AddSeparators();
     loggingDisplay = loggingDisplay + "Sending Function: \n";
     loggingDisplay = loggingDisplay + "Dll Name: " + dllFunc.DllName + "\n";
     loggingDisplay = loggingDisplay + "Function Name: " + dllFunc.FuncName;
     AddSeparators();
     ReloadSV();
 }
コード例 #3
0
ファイル: JSONParser.cs プロジェクト: KaminFay/CSE687
        /*
         * ----< Function > parseJSON
         * ----< Description >
         * Given a JSON file this function will read in the JSON data and parse the data
         * to pull out all relevent information about the dll's and functions within and store
         * the data in a list within the class.
         * ----< Description >
         * @Param StorageFile storageFile -- File object that contains the path / name of the JSON file
         */
        public void parseJSON(StorageFile storageFile)
        {
            Debug.WriteLine(jsonData.ToString());

            JArray  jArray  = (JArray)jsonData["dlls"];
            dynamic dllData = jArray;


            Debug.WriteLine("Testing Dynamics");
            if (dllData != null)
            {
                try
                {
                    foreach (dynamic item in dllData)
                    {
                        dllInfo newDll = new dllInfo();
                        newDll.dllName        = item.Name.ToString();
                        newDll.dllLocation    = item.Location.ToString();
                        newDll.jsonSourceName = storageFile.DisplayName;


                        foreach (dynamic functionT in item.Functions)
                        {
                            dllFunction newFunction = new dllFunction();
                            newFunction.FuncName = functionT.FuncName;
                            newDll.functionList.Add(newFunction);
                        }
                        allDLLData.Add(newDll);
                    }

                    Debug.WriteLine("Testing Listing Function");
                    foreach (dllInfo item in allDLLData)
                    {
                        Debug.WriteLine("Name: " + item.dllName);
                        foreach (dllFunction function in item.functionList)
                        {
                            Debug.WriteLine(function.FuncName);
                        }
                        Debug.WriteLine("---------------------");
                    }
                }catch (Exception ex)
                {
                    GuiLogger.logException("Invalid Source JSON", ex.Message);
                    allDLLData.Clear();
                    return;
                }
            }
            else
            {
                GuiLogger.logException("Invalid Source JSON", "Please Correct");
            }
        }
コード例 #4
0
ファイル: MainPage.xaml.cs プロジェクト: KaminFay/CSE687
        /*
         * ----< Function > FunctionToggled
         * ----< Description >
         * Once a function is toggled it will be added into a list of functions that
         * are to be sent to the test harness backend.
         * ----< Description >
         */
        private void FunctionToggled(object sender, RoutedEventArgs e)
        {
            ToggleSwitch toggleSwitch   = sender as ToggleSwitch;
            dllFunction  sampleFunction = (dllFunction)((Grid)toggleSwitch.Parent).DataContext;

            if (toggleSwitch.IsOn)
            {
                functionsToHarness.Add(sampleFunction);
                this.TestableList.ItemsSource = functionsToHarness;
            }
            else
            {
                functionsToHarness.Remove(sampleFunction);
                this.TestableList.ItemsSource = functionsToHarness;
            }
        }