public override RazorEnhanced.Shard SelectShard(System.Collections.Generic.List <RazorEnhanced.Shard> shards) { RazorEnhanced.Shard cuo_shard = new RazorEnhanced.Shard("Classic UO Default", Path.Combine(ClassicUOClient.UOFilePath, "client.exe"), ClassicUOClient.UOFilePath, "", "127.0.0.1", 1000, true, false, true); return(cuo_shard); }
public bool Init(bool isOSI) // returns false on cancel { System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Profiles")); System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Backup")); System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Scripts")); // Profile RazorEnhanced.Profiles.Load(); // Shard Bookmarks RazorEnhanced.Shard.Load(); RazorEnhanced.Settings.Load(RazorEnhanced.Profiles.LastUsed()); RazorEnhanced.Shard.Read(out List <RazorEnhanced.Shard> shards); RazorEnhanced.Shard selected = Client.Instance.SelectShard(shards); m_Running = true; if ((!isOSI) || (RazorEnhanced.Settings.General.ReadBool("NotShowLauncher") && File.Exists(selected.ClientPath) && Directory.Exists(selected.ClientFolder) && selected != null)) { Instance.Start(selected); } else { RazorEnhanced.UI.EnhancedLauncher launcher = new RazorEnhanced.UI.EnhancedLauncher(); DialogResult laucherdialog = launcher.ShowDialog(); if (laucherdialog != DialogResult.Cancel) // Avvia solo se premuto launch e non se exit { if (selected == null) { MessageBox.Show("You must select a valid shard!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { RazorEnhanced.Shard.Read(out shards); selected = Instance.SelectShard(shards); Instance.Start(selected); } } else { m_Running = false; return(false); } } return(true); }
public override RazorEnhanced.Shard SelectShard(System.Collections.Generic.List <RazorEnhanced.Shard> shards) { foreach (var shard_iter in shards) { if (shard_iter.Host == ShardHost) { return(shard_iter); } } ClassicUO.Configuration.Settings settings = ClassicUO.Configuration.Settings.Get(); RazorEnhanced.Shard.Insert("Classic UO Default", Path.Combine(settings.UltimaOnlineDirectory, "client.exe"), settings.UltimaOnlineDirectory, settings.IP, settings.Port, true, false); RazorEnhanced.Shard cuo_shard = new RazorEnhanced.Shard("Classic UO Default", Path.Combine(settings.UltimaOnlineDirectory, "client.exe"), settings.UltimaOnlineDirectory, settings.IP, settings.Port, true, false, true); shards.Add(cuo_shard); return(cuo_shard); }
internal static void Read(out List <RazorEnhanced.Shard> shards) { List <RazorEnhanced.Shard> shardsOut = new List <RazorEnhanced.Shard>(); foreach (DataRow row in m_Dataset.Tables["SHARDS"].Rows) { string description = (string)row["Description"]; string clientpath = (string)row["ClientPath"]; string clientfolder = (string)row["ClientFolder"]; string host = (string)row["Host"]; int port = (int)row["Port"]; bool patchenc = (bool)row["PatchEnc"]; bool osienc = (bool)row["OSIEnc"]; bool selected = (bool)row["Selected"]; RazorEnhanced.Shard shard = new RazorEnhanced.Shard(description, clientpath, clientfolder, host, port, patchenc, osienc, selected); shardsOut.Add(shard); } shards = shardsOut; }
internal void Start(RazorEnhanced.Shard selected) { ClientEncrypted = selected.PatchEnc; ServerEncrypted = selected.OSIEnc; string clientPath = selected.ClientPath; string dataDir = selected.ClientFolder; string addr = selected.Host; int port = selected.Port; Ultima.Files.Directory = selected.ClientFolder; if (!Language.Load("ENU")) { //SplashScreen.End(); MessageBox.Show("Unable to load required file Language/Razor_lang.enu", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false); return; } if (dataDir != null && Directory.Exists(dataDir)) { Ultima.Files.SetMulPath(dataDir); } else { MessageBox.Show("Unable to find the Data Folder " + dataDir, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false); return; } Language.LoadCliLoc(); Initialize(typeof(Assistant.Engine).Assembly); Assistant.Client.Instance.SetConnectionInfo(IPAddress.None, -1); if (IsOSI) { Assistant.Client.Loader_Error result = Assistant.Client.Loader_Error.UNKNOWN_ERROR; if (clientPath != null && File.Exists(clientPath)) { result = Assistant.Client.Instance.LaunchClient(clientPath); } if (result != Assistant.Client.Loader_Error.SUCCESS) { if (clientPath == null && File.Exists(clientPath)) { MessageBox.Show("Unable to find the client " + clientPath, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show("Unable to launch the client " + clientPath, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); } //SplashScreen.End(); RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false); return; } } // if these are null then the registry entry does not exist (old razor version) Engine.IP = Resolve(addr); if (Engine.IP == IPAddress.None || port == 0) { MessageBox.Show(Language.GetString(LocString.BadServerAddr), "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); //SplashScreen.End(); RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false); return; } Engine.ClientBuild = FileVersionInfo.GetVersionInfo(clientPath).FileBuildPart; Engine.ClientMajor = FileVersionInfo.GetVersionInfo(clientPath).FileMajorPart; //SplashScreen.Start(); //m_ActiveWnd = SplashScreen.Instance; Assistant.Client.Instance.SetConnectionInfo(Engine.IP, port); Ultima.Multis.PostHSFormat = UsePostHSChanges; }
public bool Init(bool isOSI) // returns false on cancel { //Dalamar //TODO: is this a good entry point for generating the docs ? RazorEnhanced.AutoDocIO.UpdateDocs(); RazorEnhanced.Config.LoadAll(); RazorEnhanced.Journal.GlobalJournal.Clear(); // really just force it to be instantiated System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Profiles")); System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Backup")); System.IO.Directory.CreateDirectory(Path.Combine(Assistant.Engine.RootPath, "Scripts")); Initialize(typeof(Assistant.Engine).Assembly); // Profile RazorEnhanced.Profiles.Load(); // Shard Bookmarks RazorEnhanced.Shard.Load(); RazorEnhanced.Settings.Load(RazorEnhanced.Profiles.LastUsed()); RazorEnhanced.Shard.Read(out List <RazorEnhanced.Shard> shards); RazorEnhanced.Shard selected = Client.Instance.SelectShard(shards); m_Running = true; if ((!isOSI) || (RazorEnhanced.Settings.General.ReadBool("NotShowLauncher") && File.Exists(selected.ClientPath) && Directory.Exists(selected.ClientFolder) && selected != null)) { m_Version = FileVersionInfo.GetVersionInfo(selected.ClientPath); Instance.Start(selected); } else { RazorEnhanced.UI.EnhancedLauncher launcher = new RazorEnhanced.UI.EnhancedLauncher(); DialogResult laucherdialog = launcher.ShowDialog(); if (laucherdialog == DialogResult.OK) // Avvia solo se premuto launch e non se exit { if (selected == null) { MessageBox.Show("You must select a valid shard!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { RazorEnhanced.Shard.Read(out shards); selected = Instance.SelectShard(shards); m_Version = FileVersionInfo.GetVersionInfo(selected.ClientPath); if (launcher.ActiveControl.Text == "Launch CUO") { // Spin up CUO Process cuo = new Process(); cuo.StartInfo.FileName = selected.CUOClient; int osiEnc = 0; if (selected.OSIEnc) { osiEnc = 5; } string verString = String.Format("{0:00}.{1:0}.{2:0}.{3:D1}", m_Version.FileMajorPart, m_Version.FileMinorPart, m_Version.FileBuildPart, m_Version.FilePrivatePart); cuo.StartInfo.Arguments = String.Format("-ip {0} -port {1} -uopath \"{2}\" -encryption {3} -plugins \"{4}\" -clientversion \"{5}\"", selected.Host, selected.Port, selected.ClientFolder, osiEnc, System.Reflection.Assembly.GetExecutingAssembly().Location, verString); cuo.Start(); m_Running = false; return(false); } else { Instance.Start(selected); } } } else { m_Running = false; return(false); } } return(true); }
internal static void Start(RazorEnhanced.Shard selected) { ClientCommunication.ClientEncrypted = selected.PatchEnc; ClientCommunication.ServerEncrypted = selected.OSIEnc; string clientPath = selected.ClientPath; string dataDir = selected.ClientFolder; string addr = selected.Host; int port = selected.Port; Ultima.Files.Directory = selected.ClientFolder; if (!Language.Load("ENU")) { SplashScreen.End(); MessageBox.Show("Unable to load required file Language/Razor_lang.enu", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false); return; } if (dataDir != null && Directory.Exists(dataDir)) { Ultima.Files.SetMulPath(dataDir); } else { MessageBox.Show("Unable to find the Data Folder " + dataDir, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false); return; } Language.LoadCliLoc(); Initialize(typeof(Assistant.Engine).Assembly); ClientCommunication.SetConnectionInfo(IPAddress.None, -1); ClientCommunication.Loader_Error result = ClientCommunication.Loader_Error.UNKNOWN_ERROR; if (clientPath != null && File.Exists(clientPath)) { result = ClientCommunication.LaunchClient(clientPath); } if (result != ClientCommunication.Loader_Error.SUCCESS) { if (clientPath == null && File.Exists(clientPath)) { MessageBox.Show(SplashScreen.Instance, "Unable to find the client " + clientPath, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MessageBox.Show(SplashScreen.Instance, "Unable to launch the client " + clientPath, "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); } SplashScreen.End(); RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false); return; } // if these are null then the registry entry does not exist (old razor version) m_ip = Resolve(addr); if (m_ip == IPAddress.None || port == 0) { MessageBox.Show(Language.GetString(LocString.BadServerAddr), "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); SplashScreen.End(); RazorEnhanced.Settings.General.WriteBool("NotShowLauncher", false); return; } ClientBuild = FileVersionInfo.GetVersionInfo(clientPath).FileBuildPart; ClientMajor = FileVersionInfo.GetVersionInfo(clientPath).FileMajorPart; SplashScreen.Start(); m_ActiveWnd = SplashScreen.Instance; ClientCommunication.SetConnectionInfo(m_ip, port); Ultima.Multis.PostHSFormat = UsePostHSChanges; MainWnd = new MainForm(); Application.Run(MainWnd); m_Running = false; RazorEnhanced.Settings.General.SaveExitData(); // Chiuto toolbar if (RazorEnhanced.ToolBar.ToolBarForm != null) { RazorEnhanced.ToolBar.ToolBarForm.Close(); } // Chiuto Spellgrid if (RazorEnhanced.SpellGrid.SpellGridForm != null) { RazorEnhanced.SpellGrid.SpellGridForm.Close(); } // Stoppo tick timer agent if (RazorEnhanced.Scripts.Timer != null) { RazorEnhanced.Scripts.Timer.Close(); } // Stop forzato di tutti i thread agent RazorEnhanced.AutoLoot.AutoMode = false; RazorEnhanced.Scavenger.AutoMode = false; RazorEnhanced.BandageHeal.AutoMode = false; if (Assistant.Engine.MainWindow.OrganizerStop.Enabled == true) { Assistant.Engine.MainWindow.OrganizerStop.PerformClick(); } if (Assistant.Engine.MainWindow.DressStopButton.Enabled == true) { Assistant.Engine.MainWindow.DressStopButton.PerformClick(); } if (Assistant.Engine.MainWindow.RestockStop.Enabled == true) { Assistant.Engine.MainWindow.RestockStop.PerformClick(); } RazorEnhanced.UI.EnhancedScriptEditor.End(); ClientCommunication.Close(); }
public static void Main(string[] Args) { Application.ThreadException += ApplicationThreadException; AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException; m_Running = true; Thread.CurrentThread.Name = "Razor Main Thread"; DateTime local = DateTime.Now; if (local > m_ExpireDate) { MessageBox.Show("This Razor installation has expired!, Download new version from: http://www.razorenhanced.org/", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } // Profili RazorEnhanced.Profiles.Load(); // Shard Bookmarks RazorEnhanced.Shard.Load(); // Parametri di razor if (RazorEnhanced.Profiles.LastUsed() == "default") { RazorEnhanced.Settings.ProfileFiles = "RazorEnhanced.settings"; } else { RazorEnhanced.Settings.ProfileFiles = "RazorEnhanced." + RazorEnhanced.Profiles.LastUsed() + ".settings"; } RazorEnhanced.Settings.Load(); RazorEnhanced.Shard.Read(out List <RazorEnhanced.Shard> shards); RazorEnhanced.Shard selected = shards.FirstOrDefault(s => s.Selected); // remove this later!!! It is a stub!! MainWnd = new MainForm(); Application.Run(MainWnd); // remove this later!!! It is a stub!! /*if (RazorEnhanced.Settings.General.ReadBool("NotShowLauncher") && File.Exists(selected.ClientPath) && Directory.Exists(selected.ClientFolder) && selected != null) * { * Start(selected); * } * else * { * RazorEnhanced.UI.EnhancedLauncher launcher = new RazorEnhanced.UI.EnhancedLauncher(); * DialogResult laucherdialog = launcher.ShowDialog(); * * if (laucherdialog != DialogResult.Cancel) // Avvia solo se premuto launch e non se exit * { * if (selected == null) * { * MessageBox.Show("You must select a valid shard!", "ERROR!", MessageBoxButtons.OK, MessageBoxIcon.Error); * } * else * { * RazorEnhanced.Shard.Read(out shards); * selected = shards.FirstOrDefault(s => s.Selected); * Start(selected); * } * } * }*/ }