public ntfPermissions(RadegastInstance instance, Simulator simulator, UUID taskID, UUID itemID, string objectName, string objectOwner, ScriptPermission questions)
            : base(NotificationType.PermissionsRequest)
        {
            InitializeComponent();

            this.instance = instance;
            this.simulator = simulator;
            this.taskID = taskID;
            this.itemID = itemID;
            this.objectName = objectName;
            this.objectOwner = objectOwner;
            this.questions = questions;

            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text = "Object " + objectName + " owned by " + objectOwner + " is asking permission to " + questions.ToString() + ". Do you accept?";

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);
            args.Text = txtMessage.Text;
            args.Buttons.Add(btnYes);
            args.Buttons.Add(btnNo);
            args.Buttons.Add(btnMute);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#2
0
        public LoginConsole(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(MainConsole_Disposed);

            this.instance = instance;
            AddNetcomEvents();

            if (instance.GlobalSettings["hide_login_graphics"].AsBoolean())
                pnlSplash.BackgroundImage = null;
            else
                pnlSplash.BackgroundImage = Properties.Resources.radegast_main_screen2;

            if (!instance.GlobalSettings.ContainsKey("remember_login"))
            {
                instance.GlobalSettings["remember_login"] = true;
            }

            instance.GlobalSettings.OnSettingChanged += new Settings.SettingChangedCallback(GlobalSettings_OnSettingChanged);

            lblVersion.Text = Properties.Resources.RadegastTitle + "." + RadegastBuild.CurrentRev;

            Load += new EventHandler(LoginConsole_Load);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#3
0
        public void StartPlugin(RadegastInstance inst)
        {
            return;
            Instance = inst;
            XmlConfigurator.Configure();

            ArgvConfigSource configSource = new ArgvConfigSource(new string[0]);
            configSource.Alias.AddAlias("On", true);
            configSource.Alias.AddAlias("Off", false);
            configSource.Alias.AddAlias("True", true);
            configSource.Alias.AddAlias("False", false);

            idealistUserControl = new IdealistUserControl();
            IV = new RadegastViewer(inst, configSource, idealistUserControl);
            IV.Startup();
            inst.TabConsole.AddTab("Idealist", "Idealist", idealistUserControl);
            //while (true)
            //{
            //    if (MainConsole.Instance != null)
            //    {
            //        MainConsole.Instance.Prompt();
            //        Thread.Sleep(100);
            //    }
            //}
        }
示例#4
0
 public RadegastMovement(RadegastInstance instance)
 {
     this.instance = instance;
     timer = new System.Timers.Timer(100);
     timer.Elapsed +=new ElapsedEventHandler(timer_Elapsed);
     timer.Enabled = false;
 }
示例#5
0
        public RelayConsole(RadegastInstance instance)
            : base(instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(RelayConsole_Disposed);
            textPrinter = new RichTextBoxPrinter(rtbChatText);

            irc = new IrcClient();
            irc.SendDelay = 200;
            irc.AutoReconnect = true;
            irc.CtcpVersion = Properties.Resources.RadegastTitle;
            irc.Encoding = Encoding.UTF8;

            TC.OnTabAdded += new TabsConsole.TabCallback(TC_OnTabAdded);
            TC.OnTabRemoved += new TabsConsole.TabCallback(TC_OnTabRemoved);
            irc.OnError += new ErrorEventHandler(irc_OnError);
            irc.OnRawMessage += new IrcEventHandler(irc_OnRawMessage);
            irc.OnChannelMessage += new IrcEventHandler(irc_OnChannelMessage);
            irc.OnConnected += new EventHandler(irc_OnConnected);
            irc.OnDisconnected += new EventHandler(irc_OnDisconnected);

            client.Self.IM += new EventHandler<InstantMessageEventArgs>(Self_IM);

            RefreshGroups();
        }
示例#6
0
        public FriendsConsole(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(FriendsConsole_Disposed);

            this.instance = instance;

            if (instance.GlobalSettings["show_friends_online_notifications"].Type == OSDType.Unknown)
            {
                instance.GlobalSettings["show_friends_online_notifications"] = OSD.FromBoolean(true);
            }

            if (instance.GlobalSettings["friends_notification_highlight"].Type == OSDType.Unknown)
            {
                instance.GlobalSettings["friends_notification_highlight"] = new OSDBoolean(true);
            }

            // Callbacks
            client.Friends.FriendOffline += new EventHandler<FriendInfoEventArgs>(Friends_FriendOffline);
            client.Friends.FriendOnline += new EventHandler<FriendInfoEventArgs>(Friends_FriendOnline);
            client.Friends.FriendshipTerminated += new EventHandler<FriendshipTerminatedEventArgs>(Friends_FriendshipTerminated);
            client.Friends.FriendshipResponse += new EventHandler<FriendshipResponseEventArgs>(Friends_FriendshipResponse);
            client.Friends.FriendNames += new EventHandler<FriendNamesEventArgs>(Friends_FriendNames);
            Load += new EventHandler(FriendsConsole_Load);
            instance.Names.NameUpdated += new EventHandler<UUIDNameReplyEventArgs>(Names_NameUpdated);
        }
        public SearchConsole(METAboltInstance instance)
        {
            InitializeComponent();

            this.instance = instance;
            netcom        = this.instance.Netcom;
            client        = this.instance.Client;
            AddClientEvents();

            tabConsole = this.instance.TabConsole;

            console      = new FindPeopleConsole(instance, UUID.Random());
            console.Dock = DockStyle.Fill;
            console.SelectedIndexChanged += new EventHandler(console_SelectedIndexChanged);
            pnlFindPeople.Controls.Add(console);

            eventsconsole      = new FindEvents(instance, UUID.Random());
            eventsconsole.Dock = DockStyle.Fill;
            eventsconsole.SelectedIndexChanged += new EventHandler(eventsconsole_SelectedIndexChanged);
            pnlFindEvents.Controls.Add(eventsconsole);

            placesconsole      = new FindPlaces(instance, UUID.Random());
            placesconsole.Dock = DockStyle.Fill;
            placesconsole.SelectedIndexChanged += new EventHandler(placesconsole_SelectedIndexChanged);
            pnlFindPlaces.Controls.Add(placesconsole);

            groupsconsole      = new FindGroups(instance, UUID.Random());
            groupsconsole.Dock = DockStyle.Fill;
            groupsconsole.SelectedIndexChanged += new EventHandler(groupsconsole_SelectedIndexChanged);
            pnlFindGroups.Controls.Add(groupsconsole);
        }
示例#8
0
        public SearchConsole(METAboltInstance instance)
        {
            InitializeComponent();

            this.instance = instance;
            netcom = this.instance.Netcom;
            client = this.instance.Client;
            AddClientEvents();

            tabConsole = this.instance.TabConsole;

            console = new FindPeopleConsole(instance, UUID.Random());
            console.Dock = DockStyle.Fill;
            console.SelectedIndexChanged += new EventHandler(console_SelectedIndexChanged);
            pnlFindPeople.Controls.Add(console);

            eventsconsole = new FindEvents(instance, UUID.Random());
            eventsconsole.Dock = DockStyle.Fill;
            eventsconsole.SelectedIndexChanged += new EventHandler(eventsconsole_SelectedIndexChanged);
            pnlFindEvents.Controls.Add(eventsconsole);

            placesconsole = new FindPlaces(instance, UUID.Random());
            placesconsole.Dock = DockStyle.Fill;
            placesconsole.SelectedIndexChanged += new EventHandler(placesconsole_SelectedIndexChanged);
            pnlFindPlaces.Controls.Add(placesconsole);

            groupsconsole = new FindGroups(instance, UUID.Random());
            groupsconsole.Dock = DockStyle.Fill;
            groupsconsole.SelectedIndexChanged += new EventHandler(groupsconsole_SelectedIndexChanged);
            pnlFindGroups.Controls.Add(groupsconsole);
        }
示例#9
0
        //PropertiesQueue propRequester;

        public SimObjectsConsole(RadegastInstance instance, CogbotRadegastPlugin plugin)
        {
            this.instance = instance;
            InitializeComponent();
            Plugin = plugin;
            addObjects = new TaskQueueHandler(plugin.TheBot, "SimObjectsConsole", TimeSpan.Zero, false);
            Disposed += new EventHandler(frmObjects_Disposed);

            //propRequester = new PropertiesQueue(instance);
            //propRequester.OnTick += new PropertiesQueue.TickCallback(propRequester_OnTick);

            nudRadius.Value = (decimal)searchRadius;
            nudRadius.ValueChanged += nudRadius_ValueChanged;
            nudRadius.KeyUp += nudRadius_KeyUp;
            nudRadius.KeyDown += nudRadius_KeyDown;

            lstPrims.ListViewItemSorter = new SimObjectSorter(client.Self);
            lstPrims.MouseUp += lstPrims_MouseUp;

            AddObjectType(typeof (SimObjectImpl));
            AddObjectType(typeof(Primitive));
            AddObjectType(typeof(Primitive.ObjectProperties));
            // Callbacks
            client.Network.Disconnected += Network_OnDisconnected;
            instance.Netcom.ClientConnected += Network_OnConnected;
            if (instance.Netcom.IsLoggedIn)
            {
                RegisterWorldSystemEvents();
            }
            client.Objects.KillObject +=  Objects_OnObjectKilled;
            //client.Objects.OnObjectProperties += new ObjectManager.ObjectPropertiesCallback(Objects_OnObjectProperties);
            client.Network.SimChanged +=  Network_OnCurrentSimChanged;
            client.Avatars.UUIDNameReply += Avatars_OnAvatarNames;
            instance.State.OnWalkStateCanged += new StateManager.WalkStateCanged(State_OnWalkStateCanged);
        }
 public CommandContextAction(RadegastInstance radegastInstance, CogbotRadegastPlugin plugin)
     : base(radegastInstance)
 {
     ContextType = typeof(Object);
     Label = "commands...";
     Plugin = plugin;
 }
示例#11
0
        public GroupInvite(RadegastInstance instance, Group group, Dictionary<UUID, GroupRole> roles)
            : base(instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(GroupInvite_Disposed);
            AutoSavePosition = true;

            this.instance = instance;
            this.roles = roles;
            this.group = group;
            this.netcom = instance.Netcom;

            picker = new AvatarPicker(instance) { Dock = DockStyle.Fill };
            Controls.Add(picker);
            picker.SelectionChaged += new EventHandler(picker_SelectionChaged);
            picker.BringToFront();

            netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(Netcom_ClientDisconnected);

            cmbRoles.Items.Add(roles[UUID.Zero]);
            cmbRoles.SelectedIndex = 0;

            foreach (KeyValuePair<UUID, GroupRole> role in roles)
                if (role.Key != UUID.Zero)
                    cmbRoles.Items.Add(role.Value);
        }
示例#12
0
 public DebugConsole(RadegastInstance instance)
     : base(instance)
 {
     InitializeComponent();
     Disposed += new EventHandler(DebugConsole_Disposed);
     RadegastAppender.Log += new EventHandler<LogEventArgs>(RadegastAppender_Log);
 }
 public SimUsageContextAction(RadegastInstance radegastInstance, CogbotRadegastPlugin plugin)
     : base(radegastInstance)
 {
     ContextType = typeof(Object);
     Label = "SimUsageContextAction...";
     Plugin = plugin;
 }
示例#14
0
        public Notecard(RadegastInstance instance, InventoryNotecard notecard, Primitive prim)
        {
            InitializeComponent();
            Disposed += new EventHandler(Notecard_Disposed);

            this.instance = instance;
            this.notecard = notecard;
            this.prim = prim;

            Text = notecard.Name;

            rtbContent.DetectUrls = false;

            if (notecard.AssetUUID == UUID.Zero)
            {
                UpdateStatus("Blank");
            }
            else
            {
                rtbContent.Text = " ";
                UpdateStatus("Loading...");

                if (prim == null)
                {
                    client.Assets.RequestInventoryAsset(notecard, true, Assets_OnAssetReceived);
                }
                else
                {
                    client.Assets.RequestInventoryAsset(notecard.AssetUUID, notecard.UUID, prim.ID, prim.OwnerID, notecard.AssetType, true, Assets_OnAssetReceived);
                }
            }
        }
示例#15
0
 public void StopPlugin(RadegastInstance instance)
 {
     // Unregister events
     Client.Self.ChatFromSimulator -= new EventHandler<ChatEventArgs>(Self_ChatFromSimulator);
     Client.Self.IM -= new EventHandler<InstantMessageEventArgs>(Self_IM);
     Notification.OnNotificationDisplayed -= new Notification.NotificationCallback(Notification_OnNotificationDisplayed);
 }
示例#16
0
 public PluginsTab(RadegastInstance instance)
     : base(instance)
 {
     InitializeComponent();
     ListPlugins();
     PluginsTab_SizeChanged(this, EventArgs.Empty);
 }
示例#17
0
 public Landmark(RadegastInstance instance, UUID parcelID)
 {
     this.parcelID = parcelID;
     Init(instance);
     parcelLocation = true;
     client.Parcels.RequestParcelInfo(parcelID);
 }
示例#18
0
        /// <summary>
        /// Plugin start-up entry.
        /// </summary>
        /// <param name="inst"></param>
        /// <remarks>Called by Radegast at start-up</remarks>
        public void StartPlugin(RadegastInstance inst)
        {
            instance = inst;

            // Get configuration settings, and initialize if not found.
            config = instance.GlobalSettings["plugin.speech"] as OSDMap;

            if (config == null)
            {
                config = new OSDMap();
                config["enabled"] = new OSDBoolean(false);
                config["voices"] = new OSDMap();
                config["properties"] = new OSDMap();
                config["substitutions"] = new OSDMap();
                instance.GlobalSettings["plugin.speech"] = config;
                instance.GlobalSettings.Save();
            }

            // Add our enable/disable item to the Plugin Menu.
            ToolsMenu = instance.MainForm.PluginsMenu;

            SpeechButton = new ToolStripMenuItem("Speech", null, OnSpeechMenuButtonClicked);
            ToolsMenu.DropDownItems.Add(SpeechButton);

            SpeechButton.Checked = config["enabled"].AsBoolean();

            ToolsMenu.Visible = true;

            if (SpeechButton.Checked)
            {
                Initialize();
            }
        }
示例#19
0
        public VoiceConsole(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(VoiceConsole_Disposed);

            this.instance = instance;

            // Callbacks
            netcom.ClientLoginStatus += new EventHandler<LoginProgressEventArgs>(netcom_ClientLoginStatus);

            this.instance.MainForm.Load += new EventHandler(MainForm_Load);

            config = instance.GlobalSettings["voice"] as OSDMap;
            if (config == null)
            {
                config = new OSDMap();
                config["enabled"] = new OSDBoolean(false);
                instance.GlobalSettings["voice"] = config;
                instance.GlobalSettings.Save();
            }

            chkVoiceEnable.Checked = config["enabled"].AsBoolean();
            if (chkVoiceEnable.Checked)
                Start();
        }
示例#20
0
 public NotecardReadAction(RadegastInstance inst, PluginControl pc)
     : base(inst)
 {
     control = pc;
     Label = "Read";
     ContextType = typeof(InventoryNotecard);
 }
示例#21
0
        public SearchConsole(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(SearchConsole_Disposed);

            this.instance = instance;

            comboEventType.SelectedIndex = 0;
            lvwEvents.Parent.SizeChanged += lvwEvents_SizeChanged;
            lvwEvents.ListViewItemSorter = new EventSorter();

            // Callbacks
            client.Directory.DirPeopleReply += new EventHandler<DirPeopleReplyEventArgs>(Directory_DirPeopleReply);
            client.Directory.DirPlacesReply += new EventHandler<DirPlacesReplyEventArgs>(Directory_DirPlacesReply);
            client.Directory.DirGroupsReply += new EventHandler<DirGroupsReplyEventArgs>(Directory_DirGroupsReply);
            client.Directory.DirEventsReply += Directory_DirEventsReply;
            client.Directory.EventInfoReply += Directory_EventInfoReply;
            instance.Names.NameUpdated += Names_NameUpdated;
            console = new FindPeopleConsole(instance, UUID.Random());
            console.Dock = DockStyle.Fill;
            console.SelectedIndexChanged += new EventHandler(console_SelectedIndexChanged);
            pnlFindPeople.Controls.Add(console);
            lvwPlaces.ListViewItemSorter = new PlaceSorter();
            lvwGroups.ListViewItemSorter = new GroupSorter();

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#22
0
        public frmKeyboardShortcuts(RadegastInstance instance)
        {
            InitializeComponent();
            this.instance = instance;

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
 public InventoryBackup(RadegastInstance instance)
 {
     InitializeComponent();
     Disposed += new System.EventHandler(InventoryBackup_Disposed);
     this.instance = instance;
     inv = client.Inventory.Store;
 }
示例#24
0
        public CycBrowser(RadegastInstance i)
        {
            InitializeComponent();
            Disposed += new EventHandler(frmMap_Disposed);

            instance = i;
            try
            {
                map = new WebBrowser();
                map.Dock = DockStyle.Fill;
                map.AllowWebBrowserDrop = false;
                map.Navigate(cycURL);
                map.WebBrowserShortcutsEnabled = true;
                map.ScriptErrorsSuppressed = false;
                map.ObjectForScripting = this;
                map.AllowNavigation = true;
                if (instance.MonoRuntime)
                {
                    map.Navigating += new WebBrowserNavigatingEventHandler(map_Navigating);
                }
                pnlMap.Controls.Add(map);
            }
            catch (Exception e)
            {
                Logger.Log(e.Message, Helpers.LogLevel.Warning, client, e);
                pnlMap.Visible = false;
                map = null;
            }

            // Register callbacks
            //TODO client.Network.OnCurrentSimChanged += new NetworkManager.CurrentSimChangedCallback(Network_OnCurrentSimChanged);
        }
示例#25
0
 public AvatarSpeechAction(RadegastInstance inst, PluginControl pc)
     : base(inst)
 {
     control = pc;
     Label = "Speech...";
     ContextType = typeof(Avatar);
 }
        public ConferenceIMTabWindow(RadegastInstance instance, UUID session, string sessionName)
        {
            InitializeComponent();
            Disposed += new EventHandler(IMTabWindow_Disposed);

            this.instance = instance;
            this.client = instance.Client;
            this.SessionName = sessionName;
            netcom = this.instance.Netcom;

            this.session = session;

            textManager = new IMTextManager(this.instance, new RichTextBoxPrinter(rtbIMText), IMTextManagerType.Conference, this.session, sessionName);

            // Callbacks
            netcom.ClientLoginStatus += new EventHandler<LoginProgressEventArgs>(netcom_ClientLoginStatus);
            netcom.ClientDisconnected += new EventHandler<DisconnectedEventArgs>(netcom_ClientDisconnected);
            instance.GlobalSettings.OnSettingChanged += new Settings.SettingChangedCallback(GlobalSettings_OnSettingChanged);

            if (!client.Self.GroupChatSessions.ContainsKey(session))
            {
                client.Self.ChatterBoxAcceptInvite(session);
            }

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#27
0
 public CurrentOutfitFolder(RadegastInstance instance)
 {
     this.Instance = instance;
     this.Client = instance.Client;
     Instance.ClientChanged += new EventHandler<ClientChangedEventArgs>(instance_ClientChanged);
     RegisterClientEvents(Client);
 }
示例#28
0
        public OutfitTextures(RadegastInstance instance, Avatar avatar)
        {
            InitializeComponent();

            this.instance = instance;
            this.avatar = avatar;
        }
示例#29
0
 public AspectContextAction(RadegastInstance radegastInstance, CogbotRadegastPlugin plugin)
     : base(radegastInstance)
 {
     ContextType = typeof (Object);
     Label = "cogbot...";
     Client.Network.LoginProgress += aspectLogin;
     Plugin = plugin;
 }
 public RadegastMovement(RadegastInstance instance)
 {
     this.instance = instance;
     angle = client.Self.Movement.BodyRotation.Z;
     timer = new System.Timers.Timer(250);
     timer.Elapsed +=new ElapsedEventHandler(timer_Elapsed);
     timer.Enabled = false;
 }
示例#31
0
        public frmAbout(RadegastInstance instance)
            : base(instance)
        {
            InitializeComponent();
            txtTitle.Text = Properties.Resources.RadegastTitle + " " + RadegastBuild.VersionString;

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#32
0
        public FindEvents(METAboltInstance instance, UUID queryID)
        {
            InitializeComponent();

            findEventsResults = new Dictionary <string, uint>();
            this.queryID      = queryID;

            this.instance = instance;
            netcom        = this.instance.Netcom;
            client        = this.instance.Client;
            AddClientEvents();
        }
        public FindPlaces(METAboltInstance instance, UUID queryID)
        {
            InitializeComponent();

            findPlacesResults = new Dictionary <string, DirectoryManager.PlacesSearchData>();
            this.queryID      = queryID;

            this.instance = instance;
            netcom        = this.instance.Netcom;
            client        = this.instance.Client;
            AddClientEvents();
        }
示例#34
0
        void BtnBrowseClick(object sender, EventArgs e)
        {
            SaveFileDialog dlg = new SaveFileDialog();

            dlg.Title  = "Export Collada File";
            dlg.Filter = "Collada (*.dae)|*.dae|All Files (*.*)|*.*";
            if (txtFileName.Text.Trim() == string.Empty)
            {
                dlg.FileName = RadegastInstance.SafeFileName(objectName.Text);
            }
            else
            {
                dlg.FileName = Path.GetFileName(txtFileName.Text);
            }

            DialogResult res = dlg.ShowDialog();

            if (res == DialogResult.OK)
            {
                txtFileName.Text = dlg.FileName;
                ValidatePath(dlg.FileName);
            }
        }
示例#35
0
        public ntfGeneric(RadegastInstance instance, string msg)
            : base(NotificationType.Generic)
        {
            InitializeComponent();

            this.instance        = instance;
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text      = msg.Replace("\n", "\r\n");
            if (msg.Length < 100)
            {
                txtMessage.ScrollBars = ScrollBars.None;
            }
            btnOk.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);

            args.Text = txtMessage.Text;
            args.Buttons.Add(btnOk);
            FireNotificationCallback(args);

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#36
0
        public AvatarPicker(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(AvatarPicker_Disposed);

            this.instance = instance;

            // events
            client.Avatars.AvatarPickerReply += new EventHandler <AvatarPickerReplyEventArgs>(Avatars_AvatarPickerReply);

            List <NearbyAvatar> nearAvatars = instance.TabConsole.NearbyAvatars;

            for (int i = 0; i < nearAvatars.Count; i++)
            {
                string name = instance.Names.Get(nearAvatars[i].ID, nearAvatars[i].Name);
                lvwNear.Items.Add(new ListViewItem()
                {
                    Text = nearAvatars[i].Name, Tag = nearAvatars[i].ID
                });
            }

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#37
0
        public GroupIMTabWindow(RadegastInstance instance, UUID session, string sessionName)
        {
            InitializeComponent();
            Disposed += new EventHandler(IMTabWindow_Disposed);

            this.instance = instance;
            SessionId     = session;

            TextManager = new IMTextManager(this.instance, new RichTextBoxPrinter(rtbIMText), IMTextManagerType.Group, SessionId, sessionName);

            btnShow.Text = "Show";
            chatSplit.Panel2Collapsed = true;

            // Callbacks
            RegisterClientEvents(client);
            if (!client.Self.GroupChatSessions.ContainsKey(session))
            {
                client.Self.RequestJoinGroupChat(session);
            }
            Load += new EventHandler(GroupIMTabWindow_Load);

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#38
0
        public MapControl(RadegastInstance instance)
        {
            Zoom = 1.0f;
            InitializeComponent();
            Disposed += new EventHandler(MapControl_Disposed);
            Instance  = instance;

            downloader = new ParallelDownloader();

            background         = Color.FromArgb(4, 4, 75);
            textFont           = new Font(FontFamily.GenericSansSerif, 8.0f, FontStyle.Bold);
            textBrush          = new SolidBrush(Color.FromArgb(255, 200, 200, 200));
            dotBrush           = new SolidBrush(Color.FromArgb(255, 30, 210, 30));
            blackPen           = new Pen(Color.Black, 2.0f);
            textBackgroudBrush = new SolidBrush(Color.Black);

            repaint = new System.Threading.Timer(RepaintTick, null, 1000, 1000);

            Instance.ClientChanged += new EventHandler <ClientChangedEventArgs>(Instance_ClientChanged);
            RegisterClientEvents();

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#39
0
        public ntfTeleport(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.Teleport)
        {
            InitializeComponent();
            this.instance = instance;
            this.msg      = msg;

            txtHead.BackColor    = instance.MainForm.NotificationBackground;
            txtHead.Text         = String.Format("{0} has offered to teleport you to their location.", msg.FromAgentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text      = msg.Message;
            btnTeleport.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);

            args.Text = txtHead.Text + Environment.NewLine + txtMessage.Text;
            args.Buttons.Add(btnTeleport);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#40
0
        public ntfSendLureOffer(RadegastInstance instance, UUID agentID)
            : base(NotificationType.SendLureOffer)
        {
            InitializeComponent();
            this.instance = instance;
            this.agentID  = agentID;

            txtHead.BackColor = instance.MainForm.NotificationBackground;

            agentName            = instance.Names.Get(agentID, true);
            txtHead.Text         = String.Format("Offer a teleport to {0} with the following message: ", agentName);
            txtMessage.Text      = String.Format("Join me in {0}!", instance.Client.Network.CurrentSim.Name);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            btnOffer.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);

            args.Text = txtHead.Text + Environment.NewLine + txtMessage.Text;
            args.Buttons.Add(btnOffer);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);
        }
示例#41
0
        public ntfGroupInvitation(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.GroupInvitation)
        {
            InitializeComponent();

            this.instance = instance;
            this.msg      = msg;

            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text      = msg.Message.Replace("\n", "\r\n");
            btnYes.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance)
            {
                Text = txtMessage.Text
            };

            args.Buttons.Add(btnYes);
            FireNotificationCallback(args);

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#42
0
        public Notecard(RadegastInstance instance, InventoryNotecard notecard, Primitive prim)
        {
            InitializeComponent();
            Disposed += new EventHandler(Notecard_Disposed);

            this.instance = instance;
            this.notecard = notecard;
            this.prim     = prim;

            Text = notecard.Name;

            rtbContent.DetectUrls = false;


            if (notecard.AssetUUID == UUID.Zero)
            {
                UpdateStatus("Blank");
            }
            else
            {
                rtbContent.Text = " ";
                UpdateStatus("Loading...");

                var transferID = UUID.Random();
                if (prim == null)
                {
                    client.Assets.RequestInventoryAsset(notecard, true, transferID, Assets_OnAssetReceived);
                }
                else
                {
                    client.Assets.RequestInventoryAsset(notecard.AssetUUID, notecard.UUID, prim.ID, prim.OwnerID,
                                                        notecard.AssetType, true, transferID, Assets_OnAssetReceived);
                }
            }

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
        public ntfLoadURL(RadegastInstance instance, LoadUrlEventArgs e)
        {
            InitializeComponent();
            Disposed += new EventHandler(ntfLoadURL_Disposed);

            ev            = e;
            this.instance = instance;

            instance.Names.NameUpdated += new EventHandler <UUIDNameReplyEventArgs>(Avatars_UUIDNameReply);

            SetText();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance)
            {
                Text = rtbText.Text
            };

            args.Buttons.Add(btnGoTo);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#44
0
        public ntfFriendshipOffer(RadegastInstance instance, InstantMessage msg)
            : base(NotificationType.FriendshipOffer)
        {
            InitializeComponent();
            this.instance = instance;
            this.msg      = msg;

            txtHead.BackColor    = instance.MainForm.NotificationBackground;
            txtHead.Text         = String.Format("{0} has offered you friendship.", msg.FromAgentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            txtMessage.Text      = msg.Message;
            btnYes.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);

            args.Text = txtHead.Text;
            args.Buttons.Add(btnYes);
            args.Buttons.Add(btnNo);
            args.Buttons.Add(btnIgnore);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#45
0
        public LoginConsole(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(MainConsole_Disposed);

            this.instance = instance;
            AddNetcomEvents();

            pnlSplash.BackgroundImage = instance.GlobalSettings["hide_login_graphics"].AsBoolean()
                ? null : Properties.Resources.radegast_main_screen2;

            if (!instance.GlobalSettings.ContainsKey("remember_login"))
            {
                instance.GlobalSettings["remember_login"] = true;
            }

            instance.GlobalSettings.OnSettingChanged += new Settings.SettingChangedCallback(GlobalSettings_OnSettingChanged);

            lblVersion.Text = Properties.Resources.RadegastTitle + " " + Assembly.GetExecutingAssembly().GetName().Version;

            Load += new EventHandler(LoginConsole_Load);

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#46
0
        public ChatConsole(RadegastInstance instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(ChatConsole_Disposed);

            if (!instance.advancedDebugging)
            {
                ctxAnim.Visible     = false;
                ctxTextures.Visible = false;
            }

            this.instance = instance;
            this.instance.ClientChanged += new EventHandler <ClientChangedEventArgs>(instance_ClientChanged);

            if (instance.GlobalSettings["chat_font_size"].Type != OSDType.Real)
            {
                instance.GlobalSettings["chat_font_size"] = OSD.FromReal(cbxInput.Font.Size);
            }

            instance.GlobalSettings.OnSettingChanged += new Settings.SettingChangedCallback(GlobalSettings_OnSettingChanged);

            // Callbacks
            netcom.ClientLoginStatus += new EventHandler <LoginProgressEventArgs>(netcom_ClientLoginStatus);
            netcom.ClientLoggedOut   += new EventHandler(netcom_ClientLoggedOut);
            RegisterClientEvents(client);

            chatManager = new ChatTextManager(instance, new RichTextBoxPrinter(rtbChat));
            chatManager.PrintStartupMessage();

            this.instance.MainForm.Load += new EventHandler(MainForm_Load);

            lvwObjects.ListViewItemSorter = new SorterClass(instance);
            cbChatType.SelectedIndex      = 1;

            UpdateFontSize();
        }
示例#47
0
        public frmDetachedTab(RadegastInstance instance, RadegastTab tab)
            : base(instance)
        {
            InitializeComponent();
            Disposed += new EventHandler(frmDetachedTab_Disposed);

            this.instance = instance;
            this.tab      = tab;
            ClientSize    = tab.Control.Size;
            Controls.Add(tab.Control);
            tab.Control.Visible = true;
            tab.Control.BringToFront();
            tab.Control.TextChanged += new EventHandler(Control_TextChanged);
            SettingsKeyBase          = "tab_window_" + tab.Control.GetType().Name;
            AutoSavePosition         = true;
            instance.MainForm.Move  += new EventHandler(MainForm_ResizeEnd);
            SaveMainFormPos();
            if (tab.Floater)
            {
                Owner = instance.MainForm;
            }

            GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#48
0
        public BanGroupMember(RadegastInstance instance, Group group, GroupDetails parent)
            : base(instance)
        {
            InitializeComponent();
            Disposed        += new EventHandler(GroupInvite_Disposed);
            AutoSavePosition = true;

            this.instance = instance;
            this.group    = group;
            this.netcom   = instance.Netcom;
            this.parent   = parent;

            picker = new AvatarPicker(instance)
            {
                Dock = DockStyle.Fill
            };
            Controls.Add(picker);
            picker.SelectionChaged += new EventHandler(picker_SelectionChaged);
            picker.BringToFront();

            netcom.ClientDisconnected += new EventHandler <DisconnectedEventArgs>(Netcom_ClientDisconnected);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#49
0
        public NameManager(RadegastInstance instance)
        {
            this.instance = instance;

            requestTimer  = new Timer(MakeRequest, null, Timeout.Infinite, Timeout.Infinite);
            cacheTimer    = new Timer(SaveCache, null, Timeout.Infinite, Timeout.Infinite);
            cacheFileName = Path.Combine(instance.UserDir, "name.cache");
            LoadCachedNames();
            instance.ClientChanged += new EventHandler <ClientChangedEventArgs>(instance_ClientChanged);
            RegisterEvents(client);

            // Mono HTTPWebRequest sucks balls
            useRequestThread = instance.MonoRuntime;

            if (useRequestThread)
            {
                PendingLookups             = new BlockingQueue <List <UUID> >();
                lookupGate                 = new Semaphore(4, 4);
                requestThread              = new Thread(new ThreadStart(RequestThread));
                requestThread.IsBackground = true;
                requestThread.Name         = "Display Name Request Thread";
                requestThread.Start();
            }
        }
示例#50
0
        public ntfSendLureRequest(RadegastInstance instance, UUID agentID)
            : base(NotificationType.SendLureRequest)
        {
            InitializeComponent();
            this.instance = instance;
            this.agentID  = agentID;

            txtHead.BackColor = instance.MainForm.NotificationBackground;

            agentName            = instance.Names.Get(agentID, true);
            txtHead.Text         = String.Format("Request a teleport to {0}'s location with the following message:", agentName);
            txtMessage.BackColor = instance.MainForm.NotificationBackground;
            btnRequest.Focus();

            // Fire off event
            NotificationEventArgs args = new NotificationEventArgs(instance);

            args.Text = txtHead.Text + Environment.NewLine + txtMessage.Text;
            args.Buttons.Add(btnRequest);
            args.Buttons.Add(btnCancel);
            FireNotificationCallback(args);

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#51
0
 public FolderCopy(RadegastInstance instance)
 {
     Instance = instance;
     Client   = Instance.Client;
 }
示例#52
0
 public OfferTeleportAction(RadegastInstance inst)
     : base(inst)
 {
     Label       = "Offer Teleport";
     ContextType = typeof(Avatar);
 }
示例#53
0
        public frmSettings(RadegastInstance instance)
            : base(instance)
        {
            if (settingInitialized)
            {
                frmSettings.InitSettigs(instance.GlobalSettings, instance.MonoRuntime);
            }

            InitializeComponent();
            AutoSavePosition = true;
            InitColorSettings();

            s = instance.GlobalSettings;
            tbpGraphics.Controls.Add(new Radegast.Rendering.GraphicsPreferences(instance));
            cbChatTimestamps.Checked = s["chat_timestamps"].AsBoolean();

            cbIMTimeStamps.Checked = s["im_timestamps"].AsBoolean();

            cbChatTimestamps.CheckedChanged += new EventHandler(cbChatTimestamps_CheckedChanged);
            cbIMTimeStamps.CheckedChanged   += new EventHandler(cbIMTimeStamps_CheckedChanged);

            cbTrasactDialog.Checked = s["transaction_notification_dialog"].AsBoolean();
            cbTrasactChat.Checked   = s["transaction_notification_chat"].AsBoolean();

            cbFriendsNotifications.Checked         = s["show_friends_online_notifications"].AsBoolean();
            cbFriendsNotifications.CheckedChanged += new EventHandler(cbFriendsNotifications_CheckedChanged);

            cbAutoReconnect.Checked         = s["auto_reconnect"].AsBoolean();
            cbAutoReconnect.CheckedChanged += new EventHandler(cbAutoReconnect_CheckedChanged);

            cbResolveURIs.Checked         = s["resolve_uris"].AsBoolean();
            cbResolveURIs.CheckedChanged += new EventHandler(cbResolveURIs_CheckedChanged);;

            cbHideLoginGraphics.Checked         = s["hide_login_graphics"].AsBoolean();
            cbHideLoginGraphics.CheckedChanged += new EventHandler(cbHideLoginGraphics_CheckedChanged);

            cbRLV.Checked         = s["rlv_enabled"].AsBoolean();
            cbRLV.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["rlv_enabled"] = new OSDBoolean(cbRLV.Checked);
            };

            cbRLVDebug.Checked         = s["rlv_debugcommands"].AsBoolean();
            cbRLVDebug.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["rlv_debugcommands"] = new OSDBoolean(cbRLVDebug.Checked);
            };

            cbMUEmotes.Checked         = s["mu_emotes"].AsBoolean();
            cbMUEmotes.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["mu_emotes"] = new OSDBoolean(cbMUEmotes.Checked);
            };

            if (!s.ContainsKey("minimize_to_tray"))
            {
                s["minimize_to_tray"] = OSD.FromBoolean(false);
            }
            cbMinToTrey.Checked         = s["minimize_to_tray"].AsBoolean();
            cbMinToTrey.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["minimize_to_tray"] = OSD.FromBoolean(cbMinToTrey.Checked);
            };


            cbNoTyping.Checked         = s["no_typing_anim"].AsBoolean();
            cbNoTyping.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["no_typing_anim"] = OSD.FromBoolean(cbNoTyping.Checked);
            };

            txtAutoResponse.Text         = s["auto_response_text"];
            txtAutoResponse.TextChanged += (object sender, EventArgs e) =>
            {
                s["auto_response_text"] = txtAutoResponse.Text;
            };
            AutoResponseType art = (AutoResponseType)s["auto_response_type"].AsInteger();

            switch (art)
            {
            case AutoResponseType.WhenBusy: rbAutobusy.Checked = true; break;

            case AutoResponseType.WhenFromNonFriend: rbAutoNonFriend.Checked = true; break;

            case AutoResponseType.Always: rbAutoAlways.Checked = true; break;
            }

            cbSyntaxHighlight.Checked         = s["script_syntax_highlight"].AsBoolean();
            cbSyntaxHighlight.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["script_syntax_highlight"] = OSD.FromBoolean(cbSyntaxHighlight.Checked);
            };

            switch ((NameMode)s["display_name_mode"].AsInteger())
            {
            case NameMode.Standard: rbDNOff.Checked = true; break;

            case NameMode.Smart: rbDNSmart.Checked = true; break;

            case NameMode.DisplayNameAndUserName: rbDNDandUsernme.Checked = true; break;

            case NameMode.OnlyDisplayName: rbDNOnlyDN.Checked = true; break;
            }

            txtReconnectTime.Text = s["reconnect_time"].AsInteger().ToString();

            txtResolveURITime.Text = s["resolve_uri_time"].AsInteger().ToString();

            cbRadegastClientTag.Checked         = s["send_rad_client_tag"];
            cbRadegastClientTag.CheckedChanged += (sender, e) =>
            {
                s["send_rad_client_tag"] = cbRadegastClientTag.Checked;
                instance.SetClientTag();
            };

            cbOnInvOffer.SelectedIndex         = s["inv_auto_accept_mode"].AsInteger();
            cbOnInvOffer.SelectedIndexChanged += (sender, e) =>
            {
                s["inv_auto_accept_mode"] = cbOnInvOffer.SelectedIndex;
            };

            cbRadegastLogToFile.Checked = s["log_to_file"];

            cbDisableChatIMLog.Checked         = s["disable_chat_im_log"];
            cbDisableChatIMLog.CheckedChanged += (sender, e) =>
            {
                s["disable_chat_im_log"] = cbDisableChatIMLog.Checked;
            };

            cbDisableLookAt.Checked         = s["disable_look_at"];
            cbDisableLookAt.CheckedChanged += (sender, e) =>
            {
                s["disable_look_at"] = cbDisableLookAt.Checked;
            };

            cbConfirmExit.Checked         = s["confirm_exit"];
            cbConfirmExit.CheckedChanged += (sender, e) =>
            {
                s["confirm_exit"] = cbConfirmExit.Checked;
            };

            cbThemeCompatibilityMode.Checked         = s["theme_compatibility_mode"];
            cbThemeCompatibilityMode.CheckedChanged += (sender, e) =>
            {
                s["theme_compatibility_mode"] = cbThemeCompatibilityMode.Checked;
            };

            cbTaskBarHighLight.Checked         = s["taskbar_highlight"];
            cbTaskBarHighLight.CheckedChanged += (sender, e) =>
            {
                s["taskbar_highlight"] = cbTaskBarHighLight.Checked;
                UpdateEnabled();
            };

            cbFriendsHighlight.Checked         = s["friends_notification_highlight"].AsBoolean();
            cbFriendsHighlight.CheckedChanged += (object sender, EventArgs e) =>
            {
                s["friends_notification_highlight"] = new OSDBoolean(cbFriendsHighlight.Checked);
            };

            cbHighlightChat.Checked         = s["highlight_on_chat"];
            cbHighlightChat.CheckedChanged += (sender, e) =>
            {
                s["highlight_on_chat"] = cbHighlightChat.Checked;
            };

            cbHighlightIM.Checked         = s["highlight_on_im"];
            cbHighlightIM.CheckedChanged += (sender, e) =>
            {
                s["highlight_on_im"] = cbHighlightIM.Checked;
            };

            cbHighlightGroupIM.Checked         = s["highlight_on_group_im"];
            cbHighlightGroupIM.CheckedChanged += (sender, e) =>
            {
                s["highlight_on_group_im"] = cbHighlightGroupIM.Checked;
            };

            // disable_av_name_link
            if (instance.MonoRuntime)
            {
                cbNameLinks.Visible = false;
            }
            else
            {
                cbNameLinks.Checked         = s["av_name_link"];
                cbNameLinks.CheckedChanged += (sender, e) =>
                {
                    s["av_name_link"] = cbNameLinks.Checked;
                };
            }

            cbDisableHTTPInventory.Checked         = s["disable_http_inventory"];
            cbDisableHTTPInventory.CheckedChanged += (sender, e) =>
            {
                s["disable_http_inventory"] = cbDisableHTTPInventory.Checked;
            };

            cbShowScriptErrors.Checked         = s["show_script_errors"];
            cbShowScriptErrors.CheckedChanged += (sender, e) =>
            {
                s["show_script_errors"] = cbShowScriptErrors.Checked;
            };

            autoSitPrefsUpdate();
            pseudoHomePrefsUpdated();
            LSLHelperPrefsUpdate();

            cbAutoScriptPermission.Text = s["on_script_question"];

            ckUseProxy.Checked = s["use_proxy"];

            txtProxyURL.Text      = s["proxy_url"];
            txtProxyPort.Text     = s["proxy_port"];
            txtProxyUser.Text     = s["proxy_user"];
            txtProxyPassword.Text = s["proxy_password"];

            /*
             * RadeProxy proxy = new RadeProxy();
             *
             * if (ckUseProxy.Checked)
             * {
             *  proxy.SetProxy(ckUseProxy.Checked, txtProxyURL.Text, txtProxyPort.Text, txtProxyUser.Text, txtProxyPassword.Text);
             * }
             * else
             * {
             *  RadeProxy.DisableProxy();
             * }
             */

            UpdateEnabled();

            Radegast.GUI.GuiHelpers.ApplyGuiFixes(this);
        }
示例#54
0
 public frmAbout(RadegastInstance instance)
     : base(instance)
 {
     InitializeComponent();
     txtTitle.Text = Properties.Resources.RadegastTitle + "." + RadegastBuild.CurrentRev;
 }
示例#55
0
 public AvatarProfileAction(RadegastInstance inst)
     : base(inst)
 {
     Label       = "Profile";
     ContextType = typeof(Avatar);
 }
示例#56
0
 public Landmark(RadegastInstance instance, InventoryLandmark landmark)
 {
     this.landmark = landmark;
     Init(instance);
     client.Assets.RequestAsset(landmark.AssetUUID, landmark.AssetType, true, Assets_OnAssetReceived);
 }
示例#57
0
 public RadegastForm(RadegastInstance instance)
     : base()
 {
     this.instance = instance;
     instance.OnRadegastFormCreated(this);
 }
示例#58
0
        private void TraverseDir(InventoryNode node, string path)
        {
            var nodes = new List <InventoryNode>(node.Nodes.Values);

            foreach (InventoryNode n in nodes)
            {
                traversed++;
                try
                {
                    backupTaskCancelToken.Token.ThrowIfCancellationRequested();
                    if (IsHandleCreated && (traversed % 13 == 0))
                    {
                        BeginInvoke(new MethodInvoker(() =>
                        {
                            lblStatus.Text = string.Format("Traversed {0} nodes...", traversed);
                        }));
                    }

                    if (n.Data is InventoryFolder)
                    {
                        WriteCSVLine("Folder", path, n.Data.Name, "", "", "", "");
                        TraverseDir(n, Path.Combine(path, RadegastInstance.SafeFileName(n.Data.Name)));
                    }
                    else
                    {
                        InventoryItem item      = (InventoryItem)n.Data;
                        string        creator   = item.CreatorID == UUID.Zero ? string.Empty : instance.Names.Get(item.CreatorID, true);
                        string        lastOwner = item.LastOwnerID == UUID.Zero ? string.Empty : instance.Names.Get(item.LastOwnerID, true);
                        string        type      = item.AssetType.ToString();
                        if (item.InventoryType == InventoryType.Wearable)
                        {
                            type = ((WearableType)item.Flags).ToString();
                        }
                        string created = item.CreationDate.ToString("yyyy-MM-dd HH:mm:ss");
                        WriteCSVLine(type, path, item.Name, item.Description, created, creator, lastOwner);

                        PermissionMask fullPerm = PermissionMask.Modify | PermissionMask.Copy | PermissionMask.Transfer;
                        if ((item.Permissions.OwnerMask & fullPerm) != fullPerm)
                        {
                            continue;
                        }

                        string filePartial = Path.Combine(path, RadegastInstance.SafeFileName(n.Data.Name));
                        string fullName    = folderName + filePartial;
                        switch (item.AssetType)
                        {
                        case AssetType.LSLText:
                            client.Settings.USE_ASSET_CACHE = false;
                            fullName += ".lsl";
                            break;

                        case AssetType.Notecard: fullName += ".txt"; break;

                        case AssetType.Texture: fullName += ".png"; break;

                        default: fullName += ".bin"; break;
                        }
                        string dirName = Path.GetDirectoryName(fullName);
                        bool   dateOK  = item.CreationDate > new DateTime(1970, 1, 2);

                        if (
                            (item.AssetType == AssetType.LSLText && cbScripts.Checked) ||
                            (item.AssetType == AssetType.Notecard && cbNoteCards.Checked) ||
                            (item.AssetType == AssetType.Texture && cbImages.Checked)
                            )
                        {
                            ListViewItem lvi = new ListViewItem
                            {
                                Text = n.Data.Name, Tag = n.Data, Name = n.Data.UUID.ToString()
                            };

                            ListViewItem.ListViewSubItem fileName = new ListViewItem.ListViewSubItem(lvi, filePartial);
                            lvi.SubItems.Add(fileName);

                            ListViewItem.ListViewSubItem status = new ListViewItem.ListViewSubItem(lvi, "Fetching asset");
                            lvi.SubItems.Add(status);

                            //bool cached = dateOK && File.Exists(fullName) && File.GetCreationTimeUtc(fullName) == item.CreationDate;

                            //if (cached)
                            //{
                            //    status.Text = "Cached";
                            //}

                            backupTaskCancelToken.Token.ThrowIfCancellationRequested();

                            BeginInvoke(new MethodInvoker(() =>
                            {
                                lvwFiles.Items.Add(lvi);
                                lvwFiles.EnsureVisible(lvwFiles.Items.Count - 1);
                            }));

                            //if (cached) continue;
                            backupTaskCancelToken.Token.ThrowIfCancellationRequested();

                            Asset receivedAsset = null;
                            using (AutoResetEvent done = new AutoResetEvent(false))
                            {
                                if (item.AssetType == AssetType.Texture)
                                {
                                    client.Assets.RequestImage(item.AssetUUID, (state, asset) =>
                                    {
                                        if (state == TextureRequestState.Finished && asset != null && asset.Decode())
                                        {
                                            receivedAsset = asset;
                                            done.Set();
                                        }
                                    });
                                }
                                else
                                {
                                    var transferID = UUID.Random();
                                    client.Assets.RequestInventoryAsset(item, true, transferID, (transfer, asset) =>
                                    {
                                        if (transfer.Success && transfer.ID == transferID)
                                        {
                                            receivedAsset = asset;
                                        }
                                        done.Set();
                                    }
                                                                        );
                                }

                                backupTaskCancelToken.Token.ThrowIfCancellationRequested();
                                done.WaitOne(30 * 1000, false);
                            }

                            client.Settings.USE_ASSET_CACHE = true;

                            backupTaskCancelToken.Token.ThrowIfCancellationRequested();
                            if (receivedAsset == null)
                            {
                                BeginInvoke(new MethodInvoker(() => status.Text = "Failed to fetch asset"));
                            }
                            else
                            {
                                BeginInvoke(new MethodInvoker(() => status.Text = "Saving..."));

                                try
                                {
                                    backupTaskCancelToken.Token.ThrowIfCancellationRequested();
                                    if (!Directory.Exists(dirName))
                                    {
                                        Directory.CreateDirectory(dirName);
                                    }

                                    switch (item.AssetType)
                                    {
                                    case AssetType.Notecard:
                                        AssetNotecard note = (AssetNotecard)receivedAsset;
                                        if (note.Decode())
                                        {
                                            File.WriteAllText(fullName, note.BodyText, System.Text.Encoding.UTF8);
                                            if (dateOK)
                                            {
                                                File.SetCreationTimeUtc(fullName, item.CreationDate);
                                                File.SetLastWriteTimeUtc(fullName, item.CreationDate);
                                            }
                                        }
                                        else
                                        {
                                            Logger.Log(string.Format("Falied to decode asset for '{0}' - {1}", item.Name, receivedAsset.AssetID), Helpers.LogLevel.Warning, client);
                                        }

                                        break;

                                    case AssetType.LSLText:
                                        AssetScriptText script = (AssetScriptText)receivedAsset;
                                        if (script.Decode())
                                        {
                                            File.WriteAllText(fullName, script.Source, System.Text.Encoding.UTF8);
                                            if (dateOK)
                                            {
                                                File.SetCreationTimeUtc(fullName, item.CreationDate);
                                                File.SetLastWriteTimeUtc(fullName, item.CreationDate);
                                            }
                                        }
                                        else
                                        {
                                            Logger.Log(string.Format("Falied to decode asset for '{0}' - {1}", item.Name, receivedAsset.AssetID), Helpers.LogLevel.Warning, client);
                                        }

                                        break;

                                    case AssetType.Texture:
                                        AssetTexture imgAsset = (AssetTexture)receivedAsset;
                                        var          img      = LoadTGAClass.LoadTGA(new MemoryStream(imgAsset.Image.ExportTGA()));
                                        img.Save(fullName, System.Drawing.Imaging.ImageFormat.Png);
                                        if (dateOK)
                                        {
                                            File.SetCreationTimeUtc(fullName, item.CreationDate);
                                            File.SetLastWriteTimeUtc(fullName, item.CreationDate);
                                        }
                                        break;
                                    }

                                    BeginInvoke(new MethodInvoker(() =>
                                    {
                                        fileName.Text  = fullName;
                                        status.Text    = "Saved";
                                        lblStatus.Text = string.Format("Saved {0} items", ++fetched);
                                    }));
                                }
                                catch (OperationCanceledException)
                                {
                                    BeginInvoke(new MethodInvoker(() => status.Text = "Operation cancelled."));
                                    return;
                                }
                                catch (Exception ex)
                                {
                                    BeginInvoke(new MethodInvoker(() => status.Text = "Failed to save " + Path.GetFileName(fullName) + ": " + ex.Message));
                                }
                            }
                        }
                    }
                }
                catch (OperationCanceledException)
                {
                    return;
                }
                catch { }
            }
        }
 public ContextActionsManager(RadegastInstance instance)
 {
     this.instance = instance;
 }
示例#60
0
 public TurnToAction(RadegastInstance inst)
     : base(inst)
 {
     Label       = "Turn To";
     ContextType = typeof(Primitive);
 }