//
// Radegast Metaverse Client
-// Copyright (c) 2009-2012, Radegast Development Team
+// Copyright (c) 2009-2014, Radegast Development Team
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
using System.Text;
using System.Text.RegularExpressions;
using System.Timers;
+#if (COGBOT_LIBOMV || USE_STHREADS)
+using ThreadPoolUtil;
+using Thread = ThreadPoolUtil.Thread;
+using ThreadPool = ThreadPoolUtil.ThreadPool;
+using Monitor = ThreadPoolUtil.Monitor;
+#endif
using System.Threading;
+
using System.Windows.Forms;
using System.Resources;
using System.IO;
private bool AutoPilotActive = false;
private TransparentButton btnDialogNextControl;
private MediaConsole mediaConsole;
+ private SlUriParser uriParser;
#endregion
#region Constructor and disposal
public void InitializeControls()
{
InitializeTabsConsole();
+ uriParser = new SlUriParser();
if (instance.MediaManager.SoundSystemAvailable)
{
{
if (InAutoReconnect)
{
- if (instance.GlobalSettings["auto_reconnect"].AsBoolean())
+ if (instance.GlobalSettings["auto_reconnect"].AsBoolean() && e.FailReason != "tos")
BeginAutoReconnect();
else
InAutoReconnect = false;
public bool ProcessSecondlifeURI(string link)
{
- // First try if we have a region name, assume it's a teleport link if we have
- Regex r = new Regex(@"^(secondlife://)(?<region>[^/$]+)(/(?<x>\d+))?((/?<y>\d+))?(/(?<z>\d+))?",
- RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
- Match m = r.Match(link);
-
- if (m.Success)
- {
- string region = HttpUtility.UrlDecode(m.Groups["region"].Value);
- int x = string.IsNullOrEmpty(m.Groups["x"].Value) ? 128 : int.Parse(m.Groups["x"].Value);
- int y = string.IsNullOrEmpty(m.Groups["y"].Value) ? 128 : int.Parse(m.Groups["y"].Value);
- int z = string.IsNullOrEmpty(m.Groups["z"].Value) ? 0 : int.Parse(m.Groups["z"].Value);
- MapTab.Select();
- WorldMap.DisplayLocation(region, x, y, z);
- return true;
- }
-
- // Is it group profile link
- r = new Regex(@"^secondlife:///app/group/(?<id>[^/]+)/about",
- RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
- m = r.Match(link);
-
- if (m.Success)
- {
- UUID id;
- if (UUID.TryParse(m.Groups["id"].Value, out id))
- {
- ShowGroupProfile(id);
- return true;
- }
- return false;
- }
-
- // Is it user profile link
- r = new Regex(@"^secondlife:///app/agent/(?<id>[^/]+)/about",
- RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture | RegexOptions.IgnoreCase);
- m = r.Match(link);
-
- if (m.Success)
- {
- UUID id;
- if (UUID.TryParse(m.Groups["id"].Value, out id))
- {
- ShowAgentProfile(instance.Names.Get(id), id);
- return true;
- }
- return false;
- }
-
- return false;
+ uriParser.ExecuteLink(link);
+ return true;
}
public void ProcessLink(string link)
link = link.Substring(pos + 1);
}
- if (link.StartsWith("secondlife://"))
+ if (link.StartsWith("secondlife://") || link.StartsWith("[secondlife://"))
{
return ProcessSecondlifeURI(link);
}
private void importObjectToolStripMenuItem_Click(object sender, EventArgs e)
{
- PrimDeserializer.ImportFromFile(client);
+ //PrimDeserializer.ImportFromFile(client);
+ DisplayImportConsole();
}
private void autopilotToolStripMenuItem_Click(object sender, EventArgs e)
}
+ int filesDeleted;
+
+ private void deleteFolder(DirectoryInfo dir)
+ {
+ foreach (var file in dir.GetFiles())
+ {
+ try
+ {
+ file.Delete();
+ filesDeleted++;
+ }
+ catch { }
+ }
+
+ foreach (var subDir in dir.GetDirectories())
+ {
+ deleteFolder(subDir);
+ }
+
+ try { dir.Delete(); }
+ catch { }
+ }
+
private void cleanCacheToolStripMenuItem_Click(object sender, EventArgs e)
{
- ThreadPool.QueueUserWorkItem(sync => client.Assets.Cache.Clear());
+ WorkPool.QueueUserWorkItem(sync =>
+ {
+ filesDeleted = 0;
+ try { deleteFolder(new DirectoryInfo(client.Settings.ASSET_CACHE_DIR)); }
+ catch { }
+ Logger.DebugLog("Wiped out " + filesDeleted + " files from the cache directory.");
+ });
instance.Names.CleanCache();
}
private void rebakeTexturesToolStripMenuItem_Click(object sender, EventArgs e)
{
- client.Appearance.RequestSetAppearance(true);
+ instance.COF.RebakeTextures();
}
public void MapToCurrentLocation()
ProcessLink("http://jira.openmetaverse.org/browse/RAD");
}
+ private void accessibilityGuideToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ ProcessLink("http://radegast.org/wiki/Accessibility_Guide");
+ }
+
private void aboutRadegastToolStripMenuItem_Click(object sender, EventArgs e)
{
(new frmAbout(instance)).ShowDialog();
}
ShowInTaskbar = false;
trayIcon.Visible = true;
- FormBorderStyle = FormBorderStyle.SizableToolWindow;
+ trayIcon.BalloonTipText = "Radegast is runnig in the background";
+ trayIcon.ShowBalloonTip(2000);
}
}
WindowState = FormWindowState.Normal;
ShowInTaskbar = true;
trayIcon.Visible = false;
- FormBorderStyle = FormBorderStyle.Sizable;
}
private void ctxTreyRestore_Click(object sender, EventArgs e)
}
}
+ public void DisplayExportConsole(uint localID)
+ {
+ if (InvokeRequired)
+ {
+ if (IsHandleCreated || !instance.MonoRuntime)
+ BeginInvoke(new MethodInvoker(() => DisplayExportConsole(localID)));
+ return;
+ }
+
+ if (tabsConsole.TabExists("export console"))
+ {
+ tabsConsole.Tabs["export console"].Close();
+ }
+ RadegastTab tab = tabsConsole.AddTab("export console", "Export Object", new ExportConsole(client, localID));
+ tab.Select();
+ }
+
+ public void DisplayImportConsole()
+ {
+ if (TabConsole.TabExists("import console"))
+ {
+ TabConsole.Tabs["import console"].Select();
+ }
+ else
+ {
+ RadegastTab tab = tabsConsole.AddTab("import console", "Import Object", new ImportConsole(client));
+ tab.AllowClose = false;
+ tab.AllowHide = true;
+ tab.Select();
+ }
+ }
+
+ public void DisplayColladaConsole(Primitive prim)
+ {
+ if (InvokeRequired)
+ {
+ if (IsHandleCreated || !instance.MonoRuntime)
+ BeginInvoke(new MethodInvoker(() => DisplayColladaConsole(prim)));
+ return;
+ }
+
+ if (tabsConsole.TabExists("collada console"))
+ {
+ tabsConsole.Tabs["collada console"].Close();
+ }
+ RadegastTab tab = tabsConsole.AddTab("collada console", "Export Collada", new ExportCollada(instance, prim));
+ tab.Select();
+ }
+
private void regionParcelToolStripMenuItem_Click(object sender, EventArgs e)
{
DisplayRegionParcelConsole();
private void tlblParcel_Click(object sender, EventArgs e)
{
+ if (!client.Network.Connected) return;
DisplayRegionParcelConsole();
}
private void loginToolStripMenuItem_Click(object sender, EventArgs e)
{
+ // We are logging in without exiting the client
+ // Mark last run as successful
+ instance.MarkEndExecution();
TabConsole.InitializeMainTab();
TabConsole.Tabs["login"].Select();
}
+
+ private void setMaturityLevel(string level)
+ {
+ client.Self.SetAgentAccess(level, res =>
+ {
+ if (res.Success)
+ {
+ tabsConsole.DisplayNotificationInChat("Successfully changed maturity access level to " + res.NewLevel);
+ }
+ else
+ {
+ tabsConsole.DisplayNotificationInChat("Failed to change maturity access level.", ChatBufferTextStyle.Error);
+ }
+ });
+ }
+
+ private void pGToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ setMaturityLevel("PG");
+ }
+
+ private void matureToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ setMaturityLevel("M");
+ }
+
+ private void adultToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ setMaturityLevel("A");
+ }
+
+ private void uploadmeshToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ if (!tabsConsole.TabExists("mesh upload console"))
+ {
+ tabsConsole.AddTab("mesh upload console", "Upload mesh", new MeshUploadConsole(instance));
+ }
+ tabsConsole.Tabs["mesh upload console"].Select();
+ }
+
}
}
\ No newline at end of file