Ejemplo n.º 1
0
        // ------------------------------------------------------------------------------------
        // Filters

        // Get suite names and generate dropdown content
        void GenerateSuitesDropdown()
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Generating suites dropdown"); // Write to console
            List <Dropdown.OptionData> options = new List <Dropdown.OptionData>();                   // Create new options list

            options.Add(Common.ConvertStringToDropdownOptionData("All Suites"));
            string[] suites = SuiteManager.GetSuiteNames();                       // Get suite names
            for (int i = 0; i < suites.Length; i++)                               // Iterate suites
            {
                options.Add(Common.ConvertStringToDropdownOptionData(suites[i])); // Convert string to option data and add
            }
            suitesDropdown.options = options;                                     // Add options
        }
Ejemplo n.º 2
0
        // ------------------------------------------------------------------------------------
        // AltBaseline Menu
        // - Menu for chosing alternative baselines if current baselines are incomplete

        // Generate a resolve list
        IEnumerator GenerateAltBaselineList()
        {
            Console.Instance.Write(DebugLevel.Full, MessageLevel.Log, "Generating alternative baseline list"); // Write to console

            NameValueCollection fullSet = null;

            SQL.SQLIO.StartCoroutine(SQL.SQLIO.BaselineSetCheck(SuiteManager.GetSuiteNames(), (value => { fullSet = value; })));
            while (fullSet == null)
            {
                yield return(null);
            }

            Master.SetAltBaselines(fullSet);

            int count = 0;

            foreach (string key in fullSet.AllKeys)
            {
                foreach (string val in fullSet.GetValues(key))
                {
                    GameObject go = Instantiate(altBaselineWindow.listEntryPrefab, altBaselineWindow.contentRect, false);
                    MenuAltBaselineListEntry newEntry = go.GetComponent <MenuAltBaselineListEntry>();
                    newEntry.Setup(key, val);
                    count++;
                }
            }
            if (count == 0)
            {
                altBaselineWindow.button.interactable    = false;
                altBaselineWindow.altBaselineButton.text = String.Format("No Alternative Baselines Available", count);
            }
            else
            {
                altBaselineWindow.button.interactable    = true;
                altBaselineWindow.altBaselineButton.text = String.Format("Alternative Baselines  ( {0} )", count);
            }
        }
Ejemplo n.º 3
0
        public IEnumerator Init()
        {
            ProgressScreen.Instance.SetState(true, ProgressType.LocalLoad, "Loading local data"); //Show loading screen
            _suiteBaselineData = LocalIO.Instance.ReadLocalBaselines();                           // - TODO this needs to get called again at some point

            //Hardcoded wait for SuiteManager to populate - TODO might be cleaner way to do later
            float timeout = 0f;

            while (SuiteManager.GetSuiteNames().Length == 0)
            {
                timeout += Time.deltaTime;
                if (timeout > 5f)
                {
                    break;
                }
                yield return(new WaitForEndOfFrame());
            }

            //wait for the SQL connection to be made, timeout after 10seconds
            timeout = 0f;
            do
            {
                yield return(new WaitForEndOfFrame());

                timeout += Time.deltaTime;
            } while(SQL.SQLIO.Instance.liveConnection == connectionStatus.Internet && timeout < 10f);

            //if timeout reaches 10f then no network

            //fetch suite names from the suite manager
            string[] suiteNames = SuiteManager.GetSuiteNames();

            if (suiteNames.Length == 0)                                                                                                       //if there are no suites loaded fail - TODO need to add code path for this
            {
                Console.Instance.Write(DebugLevel.Critical, MessageLevel.LogWarning, "No suites loaded in SuiteManager, unable to continue"); // Write to console
            }
            else
            {
                //now we check local timestamps vs server to make sure up to date, then add the outdated ones to be pulled
                foreach (string suiteName in suiteNames)
                {
                    Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Fetching baseline timestamps from cloud");
                    //Get timestamp for suite via SQL
                    DateTime dt = DateTime.MaxValue;
                    StartCoroutine(SQL.SQLIO.Instance.GetbaselineTimestamp(suiteName, (value => { dt = value; })));
                    while (dt == DateTime.MaxValue)
                    {
                        yield return(null);
                    }
                    if (dt != DateTime.MinValue)//Min value is null(doesnt exist)
                    {
                        CompareBaselineTimestamps(suiteName, dt.ToString());
                    }
                }

                if (suiteBaselinesPullList.Count > 0)
                {
                    ResultsIOData[] data = null;
                    StartCoroutine(SQL.SQLIO.Instance.FetchBaselines(suiteBaselinesPullList.ToArray(), sysData.Platform, sysData.API, (value => { data = value; })));
                    while (data == null)
                    {
                        yield return(null);
                    }
                    //ResultsIOData[] data = SQL.SQLIO.Instance.FetchBaselines (suiteBaselinesPullList.ToArray (), sysData.Platform, sysData.API);
                    Console.Instance.Write(DebugLevel.File, MessageLevel.Log, "Cloud baselines pulled, writing local files");
                    foreach (ResultsIOData rd in data)
                    {
                        StartCoroutine(LocalIO.Instance.WriteDataFiles(rd, fileType.Baseline));
                    }
                    yield return(new WaitForSeconds(0.5f));

                    _suiteBaselineData = LocalIO.Instance.ReadLocalBaselines();
                    BroadcastBaselineParsed();
                }
                else
                {
                    Console.Instance.Write(DebugLevel.Logic, MessageLevel.Log, "No cloud based baselines to pull");                      // Write to console
                    BroadcastBaselineParsed();
                }
            }
        }