internal LinSynth(PluginControl pc, string[] beeps) { BeepNames = beeps; ToASCII = new System.Text.ASCIIEncoding(); OSDMap speech = pc.config["synthesizer"] as OSDMap; if (speech == null) { speech = new OSDMap(); speech["server"] = new OSDString("localhost:1314"); speech["speed"] = new OSDInteger(0); pc.config["synthesizer"] = speech; pc.SaveSpeechSettings(); } string server = speech["server"].AsString() ?? "localhost:1314"; string[] parts = server.Split(':'); serverhost = parts[0]; if (parts.Length > 1) { serverport = parts[1]; } else { serverport = "1314"; } rateBias = speech["speed"].AsInteger(); // Build the festival command line args ActualArgs = Regex.Replace(SynthArgs, @"%S", serverhost); ActualArgs = Regex.Replace(ActualArgs, @"%P", serverport); voiceProperties = pc.config["properties"] as OSDMap; }
public void DeserializeNestedComposite() { OSD llsdNested = OSDParser.DeserializeLLSDBinary(binaryNested); Assert.AreEqual(OSDType.Array, llsdNested.Type); OSDArray llsdArray = (OSDArray)llsdNested; Assert.AreEqual(3, llsdArray.Count); OSDMap llsdMap = (OSDMap)llsdArray[0]; Assert.AreEqual(OSDType.Map, llsdMap.Type); Assert.AreEqual(2, llsdMap.Count); OSDArray llsdNestedArray = (OSDArray)llsdMap["t0st"]; Assert.AreEqual(OSDType.Array, llsdNestedArray.Type); OSDInteger llsdNestedIntOne = (OSDInteger)llsdNestedArray[0]; Assert.AreEqual(OSDType.Integer, llsdNestedIntOne.Type); Assert.AreEqual(1, llsdNestedIntOne.AsInteger()); OSDInteger llsdNestedIntTwo = (OSDInteger)llsdNestedArray[1]; Assert.AreEqual(OSDType.Integer, llsdNestedIntTwo.Type); Assert.AreEqual(2, llsdNestedIntTwo.AsInteger()); OSDString llsdString = (OSDString)llsdMap["test"]; Assert.AreEqual(OSDType.String, llsdString.Type); Assert.AreEqual("what", llsdString.AsString()); OSDInteger llsdIntOne = (OSDInteger)llsdArray[1]; Assert.AreEqual(OSDType.Integer, llsdIntOne.Type); Assert.AreEqual(124, llsdIntOne.AsInteger()); OSDInteger llsdIntTwo = (OSDInteger)llsdArray[2]; Assert.AreEqual(OSDType.Integer, llsdIntTwo.Type); Assert.AreEqual(987, llsdIntTwo.AsInteger()); }
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) { OSD extras = new OSDMap(); if (features.ContainsKey("OpenSimExtras")) { extras = features["OpenSimExtras"]; } else { features["OpenSimExtras"] = extras; } if (m_SayRange == null) { // Do this only once m_SayRange = new OSDInteger(m_saydistance); m_WhisperRange = new OSDInteger(m_whisperdistance); m_ShoutRange = new OSDInteger(m_shoutdistance); } ((OSDMap)extras)["say-range"] = m_SayRange; ((OSDMap)extras)["whisper-range"] = m_WhisperRange; ((OSDMap)extras)["shout-range"] = m_ShoutRange; }
internal LinSynth( PluginControl pc, string[] beeps) { BeepNames = beeps; ToASCII = new System.Text.ASCIIEncoding(); OSDMap speech = pc.config["synthesizer"] as OSDMap; if (speech == null) { speech = new OSDMap(); speech["server"] = new OSDString("localhost:1314"); speech["speed"] = new OSDInteger(0); pc.config["synthesizer"] = speech; pc.SaveSpeechSettings(); } string server = speech["server"].AsString(); if (server==null) server = "localhost:1314"; string[] parts = server.Split(':'); serverhost = parts[0]; if (parts.Length>1) serverport = parts[1]; else serverport = "1314"; rateBias = speech["speed"].AsInteger(); // Build the festival command line args ActualArgs = Regex.Replace( SynthArgs, @"%S", serverhost ); ActualArgs = Regex.Replace( ActualArgs, @"%P", serverport ); voiceProperties = pc.config["properties"] as OSDMap; }
private void txtPort_Validated(object sender, EventArgs e) { int port = 6667; int.TryParse(txtPort.Text, out port); config["port"] = new OSDInteger(port); }
public void DeserializeArray() { string sArrayOne = "[]"; OSDArray llsdArrayOne = (OSDArray)OSDParser.DeserializeLLSDNotation(sArrayOne); Assert.AreEqual(OSDType.Array, llsdArrayOne.Type); Assert.AreEqual(0, llsdArrayOne.Count); string sArrayTwo = "[ i0 ]"; OSDArray llsdArrayTwo = (OSDArray)OSDParser.DeserializeLLSDNotation(sArrayTwo); Assert.AreEqual(OSDType.Array, llsdArrayTwo.Type); Assert.AreEqual(1, llsdArrayTwo.Count); OSDInteger llsdIntOne = (OSDInteger)llsdArrayTwo[0]; Assert.AreEqual(OSDType.Integer, llsdIntOne.Type); Assert.AreEqual(0, llsdIntOne.AsInteger()); string sArrayThree = "[ i0, i1 ]"; OSDArray llsdArrayThree = (OSDArray)OSDParser.DeserializeLLSDNotation(sArrayThree); Assert.AreEqual(OSDType.Array, llsdArrayThree.Type); Assert.AreEqual(2, llsdArrayThree.Count); OSDInteger llsdIntTwo = (OSDInteger)llsdArrayThree[0]; Assert.AreEqual(OSDType.Integer, llsdIntTwo.Type); Assert.AreEqual(0, llsdIntTwo.AsInteger()); OSDInteger llsdIntThree = (OSDInteger)llsdArrayThree[1]; Assert.AreEqual(OSDType.Integer, llsdIntThree.Type); Assert.AreEqual(1, llsdIntThree.AsInteger()); string sArrayFour = " [ \"testtest\", \"aha\",t,f,i1, r1.2, [ i1] ] "; OSDArray llsdArrayFour = (OSDArray)OSDParser.DeserializeLLSDNotation(sArrayFour); Assert.AreEqual(OSDType.Array, llsdArrayFour.Type); Assert.AreEqual(7, llsdArrayFour.Count); Assert.AreEqual("testtest", llsdArrayFour[0].AsString()); Assert.AreEqual("aha", llsdArrayFour[1].AsString()); Assert.AreEqual(true, llsdArrayFour[2].AsBoolean()); Assert.AreEqual(false, llsdArrayFour[3].AsBoolean()); Assert.AreEqual(1, llsdArrayFour[4].AsInteger()); Assert.AreEqual(1.2d, llsdArrayFour[5].AsReal()); Assert.AreEqual(OSDType.Array, llsdArrayFour[6].Type); OSDArray llsdArrayFive = (OSDArray)llsdArrayFour[6]; Assert.AreEqual(1, llsdArrayFive[0].AsInteger()); }
public void DeserializeIntegers() { OSD theSD = null; OSDArray array = null; OSDInteger tempInt = null; String testSD = @"<?xml version='1.0' encoding='UTF-8'?> <llsd> <array> <integer>2147483647</integer> <integer>-2147483648</integer> <integer>0</integer> <integer>013</integer> <integer/> </array> </llsd>"; //Deserialize the string byte[] bytes = Encoding.UTF8.GetBytes(testSD); theSD = OSDParser.DeserializeLLSDXml(bytes); Assert.IsTrue(theSD is OSDArray); array = (OSDArray)theSD; Assert.AreEqual(OSDType.Integer, array[0].Type); tempInt = (OSDInteger)array[0]; Assert.AreEqual(2147483647, tempInt.AsInteger()); Assert.AreEqual(OSDType.Integer, array[1].Type); tempInt = (OSDInteger)array[1]; Assert.AreEqual(-2147483648, tempInt.AsInteger()); Assert.AreEqual(OSDType.Integer, array[2].Type); tempInt = (OSDInteger)array[2]; Assert.AreEqual(0, tempInt.AsInteger()); Assert.AreEqual(OSDType.Integer, array[3].Type); tempInt = (OSDInteger)array[3]; Assert.AreEqual(13, tempInt.AsInteger()); Assert.AreEqual(OSDType.Integer, array[4].Type); tempInt = (OSDInteger)array[4]; Assert.AreEqual(0, tempInt.AsInteger()); }
protected bool OnSceneGroupMove(UUID groupId, Vector3 delta) { OSDMap attrs = null; SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId); if (sop == null) { return(true); } if (!sop.DynAttrs.TryGetStore(Namespace, StoreName, out attrs)) { attrs = new OSDMap(); } OSDInteger newValue; // We have to lock on the entire dynamic attributes map to avoid race conditions with serialization code. lock (sop.DynAttrs) { if (!attrs.ContainsKey("moves")) { newValue = new OSDInteger(1); } else { newValue = new OSDInteger(attrs["moves"].AsInteger() + 1); } attrs["moves"] = newValue; sop.DynAttrs.SetStore(Namespace, StoreName, attrs); } sop.ParentGroup.HasGroupChanged = true; string msg = string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue); m_log.DebugFormat("[DA EXAMPLE MODULE]: {0}", msg); m_dialogMod.SendGeneralAlert(msg); return(true); }
protected virtual void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) { OSD extras; if (!features.TryGetValue("OpenSimExtras", out extras)) { extras = new OSDMap(); } if (m_SayRange == null) { // Do this only once m_SayRange = new OSDInteger(m_saydistance); m_WhisperRange = new OSDInteger(m_whisperdistance); m_ShoutRange = new OSDInteger(m_shoutdistance); } ((OSDMap)extras)["say-range"] = m_SayRange; ((OSDMap)extras)["whisper-range"] = m_WhisperRange; ((OSDMap)extras)["shout-range"] = m_ShoutRange; }
private void readConfig() { config = instance.GlobalSettings["plugin." + pluginName] as OSDMap; if (config == null) { config = new OSDMap(); config["startup_delay"] = new OSDInteger(60); config["delivery_interval"] = new OSDInteger(60); instance.GlobalSettings["plugin." + pluginName] = config; } if (!config.ContainsKey("startup_delay")) { config["startup_delay"] = 60; } if (!config.ContainsKey("delivery_interval")) { config["delivery_interval"] = 60; } STARTUP_DELAY = config["startup_delay"].AsInteger(); DELIVERY_INTERVAL = config["delivery_interval"].AsInteger(); }
private void readConfig() { config = instance.GlobalSettings["plugin." + pluginName] as OSDMap; if (config == null) { config = new OSDMap(); config["startup_delay"] = new OSDInteger(60); config["delivery_interval"] = new OSDInteger(60); instance.GlobalSettings["plugin." + pluginName] = config; } if (!config.ContainsKey("startup_delay")) config["startup_delay"] = 60; if (!config.ContainsKey("delivery_interval")) config["delivery_interval"] = 60; STARTUP_DELAY = config["startup_delay"].AsInteger(); DELIVERY_INTERVAL = config["delivery_interval"].AsInteger(); }
public RelayConsole(RadegastInstance instance) : base(instance) { InitializeComponent(); Disposed += RelayConsole_Disposed; textPrinter = new RichTextBoxPrinter(rtbChatText); // Get configuration settings, and initialize if not found. config = instance.GlobalSettings["plugin.irc"] as OSDMap; if (config == null) { config = new OSDMap(); config["server"] = new OSDString("irc.freenode.net"); config["port"] = new OSDInteger(6667); config["nick"] = new OSDString(string.Empty); config["channel"] = new OSDString("#"); config["send_delay"] = new OSDInteger(200); config["auto_reconnect"] = new OSDBoolean(true); config["ctcp_version"] = new OSDString("Radegast IRC"); instance.GlobalSettings["plugin.irc"] = config; } if (!config.ContainsKey("server")) config["server"] = new OSDString("irc.freenode.net"); if (!config.ContainsKey("port")) config["port"] = new OSDInteger(6667); if (!config.ContainsKey("nick")) config["nick"] = new OSDString(instance.Client.Self.Name); if (!config.ContainsKey("channel")) config["channel"] = new OSDString("#"); if (!config.ContainsKey("send_delay")) config["send_delay"] = new OSDInteger(200); if (!config.ContainsKey("auto_reconnect")) config["auto_reconnect"] = new OSDBoolean(true); if (!config.ContainsKey("ctcp_version")) config["ctcp_version"] = new OSDString("Radegast IRC"); txtChan.Text = config["channel"].AsString(); txtNick.Text = config["nick"].AsString(); txtPort.Text = config["port"].AsString(); txtServer.Text = config["server"].AsString(); irc = new IrcClient(); irc.SendDelay = config["send_delay"].AsInteger(); irc.AutoReconnect = config["auto_reconnect"].AsBoolean(); irc.CtcpVersion = config["ctcp_version"].AsString(); irc.Encoding = Encoding.UTF8; TC.OnTabAdded += TC_OnTabAdded; TC.OnTabRemoved += TC_OnTabRemoved; irc.OnError += irc_OnError; irc.OnRawMessage += irc_OnRawMessage; irc.OnChannelMessage += irc_OnChannelMessage; irc.OnConnected += irc_OnConnected; irc.OnDisconnected += irc_OnDisconnected; client.Self.IM += Self_IM; client.Self.ChatFromSimulator += Self_ChatFromSimulator; UpdateGui(); RefreshGroups(); }
public RelayConsole(RadegastInstance instance) : base(instance) { InitializeComponent(); Disposed += RelayConsole_Disposed; textPrinter = new RichTextBoxPrinter(rtbChatText); // Get configuration settings, and initialize if not found. config = instance.GlobalSettings["plugin.irc"] as OSDMap; if (config == null) { config = new OSDMap(); config["server"] = new OSDString("irc.freenode.net"); config["port"] = new OSDInteger(6667); config["nick"] = new OSDString(string.Empty); config["channel"] = new OSDString("#"); config["send_delay"] = new OSDInteger(200); config["auto_reconnect"] = new OSDBoolean(true); config["ctcp_version"] = new OSDString("Radegast IRC"); instance.GlobalSettings["plugin.irc"] = config; } if (!config.ContainsKey("server")) { config["server"] = new OSDString("irc.freenode.net"); } if (!config.ContainsKey("port")) { config["port"] = new OSDInteger(6667); } if (!config.ContainsKey("nick")) { config["nick"] = new OSDString(instance.Client.Self.Name); } if (!config.ContainsKey("channel")) { config["channel"] = new OSDString("#"); } if (!config.ContainsKey("send_delay")) { config["send_delay"] = new OSDInteger(200); } if (!config.ContainsKey("auto_reconnect")) { config["auto_reconnect"] = new OSDBoolean(true); } if (!config.ContainsKey("ctcp_version")) { config["ctcp_version"] = new OSDString("Radegast IRC"); } txtChan.Text = config["channel"].AsString(); txtNick.Text = config["nick"].AsString(); txtPort.Text = config["port"].AsString(); txtServer.Text = config["server"].AsString(); irc = new IrcClient(); irc.SendDelay = config["send_delay"].AsInteger(); irc.AutoReconnect = config["auto_reconnect"].AsBoolean(); irc.CtcpVersion = config["ctcp_version"].AsString(); irc.Encoding = Encoding.UTF8; TC.OnTabAdded += TC_OnTabAdded; TC.OnTabRemoved += TC_OnTabRemoved; irc.OnError += irc_OnError; irc.OnRawMessage += irc_OnRawMessage; irc.OnChannelMessage += irc_OnChannelMessage; irc.OnConnected += irc_OnConnected; irc.OnDisconnected += irc_OnDisconnected; client.Self.IM += Self_IM; client.Self.ChatFromSimulator += Self_ChatFromSimulator; UpdateGui(); RefreshGroups(); }
protected bool OnSceneGroupMove(UUID groupId, Vector3 delta) { OSDMap attrs = null; SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId); if (sop == null) return true; if (!sop.DynAttrs.TryGetValue(DANamespace, out attrs)) attrs = new OSDMap(); OSDInteger newValue; // We have to lock on the entire dynamic attributes map to avoid race conditions with serialization code. lock (sop.DynAttrs) { if (!attrs.ContainsKey("moves")) newValue = new OSDInteger(1); else newValue = new OSDInteger(attrs["moves"].AsInteger() + 1); attrs["moves"] = newValue; sop.DynAttrs[DANamespace] = attrs; } sop.ParentGroup.HasGroupChanged = true; m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); return true; }
private void OnSimulatorFeaturesRequest(UUID agentID, ref OSDMap features) { OSD extras = new OSDMap(); if (features.ContainsKey("OpenSimExtras")) extras = features["OpenSimExtras"]; else features["OpenSimExtras"] = extras; if (m_SayRange == null) { // Do this only once m_SayRange = new OSDInteger(m_saydistance); m_WhisperRange = new OSDInteger(m_whisperdistance); m_ShoutRange = new OSDInteger(m_shoutdistance); } ((OSDMap)extras)["say-range"] = m_SayRange; ((OSDMap)extras)["whisper-range"] = m_WhisperRange; ((OSDMap)extras)["shout-range"] = m_ShoutRange; }
protected bool OnSceneGroupMove(UUID groupId, Vector3 delta) { OSDMap attrs = null; SceneObjectPart sop = m_scene.GetSceneObjectPart(groupId); if (!sop.DynAttrs.TryGetValue(Name, out attrs)) attrs = new OSDMap(); OSDInteger newValue; if (!attrs.ContainsKey("moves")) newValue = new OSDInteger(1); else newValue = new OSDInteger(((OSDInteger)attrs["moves"]).AsInteger() + 1); attrs["moves"] = newValue; sop.DynAttrs[Name] = attrs; m_dialogMod.SendGeneralAlert(string.Format("{0} {1} moved {2} times", sop.Name, sop.UUID, newValue)); return true; }