entity.MetaEditor2.MetaEditorControlPage.checkSave C# (CSharp) Method

checkSave() private method

Called before the panel is disposed of. Checks for any changes to the tag and propmts to save if changes found.
private checkSave ( ) : void
return void
        void checkSave()
        {
            // Focus the Save button to make sure that the current field is updated by BaseField_Leave() function
            this.btnSave.Focus();

            byte[] bn = meta.MS.ToArray();
            byte[] bo = msBackup.ToArray();
            List<int> changedOffsets = new List<int>();
            for (int i = 0; i < bn.Length; i++)
                if (bn[i] != bo[i])
                    changedOffsets.Add(i);
            if (changedOffsets.Count > 0)
            {
                DialogResult dr = MessageBox.Show("Changes were made to:\n[" +
                                    this.meta.type +
                                    "] " +
                                    this.meta.name +
                                    "\nDo you wish to save?", "Save Changes?", MessageBoxButtons.YesNo);
                if (dr == DialogResult.Yes)
                {
                    btnSave_Click(this, null);
                }
                else
                {
                    meta.MS.Dispose();
                    meta.MS = new MemoryStream(msBackup.ToArray());
                }
            }
        }