示例#1
0
        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);
        }
示例#2
0
        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);
        }