Esempio n. 1
0
#pragma warning restore CA2213

        public MainForm()
        {
            LoadAssetTypes();
            InitializeComponent();

            Text = "VRF - Source 2 Resource Viewer v" + Application.ProductVersion;

            mainTabs.SelectedIndexChanged += (o, e) =>
            {
                if (mainTabs.SelectedTab != null)
                {
                    findToolStripButton.Enabled = mainTabs.SelectedTab.Controls["TreeViewWithSearchResults"] is TreeViewWithSearchResults;
                }
            };

            mainTabs.TabPages.Add(ConsoleTab.CreateTab());

            Console.WriteLine($"VRF v{Application.ProductVersion}");

            searchForm = new SearchForm();

            Settings.Load();

            NewLineRegex = new Regex(@"\r\n|\n\r|\n|\r", RegexOptions.Compiled | RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture);

            string[] args = Environment.GetCommandLineArgs();
            for (int i = 1; i < args.Length; i++)
            {
                string file = args[i];
                if (File.Exists(file))
                {
                    OpenFile(file);
                }
            }
        }
Esempio n. 2
0
        public ToolStripDropDownButton ExportToolStripButton => exportToolStripButton; // TODO

        public MainForm()
        {
            LoadAssetTypes();
            InitializeComponent();

            Text = "VRF - Source 2 Resource Viewer v" + Application.ProductVersion;

            mainTabs.SelectedIndexChanged += (o, e) =>
            {
                ShowHideSearch();
            };

            mainTabs.TabPages.Add(ConsoleTab.CreateTab());

            Console.WriteLine($"VRF v{Application.ProductVersion}");

            searchForm = new SearchForm();

            Settings.Load();

            string[] args = Environment.GetCommandLineArgs();
            for (int i = 1; i < args.Length; i++)
            {
                string file = args[i];
                if (File.Exists(file))
                {
                    OpenFile(file);
                }
            }
        }
Esempio n. 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            ConsoleTab console = new ConsoleTab();

            this.tabControl1.TabPages.Add(console);

            ConsoleTab.WriteLine("BlueVex 2 Diablo 2 Proxy By Pleh");

            OverviewTab overview = new OverviewTab();

            this.tabControl1.TabPages.Add(overview);

            try
            {
                LoadDiabloTabs();
            }
            catch (Exception err)
            {
                MessageBox.Show("Make sure your settings are set." + "\r\n\n" + "Advanced:" + "\r\n\n" + err.ToString(), "BlueVex2", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

            if (BlueVex2.Properties.Settings.Default.UseBV2Proxy)
            {
                StartProxies();
                PlugInManager.FindAvailablePlugIns();
                List <Plugin> plugs = PlugInManager.AvailablePlugins;

                foreach (Plugin plug in plugs)
                {
                    ConsoleTab.WriteLine("Loading plugin: " + plug.TypeName);
                }
            }
        }
Esempio n. 4
0
 void bnetProxy_ClientConnected(object sender, EventArgs args)
 {
     foreach (Plugin plugin in PlugInManager.AvailablePlugins)
     {
         ConsoleTab.WriteLine("Loading " + plugin.TypeName);
         IPlugin loadedPlugin = plugin.CreateInstance();
         loadedPlugin.Initialize(((BnetProxy)sender).Proxy);
         this.BeginInvoke(new InitUIDelegate(InitUI), loadedPlugin);
     }
 }
Esempio n. 5
0
 void bnetProxy_AttachDiabloWindow(Proxy proxy, string keyOwner)
 {
     foreach (IDiabloWindow diabloWindow in DiabloWindow.DiabloWindows)
     {
         if (diabloWindow.KeyOwner.ToUpper() == keyOwner.ToUpper())
         {
             proxy.DiabloWindow = diabloWindow;
             return;
         }
     }
     ConsoleTab.WriteLine("Could not find window for " + keyOwner);
 }
Esempio n. 6
0
        private void StartProxies()
        {
            ConsoleTab.WriteLine("Starting Proxies...");
            ProxyServer bnetProxy = new ProxyServer(6112, ProxyType.Bnet);

            bnetProxy.ClientConnected    += new ProxyServer.ClientConnectedHandler(bnetProxy_ClientConnected);
            bnetProxy.AttachDiabloWindow += new ProxyServer.AttachDiabloWindowHandler(bnetProxy_AttachDiabloWindow);
            ProxyServer realmProxy = new ProxyServer(6113, ProxyType.Realm); // bnet 6112
            ProxyServer gameProxy  = new ProxyServer(4000, ProxyType.Game);

            ConsoleTab.WriteLine("Proxies running!");
        }
Esempio n. 7
0
 public void RemoveTab(ConsoleTab consoleTab)
 {
     for (int i = 0; i < Tabs.Count; i++)
     {
         if (Tabs[i].console == consoleTab)
         {
             Destroy(Tabs[i].button.gameObject);
             Tabs.RemoveAt(i);
             ChangeTab(Tabs.Last().console);
             Unsubscribe(consoleTab);
             break;
         }
     }
 }
Esempio n. 8
0
        public MainForm()
        {
            InitializeComponent();

            Model = new ViewModel(this, new BrightColorProfile());

            InitRenderers();
            SetRenderer(typeof(GdiRenderer));

            Model.SetRoot(Model.CurrentRoot); // init first node in history


            RedrawTimer.Interval = 1000 / XRay.TargetFps;
            RedrawTimer.Enabled  = true;

            RevalueTimer.Interval = 1000;
            RevalueTimer.Enabled  = true;

            InstanceTab.Init(this);
            DisplayTab.Init(this);
            ConsoleTab.Init(this);
            CodeTab.Init(this);
            NamespaceTab.Init(this);
            SettingsTab.Init(this);

            CodeTab.Visible      = false;
            InstanceTab.Visible  = false;
            NamespaceTab.Visible = false;

            //var x = Assembly.GetEntryAssembly();
            //Text = Path.GetFileNameWithoutExtension(Assembly.GetEntryAssembly().Location) + " Code Perspective";
            //Text = Path.GetFileName(Process.GetCurrentProcess().MainModule.FileName) + " Code Perspective";

            Text = "Code Perspective";

            if (XRay.Remote != null && XRay.Remote.RemoteDatHash != null)
            {
                Text = "Remote " + Text;
            }

            if (Pro.Verified)
            {
                Text += " Pro";
            }

            Show();
            WindowState = FormWindowState.Normal;
            BringToFront();
        }
Esempio n. 9
0
        public void AddTab(ConsoleTab consoleTab)
        {
            var tabButton = Instantiate(TabButtonPrefab, Vector3.zero, Quaternion.identity, tabBar);

            Tabs.Add(new TabData
            {
                console = consoleTab,
                button  = tabButton
            });
            if (Tabs.Count == 1)
            {
                ChangeTab(consoleTab);
            }

            tabButton.onClick.AddListener(() => this.ChangeTab(consoleTab));
            tabButton.gameObject.GetComponentInChildren <Text>().text = consoleTab.Name;
            Subscribe(consoleTab);
        }
Esempio n. 10
0
        public Logging(ConsoleTab consoleTab)
        {
            this._consoleTab = consoleTab;

            CreateConsoleLog();
        }
Esempio n. 11
0
        private void CheckAutoUpdate()
        {
            try
            {
                if (InvokeRequired)
                {
                    Invoke((MethodInvoker)(CheckAutoUpdate));
                }
                else
                {
                    if (CBUpdateBehaviour.SelectedIndex < 1)
                    {
                        return;
                    }
                    if (CBUpdateBranch.SelectedItem == null ||
                        string.IsNullOrEmpty(CBUpdateBranch.SelectedItem.ToString()))
                    {
                        return;
                    }

                    ProcessHandler.SetStatusStarting();                     // already show that the server is starting
                    ConsoleTab.WriteOut("__________________________________________________________________");
                    ConsoleTab.WriteOut("Performing version check... Branch: " + CBUpdateBranch.SelectedItem);

                    IMinecraftServer server         = GetSelectedServer();
                    string           currentversion = server.GetCurrentVersion(TxtJarFile.Text);
                    ConsoleTab.WriteOut("Performing version check... Current version: " + currentversion);

                    string latestversion = "";

                    if (CBUpdateBranch.SelectedItem.ToString().ToLower().Contains("recommended"))
                    {
                        latestversion = server.FetchRecommendedVersion;
                    }
                    if (CBUpdateBranch.SelectedItem.ToString().ToLower().Contains("beta"))
                    {
                        latestversion = server.FetchBetaVersion;
                    }
                    if (CBUpdateBranch.SelectedItem.ToString().ToLower().Contains("dev"))
                    {
                        latestversion = server.FetchDevVersion;
                    }
                    ConsoleTab.WriteOut("Performing version check... Latest version: " + latestversion);

                    switch (CBUpdateBehaviour.SelectedIndex)
                    {
                    case 1:                             // Notify

                        if (int.Parse(latestversion) > int.Parse(currentversion))
                        {
                            ConsoleTab.WriteOut("A new server version is available for " + server.Name);
                            ConsoleTab.WriteOut(
                                "Download the latest version in the starter tab. The latest version is #" +
                                latestversion);

                            Thread t = new Thread(() =>
                                                  MetroMessageBox.Show(FindForm(),
                                                                       "A new server version is available for " + server.Name + "." +
                                                                       Environment.NewLine +
                                                                       "Download the latest version in the starter tab. The latest version is #" +
                                                                       latestversion,
                                                                       "Server update available",
                                                                       MessageBoxButtons.OK, MessageBoxIcon.Information)
                                                  );
                            t.Start();
                        }
                        break;

                    case 2:                             // Auto update
                        if (int.Parse(latestversion) > int.Parse(currentversion))
                        {
                            ConsoleTab.WriteOut("New server version available: #" + latestversion +
                                                ". This version will be installed automaticly. You can disable this in the starter tab.");
                            if (CBUpdateBranch.SelectedItem.ToString().ToLower().Contains("recommended"))
                            {
                                server.DownloadRecommendedVersion(TxtJarFile.Text);
                            }
                            if (CBUpdateBranch.SelectedItem.ToString().ToLower().Contains("beta"))
                            {
                                server.DownloadBetaVersion(TxtJarFile.Text);
                            }
                            if (CBUpdateBranch.SelectedItem.ToString().ToLower().Contains("dev"))
                            {
                                server.DownloadDevVersion(TxtJarFile.Text);
                            }
                            ConsoleTab.WriteOut("New server version installed.");
                        }
                        break;
                    }
                    ConsoleTab.WriteOut("Finished update check. Starting server...");
                    ConsoleTab.WriteOut("__________________________________________________________________");
                }
            }
            catch (Exception exception)
            {
                Logger.Log(LogLevel.Severe, "StarterTab",
                           "Failed to complete auto-update check for " + GetSelectedServer(), exception.Message);
            }
        }
Esempio n. 12
0
 void Unsubscribe(ConsoleTab consoleTab)
 {
     consoleTab.AppendOutput   -= HandleAppendOutput;
     consoleTab.RefreshContent -= HandleRefreshContent;
     consoleTab.Bell           -= HandleBell;
 }
Esempio n. 13
0
 void Subscribe(ConsoleTab consoleTab)
 {
     consoleTab.AppendOutput   += HandleAppendOutput;
     consoleTab.RefreshContent += HandleRefreshContent;
     consoleTab.Bell           += HandleBell;
 }
Esempio n. 14
0
        public static void LoginToBattleNet(string defaultAccount, int delay, DiabloWindow diabloWindow)
        {
            if (!string.IsNullOrEmpty(defaultAccount))
            {
                string username = string.Empty;
                string password = string.Empty;
                string charslot = string.Empty;
                string master   = string.Empty;

                foreach (string accountString in BlueVex2.Properties.Settings.Default.Accounts)
                {
                    if (accountString.StartsWith(defaultAccount + ","))
                    {
                        string[] parts = accountString.Split(',');
                        username = parts[0];
                        password = parts[1];
                        charslot = parts[2];
                        master   = parts[3];
                    }
                }

                if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
                {
                    return;
                }

                Thread.Sleep((int)delay);
                ConsoleTab.WriteLine("Logging into Battle Net as " + username);

                // Click to load menu
                Thread.Sleep(2000);
                DiabloInteraction.ClickButton(DiabloInteraction.Diablo2Button.BattleNet, diabloWindow);

                // Click BattleNet button
                Thread.Sleep(500);
                DiabloInteraction.ClickButton(DiabloInteraction.Diablo2Button.BattleNet, diabloWindow);

                // Tab
                Thread.Sleep(2000);
                diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Tab));
                diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Tab));

                //Username
                Thread.Sleep(500);
                DiabloInteraction.WriteString(username, diabloWindow);

                //Tab
                Thread.Sleep(500);
                diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Tab));
                diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Tab));

                //Password
                Thread.Sleep(500);
                DiabloInteraction.WriteString(password, diabloWindow);

                // Enter
                Thread.Sleep(500);
                diabloWindow.SendKeyDown(new KeyEventArgs(Keys.Enter));
                diabloWindow.SendKeyUp(new KeyEventArgs(Keys.Enter));

                // Double Click Character Slot
                Thread.Sleep(5000);
                switch (charslot)
                {
                case "1":
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot1, diabloWindow);
                    break;

                case "2":
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot2, diabloWindow);
                    break;

                case "3":
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot3, diabloWindow);
                    break;

                case "4":
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot4, diabloWindow);
                    break;

                case "5":
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot5, diabloWindow);
                    break;

                case "6":
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot6, diabloWindow);
                    break;

                case "7":
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot7, diabloWindow);
                    break;

                case "8":
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot8, diabloWindow);
                    break;

                default:
                    DiabloInteraction.DoubleClickButton(DiabloInteraction.Diablo2Button.CharacterSlot1, diabloWindow);
                    break;
                }
            }
        }