public ClientEditor(MuBMD.BmdFile file, bool IsGroupedMode)
        {
            InitializeComponent();
            m_File        = file;
            m_IsSaved     = false;
            m_NeedsSaving = false;

            m_IsGroupedMode = IsGroupedMode;

            m_SaveFolderPath = Properties.Settings.Default.SaveFolder;
            Properties.Settings.Default.Save();

            dataGridView1.RowHeadersWidth = 50;

            if (m_IsGroupedMode)
            {
                m_AllStructures = file.GetStructures();
                object[] items = Item.GetItemsByGroupID(m_AllStructures, 0);
                file.BuildTable(dataGridView1, items);
            }
            else
            {
                groupbox_grouping.Visible = false;
                groupbox_grouping.Dock    = DockStyle.None;
                dataGridView1.Dock        = DockStyle.Fill;
                file.BuildTable(dataGridView1, file.GetStructures());
                dataGridView1.EditMode = DataGridViewEditMode.EditOnF2;
            }
        }
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            string         FilePath;
            SaveFileDialog Dialog = new SaveFileDialog();

            Dialog.InitialDirectory = m_SaveFolderPath;
            Dialog.Filter           = "ZT Config File (*.z)|*.z";

            if (Dialog.ShowDialog() == DialogResult.OK)
            {
                m_SaveFolderPath = Path.GetDirectoryName(Dialog.FileName);
                Properties.Settings.Default.SaveFolder = m_SaveFolderPath;
                FilePath = Dialog.FileName;
            }
            else
            {
                return;
            }

            saveBody();

            FileStream Stream      = new FileStream(FilePath, FileMode.Create, FileAccess.Write);
            int        ElementSize = Marshal.SizeOf(typeof(MuDef.MUFile_ClientCommon));

            byte[] Temp = BmdFile.StructureToByteArray(m_Body);
            BmdFile.XorFilter(ref Temp, Marshal.SizeOf(typeof(MuDef.MUFile_ClientCommon)));
            Stream.Write(Temp, 0, ElementSize);
            Stream.Close();

            MessageBox.Show(FilePath + " has been saved", "zFileManager");
            Properties.Settings.Default.SaveFolder = Path.GetDirectoryName(FilePath);
            Properties.Settings.Default.Save();
        }
Example #3
0
 void init(BmdFile File)
 {
     m_File           = File;
     m_Items          = m_File.GetStructures();
     m_SaveFolderPath = Properties.Settings.Default.SaveFolder;
     m_IsSaved        = false;
     m_NeedSaving     = false;
     m_CopyboardIndex = -1;
     button4.Enabled  = false;
     m_ItemCode       = -1;
     Properties.Settings.Default.Save();
 }
        object readInfo(string File)
        {
            FileStream Stream      = new FileStream(File, FileMode.Open, FileAccess.Read);
            int        ElementSize = Marshal.SizeOf(typeof(MuDef.MUFile_ClientCommon));

            byte[] m_File = new byte[ElementSize + 1];
            m_FileSize = Stream.Read(m_File, 0, ElementSize);
            object DecryptedInfo = Marshal.PtrToStructure(Marshal.UnsafeAddrOfPinnedArrayElement(m_File, 0), typeof(MuDef.MUFile_ClientCommon));

            BmdFile.XorFilter(ref DecryptedInfo);
            Stream.Close();
            return(DecryptedInfo);
        }
Example #5
0
 public ItemEditor(BmdFile File)
 {
     InitializeComponent();
     init(File);
 }
 public ItemExcellentOptionEditor(BmdFile File)
 {
     InitializeComponent();
     init(File);
 }