Beispiel #1
0
        public string GetClientPath()
        {
            string ClientFile = string.Empty;

            ClientFile = GetClientPathFromFile();
            if (ClientFile == null || ClientFile == "")
            {
                string UserPath = GetClientPathFromUser();
                if (UserPath == null || UserPath == "")
                {
                    return(null);
                }
                else
                {
                    SetClientPath(UserPath);
                    ClientFile = UserPath;
                }
            }
            if (FileVersionInfo.GetVersionInfo(ClientFile).FileVersion != Key)
            {
                inifile.IniWriteValue(Section, Key, "");
                MessageBox.Show(new WindowWrapper(WinApi.GetForegroundWindow()), "Wrong Tibia Version!!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(null);
            }
            return(ClientFile);
        }
Beispiel #2
0
        public static string GetMoviePath()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.CheckFileExists = true;
            dialog.CheckPathExists = true;
            dialog.Multiselect     = false;
            dialog.Title           = "Select BynaCam movie.. ";
            dialog.Filter          = "BynaCam movies|*.byn";
            dialog.ShowDialog(new WindowWrapper(WinApi.GetForegroundWindow()));
            return(dialog.FileName);
        }
Beispiel #3
0
        private string GetClientPathFromUser()
        {
            OpenFileDialog dialog = new OpenFileDialog();

            dialog.CheckFileExists  = true;
            dialog.CheckPathExists  = true;
            dialog.Multiselect      = false;
            dialog.InitialDirectory = "%programfiles%\\Tibia";
            dialog.Title            = "Select Tibia " + Key;
            dialog.Filter           = "Exe files|*.exe";
            dialog.ShowDialog(new WindowWrapper(WinApi.GetForegroundWindow()));
            return(dialog.FileName);
        }
Beispiel #4
0
        static void Main(string[] args)
        {
            try
            {
                string mpath = string.Empty;
                if (args.Length > 0)
                {
                    mpath = args[0];
                }
                else
                {
                    mpath = Files.GetMoviePath();
                }
                file = new BynFile(mpath);
                file.Buffer.Position = 0;
                client = Client.OpenMC(Files.GetClientPath(file.TibiaVersion), null);
            }
            catch { System.Diagnostics.Process.GetCurrentProcess().Kill(); }

            client.WindowTitle = "BynaCam";
            client.Exited     += new EventHandler(client_Exited);
            StartServers(client);
            client.LoginCam("1", "1");

            Timer titleTimer = new Timer();

            titleTimer.Tick    += new EventHandler(UpdateTitle);
            titleTimer.Interval = 500;
            titleTimer.Start();

            Utilities.globalKeyboardHook gkh = new Utilities.globalKeyboardHook();
            gkh.HookedKeys.Add(System.Windows.Forms.Keys.Up);
            gkh.HookedKeys.Add(System.Windows.Forms.Keys.Down);
            gkh.HookedKeys.Add(System.Windows.Forms.Keys.Left);
            gkh.HookedKeys.Add(System.Windows.Forms.Keys.Right);
            gkh.HookedKeys.Add(System.Windows.Forms.Keys.Pause);
            gkh.HookedKeys.Add(System.Windows.Forms.Keys.Back);
            gkh.KeyDown += new System.Windows.Forms.KeyEventHandler(delegate(object sender, KeyEventArgs e)
            {
                if (client.WindowHandle == WinApi.GetForegroundWindow())     //isactive
                {
                    if (e.KeyCode == Keys.Right)
                    {
                        if (Player.speed == 50)
                        {
                            e.Handled = false;
                            return;
                        }
                        Player.speed++;
                    }
                    if (e.KeyCode == Keys.Left)
                    {
                        if (Player.speed == 1)
                        {
                            e.Handled = false;
                            return;
                        }
                        Player.speed--;
                    }
                    if (e.KeyCode == Keys.Up)
                    {
                        Player.speed = 50;
                        e.Handled    = false;
                    }
                    if (e.KeyCode == Keys.Down)
                    {
                        Player.speed = 1;
                        e.Handled    = false;
                    }

                    if (e.KeyCode == Keys.Pause && !Player.paused)
                    {
                        Player.paused = true;
                    }
                    else if (e.KeyCode == Keys.Pause && Player.paused)
                    {
                        Player.paused = false;
                    }
                    if (e.KeyCode == Keys.Back)
                    {
                        int ms = (int)Player.currentTime.TotalMilliseconds - (30 * 1000);
                        if (ms <= 0)
                        {
                            ms = 0;
                        }

                        Player.GotoTime(TimeSpan.FromMilliseconds(ms));
                    }

                    if (e.KeyCode == Keys.Left || e.KeyCode == Keys.Right ||
                        e.KeyCode == Keys.Down || e.KeyCode == Keys.Up || e.KeyCode == Keys.Pause)
                    {
                        UpdateTitle(null, null);
                    }
                }

                e.Handled = true;
            });

            System.Windows.Forms.Application.Run();
        }