public clsAttachment CreateAttachment()
        {
            var result = new clsAttachment();

            Attachments.Add(result);
            return(result);
        }
 public void ActionPerform()
 {
     ResultUnit      = null;
     ActionPerformed = false;
     if (Unit == null)
     {
         Debugger.Break();
         return;
     }
     ActionPerformed = true;
     ActionCondition();
     if (!ActionPerformed)
     {
         return;
     }
     ResultUnit = new Unit(Unit, Map);
     _ActionPerform();
     if (ResultUnit == null)
     {
         ResultUnit = Unit;
     }
     else
     {
         _ResultUnits.Add(ResultUnit);
         Map.UnitSwap(Unit, ResultUnit);
     }
 }
Beispiel #3
0
        private App.sResult Read_WZ_Structures(BinaryReader File, SimpleClassList<clsWZBJOUnit> WZUnits)
        {
            App.sResult ReturnResult = new App.sResult();
            ReturnResult.Success = false;
            ReturnResult.Problem = "";

            string strTemp = null;
            UInt32 Version = 0;
            UInt32 uintTemp = 0;
            int A = 0;
            int B = 0;
            clsWZBJOUnit WZBJOUnit = default(clsWZBJOUnit);

            try
            {
                strTemp = IOUtil.ReadOldTextOfLength(File, 4);
                if ( strTemp != "stru" )
                {
                    ReturnResult.Problem = "Unknown struct.bjo identifier.";
                    return ReturnResult;
                }

                Version = File.ReadUInt32();
                if ( Version != 8U )
                {
                    if (
                        Interaction.MsgBox("struct.bjo version is unknown. Continue?", (MsgBoxStyle)(MsgBoxStyle.OkCancel | MsgBoxStyle.Question),
                            null) != MsgBoxResult.Ok )
                    {
                        ReturnResult.Problem = "Aborted.";
                        return ReturnResult;
                    }
                }

                uintTemp = File.ReadUInt32();
                for ( A = 0; A <= (Convert.ToInt32(uintTemp)) - 1; A++ )
                {
                    WZBJOUnit = new clsWZBJOUnit();
                    WZBJOUnit.ObjectType = clsUnitType.enumType.PlayerStructure;
                    WZBJOUnit.Code = IOUtil.ReadOldTextOfLength(File, 40);
                    B = Strings.InStr(WZBJOUnit.Code, Convert.ToString('\0'), (CompareMethod)0);
                    if ( B > 0 )
                    {
                        WZBJOUnit.Code = Strings.Left(WZBJOUnit.Code, B - 1);
                    }
                    WZBJOUnit.ID = File.ReadUInt32();
                    WZBJOUnit.Pos.Horizontal.X = (int)(File.ReadUInt32());
                    WZBJOUnit.Pos.Horizontal.Y = (int)(File.ReadUInt32());
                    WZBJOUnit.Pos.Altitude = (int)(File.ReadUInt32());
                    WZBJOUnit.Rotation = File.ReadUInt32();
                    WZBJOUnit.Player = File.ReadUInt32();
                    File.ReadBytes(56);
                    WZUnits.Add(WZBJOUnit);
                }
            }
            catch ( Exception ex )
            {
                ReturnResult.Problem = ex.Message;
                return ReturnResult;
            }

            ReturnResult.Success = true;
            return ReturnResult;
        }