Esempio n. 1
0
        //This is complete overkill, using the xmlserializer. But I already had similar code for the xcore property table
        #region persistUserChoices

        private StringPair[] MakeArrayForSerializing()
        {
            StringPair[] list = new StringPair[SavedResponses.Count];
            int          i    = 0;

            foreach (string key in SavedResponses.Keys)
            {
                StringPair pair = new StringPair();
                pair.key   = key;
                pair.value = SavedResponses[key];
                list.SetValue(pair, i);
                i++;
            }

            return(list);
        }
Esempio n. 2
0
        //This is complete overkill, using the xmlserializer. But I already had similar code for the xcore property table
        #region persistUserChoices

        private static StringPair[] MakeArrayForSerializing()
        {
            var list = new StringPair[MessageBoxExManager.SavedResponses.Count];
            int i    = 0;

            foreach (string key in MessageBoxExManager.SavedResponses.Keys)
            {
                var pair = new StringPair {
                    key = key, value = MessageBoxExManager.SavedResponses[key]
                };
                list.SetValue(pair, i);
                i++;
            }

            return(list);
        }
Esempio n. 3
0
        private void AddSavedResponsesSafely(Dictionary <string, string> responseDict, StringPair pair)
        {
            // The original code here threw an exception if the pair key was already in the dictionary.
            // We don't want to overwrite what's in memory with what's on disk, so we'll skip them in that case.
            string dummyValue;

            if (responseDict.TryGetValue(pair.key, out dummyValue))
            {
                return;
            }
            responseDict.Add(pair.key, pair.value);
        }
Esempio n. 4
0
		private void ReadStringPairArrayForDeserializing(StringPair[] list)
		{
			foreach (StringPair pair in list)
			{
				//I know it is strange, but the serialization code will give us a
				//	null property if there were no other properties.
				if (pair != null)
				{
					SavedResponses.Add(pair.key, pair.value);
				}
			}
		}
Esempio n. 5
0
		//This is complete overkill, using the xmlserializer. But I already had similar code for the xcore property table
		#region persistUserChoices

		private StringPair[] MakeArrayForSerializing()
		{
			StringPair[] list = new StringPair[SavedResponses.Count];
			int i = 0;
			foreach (string key in SavedResponses.Keys)
			{
				StringPair pair = new StringPair();
				pair.key = key;
				pair.value = SavedResponses[key];
				list.SetValue(pair, i);
				i++;
			}

			return list;
		}
		private void AddSavedResponsesSafely(Dictionary<string, string> responseDict, StringPair pair)
		{
			// The original code here threw an exception if the pair key was already in the dictionary.
			// We don't want to overwrite what's in memory with what's on disk, so we'll skip them in that case.
			string dummyValue;
			if(responseDict.TryGetValue(pair.key, out dummyValue))
				return;
			responseDict.Add(pair.key, pair.value);
		}
		private void ReadStringPairArrayForDeserializing(StringPair[] list)
		{
			foreach (StringPair pair in list)
			{
				//I know it is strange, but the serialization code will give us a
				//	null property if there were no other properties.
				if (pair != null)
				{
					AddSavedResponsesSafely(MessageBoxExManager.SavedResponses, pair);
				}
			}
		}
		//This is complete overkill, using the xmlserializer. But I already had similar code for the xcore property table
		#region persistUserChoices

		private static StringPair[] MakeArrayForSerializing()
		{
			var list = new StringPair[MessageBoxExManager.SavedResponses.Count];
			int i = 0;
			foreach (string key in MessageBoxExManager.SavedResponses.Keys)
			{
				var pair = new StringPair {key = key, value = MessageBoxExManager.SavedResponses[key]};
				list.SetValue(pair, i);
				i++;
			}

			return list;
		}