private void ExcuteDeleteCpoCommand() { if (MessageBox.Show("Are you Sure You want to Delete this Cpo?", "Delete Cpo", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning) == MessageBoxResult.Yes) { try { if (SelectedCpo != null) { SelectedCpo.Enabled = false; var stat = _cpoService.Disable(SelectedCpo); if (stat == string.Empty) { Cpos.Remove(SelectedCpo); GetLiveCpos(); } else { MessageBox.Show("Can't Delete, may be the data is already in use..." + Environment.NewLine + stat, "Can't Delete", MessageBoxButton.OK, MessageBoxImage.Error); } } } catch (Exception ex) { MessageBox.Show("Can't Delete, may be the data is already in use..." + Environment.NewLine + ex.Message + Environment.NewLine + ex.InnerException, "Can't Delete", MessageBoxButton.OK, MessageBoxImage.Error); } } }
private void GetInfo() { this.charBlock = this.nitro.GetBlock <CHAR>(0); if (this.nitro.Blocks.ContainsType("CPOS")) { this.cpos = this.nitro.GetBlock <Cpos>(0); } this.Format = this.charBlock.Format; // To get BPP int numPixels = this.charBlock.ImageData.Length * 8 / this.Format.Bpp(); int defaultWidth = this.TileSize.Width; int defaultHeight = numPixels / defaultWidth; if (this.charBlock.Width == 0xFFFF && this.charBlock.Height == 0xFFFF) { // Since these images can be tiled used with OAMs or MAPs files, the width must be a multiple of // tile size to do correctly the lineal transformation. this.Width = defaultWidth; this.Height = defaultHeight; this.InvalidSize = true; } else { this.Width = this.charBlock.Width * 8; // It indicates the number of tiles in X axis this.Height = this.charBlock.Height * 8; // It indicates the number of tiles in Y axis this.InvalidSize = false; } // It's "Digimon" game developper fault if (this.Width * this.Height != numPixels) { this.Width = defaultWidth; this.Height = defaultHeight; } // It's "Donkey Kong - Jungle Climber" game developper fault (and its damn dummy files) // I will left it to throw the error since there is no image and a bitmap with width or height // 0 can not be created. if (this.Width == 0 || this.Height == 0) { this.Width = this.Height = 0; } this.SetData(this.charBlock.ImageData, this.charBlock.PixelEncoding, this.charBlock.Format); }
private void GetInfo() { this.charBlock = this.nitro.GetBlock<CHAR>(0); if (this.nitro.Blocks.ContainsType("CPOS")) this.cpos = this.nitro.GetBlock<Cpos>(0); this.Format = this.charBlock.Format; // To get BPP int numPixels = this.charBlock.ImageData.Length * 8 / this.Format.Bpp(); int defaultWidth = this.TileSize.Width; int defaultHeight = numPixels / defaultWidth; if (this.charBlock.Width == 0xFFFF && this.charBlock.Height == 0xFFFF) { // Since these images can be tiled used with OAMs or MAPs files, the width must be a multiple of // tile size to do correctly the lineal transformation. this.Width = defaultWidth; this.Height = defaultHeight; this.InvalidSize = true; } else { this.Width = this.charBlock.Width * 8; // It indicates the number of tiles in X axis this.Height = this.charBlock.Height * 8; // It indicates the number of tiles in Y axis this.InvalidSize = false; } // It's "Digimon" game developper fault if (this.Width * this.Height != numPixels) { this.Width = defaultWidth; this.Height = defaultHeight; } // It's "Donkey Kong - Jungle Climber" game developper fault (and its damn dummy files) // I will left it to throw the error since there is no image and a bitmap with width or height // 0 can not be created. if (this.Width == 0 || this.Height == 0) this.Width = this.Height = 0; this.SetData(this.charBlock.ImageData, this.charBlock.PixelEncoding, this.charBlock.Format); }
public override string ToString() { StringBuilder __sb = new StringBuilder("CreatureState("); bool __first = true; if (Uid != null && __isset.uid) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Uid: "); __sb.Append(Uid); } if (Type != null && __isset.type) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Type: "); __sb.Append(Type); } if (__isset.camp) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Camp: "); __sb.Append(Camp); } if (__isset.movingStartTick) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("MovingStartTick: "); __sb.Append(MovingStartTick); } if (Spos != null && __isset.spos) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Spos: "); __sb.Append(Spos == null ? "<null>" : Spos.ToString()); } if (Cpos != null && __isset.cpos) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Cpos: "); __sb.Append(Cpos == null ? "<null>" : Cpos.ToString()); } if (Goal != null && __isset.goal) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Goal: "); __sb.Append(Goal == null ? "<null>" : Goal.ToString()); } if (__isset.speed) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Speed: "); __sb.Append(Speed); } if (__isset.death) { if (!__first) { __sb.Append(", "); } __first = false; __sb.Append("Death: "); __sb.Append(Death); } __sb.Append(")"); return(__sb.ToString()); }
public void Write(TProtocol oprot) { TStruct struc = new TStruct("CreatureState"); oprot.WriteStructBegin(struc); TField field = new TField(); if (Uid != null && __isset.uid) { field.Name = "uid"; field.Type = TType.String; field.ID = 1; oprot.WriteFieldBegin(field); oprot.WriteString(Uid); oprot.WriteFieldEnd(); } if (Type != null && __isset.type) { field.Name = "type"; field.Type = TType.String; field.ID = 2; oprot.WriteFieldBegin(field); oprot.WriteString(Type); oprot.WriteFieldEnd(); } if (__isset.camp) { field.Name = "camp"; field.Type = TType.I32; field.ID = 3; oprot.WriteFieldBegin(field); oprot.WriteI32(Camp); oprot.WriteFieldEnd(); } if (__isset.movingStartTick) { field.Name = "movingStartTick"; field.Type = TType.I64; field.ID = 4; oprot.WriteFieldBegin(field); oprot.WriteI64(MovingStartTick); oprot.WriteFieldEnd(); } if (Spos != null && __isset.spos) { field.Name = "spos"; field.Type = TType.Struct; field.ID = 5; oprot.WriteFieldBegin(field); Spos.Write(oprot); oprot.WriteFieldEnd(); } if (Cpos != null && __isset.cpos) { field.Name = "cpos"; field.Type = TType.Struct; field.ID = 6; oprot.WriteFieldBegin(field); Cpos.Write(oprot); oprot.WriteFieldEnd(); } if (Goal != null && __isset.goal) { field.Name = "goal"; field.Type = TType.Struct; field.ID = 7; oprot.WriteFieldBegin(field); Goal.Write(oprot); oprot.WriteFieldEnd(); } if (__isset.speed) { field.Name = "speed"; field.Type = TType.Double; field.ID = 8; oprot.WriteFieldBegin(field); oprot.WriteDouble(Speed); oprot.WriteFieldEnd(); } if (__isset.death) { field.Name = "death"; field.Type = TType.Bool; field.ID = 9; oprot.WriteFieldBegin(field); oprot.WriteBool(Death); oprot.WriteFieldEnd(); } oprot.WriteFieldStop(); oprot.WriteStructEnd(); }