Пример #1
0
        static void SaveEdits()
        {
            StringBuilder newOrderedTabList = new StringBuilder();

            for (int x = 0; x < TabPreferences.Count; x++)
            {
                newOrderedTabList.Append(string.Format("{0}${1}|", TabPreferences[x].Key, x + 1));
            }
            FileBroker.SaveNonUnityTextResource(FileResource.NexusTabs, newOrderedTabList.ToString());
        }
Пример #2
0
        public static void SaveMostRecentsResults(string status)
        {
            _testsMeta = new List <KeyValuePair <string, string[]> >();
            fileText   = new StringBuilder();

            string plainText = string.Format("status:{0}|name:{1}|class:{2}|test_categories:{3}",
                                             status, AutomationMaster.CurrentTestContext.TestName, AutomationMaster.CurrentTestContext.ClassName, string.Join(", ", AutomationMaster.CurrentTestContext.Categories.ToArray()));

            GetMostRecentsResults(status, plainText);

            //Save updated results.
            FileBroker.SaveNonUnityTextResource(FileResource.LatestTestResults, fileText);
        }
Пример #3
0
        public void SaveUpdates()
        {
            if (ResourceOrigin == FileResource.TrilleonConfig)
            {
                throw new UnityEngine.UnityException("Cannot save to TrilleonConfig from ConfigReader at this time. Not implemented.");
            }

            StringBuilder configRaw = new StringBuilder();

            for (int i = 0; i < _customConfigs.Count; i++)
            {
                configRaw.AppendLine(string.Format("{0}={1}", _customConfigs[i].Key, _customConfigs[i].Value));
            }
            for (int i = 0; i < _requiredConfigs.Count; i++)
            {
                configRaw.AppendLine(string.Format("{0}={1}", _requiredConfigs[i].Key, _requiredConfigs[i].Value));
            }
            FileBroker.SaveNonUnityTextResource(ResourceOrigin, configRaw.ToString());
        }
Пример #4
0
        void SaveNew()
        {
            StringBuilder sb = new StringBuilder();

            if (FavoritesList.Count > 0)
            {
                sb.Append(AutomationMaster.DELIMITER);
            }

            if (isEdit)
            {
                keyToDelete = FavoritesList[EditId].Key;
                DeleteFavorite();
                isEdit = false;
            }

            sb.Append(newName);
            sb.Append(internalDelimiter);
            List <string> handledClasses = new List <string>();

            for (int x = 0; x < buildingAdded.Count; x++)
            {
                string className = buildingAdded[x].Key;
                if (handledClasses.Contains(className))
                {
                    continue;
                }
                List <KeyValuePair <string, string> > sameClass = buildingAdded.FindAll(k => k.Key == className);
                sameClass = sameClass.OrderByValues();
                string nextToAdd = string.Format("{0}{1}{2}{3}", className, classIndicator, buildingAdded[x].Value.Length > 0 ? internalDelimiter : string.Empty, buildingAdded[x].Value.Length > 0 ? (sameClass.Count > 1 ? string.Join(internalDelimiter, sameClass.ExtractListOfValuesFromKeyValList().ToArray()) : buildingAdded[x].Value) : string.Empty);
                sb.Append(nextToAdd);
                if (x + 1 != buildingAdded.Count)
                {
                    sb.Append(internalDelimiter);
                }
                handledClasses.Add(className);
            }
            FileBroker.SaveNonUnityTextResource(AutomationMaster.UnitTestMode ? FileResource.FavoritesUnit : FileResource.Favorites, sb.ToString(), false);
            newName = string.Empty;
            Set();
            Nexus.Self.Tests.Update_Data = true;
        }
Пример #5
0
        //Take raw file data and simply splice out substring that represents this Favorite's data.
        void DeleteFavorite()
        {
            string        rawFavoritesData = FileBroker.GetNonUnityTextResource(AutomationMaster.UnitTestMode ? FileResource.FavoritesUnit : FileResource.Favorites);
            List <string> split            = rawFavoritesData.Split(new string[] { string.Format("{0}{1}", AutomationMaster.DELIMITER, keyToDelete) }, StringSplitOptions.None).ToList();

            StringBuilder newData = new StringBuilder();

            if (split.Count > 1)
            {
                //The item to be deleted is the first Favorites list in the file, so there will not be a complete splice.
                newData.Append(split.First());
            }
            split = split.Last().Split(AutomationMaster.DELIMITER).ToList();
            for (int s = 1; s < split.Count; s++)
            {
                newData.Append(string.Format("{0}{1}", AutomationMaster.DELIMITER, split[s]));
            }
            FileBroker.SaveNonUnityTextResource(AutomationMaster.UnitTestMode ? FileResource.FavoritesUnit : FileResource.Favorites, newData.ToString(), true);
            Set();
            Nexus.Self.Tests.Update_Data = true;
        }
Пример #6
0
        public static void SaveBuddyHistory(string buddyName)
        {
            string saveName = buddyName.Replace(Arbiter.DEVICE_IDENTIFIER_PREFIX, string.Empty);

            string        txt        = FileBroker.GetNonUnityTextResource(FileResource.BuddyHistory);
            List <string> resultsRaw = txt.Split(new string[] { "\n" }, StringSplitOptions.None).ToList();
            StringBuilder fileText   = new StringBuilder();

            if (!resultsRaw.Contains(saveName))
            {
                resultsRaw.Add(saveName);
            }
            resultsRaw = resultsRaw.RemoveNullAndEmpty().Distinct();
            for (int f = 0; f < resultsRaw.Count; f++)
            {
                fileText.AppendLine(saveName);
            }

            //Save updated results.
            FileBroker.SaveNonUnityTextResource(FileResource.BuddyHistory, fileText);
        }