Exemple #1
0
        public bool RevertFile(string fileName)
        {
            bool result = CoreGlobals.getPerforce().getConnection().P4Revert(ID, fileName);

            mbKnownDirty = true;
            return(result);
        }
Exemple #2
0
        private void Save()
        {
            try
            {
                mData.mMetadata.mTags          = mTags;//
                mData.mMetadata.mSourceControl = (this.MarkForAddCheckBox.Checked == true) ? "InPerforce" : "";
                mData.mMetadata.mCreator       = System.Environment.UserName;
                //mData.mMetadata.mDescription = MetaDescriptionTextBox.Text;
                //GetNewChangeList()
                mData.Save();

                if (CoreGlobals.UsingPerforce == true && MarkForAddCheckBox.Checked == true)
                {
                    SimpleFileStatus status = CoreGlobals.getPerforce().GetFileStatusSimple(mData.mFileName);
                    if (status.InPerforce == false)
                    {
                        PerforceChangeList list = CoreGlobals.getPerforce().GetNewChangeList("Auto checkin:Clipart");
                        list.AddFile(mData.mFileName);

                        list.Submitchanges();
                    }
                }
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Exemple #3
0
        private static bool P4CanEditFile(string filename)
        {
            if (CoreGlobals.UsingPerforce == false)
            {
                throw new System.Exception("Editor Bug.  Invalid perforce use");
            }

            SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(filename);

            if (status.InPerforce == false)
            {
                return(true);
            }
            if (!status.CheckedOut)
            {
                CoreGlobals.ShowMessage(Path.GetFileName(filename) + " is not checked out from perforce. Export Aborted!");
                return(false);
            }
            if (status.CheckedOutOtherUser == true)
            {
                CoreGlobals.ShowMessage(Path.GetFileName(filename) + " is checked out by " + status.ActionOwner + ". Export Aborted!");
                return(false);
            }

            return(true);
        }
Exemple #4
0
        private void RemovePallete_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("Are you sure you'd like to delete this palette?", "Delete", MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                string fname = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + palleteListBox.SelectedItem.ToString() + SimTerrainType.mTextureSetExtention;

                SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(fname);
                if (status.InPerforce == true)
                {
                    if (status.CheckedOut == false)
                    {
                        MessageBox.Show("You must check this file out from perforce before you delete it");
                        return;
                    }
                    else if (status.CheckedOutOtherUser == true)
                    {
                        MessageBox.Show("This file is checked out by " + status.ActionOwner + " you cannot delete it.");
                        return;
                    }
                }


                if (File.Exists(fname))
                {
                    File.Delete(fname);
                    palleteListBox.Items.Remove(palleteListBox.SelectedItem);
                }
            }
        }
Exemple #5
0
        static private bool P4CanEdit(string filename, bool showAlerts)
        {
            SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(filename);

            if (status.InPerforce == false)
            {
                return(true);
            }
            if (status.CheckedOutOtherUser == true)
            {
                return(false);
            }


            if (status.CheckedOut == false)
            {
                if (showAlerts)
                {
                    if (MessageBox.Show(Path.GetFileName(filename) + "is not checked out. Would you like to check it out and add it to a new perforce changelist?", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        P4AddFileToChangeList(filename);
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(false);
            }

            return(true);
        }
Exemple #6
0
        private void CancelChangesButton_Click(object sender, EventArgs e)
        {
            if (mChangeList == null)
            {
                //we could try to use and existing change list, but that could get tricky

                //if (mStatus.Count == 0)
                //   return;
                //int id = mStatus[0].UserChangeListNumber;
                //if(id == PerforceConnection.cDefaultChangeList)
                //{
                //   mChangeList = CoreGlobals.getPerforce().GetNewChangeList("Automated action: " + Path.GetFileNameWithoutExtension(mFiles[0]));
                //}
                //else
                //{
                //   mChangeList = CoreGlobals.getPerforce().GetExistingChangeList("Automated action: " + Path.GetFileNameWithoutExtension(mFiles[0]));
                //}

                mChangeList = CoreGlobals.getPerforce().GetNewChangeList(GetDescription());
            }

            foreach (string file in mFiles)
            {
                mChangeList.AddOrEdit(file, true);
            }

            mChangeList.RemoveListAndRevert();
            mChangeList = null;

            UpdateUIStatus();
        }
Exemple #7
0
        public void UpdateChangeListInfo()
        {
            string changelist = CoreGlobals.getPerforce().getConnection().P4Cmd("change -o ", ID.ToString(), "");

            ParseChanges(changelist);
            mbKnownDirty = false;
        }
Exemple #8
0
        /// <summary>
        /// Do you want a file in a change list.  This will accomplish the goal in several ways.
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="reopen">pulls the file from another one of the user's change list into this one</param>
        /// <returns></returns>
        public bool AddOrEdit(string fileName, bool reopen)
        {
            SimpleFileStatus status = CoreGlobals.getPerforce().GetFileStatusSimple(fileName);

            if (status.State == eFileState.NotInPerforce)
            {
                return(AddFile(fileName));
            }
            //else if (status.IsLatestRevision == false)
            //{
            //   return EditFile(fileName);
            //}
            else if (reopen && status.CheckedOutThisUser == true)
            {
                if (status.UserChangeListNumber != ID)
                {
                    return(ReOpenFile(fileName));//yoink
                }
                else
                {
                    return(true);//we already have it!
                }
            }
            else
            {
                return(EditFile(fileName));
            }
        }
Exemple #9
0
        public bool Submitchanges()
        {
            bool result = CoreGlobals.getPerforce().getConnection().P4Submit(ID);

            mbKnownDirty = true;
            return(result);
        }
Exemple #10
0
        public bool SubmitFiles()
        {
            if (ValidateFiles() == false)
            {
                return(false);
            }

            if (mChangeList == null)
            {
                mChangeList = CoreGlobals.getPerforce().GetNewChangeList(GetDescription());
            }
            else
            {
                mChangeList.Description = GetDescription();//wtf??? why does this remove files...?
            }

            foreach (string file in mFiles)
            {
                mChangeList.AddOrEdit(file, true);
            }

            mChangeList.Submitchanges();

            UpdateUIStatus();

            return(true);
        }
Exemple #11
0
 private void P4SubmitChangelist()
 {
     if (mChangelistID != -1)
     {
         CoreGlobals.getPerforce().getConnection().P4Submit(mChangelistID);
     }
 }
Exemple #12
0
        private bool P4AddFileToChangeList(string filename)
        {
            PerforceChangeList list = null;

            if (mChangelistID == -1)
            {
                list = CoreGlobals.getPerforce().GetNewChangeList(mChangelistDesc);
                if (list == null)
                {
                    return(false);
                }
                mChangelistID = list.ID;
            }
            else
            {
                list = CoreGlobals.getPerforce().GetExistingChangeList(mChangelistID);
                if (list == null)
                {
                    return(false);
                }
            }

            list.AddOrEdit(filename, true);

            outputMessage(Path.GetFileName(filename) + " has been checked out from perforce.");
            return(true);
        }
Exemple #13
0
        public bool EditFile(string fileName)
        {
            bool result  = CoreGlobals.getPerforce().getConnection().P4Sync(fileName);
            bool result2 = CoreGlobals.getPerforce().getConnection().P4Checkout(ID, fileName);

            mbKnownDirty = true;
            return(result);
        }
Exemple #14
0
            public P4Resource(PerforceChangeList list, string localName, string perforceName, string perforceAction)
            {
                mList           = list;
                mLocalName      = localName;
                mPerforceName   = perforceName;
                mPerforceAction = (ePerforceAction)Enum.Parse(typeof(ePerforceAction), perforceAction, true);

                mStatus = CoreGlobals.getPerforce().getConnection().P4GetFileStatus(mPerforceName);
            }
Exemple #15
0
        public bool HasFilesOpen(int changelistID)
        {
            string results = CoreGlobals.getPerforce().getConnection().P4Cmd("opened -c " + changelistID.ToString(), "", "");

            if (CoreGlobals.getPerforce().getConnection().mLastError.Contains("not opened"))
            {
                return(false);
            }
            return(true);
        }
Exemple #16
0
 public void Refresh()
 {
     if (mStatus.ContainsKey("depotFile"))
     {
         mStatus = CoreGlobals.getPerforce().getConnection().P4GetFileStatus(mStatus["depotFile"]);
     }
     else
     {
         mStatus = CoreGlobals.getPerforce().getConnection().P4GetFileStatus(mFileName);
     }
     ComputeState();
 }
Exemple #17
0
        public bool RemoveListAndRevert()
        {
            if (mbListAlive == false)
            {
                return(false);
            }
            bool result = true;

            result &= Revert();
            result &= CoreGlobals.getPerforce().getConnection().P4DeleteList(ID);

            mbListAlive = false;

            return(result);
        }
Exemple #18
0
        private void CheckInButton_Click(object sender, EventArgs e)
        {
            using (PerfSection p10 = new PerfSection("Perforce - Check in scenario component: " + mTopic.Name))
            {
                Cursor.Current = Cursors.WaitCursor;

                PerforceChangeList newlist = CoreGlobals.getPerforce().GetNewChangeList("Scenario Topic: " + GetTopicAlias(mTopic.Name) + "   Scenario: " + Path.GetFileNameWithoutExtension(CoreGlobals.ScenarioFile));
                foreach (string file in mTopic.Files)
                {
                    if (newlist.ReOpenFile(file) == false)
                    {
                        CoreGlobals.ShowMessage("Error re-opening: " + file);
                        return;
                    }
                }

                mTopic.mbPauseFileCheck = true;

                bool updateMemoryVersion = false;
                if (newlist.Submitchanges() == false)
                {
                    CoreGlobals.ShowMessage("Error checking in files");
                }
                using (PerfSection p1 = new PerfSection("Clean list"))
                {
                    //CoreGlobals.getPerforce().CleanEmptyChangeLists("Scenario Topic: ");
                    if (CoreGlobals.getPerforce().HasFilesOpen(newlist.ID) == false)
                    {
                        CoreGlobals.getPerforce().getConnection().P4DeleteList(newlist.ID);
                        updateMemoryVersion = true;
                    }
                }

                ///////Double check that this is good

                mTopic.UpdateState(updateMemoryVersion);
                UpdateUI();

                if (!mbPaused && StateChanged != null)
                {
                    StateChanged.Invoke(this, null);
                }

                Cursor.Current = Cursors.Default;

                mTopic.mbPauseFileCheck = false;
            }
        }
Exemple #19
0
        private void P4RevertFileInChangeList(string filename)
        {
            PerforceChangeList list = null;

            if (mChangelistID == -1)
            {
                return;//there should be an existing changelist
            }
            {
                list = CoreGlobals.getPerforce().GetExistingChangeList(mChangelistID);
            }

            list.RevertFile(filename);

            outputMessage(Path.GetFileName(filename) + " has been reverted in perforce.");
        }
Exemple #20
0
        static private void P4AddFileToChangeList(string filename)
        {
            PerforceChangeList list = null;

            if (mChangelistID == -1)
            {
                list          = CoreGlobals.getPerforce().GetNewChangeList(mChangelistDesc);
                mChangelistID = list.ID;
            }
            else
            {
                list = CoreGlobals.getPerforce().GetExistingChangeList(mChangelistID);
            }


            list.AddOrEdit(filename, true);
        }
Exemple #21
0
        private bool P4CanEditFile(string filename, ref bool inPerforce)
        {
            SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(filename);

            inPerforce |= status.InPerforce;
            if (status.InPerforce == false)
            {
                return(true);
            }
            if (status.CheckedOutOtherUser == true)
            {
                outputMessage(Path.GetFileName(filename) + " is checked out by " + status.ActionOwner + ". Cannot convert");
                mStatusResult = 1;
                return(false);
            }

            return(true);
        }
Exemple #22
0
        public void CleanEmptyChangeLists(string prefix)
        {
            Dictionary <int, string> lists = CoreGlobals.getPerforce().GetCurrentUserChangelists();

            Dictionary <int, string> .Enumerator it = lists.GetEnumerator();

            while (it.MoveNext())
            {
                if (it.Current.Value.StartsWith(prefix))
                {
                    if (CoreGlobals.getPerforce().HasFilesOpen(it.Current.Key) == false)
                    {
                        //CoreGlobals.ShowMessage("Deleting empty changelist:" + it.Current.Value);
                        CoreGlobals.getPerforce().getConnection().P4DeleteList(it.Current.Key);
                    }
                }
            }
        }
Exemple #23
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (mFiles.Count == 0)
            {
                return;
            }
            if (mChangeList == null)
            {
                mChangeList = CoreGlobals.getPerforce().GetNewChangeList(GetDescription());
            }

            foreach (string file in mFiles)
            {
                mChangeList.AddOrEdit(file, true);
            }

            UpdateUIStatus();
        }
Exemple #24
0
        private void CheckoutButton_Click(object sender, EventArgs e)
        {
            if (mFiles.Count == 0)
            {
                return;
            }
            if (mChangeList == null)
            {
                mChangeList = CoreGlobals.getPerforce().GetNewChangeList("Automated action: " + Path.GetFileNameWithoutExtension(mFiles[0]));
            }

            foreach (string file in mFiles)
            {
                mChangeList.AddOrEdit(file, true);
            }

            UpdateUIStatus();
        }
Exemple #25
0
        //Change 35576 on 2007/07/10 by Pthomas@SYS487 *pending* 'Auto import gr2: D:\x\work\art\'
        //List<Pair<string,int>>
        public Dictionary <int, string> GetCurrentUserChangelists()
        {
            Dictionary <int, string> lists = new Dictionary <int, string>();
            string userName;

            if (CoreGlobals.getPerforce().getConnection().mSettings.TryGetValue("User name", out userName))
            {
                string results = CoreGlobals.getPerforce().getConnection().P4Cmd("changes -l -s pending -u " + userName, "", "");

                StringReader res = new StringReader(results);

                string line = res.ReadLine();
                while (line != null && line != "")
                {
                    string[] tokens = line.Split(' ');
                    int      id     = -1;
                    int.TryParse(tokens[1], out id);
                    res.ReadLine(); //blank
                    string name = res.ReadLine().Trim();
                    //string name = line.Substring(1 + line.IndexOf('\''), -2 + line.Length - line.IndexOf('\''));
                    lists[id] = name;

                    //res.ReadLine();  //blank
                    //line = res.ReadLine();
                    line = res.ReadLine();
                    while (line != null)// && line != "" )
                    {
                        if (line.StartsWith("Change"))
                        {
                            break; //next entry
                        }
                        else
                        {
                            //could appened to description.. but that doesn't matter to us
                        }
                        line = res.ReadLine();
                    }
                }
            }

            return(lists);
        }
Exemple #26
0
        /// <summary>
        /// check out the stringtable
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void mBtnCheckout_Click(object sender, EventArgs e)
        {
            // sync these without checking the error
            string strTablePath    = Path.Combine(CoreGlobals.getWorkPaths().mGameDataDirectory, mStringTableFilename);
            string strTableXsdPath = Path.Combine(CoreGlobals.getWorkPaths().mGameDataDirectory, "stringtable.xsd");

            // If this file is checked out, then we cannot edit it in the editor. It must be fixed up manually first.
            SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(strTablePath);

            if (status.CheckedOutThisUser == true)
            {
                MessageBox.Show(this, "The stringtable is already checked out and must be resolved in perforce before editing in the editor.", "Error", MessageBoxButtons.OK);
                return;
            }

            // sync without checking for an error.
            mP4.Sync(strTablePath);
            mP4.Sync(strTableXsdPath);

            ReloadStringtable(true);
        }
Exemple #27
0
        static private bool P4IsCheckedOut(string fileName, bool showAlert)
        {
            SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(fileName);

            if (status.CheckedOutOtherUser == true)
            {
                if (showAlert)
                {
                    if (MessageBox.Show("This scenario is checked out by " + status.ActionOwner + " cannot check out", "", MessageBoxButtons.OKCancel) == DialogResult.OK)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
                return(true);
            }
            return(false);
        }
Exemple #28
0
        private void UpdateUIStatus()
        {
            int numInPerforce        = 0;
            int numCheckedoutByOther = 0;
            int numCheckedOutByUser  = 0;
            int numCheckedOutByBoth  = 0;

            mStatus.Clear();


            if (mFiles.Count == 0)
            {
                return;
            }


            foreach (string file in mFiles)
            {
                SimpleFileStatus s = CoreGlobals.getPerforce().GetFileStatusSimple(file);
                mStatus.Add(s);

                if (s.InPerforce)
                {
                    numInPerforce++;
                }
                if (s.State == eFileState.CheckedOutByUserAndOther)
                {
                    numCheckedOutByBoth++;
                }
                else if (s.State == eFileState.CheckedOutByOther)
                {
                    numCheckedoutByOther++;
                }
                else if (s.State == eFileState.CheckedOutByUser)
                {
                    numCheckedOutByUser++;
                }
            }

            FileListGridControl.DataSource = mStatus;


            EnumViewer <eFileState> item = new EnumViewer <eFileState>();

            item.mImageList = imageList1;
            CellViewerManager manager = new CellViewerManager(item, "Value");

            FileListGridControl.Columns["State"].CellViewerManager = manager;


            if (numInPerforce < mFiles.Count && numInPerforce > 0)
            {
                mMode = ePerforcePageMode.SomeFilesInPerforce;
                AddOptions();
            }
            else if (numInPerforce == 0)
            {
                mMode = ePerforcePageMode.NoFilesInPerforce;
                AddOptions();
            }
            else if (numCheckedoutByOther > 0)
            {
                mMode = ePerforcePageMode.SomeCheckedOutByOther;
                CheckedOutByOtherOptions();
            }
            else if (numCheckedoutByOther == mFiles.Count)
            {
                mMode = ePerforcePageMode.AllCheckedOutByOther;
                CheckedOutByOtherOptions();
            }
            else if (numCheckedOutByUser == mFiles.Count)
            {
                mMode = ePerforcePageMode.AllCheckedOutByUser;

                CheckedOutByUserOptions();
            }
            else if ((numInPerforce == mFiles.Count) && (numCheckedOutByUser > 0) && (numCheckedoutByOther == 0))
            {
                mMode = ePerforcePageMode.SomeCheckedOutByUser;
                AllCheckedInOptions();
            }
            else if ((numInPerforce == mFiles.Count) && (numCheckedoutByOther == 0))
            {
                mMode = ePerforcePageMode.AllCheckedIn;
                AllCheckedInOptions();
            }
            else
            {
                mMode = ePerforcePageMode.OtherState;
                //Not set up to handle this situation
                ResetUI();
            }
        }
Exemple #29
0
        /// <summary>
        /// Save the changes back to the XML and check them in.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="ev"></param>
        private void mBtnSave_Click(object sender, EventArgs ev)
        {
            // check to see if we have any changes to save out
            DataSet changes = mDoc.DataSet.GetChanges();

            if (changes == null)
            {
                MakeEditable(false);
                mEditMode = false;
                CheckEnableControls();

                return;
            }

            // build our paths
            string strTablePath    = Path.Combine(CoreGlobals.getWorkPaths().mGameDataDirectory, mStringTableFilename);
            string strTableXsdPath = Path.Combine(CoreGlobals.getWorkPaths().mGameDataDirectory, "stringtable.xsd");
            string strTableXmbPath = strTablePath + ".xmb";

            try
            {
                string backup = strTablePath + ".backup";
                makeWriteable(backup);
                if (!SaveStringTableToFile(backup, mDoc))
                {
                    MessageBox.Show(this, "Error creating a backup copy of the stringtable.", "Error", MessageBoxButtons.OK);
                    throw new Exception("error");
                }

                // make the current stringtable file RO
                if (!makeReadOnly(strTablePath))
                {
                    return;
                }

                // get the latest file
                mP4.Sync(strTablePath);
                mP4.Sync(strTableXsdPath);

                // check out the existing file
                mP4.Checkout(strTablePath);
                SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(strTablePath);
                if (status.CheckedOutThisUser != true)
                {
                    MessageBox.Show(this, "Could not check out the string table: \n\n" + mP4.LastError, "Error", MessageBoxButtons.OK);
                    throw new Exception("error");
                }

                // lock the string table
                if (!mP4.Lock(strTablePath))
                {
                    mP4.Revert(strTablePath);
                    string errorMessage = "Could not lock the stringtable: \n\n" + mP4.LastError;
                    throw new Exception(errorMessage);
                }

                // load the file into a data set
                XmlDataDocument origStringTable = new XmlDataDocument();
                origStringTable.DataSet.ReadXmlSchema(strTableXsdPath);
                origStringTable.Load(strTablePath);

                System.Data.DataTable table = origStringTable.DataSet.Tables[2];

                DataColumn[] PrimaryKeyColumns = new DataColumn[1];
                PrimaryKeyColumns[0] = table.Columns["_locID"];
                table.PrimaryKey     = PrimaryKeyColumns;

                // merge the changes into the file
                origStringTable.DataSet.Merge(changes, false, MissingSchemaAction.Error);

                // Save out the stringtable changes
                if (!SaveStringTableToFileWithBackup(strTablePath, origStringTable))
                {
                    throw new Exception("error");
                }

                // check the file back into perforce
                if (!mP4.Checkin(strTablePath, "String changes from the editor"))
                {
                    MessageBox.Show(this, "An error occurred trying to checkin the stringtable: \n\n" + mP4.LastError, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new Exception("error");
                }

                // XMB the file
                mP4.Sync(strTableXmbPath);
                EditorCore.XMBProcessor.CreateXMB(strTablePath, true);

                if (!mP4.Checkin(strTableXmbPath, "String changes from the editor"))
                {
                    MessageBox.Show(this, "An error occurred trying to checkin the stringtable XMB file: stringtable.xml.xmb : \n\n" + mP4.LastError + "\n\n Please make sure this file get's checked in.", "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    throw new Exception("error");
                }

                // force a reload of the stringtable file for other areas in the editor that use it.
                EditorCore.CoreGlobals.getGameResources().mStringTable.Load();

                ReloadStringtable(false);

                MessageBox.Show(this, "The stringtable was saved and checked in.", "", MessageBoxButtons.OK);
            }
            catch (Exception ex)
            {
                // do some clean up here
                SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(strTablePath);
                if (status.CheckedOutThisUser != true)
                {
                    mP4.Revert(strTablePath);
                }

                // rethrow the exception
                throw ex;
            }
        }
Exemple #30
0
        private void ImportButton_Click(object sender, EventArgs e)
        {
            SimpleFileStatus status = CoreGlobals.getPerforce().getConnection().P4GetFileStatusSimple(CoreGlobals.getWorkPaths().GetProtoObjectFile());

            if (status.CheckedOutThisUser == true)
            {
                MessageBox.Show("Please check in objects.xml and try again");
                return;
            }

            if (this.UsingPerforce)
            {
                mChangeList = CoreGlobals.getPerforce().GetNewChangeList("Batch Sound Objects Import");

                if (mChangeList == null)
                {
                    MessageBox.Show("Can't get new change list!");
                    return;
                }
            }

            //Sync
            if (this.UsingPerforce)
            {
                if (mChangeList != null)
                {
                    if (mChangeList.SyncFile(CoreGlobals.getWorkPaths().GetProtoObjectFile()) == false)
                    {
                        MessageBox.Show("Perforce error: " + mChangeList.GetLastError());
                        return;
                    }
                    loadProtoXML();
                }
            }

            //Start Edit
            if (this.UsingPerforce)
            {
                if (mChangeList.EditFile(CoreGlobals.getWorkPaths().GetProtoObjectFile()) == false)
                {
                    MessageBox.Show("Perforce error: " + mChangeList.GetLastError());
                    return;
                }

                loadProtoXML();
            }

            bool bSoundBehindFOW = SoundBehindFOWCheckBox.Checked;

            //Add Objects
            XmlNode protoNode = mProtoObjectsDoc.GetElementsByTagName("Objects")[0];

            Dictionary <string, string> .Enumerator it = mSoundsToAdd.GetEnumerator();
            while (it.MoveNext())
            {
                mHightestID = mHightestID + 1;
                XmlNode toImport = CreateSoundObject(mHightestID, it.Current.Key, it.Current.Value, bSoundBehindFOW);
                if (toImport != null)
                {
                    protoNode.AppendChild(toImport);
                }
            }
            mSoundsToAdd.Clear();
            try
            {
                mProtoObjectsDoc.Save(CoreGlobals.getWorkPaths().GetProtoObjectFile());
                if (this.UsingPerforce)
                {
                    mChangeList.AddOrEdit(CoreGlobals.getWorkPaths().GetProtoObjectFile() + ".xmb");
                }
                DBIDHelperTool.Run();
                EditorCore.XMBProcessor.CreateXMB(CoreGlobals.getWorkPaths().GetProtoObjectFile(), false);
            }
            catch (UnauthorizedAccessException unEx)
            {
                MessageBox.Show("Error writing to objects.xml");
            }
            //Checkin
            if (DoCheckin && this.UsingPerforce)
            {
                Checkin();
            }
            //or revert?
            else if (Revert && this.UsingPerforce)
            {
                mChangeList.Revert();
            }

            //refresh:
            loadProtoXML();
            LoadSoundNames();
            LoadUI();
            SetButtonStatus();
        }