Esempio n. 1
0
        internal static void ExportOrganizer(string listname)
        {
            SaveFileDialog sd = new SaveFileDialog();

            sd.Filter           = "Enhanced Razor Export|*.raz";
            sd.Title            = "Export Organizer List";
            sd.FileName         = "OR." + listname + ".raz";
            sd.RestoreDirectory = true;

            if (sd.ShowDialog() == DialogResult.OK)
            {
                DataSet   m_Dataset       = new DataSet();
                DataTable organizer_items = new DataTable("ORGANIZER_ITEMS");
                organizer_items.Columns.Add("List", typeof(string));
                organizer_items.Columns.Add("Item", typeof(RazorEnhanced.Organizer.OrganizerItem));
                m_Dataset.Tables.Add(organizer_items);
                m_Dataset.AcceptChanges();

                List <Organizer.OrganizerItem> items = RazorEnhanced.Settings.Organizer.ItemsRead(listname);

                foreach (RazorEnhanced.Organizer.OrganizerItem item in items)
                {
                    DataRow row = m_Dataset.Tables["ORGANIZER_ITEMS"].NewRow();
                    row["List"] = listname;
                    row["Item"] = item;
                    m_Dataset.Tables["ORGANIZER_ITEMS"].Rows.Add(row);
                }

                try
                {
                    m_Dataset.RemotingFormat          = SerializationFormat.Binary;
                    m_Dataset.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema;
                    Stream          stream   = File.Create(sd.FileName);
                    GZipStream      compress = new GZipStream(stream, CompressionMode.Compress);
                    BinaryFormatter bin      = new BinaryFormatter();
                    bin.Serialize(compress, m_Dataset);
                    compress.Close();
                    stream.Close();
                    Organizer.AddLog("List: " + listname + " exported");
                }
                catch (Exception ex)
                {
                    Organizer.AddLog("Export list fail");
                    Organizer.AddLog(ex.ToString());
                }
            }
            else
            {
                Organizer.AddLog("Export list cancelled.");
            }
        }
Esempio n. 2
0
        internal static void ProfileChange(string name)
        {
            // Salvo parametri di uscita
            RazorEnhanced.Settings.General.SaveExitData();
            PasswordMemory.ProfileChangeInit();
            Assistant.Engine.MainWindow.Initializing = true;

            // Stop timer script
            if (RazorEnhanced.Scripts.Timer != null)
            {
                RazorEnhanced.Scripts.Timer.Close();
            }

            // Stop forzato di tutti i thread agent
            if (Assistant.Engine.MainWindow.AutolootCheckBox.Checked == true)
            {
                Assistant.Engine.MainWindow.AutolootCheckBox.Checked = false;
            }

            if (Assistant.Engine.MainWindow.ScavengerCheckBox.Checked == true)
            {
                Assistant.Engine.MainWindow.ScavengerCheckBox.Checked = false;
            }

            if (Assistant.Engine.MainWindow.OrganizerStop.Enabled == true)
            {
                Assistant.Engine.MainWindow.OrganizerStop.PerformClick();
            }

            if (Assistant.Engine.MainWindow.BuyCheckBox.Checked == true)
            {
                Assistant.Engine.MainWindow.BuyCheckBox.Checked = false;
            }

            if (Assistant.Engine.MainWindow.SellCheckBox.Checked == true)
            {
                Assistant.Engine.MainWindow.SellCheckBox.Checked = false;
            }

            if (Assistant.Engine.MainWindow.DressStopButton.Enabled == true)
            {
                Assistant.Engine.MainWindow.DressStopButton.PerformClick();
            }

            if (Assistant.Engine.MainWindow.BandageHealenableCheckBox.Checked == true)
            {
                Assistant.Engine.MainWindow.BandageHealenableCheckBox.Checked = false;
            }

            if (Assistant.Engine.MainWindow.DressStopButton.Enabled == true)
            {
                Assistant.Engine.MainWindow.DressStopButton.PerformClick();
            }

            // Stop filtri
            if (Assistant.Engine.MainWindow.AutoCarverCheckBox.Enabled == true)
            {
                Assistant.Engine.MainWindow.AutoCarverCheckBox.Checked = false;
            }

            if (Assistant.Engine.MainWindow.MobFilterCheckBox.Enabled == true)
            {
                Assistant.Engine.MainWindow.MobFilterCheckBox.Checked = false;
            }

            // Stop video recorder
            Assistant.MainForm.StopVideoRecorder();

            // Svuoto logbox e reset select index
            //	Assistant.Engine.MainWindow.AutoLootLogBox.Items.Clear();
            AutoLoot.AddLog("Profile Changed!");

            Assistant.Engine.MainWindow.ScavengerLogBox.Items.Clear();
            Scavenger.AddLog("Profile Changed!");

            Assistant.Engine.MainWindow.OrganizerLogBox.Items.Clear();
            Organizer.AddLog("Profile Changed!");

            Assistant.Engine.MainWindow.SellLogBox.Items.Clear();
            SellAgent.AddLog("Profile Changed!");

            Assistant.Engine.MainWindow.BuyLogBox.Items.Clear();
            BuyAgent.AddLog("Profile Changed!");

            Assistant.Engine.MainWindow.DressLogBox.Items.Clear();
            Dress.AddLog("Profile Changed!");

            Assistant.Engine.MainWindow.FriendLogBox.Items.Clear();
            Friend.AddLog("Profile Changed!");

            Assistant.Engine.MainWindow.RestockLogBox.Items.Clear();
            Restock.AddLog("Profile Changed!");

            Assistant.Engine.MainWindow.BandageHealLogBox.Items.Clear();
            BandageHeal.AddLog("Profile Changed!");

            // Cambio file
            //if (name == "default")
            //	RazorEnhanced.Settings.ProfileFiles = "RazorEnhanced.settings";
            //else
            //	RazorEnhanced.Settings.ProfileFiles = "RazorEnhanced." + name + ".settings";

            // Rimuovo cache password e disabilito vecchi filtri
            Assistant.Filters.Filter.DisableAll();

            // Chiuto toolbar
            if (RazorEnhanced.ToolBar.ToolBarForm != null)
            {
                RazorEnhanced.ToolBar.ToolBarForm.Close();
            }

            // Chiuto toolbar
            if (RazorEnhanced.SpellGrid.SpellGridForm != null)
            {
                RazorEnhanced.SpellGrid.SpellGridForm.Close();
            }

            // Carico save profilo
            RazorEnhanced.Settings.Load(name);

            // Abilito patch UOMod
            UoMod.ProfileChange();

            // Refresh list
            Assistant.Engine.MainWindow.AutoLootListSelect.SelectedIndex  = -1;
            Assistant.Engine.MainWindow.ScavengerListSelect.SelectedIndex = -1;
            Assistant.Engine.MainWindow.OrganizerListSelect.SelectedIndex = -1;
            Assistant.Engine.MainWindow.SellListSelect.SelectedIndex      = -1;
            Assistant.Engine.MainWindow.BuyListSelect.SelectedIndex       = -1;
            Assistant.Engine.MainWindow.DressListSelect.SelectedIndex     = -1;
            Assistant.Engine.MainWindow.FriendListSelect.SelectedIndex    = -1;
            Assistant.Engine.MainWindow.RestockListSelect.SelectedIndex   = -1;

            // Reinizzializzo razor
            Engine.MainWindow.SafeAction(s => s.LoadSettings());
            //Assistant.Engine.MainWindow.LoadSettings();

            // Riapro toollbar se le condizioni lo permettono
            if (RazorEnhanced.Settings.General.ReadBool("AutoopenToolBarCheckBox"))
            {
                RazorEnhanced.ToolBar.Open();
            }

            // Riapro la spellgrid se le condizioni lo permettono
            if (RazorEnhanced.Settings.General.ReadBool("GridOpenLoginCheckBox"))
            {
                RazorEnhanced.SpellGrid.Open();
            }

            Assistant.Engine.MainWindow.Initializing = false;
            SetLast(name);

            PasswordMemory.ProfileChangeEnd();

            if (World.Player != null)             // Reinit script timer se cambio profilo avvene da loggati
            {
                RazorEnhanced.Scripts.Init();
            }
        }
Esempio n. 3
0
        ////////////// SCAVENGER END //////////////

        ////////////// ORGANIZER START //////////////
        internal static void ImportOrganizer()
        {
            DataSet   m_Dataset      = new DataSet();
            DataTable m_DatasetTable = new DataTable();

            OpenFileDialog od = new OpenFileDialog();

            od.Filter           = "Enhanced Razor Export|*.raz";
            od.Title            = "Import Organizer List";
            od.RestoreDirectory = true;

            if (od.ShowDialog() == DialogResult.OK)
            {
                if (File.Exists(od.FileName))
                {
                    try
                    {
                        m_Dataset.RemotingFormat          = SerializationFormat.Binary;
                        m_Dataset.SchemaSerializationMode = SchemaSerializationMode.IncludeSchema;
                        Stream          stream     = File.Open(od.FileName, FileMode.Open);
                        GZipStream      decompress = new GZipStream(stream, CompressionMode.Decompress);
                        BinaryFormatter bin        = new BinaryFormatter();
                        m_Dataset = bin.Deserialize(decompress) as DataSet;
                        decompress.Close();
                        stream.Close();
                    }
                    catch
                    {
                        Organizer.AddLog("File is corrupted!");
                    }
                }
                else
                {
                    Organizer.AddLog("Unable to access file!");
                }
                if (m_Dataset.Tables.Contains("ORGANIZER_ITEMS"))
                {
                    m_DatasetTable = m_Dataset.Tables["ORGANIZER_ITEMS"];
                    if (m_DatasetTable.Rows.Count > 0)
                    {
                        if (RazorEnhanced.Settings.Organizer.ListExists(m_Dataset.Tables["ORGANIZER_ITEMS"].Rows[0]["List"].ToString()))
                        {
                            Organizer.AddLog("List: " + m_Dataset.Tables["ORGANIZER_ITEMS"].Rows[0]["List"].ToString() + " already exist");
                        }
                        else
                        {
                            Organizer.AddList(m_Dataset.Tables["ORGANIZER_ITEMS"].Rows[0]["List"].ToString());
                            List <RazorEnhanced.Organizer.OrganizerItem> itemlist = new List <Organizer.OrganizerItem>();
                            foreach (DataRow row in m_Dataset.Tables["ORGANIZER_ITEMS"].Rows)
                            {
                                itemlist.Add((RazorEnhanced.Organizer.OrganizerItem)row["Item"]);
                            }
                            RazorEnhanced.Settings.Organizer.ItemInsertFromImport(m_Dataset.Tables["ORGANIZER_ITEMS"].Rows[0]["List"].ToString(), itemlist);
                            RazorEnhanced.Organizer.InitGrid();
                            Organizer.AddLog("List: " + m_Dataset.Tables["ORGANIZER_ITEMS"].Rows[0]["List"].ToString() + " imported!");
                        }
                    }
                    else
                    {
                        Organizer.AddLog("This list is empty!");
                    }
                }
                else
                {
                    Organizer.AddLog("This file not contain Organizer data!");
                }
            }
            else
            {
                Organizer.AddLog("Import list cancelled.");
            }
        }