private void btnUpdateItems_Click(object sender, EventArgs e) { List <GenericQbItem> gis = new List <GenericQbItem>(); GenericQbEditItem ei; GenericQbItem gi; //check that all the items are valid before saving try { //Check if QbKey is in the debug file, if not then add it to the user defined list base.AddQbKeyToUserDebugFile(base.QbItem.ItemQbKey); foreach (Control un in this.Controls) { if ((ei = (un as GenericQbEditItem)) != null) { if (!ei.IsValid) { base.ShowError("Error", "QB cannot be updated while data is invalid."); return; } gi = ei.GenericQbItem; //if QbKey, check to see if it's in the debug file, if not then add it to the user defined list if (gi.Type == typeof(QbKey)) { AddQbKeyToUserDebugFile(gi.ToQbKey()); } gis.Add(gi); } } } catch (Exception ex) { base.ShowException("Failed to Get Item Values", ex); return; } try { QbFile.SetGenericItems(base.QbItem, gis); } catch (Exception ex) { base.ShowException("Edit Values Update Error", ex); return; } base.UpdateQbItem(); }
private void btnUpdate_Click(object sender, EventArgs e) { try { string qbKeyText; try { QbFile.SetGenericItems(base.QbItem, _gItems); } catch (Exception ex) { throw new ApplicationException(string.Format("Item conversion error: {0}", ex.Message)); } base.UpdateQbItem(); //Check if QbKey is in the debug file, if not then add it to the user defined list base.AddQbKeyToUserDebugFile(base.QbItem.ItemQbKey); if (base.QbItem.ItemQbKey != null) { if ((qbKeyText = base.QbItem.Root.PakFormat.AddNonDebugQbKey(base.QbItem.ItemQbKey, base.QbItem.Root.Filename, base.QbItem.Root)).Length != 0) { base.ShowError("QB Key Error", string.Format("QB Key {0} as the same crc as item {1} from the debug file.", base.QbItem.ItemQbKey.Text, qbKeyText)); } } foreach (GenericQbItem gi in _gItems) { //if QbKey, check to see if it's in the debug file, if not then add it to the user defined list if (gi.Type == typeof(QbKey)) { base.AddQbKeyToUserDebugFile(gi.ToQbKey()); } } } catch (Exception ex) { base.ShowException("Simple Array Update Error", ex); } }