LIBOMV-477 Finished UpdateNotecardAgentInventoryMessage class for Message system (Still need unit test)
LIBOMV-496 Implements new ObservableDictionary class * Switched out KnownCaps dictionary in GridProxy to use new ObservableDictionary. LIBOMV-495 Fixes bug while loading saved settings file in WinGridProxy.AboutBox1.resources LIBOMV-492 Enhancements to WinGridProxy: * All Selection and Filtering menu uptions should work properly now * Made several setting optional in the File and Session menu * Filter preferences can be saved and restored (ie: white/blacklist like in GridProxy) * Work has began on WinGridProxy session searching * Switched out CheckedListBoxes for ListViews since they have more flexibility * Refactored WinGridProxy into multuple classes, major code cleanup * Capabilities discovered and events sent via the EventQueue are automatically added to the Messages Filter listview git-svn-id: http://libopenmetaverse.googlecode.com/svn/libopenmetaverse/trunk@2630 52acb1d6-8a22-11de-b505-999d5b087335
This commit is contained in:
@@ -1,4 +1,30 @@
|
||||
using System;
|
||||
/*
|
||||
* Copyright (c) 2009, openmetaverse.org
|
||||
* All rights reserved.
|
||||
*
|
||||
* - Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* - Redistributions of source code must retain the above copyright notice, this
|
||||
* list of conditions and the following disclaimer.
|
||||
* - Neither the name of the openmetaverse.org nor the names
|
||||
* of its contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using OpenMetaverse.StructuredData;
|
||||
@@ -9,8 +35,11 @@ namespace WinGridProxy
|
||||
class SettingsStore
|
||||
{
|
||||
public Dictionary<string, bool> MessageSessions;
|
||||
|
||||
public Dictionary<string, bool> PacketSessions;
|
||||
public bool AutoScrollEnabled;
|
||||
public bool StatisticsEnabled;
|
||||
public bool SaveSessionOnExit;
|
||||
public bool AutoCheckNewCaps;
|
||||
|
||||
public SettingsStore()
|
||||
{
|
||||
@@ -20,26 +49,37 @@ namespace WinGridProxy
|
||||
|
||||
public OSDMap Serialize()
|
||||
{
|
||||
OSDMap map = new OSDMap(2);
|
||||
OSDArray messageArray = new OSDArray(MessageSessions.Count);
|
||||
foreach (KeyValuePair<string, bool> kvp in MessageSessions)
|
||||
OSDMap map = new OSDMap();
|
||||
if (MessageSessions.Count > 0)
|
||||
{
|
||||
OSDMap sessionMap = new OSDMap(2);
|
||||
sessionMap["Capability"] = OSD.FromString(kvp.Key);
|
||||
sessionMap["Capture"] = OSD.FromBoolean(kvp.Value);
|
||||
messageArray.Add(sessionMap);
|
||||
OSDArray messageArray = new OSDArray(MessageSessions.Count);
|
||||
foreach (KeyValuePair<string, bool> kvp in MessageSessions)
|
||||
{
|
||||
OSDMap sessionMap = new OSDMap(2);
|
||||
sessionMap["Capability"] = OSD.FromString(kvp.Key);
|
||||
sessionMap["Capture"] = OSD.FromBoolean(kvp.Value);
|
||||
messageArray.Add(sessionMap);
|
||||
}
|
||||
map.Add("message_sessions", messageArray);
|
||||
}
|
||||
map["message_sessions"] = messageArray;
|
||||
|
||||
OSDArray packetArray = new OSDArray(PacketSessions.Count);
|
||||
foreach (KeyValuePair<string, bool> kvp in PacketSessions)
|
||||
if (PacketSessions.Count > 0)
|
||||
{
|
||||
OSDMap sessionMap = new OSDMap(2);
|
||||
sessionMap["PacketName"] = OSD.FromString(kvp.Key);
|
||||
sessionMap["Capture"] = OSD.FromBoolean(kvp.Value);
|
||||
packetArray.Add(sessionMap);
|
||||
OSDArray packetArray = new OSDArray(PacketSessions.Count);
|
||||
foreach (KeyValuePair<string, bool> kvp in PacketSessions)
|
||||
{
|
||||
OSDMap sessionMap = new OSDMap(2);
|
||||
sessionMap["PacketName"] = OSD.FromString(kvp.Key);
|
||||
sessionMap["Capture"] = OSD.FromBoolean(kvp.Value);
|
||||
packetArray.Add(sessionMap);
|
||||
}
|
||||
map.Add("packet_sessions", packetArray);
|
||||
}
|
||||
map["packet_sessions"] = packetArray;
|
||||
|
||||
map.Add("AutoScrollSessions", OSD.FromBoolean(AutoScrollEnabled));
|
||||
map.Add("CaptureStatistics", OSD.FromBoolean(StatisticsEnabled));
|
||||
map.Add("SaveProfileOnExit", OSD.FromBoolean(SaveSessionOnExit));
|
||||
map.Add("AutoCheckNewCaps", OSD.FromBoolean(AutoCheckNewCaps));
|
||||
|
||||
return map;
|
||||
}
|
||||
@@ -49,6 +89,12 @@ namespace WinGridProxy
|
||||
|
||||
if (map.ContainsKey("message_sessions"))
|
||||
{
|
||||
|
||||
AutoScrollEnabled = map["AutoScrollSessions"].AsBoolean();
|
||||
StatisticsEnabled = map["CaptureStatistics"].AsBoolean();
|
||||
SaveSessionOnExit = map["SaveProfileOnExit"].AsBoolean();
|
||||
AutoCheckNewCaps = map["AutoCheckNewCaps"].AsBoolean();
|
||||
|
||||
OSDArray messageArray = (OSDArray)map["message_sessions"];
|
||||
|
||||
MessageSessions = new Dictionary<string, bool>(messageArray.Count);
|
||||
@@ -86,14 +132,22 @@ namespace WinGridProxy
|
||||
|
||||
}
|
||||
|
||||
public void DeserializeFromFile(string fileName)
|
||||
public bool DeserializeFromFile(string fileName)
|
||||
{
|
||||
|
||||
if(File.Exists(fileName))
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
OSDMap map = (OSDMap)OSDParser.DeserializeLLSDNotation(File.ReadAllText(fileName));
|
||||
this.Deserialize(map);
|
||||
try
|
||||
{
|
||||
OSDMap map = (OSDMap)OSDParser.DeserializeLLSDNotation(File.ReadAllText(fileName));
|
||||
this.Deserialize(map);
|
||||
return true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine("Exception Deserializing From File: {0} {1}", e.Message, e.StackTrace);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SerializeToFile(string fileName)
|
||||
|
||||
Reference in New Issue
Block a user