internal PMWindow(Int16 Id)
        {
            this.Server   = Framework.GetInstance();
            this.form     = MainWindow2.GetInstance();
            this.Id       = Id;
            this.PMPlayer = (GraalPlayer)this.Server.PlayerManager.FindPlayer(this.Id);
            this.CenterToScreen();

            string TitleText = "";

            TitleText = this.PMPlayer.Account;
            if (this.PMPlayer.Nickname != "" && this.PMPlayer.Nickname != null)
            {
                TitleText += ": " + this.PMPlayer.Nickname;
            }
            this.Text = TitleText;
            this.InitializeComponent(Id);
            this.richTextBox1.ReadOnly = true;
            //this.listBox1 = listBox1;

            //e.

            /*
             * try
             * {
             *      this.InitializeComponent();
             *      this.Show();
             * }
             * catch (SyntaxErrorException e)
             * {
             *      this.form.Write_Text(e.Message + "\r\n");
             * }
             */
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Base Constructor
 /// </summary>
 public NCConnection()
     : base()
 {
     Server = Framework.GetInstance();
     this.Init();
     this.Setup();
 }
Ejemplo n.º 3
0
        private void RowSelected(object sender, System.EventArgs e)
        {
            Gtk.Application.Invoke(delegate
            {
                Gtk.TreeSelection selection = (sender as Gtk.TreeView).Selection;
                Gtk.TreeModel model;
                Gtk.TreeIter iter;

                // THE ITER WILL POINT TO THE SELECTED ROW
                if (selection.GetSelected(out model, out iter))
                {
                    try
                    {
                        string CDPath = "";
                        Gtk.TreeIter parent;
                        Console.WriteLine("Selected Value:" + model.GetValue(iter, 1).ToString());

                        if (model.IterParent(out parent, iter))
                        {
                            CDPath += model.GetValue(parent, 1).ToString();
                        }

                        CDPath += model.GetValue(iter, 1).ToString();

                        Abstraction.GetInstance().WriteText(CDPath);

                        Framework.GetInstance().SendGSPacket(new Core.CString() + (byte)OpenGraal.Common.Connections.Client.GraalServer.PacketOut.RC_FILEBROWSER_CD + CDPath);
                    }
                    catch (Exception ez)
                    { }
                }
            }
                                   );
        }
        private void loginButton_Click(object sender, EventArgs e)
        {
            this.framework = Framework.GetInstance();
            this.framework.RunServer();

            this.Hide();
        }
Ejemplo n.º 5
0
 public void WindowInit()
 {
     this.Build();
     this.Icon   = global::Gdk.Pixbuf.LoadFromResource("OpenGraal.GraalIM.Resources.rcicon.ico");
     this.Server = Framework.GetInstance();
     this.Show();
     this.ShowAll();
 }
Ejemplo n.º 6
0
 public void SendMessage(CString message)
 {
     this.Server = Framework.GetInstance();
     this.Server.SendPM(this._id, CString.tokenize(message.Text), true);
     Gtk.Application.Invoke(delegate
     {
         Abstraction mw = Abstraction.GetInstance();
         this.WriteText("(" + mw.NCPlayer.Nickname + "(You)): " + message.Text);
         message = null;
     }
                            );
 }
Ejemplo n.º 7
0
        public void RunServer()
        {
            this.Build();

            this.bg      = new global::Gtk.Image();
            this.bg.Name = "bg";

            this.bg.Pixbuf = global::Gdk.Pixbuf.LoadFromResource("OpenGraal.GraalIM.Resources.rc_images.rc_opengraal.jpg");

            if (this.rcSettings.Loaded)
            {
                if (System.IO.File.Exists("skins/" + this.rcSettings.Background))
                {
                    this.bg.Pixbuf = new Gdk.Pixbuf("skins/" + this.rcSettings.Background);
                }
            }

            this.bg.SetAlignment(0, 0);
            this.bg.HeightRequest = 160;

            this.SizeRequested += OnResize;
            this.table3.Add(this.bg);

            global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.table3[this.bg]));
            w4.BottomAttach = ((uint)(0));


            //this.ResizeChecked += OnResize;
            //this.SizeRequested += OnResize;
            this.CreateButtons();

            this.Framework       = Framework.GetInstance();
            this.PMWindowManager = PMWindowList.GetInstance();
            this.DeleteEvent    += delegate
            {
                this.Framework.CloseServers();

                ServerWindow serverWindow = ServerWindow.GetInstance();
                serverWindow.Show();
            };
            this.DestroyEvent += delegate
            {
                this.Framework.CloseServers();

                ServerWindow serverWindow = ServerWindow.GetInstance();
                serverWindow.Show();
            };
            this.ShowAll();
        }
Ejemplo n.º 8
0
        public void WindowInit()
        {
            this.Icon            = global::Gdk.Pixbuf.LoadFromResource("OpenGraal.GraalIM.Resources.rcicon.ico");
            this.Server          = Framework.GetInstance();
            this.PMWindowManager = PMWindowList.GetInstance();

            this.PMPlayer = this.Server.FindPlayer(this.Id);
            string TitleText = "";

            if (this.PMPlayer != null)
            {
                TitleText = this.PMPlayer.Account;
                if (this.PMPlayer.Nickname != "" && this.PMPlayer.Nickname != null)
                {
                    TitleText += ": " + this.PMPlayer.Nickname;
                }
            }
            this.Title = TitleText;
            this.Show();
        }
        public void AddPlayer(string account, string nickname)
        {
            this.Framework = Framework.GetInstance();

            nickname = (nickname != null) ? nickname : "unknown";
            if (account != null)
            {
                Gtk.Application.Invoke(delegate
                {
                    Common.Players.GraalPlayer player = this.Framework.FindPlayer(account);

                    /*
                     * if (player != null && player.Account != null)
                     * {
                     *
                     *      TreeNode[] player2 = this.Players.Nodes.Find(account, true);
                     *      TreeNode[] rc = this.RCs.Nodes.Find(account, true);
                     *      TreeNode[] irc = this.IRC.Nodes.Find(account, true);
                     *      if (player.Account.StartsWith("irc:"))
                     *      {
                     *              if (irc.Length == 0)
                     *              {
                     *                      if (player.Account != null && player.Level != null && player.Nickname != null)
                     *                              this.IRC.Nodes.Add(player.Account.ToString(), player.Nickname.ToString());
                     *                      else if (player.Account != null && player.Level != null && player.Nickname == "")
                     *                              this.RCs.Nodes.Add(player.Account.ToString(), player.Account.Split(':')[1].ToString());
                     *              }
                     *              else
                     *              {
                     *                      irc[0].Text = player.Nickname;
                     *              }
                     *      }
                     *      else
                     *      {
                     *
                     *              if (player2.Length == 0)
                     *              {
                     *                      if (player.Account != null && player.Level != null && player.Nickname != null)
                     *                              this.Players.Nodes.Add(player.Account.ToString(), player.Nickname);
                     *                      else if (player.Account != null)
                     *                              this.Players.Nodes.Add(player.Account.ToString(), "*" + player.Account.ToString());
                     *              }
                     *              else
                     *              {
                     *                      player2[0].Text = player.Nickname;
                     *              }
                     *
                     *              if (rc.Length == 0)
                     *              {
                     *                      if (player.Account != null && player.Level != null && player.Nickname != null)
                     *                              this.RCs.Nodes.Add(player.Account.ToString(), player.Nickname.ToString());
                     *                      else if (player.Account != null && player.Level != null && player.Nickname == "")
                     *                              this.RCs.Nodes.Add(player.Account.ToString(), "*" + player.Account.ToString());
                     *              }
                     *              else
                     *              {
                     *                      rc[0].Text = player.Nickname;
                     *              }
                     *      }
                     * }
                     */
                }
                                       );
            }
        }
        public void SendChat(Gtk.Entry sender2)
        {
            this.Framework = Framework.GetInstance();
            if (sender2.Name.StartsWith("irctab_"))
            {
                if (sender2.Text.StartsWith("/"))
                {
                    string[] command = sender2.Text.Split(' ');
                    if (command[0].ToLower() == "/part" && command.Length != 1)
                    {
                        this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)154 + "GraalEngine,irc,part," + command[1].Trim() + "\n");
                        this.RemovePanel("irctab_" + command[1].Trim());
                    }
                    else if (command[0].ToLower() == "/part" && command.Length == 1)
                    {
                        this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)154 + "GraalEngine,irc,part," + sender2.Name.Replace("irctab_", "").Replace("_entry", "").ToString() + "\n");
                        this.RemovePanel(sender2.Name.Replace("_entry", ""));
                    }
                    else if (command[0].ToLower() == "/join" && command.Length != 1)
                    {
                        this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)154 + "GraalEngine,irc,join," + command[1].Trim() + "\n");
                    }
                }
                else
                {
                    this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)154 + "GraalEngine,irc,privmsg," + sender2.Name.Replace("irctab_", "").Replace("_entry", "").ToString() + "," + OpenGraal.Core.CString.tokenize(sender2.Text) + "\n");
                }
            }
            else
            {
                if (sender2.Text.StartsWith("/"))
                {
                    string[] command = sender2.Text.Split(' ');
                    if (command[0].ToLower() == "/join" && command.Length != 1)
                    {
                        this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)154 + "GraalEngine,irc,join," + command[1].Trim() + "\n");
                    }
                    else if (command[0].ToLower() == "/msg" && command.Length != 1)
                    {
                        String msg = "";
                        for (int i = 2; i < command.Length; i++)
                        {
                            msg += command[i].Trim() + " ";
                        }

                        // Turn the string into a CString.
                        Core.CString Message = new Core.CString(msg);

                        this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)154 + "GraalEngine,irc,privmsg," + command[1].Trim() + "," + Message.Tokenize() + "\n");
                    }
                    else if (command[0].ToLower() == "/pm" && command.Length != 1)
                    {
                        this.SendPM(command);
                    }
                    else if (command[0].ToLower() == "/mapgen" && command.Length == 1)
                    {
                        /*
                         * MapGenWindow MapGen;
                         * Thread thread = new Thread(() =>
                         * {
                         *      MapGen = new MapGenWindow();
                         *      MapGen.Show();
                         *      //MapGen.Closed += (s, e) => MapGen.Dispatcher.InvokeShutdown();
                         *      //Dispatcher.Run();
                         * }
                         * );
                         * thread.SetApartmentState(ApartmentState.STA);
                         * //thread.IsBackground = true;
                         * thread.Start();
                         * //MapGenWindow MapGen = new MapGenWindow();
                         *
                         * TestWindow test = new TestWindow();
                         * test.ShowAll();
                         */
                    }
                    else
                    {
                        if (this.isRC)
                        {
                            this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)Common.Connections.Client.GraalServer.PacketOut.RC_CHAT + sender2.Text + "\n");
                        }
                        else
                        {
                            this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)Common.Connections.Client.GraalServer.PacketOut.PLAYERPROPS + (byte)Common.Connections.Client.GraalServer.PLPROPS.CURCHAT + (byte)sender2.Text.Length + sender2.Text + "\n");
                            this.WriteText("(" + this.NCPlayer.Account + "(" + this.NCPlayer.Id + ")) " + sender2.Text);
                        }
                    }
                }
                else
                {
                    if (this.isRC)
                    {
                        this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)Common.Connections.Client.GraalServer.PacketOut.RC_CHAT + sender2.Text + "\n");
                    }
                    else
                    {
                        this.NCPlayer.Chat = sender2.Text;
                        this.Framework.SendGSPacket(new OpenGraal.Core.CString() + (byte)Common.Connections.Client.GraalServer.PacketOut.PLAYERPROPS + (byte)Common.Connections.Client.GraalServer.PLPROPS.CURCHAT + (byte)sender2.Text.Length + sender2.Text + "\n");
                        this.WriteText("(" + this.NCPlayer.Account + "(" + this.NCPlayer.Id + ")) " + sender2.Text);
                    }
                }
            }
            sender2.Text = "";
        }