From 21f57351351ae7ebf96f95848958f759a58277f8 Mon Sep 17 00:00:00 2001 From: RejectKid Date: Mon, 13 Jul 2026 18:32:32 -0400 Subject: [PATCH] Prepare the 1.0.1 maintenance release --- .github/ISSUE_TEMPLATE/release-candidate.yml | 6 +- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 31 +- CONTRIBUTING.md | 8 +- OpenDisNet.slnx | 1 - README.md | 5 +- THIRD-PARTY-NOTICES.md | 2 - docs/api-design.md | 14 +- docs/conformance-maintenance-v1.0.1.md | 20 + docs/conformance.md | 14 +- docs/release-candidate.md | 18 +- docs/releasing.md | 12 +- docs/standards.md | 10 +- src/OpenDisNet/OpenDisNet.csproj | 4 +- .../Pdus/Families/DistributedEmissionsPdus.cs | 4 +- src/OpenDisNet/Pdus/Families/Records.cs | 2 +- .../OpenDisNet.PackageSmoke.csproj | 2 +- .../Generated/AcknowledgePdu.cs | 414 ----- .../Generated/AcknowledgeReliablePdu.cs | 345 ---- .../Generated/AcousticEmitter.cs | 341 ---- .../Generated/ActionRequestPdu.cs | 588 ------ .../Generated/ActionRequestReliablePdu.cs | 615 ------- .../Generated/ActionResponsePdu.cs | 588 ------ .../Generated/ActionResponseReliablePdu.cs | 519 ------ .../Generated/AggregateIdentifier.cs | 312 ---- .../Generated/AggregateMarking.cs | 335 ---- .../Generated/AggregateType.cs | 463 ----- .../Generated/AngleDeception.cs | 661 ------- .../Generated/AngularVelocityVector.cs | 341 ---- .../Generated/AntennaLocation.cs | 315 ---- .../Generated/ArealObjectStatePdu.cs | 685 ------- .../Generated/ArticulatedParts.cs | 405 ----- .../Generated/Association.cs | 367 ---- .../Generated/AttachedParts.cs | 405 ----- .../Generated/Attribute.cs | 323 ---- .../Generated/AttributePdu.cs | 539 ------ .../Generated/BeamAntennaPattern.cs | 538 ------ .../Generated/BeamData.cs | 405 ----- .../Generated/BeamStatus.cs | 277 --- .../Generated/BlankingSector.cs | 505 ------ .../Generated/ChangeOptions.cs | 245 --- .../Generated/ClockTime.cs | 309 ---- .../Generated/CollisionElasticPdu.cs | 745 -------- .../Generated/CollisionPdu.cs | 519 ------ .../Generated/CommentPdu.cs | 455 ----- .../Generated/CommentReliablePdu.cs | 455 ----- .../Generated/CommunicationsNodeID.cs | 300 ---- .../Generated/CreateEntityPdu.cs | 350 ---- .../Generated/CreateEntityReliablePdu.cs | 377 ---- .../OpenDisNet.Reference/Generated/DataPdu.cs | 519 ------ .../Generated/DataQueryDatumSpecification.cs | 451 ----- .../Generated/DataQueryPdu.cs | 519 ------ .../Generated/DataQueryReliablePdu.cs | 615 ------- .../Generated/DataReliablePdu.cs | 583 ------ .../Generated/DatumSpecification.cs | 451 ----- .../Generated/DeadReckoningParameters.cs | 404 ----- .../Generated/DesignatorPdu.cs | 646 ------- .../Generated/DetonationPdu.cs | 625 ------- .../Generated/DirectedEnergyAreaAimpoint.cs | 547 ------ .../Generated/DirectedEnergyDamage.cs | 635 ------- .../Generated/DirectedEnergyFirePdu.cs | 809 --------- .../DirectedEnergyPrecisionAimpoint.cs | 674 ------- .../DirectedEnergyTargetEnergyDeposition.cs | 344 ---- .../DistributedEmissionsFamilyPdu.cs | 248 --- .../Generated/EEFundamentalParameterData.cs | 405 ----- .../Generated/EightByteChunk.cs | 303 ---- .../Generated/ElectronicEmissionsPdu.cs | 620 ------- .../Generated/EmitterSystem.cs | 341 ---- .../Generated/EngineFuel.cs | 405 ----- .../Generated/EngineFuelReload.cs | 469 ----- .../Generated/EntityAssociation.cs | 536 ------ .../Generated/EntityDamageStatusPdu.cs | 451 ----- .../Generated/EntityID.cs | 312 ---- .../Generated/EntityInformationFamilyPdu.cs | 248 --- .../Generated/EntityManagementFamilyPdu.cs | 248 --- .../Generated/EntityMarking.cs | 335 ---- .../Generated/EntityStatePdu.cs | 721 -------- .../Generated/EntityStateUpdatePdu.cs | 557 ------ .../Generated/EntityType.cs | 463 ----- .../Generated/EntityTypeVP.cs | 408 ----- .../Generated/Environment.cs | 373 ---- .../Generated/EnvironmentGeneral.cs | 437 ----- .../Generated/EnvironmentType.cs | 463 ----- .../Generated/EulerAngles.cs | 323 ---- .../Generated/EventIdentifier.cs | 306 ---- .../Generated/EventIdentifierLiveEntity.cs | 323 ---- .../Generated/EventReportPdu.cs | 519 ------ .../Generated/EventReportReliablePdu.cs | 519 ------ .../Generated/Expendable.cs | 384 ---- .../Generated/ExpendableDescriptor.cs | 312 ---- .../Generated/ExpendableReload.cs | 410 ----- .../Generated/ExplosionDescriptor.cs | 376 ---- .../Generated/FalseTargetsAttribute.cs | 609 ------- .../Generated/FastEntityStatePdu.cs | 1590 ----------------- .../OpenDisNet.Reference/Generated/FirePdu.cs | 488 ----- .../Generated/FixedDatum.cs | 309 ---- .../Generated/FourByteChunk.cs | 303 ---- .../Generated/FundamentalOperationalData.cs | 565 ------ .../Generated/GridAxis.cs | 469 ----- .../Generated/GroupIdentifier.cs | 312 ---- .../Generated/IFFFundamentalParameterData.cs | 495 ----- .../Generated/IOCommunicationsNode.cs | 404 ----- .../Generated/IOEffect.cs | 482 ----- .../Generated/IffDataSpecification.cs | 280 --- .../IntercomCommunicationsParameters.cs | 341 ---- .../Generated/IntercomIdentifier.cs | 349 ---- .../Generated/IntercomSignalPdu.cs | 525 ------ .../Generated/IsPartOfPdu.cs | 458 ----- .../Generated/JammingTechnique.cs | 349 ---- .../Generated/LaunchedMunitionRecord.cs | 437 ----- .../Generated/LayerHeader.cs | 335 ---- .../Generated/LinearObjectStatePdu.cs | 589 ------ .../Generated/LinearSegmentParameter.cs | 571 ------ .../Generated/LiveEntityIdentifier.cs | 312 ---- .../Generated/LiveEntityPdu.cs | 301 ---- .../Generated/LiveSimulationAddress.cs | 309 ---- .../Generated/LogisticsFamilyPdu.cs | 248 --- .../Generated/MineEntityIdentifier.cs | 312 ---- .../Generated/MinefieldFamilyPdu.cs | 248 --- .../Generated/MinefieldIdentifier.cs | 312 ---- .../Generated/MinefieldResponseNackPdu.cs | 453 ----- .../Generated/MinefieldStatePdu.cs | 723 -------- .../Generated/ModulationParameters.cs | 245 --- .../Generated/ModulationType.cs | 373 ---- .../Generated/Munition.cs | 408 ----- .../Generated/MunitionDescriptor.cs | 408 ----- .../Generated/MunitionReload.cs | 440 ----- .../Generated/NamedLocationIdentification.cs | 309 ---- .../Generated/ObjectIdentifier.cs | 312 ---- .../Generated/ObjectType.cs | 373 ---- .../Generated/OneByteChunk.cs | 303 ---- .../Generated/OwnershipStatus.cs | 344 ---- tests/OpenDisNet.Reference/Generated/Pdu.cs | 301 ---- .../Generated/PduContainer.cs | 348 ---- .../Generated/PduHeader.cs | 501 ------ .../Generated/PduStatus.cs | 277 --- .../Generated/PduSuperclass.cs | 437 ----- .../Generated/PointObjectStatePdu.cs | 652 ------- .../Generated/PropulsionSystemData.cs | 309 ---- .../Generated/RadioCommunicationsFamilyPdu.cs | 316 ---- .../Generated/RadioIdentifier.cs | 373 ---- .../Generated/RadioType.cs | 457 ----- .../Generated/ReceiverPdu.cs | 412 ----- .../Generated/RecordQueryReliablePdu.cs | 544 ------ .../Generated/RecordQuerySpecification.cs | 345 ---- .../Generated/RecordSpecification.cs | 348 ---- .../Generated/RecordSpecificationElement.cs | 437 ----- .../Generated/Relationship.cs | 309 ---- .../Generated/RemoveEntityPdu.cs | 350 ---- .../Generated/RemoveEntityReliablePdu.cs | 377 ---- .../Generated/RepairCompletePdu.cs | 382 ---- .../Generated/RepairResponsePdu.cs | 414 ----- .../Generated/ResupplyOfferPdu.cs | 485 ----- .../Generated/ResupplyReceivedPdu.cs | 485 ----- .../Generated/SecondaryOperationalData.cs | 341 ---- .../OpenDisNet.Reference/Generated/SeesPdu.cs | 586 ------ .../OpenDisNet.Reference/Generated/Sensor.cs | 437 ----- .../Generated/SeparationVP.cs | 472 ----- .../Generated/ServiceRequestPdu.cs | 479 ----- .../Generated/SetDataPdu.cs | 519 ------ .../Generated/SetDataReliablePdu.cs | 583 ------ .../Generated/SimulationAddress.cs | 309 ---- .../Generated/SimulationIdentifier.cs | 312 ---- .../SimulationManagementFamilyPdu.cs | 318 ---- .../SimulationManagementPduHeader.cs | 349 ---- ...ationManagementWithReliabilityFamilyPdu.cs | 318 ---- .../StandardVariableSpecification.cs | 348 ---- .../Generated/StartResumePdu.cs | 419 ----- .../Generated/StartResumeReliablePdu.cs | 446 ----- .../Generated/StopFreezePdu.cs | 481 ----- .../Generated/StopFreezeReliablePdu.cs | 444 ----- .../Generated/StorageFuel.cs | 405 ----- .../Generated/StorageFuelReload.cs | 501 ------ .../Generated/SupplyQuantity.cs | 312 ---- .../SyntheticEnvironmentFamilyPdu.cs | 248 --- .../Generated/SystemIdentifier.cs | 376 ---- .../Generated/TotalRecordSets.cs | 309 ---- .../Generated/TrackJamData.cs | 344 ---- .../Generated/TwoByteChunk.cs | 303 ---- .../Generated/UAFundamentalParameter.cs | 437 ----- tests/OpenDisNet.Reference/Generated/UaPdu.cs | 756 -------- .../Generated/UnattachedIdentifier.cs | 312 ---- .../Generated/UnsignedDISInteger.cs | 277 --- .../Generated/VariableDatum.cs | 373 ---- .../Generated/VariableParameter.cs | 405 ----- .../VariableTransmitterParameters.cs | 309 ---- .../Generated/Vector2Float.cs | 309 ---- .../Generated/Vector3Double.cs | 341 ---- .../Generated/Vector3Float.cs | 341 ---- .../Generated/VectoringNozzleSystem.cs | 309 ---- .../Generated/WarfareFamilyPdu.cs | 318 ---- tests/OpenDisNet.Reference/GlobalUsings.cs | 2 - tests/OpenDisNet.Reference/LICENSE | 25 - .../OpenDisNet.Reference.csproj | 16 - .../Utilities/ChunkConverters.cs | 330 ---- .../Utilities/Conversion.cs | 103 -- .../Utilities/DataInputStream.cs | 302 ---- .../Utilities/DataOutputStream.cs | 288 --- .../Utilities/DataStream.cs | 174 -- .../OpenDisNet.Reference/Utilities/Endian.cs | 7 - tests/OpenDisNet.Reference/packages.lock.json | 6 - .../Conformance/Audit/v1.0.1.json | 40 + .../Conformance/ConformanceAuditTests.cs | 6 +- .../Conformance/OpenDisReferenceTests.cs | 31 - .../OpenDisNet.Tests/OpenDisNet.Tests.csproj | 1 - .../Schemas/DIS7/DIS_7_2012.xml | 2 +- .../DIS7/DistributedEmissionsFamilyPdus.xml | 6 +- 207 files changed, 149 insertions(+), 75321 deletions(-) create mode 100644 docs/conformance-maintenance-v1.0.1.md delete mode 100644 tests/OpenDisNet.Reference/Generated/AcknowledgePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AcknowledgeReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AcousticEmitter.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ActionRequestPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ActionRequestReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ActionResponsePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ActionResponseReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AggregateIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AggregateMarking.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AggregateType.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AngleDeception.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AngularVelocityVector.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AntennaLocation.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ArealObjectStatePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ArticulatedParts.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Association.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AttachedParts.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Attribute.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/AttributePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/BeamAntennaPattern.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/BeamData.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/BeamStatus.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/BlankingSector.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ChangeOptions.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ClockTime.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/CollisionElasticPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/CollisionPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/CommentPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/CommentReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/CommunicationsNodeID.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/CreateEntityPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/CreateEntityReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DataPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DataQueryDatumSpecification.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DataQueryPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DataQueryReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DataReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DatumSpecification.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DeadReckoningParameters.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DesignatorPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DetonationPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DirectedEnergyAreaAimpoint.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DirectedEnergyDamage.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DirectedEnergyFirePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DirectedEnergyPrecisionAimpoint.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DirectedEnergyTargetEnergyDeposition.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/DistributedEmissionsFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EEFundamentalParameterData.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EightByteChunk.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ElectronicEmissionsPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EmitterSystem.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EngineFuel.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EngineFuelReload.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityAssociation.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityDamageStatusPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityID.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityInformationFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityManagementFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityMarking.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityStatePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityStateUpdatePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityType.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EntityTypeVP.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Environment.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EnvironmentGeneral.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EnvironmentType.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EulerAngles.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EventIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EventIdentifierLiveEntity.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EventReportPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/EventReportReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Expendable.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ExpendableDescriptor.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ExpendableReload.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ExplosionDescriptor.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/FalseTargetsAttribute.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/FastEntityStatePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/FirePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/FixedDatum.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/FourByteChunk.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/FundamentalOperationalData.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/GridAxis.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/GroupIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/IFFFundamentalParameterData.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/IOCommunicationsNode.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/IOEffect.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/IffDataSpecification.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/IntercomCommunicationsParameters.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/IntercomIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/IntercomSignalPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/IsPartOfPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/JammingTechnique.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/LaunchedMunitionRecord.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/LayerHeader.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/LinearObjectStatePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/LinearSegmentParameter.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/LiveEntityIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/LiveEntityPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/LiveSimulationAddress.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/LogisticsFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/MineEntityIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/MinefieldFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/MinefieldIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/MinefieldResponseNackPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/MinefieldStatePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ModulationParameters.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ModulationType.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Munition.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/MunitionDescriptor.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/MunitionReload.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/NamedLocationIdentification.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ObjectIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ObjectType.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/OneByteChunk.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/OwnershipStatus.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Pdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/PduContainer.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/PduHeader.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/PduStatus.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/PduSuperclass.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/PointObjectStatePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/PropulsionSystemData.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RadioCommunicationsFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RadioIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RadioType.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ReceiverPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RecordQueryReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RecordQuerySpecification.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RecordSpecification.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RecordSpecificationElement.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Relationship.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RemoveEntityPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RemoveEntityReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RepairCompletePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/RepairResponsePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ResupplyOfferPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ResupplyReceivedPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SecondaryOperationalData.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SeesPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Sensor.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SeparationVP.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/ServiceRequestPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SetDataPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SetDataReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SimulationAddress.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SimulationIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SimulationManagementFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SimulationManagementPduHeader.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SimulationManagementWithReliabilityFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/StandardVariableSpecification.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/StartResumePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/StartResumeReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/StopFreezePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/StopFreezeReliablePdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/StorageFuel.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/StorageFuelReload.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SupplyQuantity.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SyntheticEnvironmentFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/SystemIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/TotalRecordSets.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/TrackJamData.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/TwoByteChunk.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/UAFundamentalParameter.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/UaPdu.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/UnattachedIdentifier.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/UnsignedDISInteger.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/VariableDatum.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/VariableParameter.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/VariableTransmitterParameters.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Vector2Float.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Vector3Double.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/Vector3Float.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/VectoringNozzleSystem.cs delete mode 100644 tests/OpenDisNet.Reference/Generated/WarfareFamilyPdu.cs delete mode 100644 tests/OpenDisNet.Reference/GlobalUsings.cs delete mode 100644 tests/OpenDisNet.Reference/LICENSE delete mode 100644 tests/OpenDisNet.Reference/OpenDisNet.Reference.csproj delete mode 100644 tests/OpenDisNet.Reference/Utilities/ChunkConverters.cs delete mode 100644 tests/OpenDisNet.Reference/Utilities/Conversion.cs delete mode 100644 tests/OpenDisNet.Reference/Utilities/DataInputStream.cs delete mode 100644 tests/OpenDisNet.Reference/Utilities/DataOutputStream.cs delete mode 100644 tests/OpenDisNet.Reference/Utilities/DataStream.cs delete mode 100644 tests/OpenDisNet.Reference/Utilities/Endian.cs delete mode 100644 tests/OpenDisNet.Reference/packages.lock.json create mode 100644 tests/OpenDisNet.Tests/Conformance/Audit/v1.0.1.json delete mode 100644 tests/OpenDisNet.Tests/Conformance/OpenDisReferenceTests.cs diff --git a/.github/ISSUE_TEMPLATE/release-candidate.yml b/.github/ISSUE_TEMPLATE/release-candidate.yml index e341535..1969879 100644 --- a/.github/ISSUE_TEMPLATE/release-candidate.yml +++ b/.github/ISSUE_TEMPLATE/release-candidate.yml @@ -1,5 +1,5 @@ name: Release candidate feedback -description: Report OpenDisNet 0.9 RC interoperability, API, performance, or documentation results. +description: Report OpenDisNet prerelease interoperability, API, performance, or documentation results. title: "[RC feedback]: " body: - type: markdown @@ -10,8 +10,8 @@ body: id: version attributes: label: Package version - description: Enter the exact prerelease version, for example 0.9.0-rc.1. - placeholder: 0.9.0-rc.1 + description: Enter the exact prerelease version, for example 1.1.0-rc.1. + placeholder: 1.1.0-rc.1 validations: required: true - type: input diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df94f60..682406e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,4 +47,4 @@ jobs: with: dotnet-version: 10.x - run: dotnet restore --locked-mode - - run: dotnet format --verify-no-changes --no-restore --exclude tests/OpenDisNet.Reference + - run: dotnet format --verify-no-changes --no-restore diff --git a/CHANGELOG.md b/CHANGELOG.md index 13aa585..c593e4e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,22 @@ # Changelog All notable changes are documented here. This project follows Semantic -Versioning after 1.0 and uses prerelease versions while conformance is incomplete. +Versioning starting with 1.0 and uses prerelease versions when conformance is +incomplete. ## Unreleased +## 1.0.1 - 2026-07-13 + +- Updated local package defaults and the binary-compatibility baseline for the + stable 1.x line. +- Replaced completed prerelease language with durable stable-release guidance. +- Corrected public XML documentation inherited from the generator schemas. +- Removed the unused generated C# reference project while retaining the compact, + independently produced conformance-vector corpus. + +## 1.0.0 - 2026-07-13 + - Added the 1.0 conformance audit manifest and report, pinning DIS schemas, SISO data, independent vector corpora, family mappings, and the public API by SHA-256. @@ -14,6 +26,9 @@ Versioning after 1.0 and uses prerelease versions while conformance is incomplet enforced low-or-higher transitive NuGet vulnerability auditing. - Added pull-request dependency review, main-branch tag verification, package checksums, and GitHub build-provenance attestations. + +## 0.9.0 - 2026-07-13 + - Froze the complete public C# surface with compiler-enforced API baselines and NuGet package compatibility validation against OpenDisNet 0.8.0. - Added an external-style smoke consumer that installs the packed artifact and @@ -22,6 +37,9 @@ Versioning after 1.0 and uses prerelease versions while conformance is incomplet structured GitHub feedback form. - Corrected the `RadioId` construction example discovered by the package smoke consumer. + +## 0.8.0 - 2026-07-13 + - Added deterministic populated conformance cases for all 72 DIS v7 PDU types, independent byte vectors, and truncation checks at every byte boundary across all 12 protocol families planned for versions 0.3 through 0.8. @@ -30,6 +48,9 @@ Versioning after 1.0 and uses prerelease versions while conformance is incomplet lengths and counts. - Added conditional IFF information layers and polymorphic Information Operations effect/communications records to the native C# codec. + +## 0.2.0 - 2026-07-13 + - Added strongly typed SISO-REF-010-2025 v36 enumerations for every DIS v7 schema reference, with .NET-style public names. - Added structured bitfield value types with validated accessors, immutable @@ -40,6 +61,14 @@ Versioning after 1.0 and uses prerelease versions while conformance is incomplet lossless unknown-value compatibility tests. - Made descriptive PDU names such as `AcknowledgeReliablePdu` canonical and removed 20 empty acronym-based alias shells from the public model surface. + +## 0.1.1 - 2026-07-13 + +- Replaced hand-authored Signal PDU payload bytes in documentation with + realistic application-produced audio examples. + +## 0.1.0 - 2026-07-13 + - Added solution foundation, DIS v7 framing, binary primitives, and defensive unknown-PDU parsing. - Added typed Entity State, Fire, and Detonation PDU parsing and serialization. diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 59583fd..8974c05 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -5,7 +5,7 @@ vectors, round-trip tests, and malformed-input tests. Run `dotnet test --configuration Release` before opening a pull request. Do not submit IEEE specification text or non-public operational packet captures. -The public API is frozen during the 0.9 release-candidate cycle. Additive API -changes must update `src/OpenDisNet/PublicAPI.Unshipped.txt`, include tests, and -describe the consumer benefit in the changelog. Removals or signature changes -require explicit breaking-change review and a new release candidate. +The 1.x public API follows semantic versioning. Additive API changes must update +`src/OpenDisNet/PublicAPI.Unshipped.txt`, include tests, and describe the +consumer benefit in the changelog. Removals or incompatible signature changes +require explicit breaking-change review and belong in the next major release. diff --git a/OpenDisNet.slnx b/OpenDisNet.slnx index 751cfd7..ff35901 100644 --- a/OpenDisNet.slnx +++ b/OpenDisNet.slnx @@ -6,7 +6,6 @@ - diff --git a/README.md b/README.md index 2bb498a..107524a 100644 --- a/README.md +++ b/README.md @@ -7,10 +7,11 @@ OpenDisNet is a high-performance, type-safe .NET codec for Distributed Interactive Simulation (DIS) Protocol Version 7, defined by IEEE 1278.1-2012. -> **Development status:** 1.0 release audit. All 72 DIS v7 PDU identifiers have +> **Development status:** Stable 1.x release. All 72 DIS v7 PDU identifiers have > typed native C# codecs, every family has populated, independent, malformed, > and hostile-input evidence, and the public API is compatibility-frozen. See -> the [`1.0 audit`](docs/conformance-audit-v1.0.md) and +> the [`1.0 audit`](docs/conformance-audit-v1.0.md), +> [`1.0.1 maintenance note`](docs/conformance-maintenance-v1.0.1.md), and > [`conformance matrix`](docs/conformance.md). ## Install diff --git a/THIRD-PARTY-NOTICES.md b/THIRD-PARTY-NOTICES.md index 59a8b3b..3492249 100644 --- a/THIRD-PARTY-NOTICES.md +++ b/THIRD-PARTY-NOTICES.md @@ -6,8 +6,6 @@ OpenDisNet's implementation was independently designed with reference to: - SISO-REF-010-2025, *Reference for Enumerations for Simulation Interoperability*. - The `open-dis/opendis7-java` and `open-dis/opendis7-source-generator` projects, distributed under the 3-Clause BSD License by their respective authors. -- The `open-dis/open-dis-csharp` project, distributed under the 2-Clause BSD - License by Open DIS and its contributors. IEEE and SISO specification names are used only to identify interoperability targets. No endorsement is implied. Specification text is not redistributed. diff --git a/docs/api-design.md b/docs/api-design.md index f0949b1..c84512a 100644 --- a/docs/api-design.md +++ b/docs/api-design.md @@ -38,13 +38,13 @@ untrusted network input. ## Compatibility -The 0.9 release-candidate line freezes the complete public C# surface before -1.0. `PublicAPI.Shipped.txt` is the reviewable contract. Compiler analyzers -reject an unrecorded public addition or removal, and NuGet package validation -compares 1.0 artifacts with version 0.9.0 for binary compatibility. +Version 1.0 freezes the complete public C# surface. `PublicAPI.Shipped.txt` is +the reviewable contract. Compiler analyzers reject an unrecorded public addition +or removal, and NuGet package validation compares 1.x artifacts with version +1.0.0 for binary compatibility. New API belongs in `PublicAPI.Unshipped.txt` and requires tests plus a changelog entry. Removing or changing frozen API requires explicit breaking-change review -and another release candidate. After 1.0, public names and wire behavior follow -semantic versioning. Internal codec generation may change without becoming part -of the supported API. +and a new major version. Public names and wire behavior follow semantic +versioning. Internal codec generation may change without becoming part of the +supported API. diff --git a/docs/conformance-maintenance-v1.0.1.md b/docs/conformance-maintenance-v1.0.1.md new file mode 100644 index 0000000..1a08898 --- /dev/null +++ b/docs/conformance-maintenance-v1.0.1.md @@ -0,0 +1,20 @@ +# OpenDisNet 1.0.1 conformance maintenance + +Version 1.0.1 does not change the supported DIS wire model, SISO enumeration +baseline, public API, or conformance-vector corpus audited for version 1.0. + +The maintenance manifest `tests/OpenDisNet.Tests/Conformance/Audit/v1.0.1.json` +retains the complete 1.0 inventory and updates two schema hashes solely because +their human-readable comments were corrected. Generated public XML documentation +changed, but no field name, type, width, ordering, condition, padding, factory +mapping, parser behavior, or serialized byte changed. + +The test-only generated C# reference project and its single Fire PDU consumer +were removed. The frozen independent corpus remains: 70 compatible default +vectors and 44 compatible populated vectors span all 12 protocol families, with +documented differential exceptions retained. Native populated, truncation, and +hostile-input coverage for all 72 PDU types is unchanged. + +The original `v1.0.json` manifest and +[`1.0 audit report`](conformance-audit-v1.0.md) remain unchanged as historical +release evidence. diff --git a/docs/conformance.md b/docs/conformance.md index 4808f16..9280e07 100644 --- a/docs/conformance.md +++ b/docs/conformance.md @@ -23,7 +23,7 @@ input tests, and round-trip tests. - [x] SISO-REF-010-2025 v36 typed enumerations and structured bitfields - [x] Lossless round trip of unknown enumeration values and reserved bitfield bits -## PDU families +## Historical family delivery milestones - [x] 0.3 Entity Information/Interaction - [x] 0.3 Warfare @@ -38,7 +38,7 @@ input tests, and round-trip tests. - [x] 0.8 Live Entity - [x] 0.8 Information Operations -## 0.9 release readiness +## Historical 0.9 release-readiness milestone - [x] Frozen, compiler-enforced public C# API baseline - [x] NuGet package compatibility validation against 0.8.0 @@ -47,7 +47,7 @@ input tests, and round-trip tests. - [x] External RC validation checklist and structured feedback form - [x] External RC feedback channel reviewed; no high-impact finding remains open -## 1.0 release gates +## Completed 1.0 release gates - [x] SHA-256-pinned conformance audit manifest and published audit report - [x] Every PDU type and protocol family accounted for exactly once @@ -64,8 +64,10 @@ code or a runtime/build dependency. Two default vectors and 28 aggressively populated vectors expose documented defects in that reference generator and are retained as differential evidence rather than copied into OpenDisNet behavior. -This file is a release gate. Version 1.0 will not be labeled complete until all -applicable entries are checked and the reviewable project audit is complete. +This file records the release gates completed for version 1.0. Future releases +must retain the applicable checks and document any changed conformance scope. The completed scope, evidence, limitations, and differential exceptions are in -the [1.0 conformance audit](conformance-audit-v1.0.md). +the [1.0 conformance audit](conformance-audit-v1.0.md). The documentation-only +schema corrections and test-harness cleanup in 1.0.1 are recorded in the +[1.0.1 maintenance note](conformance-maintenance-v1.0.1.md). diff --git a/docs/release-candidate.md b/docs/release-candidate.md index d8b96f5..400400e 100644 --- a/docs/release-candidate.md +++ b/docs/release-candidate.md @@ -1,17 +1,17 @@ -# 0.9 external release candidate +# External release candidates -Version 0.9 is the public API freeze and external validation stage before 1.0. -The current C# surface is recorded in `PublicAPI.Shipped.txt`; builds reject an -undocumented addition or removal, and package validation compares every new -artifact with the published 0.8.0 package. +Release candidates provide an external validation stage before a stable minor +or major release. The current C# surface is recorded in +`PublicAPI.Shipped.txt`; builds reject an undocumented addition or removal, and +package validation compares every new artifact with the stable 1.0.0 baseline. ## Install an RC -Release candidates use SemVer tags such as `v0.9.0-rc.1`. After a candidate is +Release candidates use SemVer tags such as `v1.1.0-rc.1`. After a candidate is published, install that exact version so test results remain reproducible: ```shell -dotnet add package OpenDisNet --version 0.9.0-rc.1 +dotnet add package OpenDisNet --version 1.1.0-rc.1 ``` GitHub and NuGet identify RC builds as prereleases. Do not use an RC in a @@ -42,9 +42,9 @@ exact package version, target framework, operating system, PDU families tested, and whether the problem concerns API usability, wire interoperability, performance, or documentation. -## 1.0 exit criteria +## Stable-release exit criteria -- Public API analyzer and 0.8.0 package-compatibility validation remain clean. +- Public API analyzer and stable-baseline package-compatibility validation remain clean. - The packed-package consumer passes on .NET 9 and .NET 10. - No unresolved high-impact wire-correctness or data-loss defect remains. - External testing covers real application workflows without relying on diff --git a/docs/releasing.md b/docs/releasing.md index e448ceb..d18c1ca 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,14 +1,14 @@ # Releasing Releases are immutable and tag-driven. The `release.yml` workflow tests, packs, -publishes to NuGet.org, and creates a GitHub release for tags such as `v0.2.0`. +publishes to NuGet.org, and creates a GitHub release for tags such as `v1.0.1`. GitHub-generated notes are categorized using `.github/release.yml`, and package plus symbol artifacts are attached to the release shown on the repository page. -Prerelease tags use SemVer identifiers such as `v0.9.0-rc.1`. The workflow +Prerelease tags use SemVer identifiers such as `v1.1.0-rc.1`. The workflow derives the package version from the tag and marks the GitHub release as a prerelease automatically. Before publishing any tag, the workflow validates the -public API, compares the package with the 0.9.0 compatibility baseline, and runs +public API, compares the package with the 1.0.0 compatibility baseline, and runs an external-style consumer against the packed artifact on .NET 9 and .NET 10. The RC testing contract and feedback process are documented in @@ -16,7 +16,7 @@ The RC testing contract and feedback process are documented in only after its exit criteria are satisfied; published NuGet versions and GitHub releases are never rewritten. -## 1.0 security gates +## Release security gates A release tag must identify a commit contained in `main`. The release workflow then repeats locked restore with low-or-higher transitive NuGet vulnerability @@ -28,10 +28,10 @@ immutable GitHub release. Verify a downloaded package with GitHub CLI: ```shell -gh attestation verify OpenDisNet.1.0.0.nupkg --repo RejectKid/OpenDisNet +gh attestation verify OpenDisNet.1.0.1.nupkg --repo RejectKid/OpenDisNet ``` -The 1.0 tag is permitted only when the +Stable tags are permitted only when their applicable [conformance audit](conformance-audit-v1.0.md) and all checks in the [conformance matrix](conformance.md) are complete. diff --git a/docs/standards.md b/docs/standards.md index b47b9ba..5534fc1 100644 --- a/docs/standards.md +++ b/docs/standards.md @@ -19,10 +19,10 @@ cross-checks: - `open-dis/opendis7-java` - `open-dis/opendis7-source-generator` -- `open-dis/open-dis-csharp` The Java source generator reports 72 DIS v7 PDUs and provides machine-readable -layout descriptions. It is an offline reference only: OpenDisNet is a native -C#/.NET design with no Java code, dependency, or runtime requirement. Its -conformance claim is based on its own coverage matrix and tests, not merely the -presence of a corresponding reference class. +layout descriptions and supplied the frozen independent byte-vector corpus. It +is an offline reference only: OpenDisNet is a native C#/.NET design with no Java +code, dependency, or runtime requirement. Its conformance claim is based on its +own coverage matrix and tests, not merely the presence of a corresponding +reference class. diff --git a/src/OpenDisNet/OpenDisNet.csproj b/src/OpenDisNet/OpenDisNet.csproj index 545d570..2b69402 100644 --- a/src/OpenDisNet/OpenDisNet.csproj +++ b/src/OpenDisNet/OpenDisNet.csproj @@ -4,7 +4,7 @@ OpenDisNet OpenDisNet OpenDisNet - 0.1.0 + 1.0.1 RejectKid High-performance, type-safe DIS Protocol Version 7 binary codec for .NET. DIS;IEEE-1278;simulation;PDU;protocol @@ -18,7 +18,7 @@ $(NoWarn);CS1591 false true - 0.9.0 + 1.0.0 true diff --git a/src/OpenDisNet/Pdus/Families/DistributedEmissionsPdus.cs b/src/OpenDisNet/Pdus/Families/DistributedEmissionsPdus.cs index c909645..f21b610 100644 --- a/src/OpenDisNet/Pdus/Families/DistributedEmissionsPdus.cs +++ b/src/OpenDisNet/Pdus/Families/DistributedEmissionsPdus.cs @@ -442,7 +442,7 @@ public partial class IdentificationFriendOrFoePdu : DistributedEmissionsRegenera public EntityId EmittingEntityId { get; set; } = new EntityId(); /// - /// Number generated by the issuing simulation to associate realted events. Part of Layer 1 basic system data 7.6.5.2. + /// Number generated by the issuing simulation to associate related events. Part of Layer 1 basic system data 7.6.5.2. /// public EventIdentifier EventId { get; set; } = new EventIdentifier(); @@ -795,7 +795,7 @@ public partial class UAEmitter public ushort Padding { get; set; } /// - /// TODO + /// Identifies the acoustic emitter represented by this system. /// public AcousticEmitter AcousticEmitter { get; set; } = new AcousticEmitter(); diff --git a/src/OpenDisNet/Pdus/Families/Records.cs b/src/OpenDisNet/Pdus/Families/Records.cs index 1da9b27..48d48c0 100644 --- a/src/OpenDisNet/Pdus/Families/Records.cs +++ b/src/OpenDisNet/Pdus/Families/Records.cs @@ -450,7 +450,7 @@ public partial class BeamData public float BeamElevationSweep { get; set; } /// - /// allows receiver to synchronize its regenerated scan pattern to that of the emmitter. Specifies the percentage of time a scan is through its pattern from its origion. + /// Allows a receiver to synchronize its regenerated scan pattern to that of the emitter. Specifies the percentage of time a scan has progressed through its pattern from its origin. /// public float BeamSweepSync { get; set; } diff --git a/tests/OpenDisNet.PackageSmoke/OpenDisNet.PackageSmoke.csproj b/tests/OpenDisNet.PackageSmoke/OpenDisNet.PackageSmoke.csproj index 1df7f4c..7d41c64 100644 --- a/tests/OpenDisNet.PackageSmoke/OpenDisNet.PackageSmoke.csproj +++ b/tests/OpenDisNet.PackageSmoke/OpenDisNet.PackageSmoke.csproj @@ -5,7 +5,7 @@ false net9.0;net10.0 - 0.1.0 + 1.0.0 true diff --git a/tests/OpenDisNet.Reference/Generated/AcknowledgePdu.cs b/tests/OpenDisNet.Reference/Generated/AcknowledgePdu.cs deleted file mode 100644 index 7897ac4..0000000 --- a/tests/OpenDisNet.Reference/Generated/AcknowledgePdu.cs +++ /dev/null @@ -1,414 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.6. Acknowledge the receipt of a start/resume, stop/freeze, or RemoveEntityPDU. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class AcknowledgePdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Identifier for originating entity(or simulation) - /// - private EntityID _originatingID = new EntityID(); - - /// - /// Identifier for the receiving entity(or simulation) - /// - private EntityID _receivingID = new EntityID(); - - /// - /// type of message being acknowledged - /// - private ushort _acknowledgeFlag; - - /// - /// Whether or not the receiving entity was able to comply with the request - /// - private ushort _responseFlag; - - /// - /// Request ID that is unique - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public AcknowledgePdu() - { - PduType = (byte)15; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AcknowledgePdu left, AcknowledgePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AcknowledgePdu left, AcknowledgePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingID.GetMarshalledSize(); // this._originatingID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += 2; // this._acknowledgeFlag - marshalSize += 2; // this._responseFlag - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the Identifier for originating entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingID")] - public EntityID OriginatingID - { - get - { - return this._originatingID; - } - - set - { - this._originatingID = value; - } - } - - /// - /// Gets or sets the Identifier for the receiving entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingID")] - public EntityID ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the type of message being acknowledged - /// - [XmlElement(Type = typeof(ushort), ElementName = "acknowledgeFlag")] - public ushort AcknowledgeFlag - { - get - { - return this._acknowledgeFlag; - } - - set - { - this._acknowledgeFlag = value; - } - } - - /// - /// Gets or sets the Whether or not the receiving entity was able to comply with the request - /// - [XmlElement(Type = typeof(ushort), ElementName = "responseFlag")] - public ushort ResponseFlag - { - get - { - return this._responseFlag; - } - - set - { - this._responseFlag = value; - } - } - - /// - /// Gets or sets the Request ID that is unique - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingID.Marshal(dos); - this._receivingID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._acknowledgeFlag); - dos.WriteUnsignedShort((ushort)this._responseFlag); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._acknowledgeFlag = dis.ReadUnsignedShort(); - this._responseFlag = dis.ReadUnsignedShort(); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._acknowledgeFlag.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._responseFlag.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AcknowledgePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AcknowledgePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingID.Equals(obj._originatingID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (this._acknowledgeFlag != obj._acknowledgeFlag) - { - ivarsEqual = false; - } - - if (this._responseFlag != obj._responseFlag) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._acknowledgeFlag.GetHashCode(); - result = GenerateHash(result) ^ this._responseFlag.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AcknowledgeReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/AcknowledgeReliablePdu.cs deleted file mode 100644 index 515cd4d..0000000 --- a/tests/OpenDisNet.Reference/Generated/AcknowledgeReliablePdu.cs +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.5: Ack receipt of a start-resume, stop-freeze, create-entity or remove enitty (reliable) pdus. COMPLETE - /// - [Serializable] - [XmlRoot] - public partial class AcknowledgeReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// ack flags - /// - private ushort _acknowledgeFlag; - - /// - /// response flags - /// - private ushort _responseFlag; - - /// - /// Request ID - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public AcknowledgeReliablePdu() - { - PduType = (byte)55; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AcknowledgeReliablePdu left, AcknowledgeReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AcknowledgeReliablePdu left, AcknowledgeReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 2; // this._acknowledgeFlag - marshalSize += 2; // this._responseFlag - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the ack flags - /// - [XmlElement(Type = typeof(ushort), ElementName = "acknowledgeFlag")] - public ushort AcknowledgeFlag - { - get - { - return this._acknowledgeFlag; - } - - set - { - this._acknowledgeFlag = value; - } - } - - /// - /// Gets or sets the response flags - /// - [XmlElement(Type = typeof(ushort), ElementName = "responseFlag")] - public ushort ResponseFlag - { - get - { - return this._responseFlag; - } - - set - { - this._responseFlag = value; - } - } - - /// - /// Gets or sets the Request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._acknowledgeFlag); - dos.WriteUnsignedShort((ushort)this._responseFlag); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._acknowledgeFlag = dis.ReadUnsignedShort(); - this._responseFlag = dis.ReadUnsignedShort(); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._acknowledgeFlag.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._responseFlag.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AcknowledgeReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AcknowledgeReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._acknowledgeFlag != obj._acknowledgeFlag) - { - ivarsEqual = false; - } - - if (this._responseFlag != obj._responseFlag) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._acknowledgeFlag.GetHashCode(); - result = GenerateHash(result) ^ this._responseFlag.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AcousticEmitter.cs b/tests/OpenDisNet.Reference/Generated/AcousticEmitter.cs deleted file mode 100644 index ea7d371..0000000 --- a/tests/OpenDisNet.Reference/Generated/AcousticEmitter.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// information about a specific UA emmtter. Section 6.2.2. - /// - [Serializable] - [XmlRoot] - public partial class AcousticEmitter - { - /// - /// the system for a particular UA emitter, and an enumeration - /// - private ushort _acousticName; - - /// - /// The function of the acoustic system - /// - private byte _function; - - /// - /// The UA emitter identification number relative to a specific system - /// - private byte _acousticIdNumber; - - /// - /// Initializes a new instance of the class. - /// - public AcousticEmitter() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AcousticEmitter left, AcousticEmitter right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AcousticEmitter left, AcousticEmitter right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._acousticName - marshalSize += 1; // this._function - marshalSize += 1; // this._acousticIdNumber - return marshalSize; - } - - /// - /// Gets or sets the the system for a particular UA emitter, and an enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "acousticName")] - public ushort AcousticName - { - get - { - return this._acousticName; - } - - set - { - this._acousticName = value; - } - } - - /// - /// Gets or sets the The function of the acoustic system - /// - [XmlElement(Type = typeof(byte), ElementName = "function")] - public byte Function - { - get - { - return this._function; - } - - set - { - this._function = value; - } - } - - /// - /// Gets or sets the The UA emitter identification number relative to a specific system - /// - [XmlElement(Type = typeof(byte), ElementName = "acousticIdNumber")] - public byte AcousticIdNumber - { - get - { - return this._acousticIdNumber; - } - - set - { - this._acousticIdNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._acousticName); - dos.WriteUnsignedByte((byte)this._function); - dos.WriteUnsignedByte((byte)this._acousticIdNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._acousticName = dis.ReadUnsignedShort(); - this._function = dis.ReadUnsignedByte(); - this._acousticIdNumber = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._acousticName.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._function.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._acousticIdNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AcousticEmitter; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AcousticEmitter obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._acousticName != obj._acousticName) - { - ivarsEqual = false; - } - - if (this._function != obj._function) - { - ivarsEqual = false; - } - - if (this._acousticIdNumber != obj._acousticIdNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._acousticName.GetHashCode(); - result = GenerateHash(result) ^ this._function.GetHashCode(); - result = GenerateHash(result) ^ this._acousticIdNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ActionRequestPdu.cs b/tests/OpenDisNet.Reference/Generated/ActionRequestPdu.cs deleted file mode 100644 index 4622583..0000000 --- a/tests/OpenDisNet.Reference/Generated/ActionRequestPdu.cs +++ /dev/null @@ -1,588 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.7. Request from simulation manager to a managed entity to perform a specified action. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class ActionRequestPdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Identifier for originating entity(or simulation) - /// - private EntityID _originatingID = new EntityID(); - - /// - /// Identifier for the receiving entity(or simulation) - /// - private EntityID _receivingID = new EntityID(); - - /// - /// identifies the request being made by the simulaton manager - /// - private uint _requestID; - - /// - /// identifies the particular action being requested(see Section 7 of SISO-REF-010). - /// - private uint _actionID; - - /// - /// Number of fixed datum records - /// - private uint _numberOfFixedDatumRecords; - - /// - /// Number of variable datum records - /// - private uint _numberOfVariableDatumRecords; - - /// - /// variable length list of fixed datums - /// - private List _fixedDatums = new List(); - - /// - /// variable length list of variable length datums - /// - private List _variableDatums = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ActionRequestPdu() - { - PduType = (byte)16; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ActionRequestPdu left, ActionRequestPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ActionRequestPdu left, ActionRequestPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingID.GetMarshalledSize(); // this._originatingID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += 4; // this._requestID - marshalSize += 4; // this._actionID - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Identifier for originating entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingID")] - public EntityID OriginatingID - { - get - { - return this._originatingID; - } - - set - { - this._originatingID = value; - } - } - - /// - /// Gets or sets the Identifier for the receiving entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingID")] - public EntityID ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the identifies the request being made by the simulaton manager - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the identifies the particular action being requested(see Section 7 of SISO-REF-010). - /// - [XmlElement(Type = typeof(uint), ElementName = "actionID")] - public uint ActionID - { - get - { - return this._actionID; - } - - set - { - this._actionID = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the variable length list of fixed datums - /// - [XmlElement(ElementName = "fixedDatumsList", Type = typeof(List))] - public List FixedDatums - { - get - { - return this._fixedDatums; - } - } - - /// - /// Gets or sets the variable length list of variable length datums - /// - [XmlElement(ElementName = "variableDatumsList", Type = typeof(List))] - public List VariableDatums - { - get - { - return this._variableDatums; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingID.Marshal(dos); - this._receivingID.Marshal(dos); - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._actionID); - dos.WriteUnsignedInt((uint)this._fixedDatums.Count); - dos.WriteUnsignedInt((uint)this._variableDatums.Count); - - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._requestID = dis.ReadUnsignedInt(); - this._actionID = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatums.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatums.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._actionID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ActionRequestPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ActionRequestPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingID.Equals(obj._originatingID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._actionID != obj._actionID) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatums.Count != obj._fixedDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - if (!this._fixedDatums[idx].Equals(obj._fixedDatums[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatums.Count != obj._variableDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - if (!this._variableDatums[idx].Equals(obj._variableDatums[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._actionID.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatums.Count > 0) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatums[idx].GetHashCode(); - } - } - - if (this._variableDatums.Count > 0) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatums[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ActionRequestReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/ActionRequestReliablePdu.cs deleted file mode 100644 index 0538f7a..0000000 --- a/tests/OpenDisNet.Reference/Generated/ActionRequestReliablePdu.cs +++ /dev/null @@ -1,615 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.6: request from a simulation manager to a managed entity to perform a specified action. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class ActionRequestReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// level of reliability service used for this transaction - /// - private byte _requiredReliabilityService; - - /// - /// padding - /// - private ushort _pad1; - - /// - /// padding - /// - private byte _pad2; - - /// - /// request ID - /// - private uint _requestID; - - /// - /// request ID - /// - private uint _actionID; - - /// - /// Fixed datum record count - /// - private uint _numberOfFixedDatumRecords; - - /// - /// variable datum record count - /// - private uint _numberOfVariableDatumRecords; - - /// - /// Fixed datum records - /// - private List _fixedDatumRecords = new List(); - - /// - /// Variable datum records - /// - private List _variableDatumRecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ActionRequestReliablePdu() - { - PduType = (byte)56; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ActionRequestReliablePdu left, ActionRequestReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ActionRequestReliablePdu left, ActionRequestReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 1; // this._requiredReliabilityService - marshalSize += 2; // this._pad1 - marshalSize += 1; // this._pad2 - marshalSize += 4; // this._requestID - marshalSize += 4; // this._actionID - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the level of reliability service used for this transaction - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliabilityService")] - public byte RequiredReliabilityService - { - get - { - return this._requiredReliabilityService; - } - - set - { - this._requiredReliabilityService = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad1")] - public ushort Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad2")] - public byte Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Gets or sets the request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "actionID")] - public uint ActionID - { - get - { - return this._actionID; - } - - set - { - this._actionID = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the Fixed datum records - /// - [XmlElement(ElementName = "fixedDatumRecordsList", Type = typeof(List))] - public List FixedDatumRecords - { - get - { - return this._fixedDatumRecords; - } - } - - /// - /// Gets or sets the Variable datum records - /// - [XmlElement(ElementName = "variableDatumRecordsList", Type = typeof(List))] - public List VariableDatumRecords - { - get - { - return this._variableDatumRecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._requiredReliabilityService); - dos.WriteUnsignedShort((ushort)this._pad1); - dos.WriteUnsignedByte((byte)this._pad2); - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._actionID); - dos.WriteUnsignedInt((uint)this._fixedDatumRecords.Count); - dos.WriteUnsignedInt((uint)this._variableDatumRecords.Count); - - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requiredReliabilityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedShort(); - this._pad2 = dis.ReadUnsignedByte(); - this._requestID = dis.ReadUnsignedInt(); - this._actionID = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatumRecords.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatumRecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._actionID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ActionRequestReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ActionRequestReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requiredReliabilityService != obj._requiredReliabilityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._actionID != obj._actionID) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatumRecords.Count != obj._fixedDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - if (!this._fixedDatumRecords[idx].Equals(obj._fixedDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumRecords.Count != obj._variableDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - if (!this._variableDatumRecords[idx].Equals(obj._variableDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requiredReliabilityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._actionID.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumRecords[idx].GetHashCode(); - } - } - - if (this._variableDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumRecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ActionResponsePdu.cs b/tests/OpenDisNet.Reference/Generated/ActionResponsePdu.cs deleted file mode 100644 index 2a7fcd5..0000000 --- a/tests/OpenDisNet.Reference/Generated/ActionResponsePdu.cs +++ /dev/null @@ -1,588 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.8. response to an action request PDU. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class ActionResponsePdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Identifier for originating entity(or simulation) - /// - private EntityID _originatingID = new EntityID(); - - /// - /// Identifier for the receiving entity(or simulation) - /// - private EntityID _receivingID = new EntityID(); - - /// - /// Request ID that is unique - /// - private uint _requestID; - - /// - /// Status of response - /// - private uint _requestStatus; - - /// - /// Number of fixed datum records - /// - private uint _numberOfFixedDatumRecords; - - /// - /// Number of variable datum records - /// - private uint _numberOfVariableDatumRecords; - - /// - /// variable length list of fixed datums - /// - private List _fixedDatums = new List(); - - /// - /// variable length list of variable length datums - /// - private List _variableDatums = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ActionResponsePdu() - { - PduType = (byte)17; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ActionResponsePdu left, ActionResponsePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ActionResponsePdu left, ActionResponsePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingID.GetMarshalledSize(); // this._originatingID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += 4; // this._requestID - marshalSize += 4; // this._requestStatus - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Identifier for originating entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingID")] - public EntityID OriginatingID - { - get - { - return this._originatingID; - } - - set - { - this._originatingID = value; - } - } - - /// - /// Gets or sets the Identifier for the receiving entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingID")] - public EntityID ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the Request ID that is unique - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the Status of response - /// - [XmlElement(Type = typeof(uint), ElementName = "requestStatus")] - public uint RequestStatus - { - get - { - return this._requestStatus; - } - - set - { - this._requestStatus = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the variable length list of fixed datums - /// - [XmlElement(ElementName = "fixedDatumsList", Type = typeof(List))] - public List FixedDatums - { - get - { - return this._fixedDatums; - } - } - - /// - /// Gets or sets the variable length list of variable length datums - /// - [XmlElement(ElementName = "variableDatumsList", Type = typeof(List))] - public List VariableDatums - { - get - { - return this._variableDatums; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingID.Marshal(dos); - this._receivingID.Marshal(dos); - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._requestStatus); - dos.WriteUnsignedInt((uint)this._fixedDatums.Count); - dos.WriteUnsignedInt((uint)this._variableDatums.Count); - - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._requestID = dis.ReadUnsignedInt(); - this._requestStatus = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatums.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatums.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ActionResponsePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ActionResponsePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingID.Equals(obj._originatingID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._requestStatus != obj._requestStatus) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatums.Count != obj._fixedDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - if (!this._fixedDatums[idx].Equals(obj._fixedDatums[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatums.Count != obj._variableDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - if (!this._variableDatums[idx].Equals(obj._variableDatums[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._requestStatus.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatums.Count > 0) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatums[idx].GetHashCode(); - } - } - - if (this._variableDatums.Count > 0) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatums[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ActionResponseReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/ActionResponseReliablePdu.cs deleted file mode 100644 index e6d6197..0000000 --- a/tests/OpenDisNet.Reference/Generated/ActionResponseReliablePdu.cs +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.7: Response from an entity to an action request PDU. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class ActionResponseReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// request ID - /// - private uint _requestID; - - /// - /// status of response - /// - private uint _responseStatus; - - /// - /// Fixed datum record count - /// - private uint _numberOfFixedDatumRecords; - - /// - /// variable datum record count - /// - private uint _numberOfVariableDatumRecords; - - /// - /// Fixed datum records - /// - private List _fixedDatumRecords = new List(); - - /// - /// Variable datum records - /// - private List _variableDatumRecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ActionResponseReliablePdu() - { - PduType = (byte)57; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ActionResponseReliablePdu left, ActionResponseReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ActionResponseReliablePdu left, ActionResponseReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._requestID - marshalSize += 4; // this._responseStatus - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the status of response - /// - [XmlElement(Type = typeof(uint), ElementName = "responseStatus")] - public uint ResponseStatus - { - get - { - return this._responseStatus; - } - - set - { - this._responseStatus = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the Fixed datum records - /// - [XmlElement(ElementName = "fixedDatumRecordsList", Type = typeof(List))] - public List FixedDatumRecords - { - get - { - return this._fixedDatumRecords; - } - } - - /// - /// Gets or sets the Variable datum records - /// - [XmlElement(ElementName = "variableDatumRecordsList", Type = typeof(List))] - public List VariableDatumRecords - { - get - { - return this._variableDatumRecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._responseStatus); - dos.WriteUnsignedInt((uint)this._fixedDatumRecords.Count); - dos.WriteUnsignedInt((uint)this._variableDatumRecords.Count); - - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requestID = dis.ReadUnsignedInt(); - this._responseStatus = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatumRecords.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatumRecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._responseStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ActionResponseReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ActionResponseReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._responseStatus != obj._responseStatus) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatumRecords.Count != obj._fixedDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - if (!this._fixedDatumRecords[idx].Equals(obj._fixedDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumRecords.Count != obj._variableDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - if (!this._variableDatumRecords[idx].Equals(obj._variableDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._responseStatus.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumRecords[idx].GetHashCode(); - } - } - - if (this._variableDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumRecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AggregateIdentifier.cs b/tests/OpenDisNet.Reference/Generated/AggregateIdentifier.cs deleted file mode 100644 index 4d02b8a..0000000 --- a/tests/OpenDisNet.Reference/Generated/AggregateIdentifier.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of each aggrgate in an exercise is specified by an aggregate identifier record. The aggregate ID is not an entity and shall not be treated as such. Section 6.2.3. - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class AggregateIdentifier - { - /// - /// Simulation address, ie site and application, the first two fields of the entity ID - /// - private SimulationAddress _simulationAddress = new SimulationAddress(); - - /// - /// the aggregate ID - /// - private ushort _aggregateID; - - /// - /// Initializes a new instance of the class. - /// - public AggregateIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AggregateIdentifier left, AggregateIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AggregateIdentifier left, AggregateIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._aggregateID - return marshalSize; - } - - /// - /// Gets or sets the Simulation address, ie site and application, the first two fields of the entity ID - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "simulationAddress")] - public SimulationAddress SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - /// - /// Gets or sets the the aggregate ID - /// - [XmlElement(Type = typeof(ushort), ElementName = "aggregateID")] - public ushort AggregateID - { - get - { - return this._aggregateID; - } - - set - { - this._aggregateID = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._aggregateID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._aggregateID = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._aggregateID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AggregateIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AggregateIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._aggregateID != obj._aggregateID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._aggregateID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AggregateMarking.cs b/tests/OpenDisNet.Reference/Generated/AggregateMarking.cs deleted file mode 100644 index 0bebe1a..0000000 --- a/tests/OpenDisNet.Reference/Generated/AggregateMarking.cs +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Specifies the character set used in the first byte, followed by up to 31 characters of text data. Section 6.2.4. - /// - [Serializable] - [XmlRoot] - public partial class AggregateMarking - { - /// - /// The character set - /// - private byte _characterSet; - - /// - /// The characters - /// - private byte[] _characters = new byte[31]; - - /// - /// Initializes a new instance of the class. - /// - public AggregateMarking() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AggregateMarking left, AggregateMarking right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AggregateMarking left, AggregateMarking right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._characterSet - marshalSize += 31 * 1; // _characters - return marshalSize; - } - - /// - /// Gets or sets the The character set - /// - [XmlElement(Type = typeof(byte), ElementName = "characterSet")] - public byte CharacterSet - { - get - { - return this._characterSet; - } - - set - { - this._characterSet = value; - } - } - - /// - /// Gets or sets the The characters - /// - [XmlArray(ElementName = "characters")] - public byte[] Characters - { - get - { - return this._characters; - } - - set - { - this._characters = value; - } -} - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._characterSet); - - for (int idx = 0; idx < this._characters.Length; idx++) - { - dos.WriteUnsignedByte(this._characters[idx]); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._characterSet = dis.ReadUnsignedByte(); - for (int idx = 0; idx < this._characters.Length; idx++) - { - this._characters[idx] = dis.ReadUnsignedByte(); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._characterSet.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._characters.Length; idx++) - { - sb.AppendLine("" + this._characters[idx] + ""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AggregateMarking; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AggregateMarking obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._characterSet != obj._characterSet) - { - ivarsEqual = false; - } - - if (obj._characters.Length != 31) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 31; idx++) - { - if (this._characters[idx] != obj._characters[idx]) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._characterSet.GetHashCode(); - - for (int idx = 0; idx < 31; idx++) - { - result = GenerateHash(result) ^ this._characters[idx].GetHashCode(); - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AggregateType.cs b/tests/OpenDisNet.Reference/Generated/AggregateType.cs deleted file mode 100644 index 9caa34b..0000000 --- a/tests/OpenDisNet.Reference/Generated/AggregateType.cs +++ /dev/null @@ -1,463 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Identifies the type and organization of an aggregate. Section 6.2.5 - /// - [Serializable] - [XmlRoot] - public partial class AggregateType - { - /// - /// Grouping criterion used to group the aggregate. Enumeration from EBV document - /// - private byte _aggregateKind; - - /// - /// Domain of entity (air, surface, subsurface, space, etc) Zero means domain does not apply. - /// - private byte _domain; - - /// - /// country to which the design of the entity is attributed - /// - private ushort _country; - - /// - /// category of entity - /// - private byte _category; - - /// - /// subcategory of entity - /// - private byte _subcategory; - - /// - /// specific info based on subcategory field - /// - private byte _specific; - - private byte _extra; - - /// - /// Initializes a new instance of the class. - /// - public AggregateType() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AggregateType left, AggregateType right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AggregateType left, AggregateType right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._aggregateKind - marshalSize += 1; // this._domain - marshalSize += 2; // this._country - marshalSize += 1; // this._category - marshalSize += 1; // this._subcategory - marshalSize += 1; // this._specific - marshalSize += 1; // this._extra - return marshalSize; - } - - /// - /// Gets or sets the Grouping criterion used to group the aggregate. Enumeration from EBV document - /// - [XmlElement(Type = typeof(byte), ElementName = "aggregateKind")] - public byte AggregateKind - { - get - { - return this._aggregateKind; - } - - set - { - this._aggregateKind = value; - } - } - - /// - /// Gets or sets the Domain of entity (air, surface, subsurface, space, etc) Zero means domain does not apply. - /// - [XmlElement(Type = typeof(byte), ElementName = "domain")] - public byte Domain - { - get - { - return this._domain; - } - - set - { - this._domain = value; - } - } - - /// - /// Gets or sets the country to which the design of the entity is attributed - /// - [XmlElement(Type = typeof(ushort), ElementName = "country")] - public ushort Country - { - get - { - return this._country; - } - - set - { - this._country = value; - } - } - - /// - /// Gets or sets the category of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "category")] - public byte Category - { - get - { - return this._category; - } - - set - { - this._category = value; - } - } - - /// - /// Gets or sets the subcategory of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "subcategory")] - public byte Subcategory - { - get - { - return this._subcategory; - } - - set - { - this._subcategory = value; - } - } - - /// - /// Gets or sets the specific info based on subcategory field - /// - [XmlElement(Type = typeof(byte), ElementName = "specific")] - public byte Specific - { - get - { - return this._specific; - } - - set - { - this._specific = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "extra")] - public byte Extra - { - get - { - return this._extra; - } - - set - { - this._extra = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._aggregateKind); - dos.WriteUnsignedByte((byte)this._domain); - dos.WriteUnsignedShort((ushort)this._country); - dos.WriteUnsignedByte((byte)this._category); - dos.WriteUnsignedByte((byte)this._subcategory); - dos.WriteUnsignedByte((byte)this._specific); - dos.WriteUnsignedByte((byte)this._extra); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._aggregateKind = dis.ReadUnsignedByte(); - this._domain = dis.ReadUnsignedByte(); - this._country = dis.ReadUnsignedShort(); - this._category = dis.ReadUnsignedByte(); - this._subcategory = dis.ReadUnsignedByte(); - this._specific = dis.ReadUnsignedByte(); - this._extra = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._aggregateKind.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._domain.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._country.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._category.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._subcategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._specific.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._extra.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AggregateType; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AggregateType obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._aggregateKind != obj._aggregateKind) - { - ivarsEqual = false; - } - - if (this._domain != obj._domain) - { - ivarsEqual = false; - } - - if (this._country != obj._country) - { - ivarsEqual = false; - } - - if (this._category != obj._category) - { - ivarsEqual = false; - } - - if (this._subcategory != obj._subcategory) - { - ivarsEqual = false; - } - - if (this._specific != obj._specific) - { - ivarsEqual = false; - } - - if (this._extra != obj._extra) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._aggregateKind.GetHashCode(); - result = GenerateHash(result) ^ this._domain.GetHashCode(); - result = GenerateHash(result) ^ this._country.GetHashCode(); - result = GenerateHash(result) ^ this._category.GetHashCode(); - result = GenerateHash(result) ^ this._subcategory.GetHashCode(); - result = GenerateHash(result) ^ this._specific.GetHashCode(); - result = GenerateHash(result) ^ this._extra.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AngleDeception.cs b/tests/OpenDisNet.Reference/Generated/AngleDeception.cs deleted file mode 100644 index 9cd9d41..0000000 --- a/tests/OpenDisNet.Reference/Generated/AngleDeception.cs +++ /dev/null @@ -1,661 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The Angle Deception attribute record may be used to communicate discrete values that are associated with angle deception jamming that cannot be referenced to an emitter mode. The values provided in the record records (provided in the associated Electromagnetic Emission PDU). (The victim radar beams are those that are targeted by the jammer.) Section 6.2.12.2 - /// - [Serializable] - [XmlRoot] - public partial class AngleDeception - { - private uint _recordType = 3501; - - private ushort _recordLength = 48; - - private ushort _padding; - - private byte _emitterNumber; - - private byte _beamNumber; - - private byte _stateIndicator; - - private uint _padding2; - - private float _azimuthOffset; - - private float _azimuthWidth; - - private float _azimuthPullRate; - - private float _azimuthPullAcceleration; - - private float _elevationOffset; - - private float _elevationWidth; - - private float _elevationPullRate; - - private float _elevationPullAcceleration; - - private uint _padding3; - - /// - /// Initializes a new instance of the class. - /// - public AngleDeception() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AngleDeception left, AngleDeception right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AngleDeception left, AngleDeception right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 2; // this._padding - marshalSize += 1; // this._emitterNumber - marshalSize += 1; // this._beamNumber - marshalSize += 1; // this._stateIndicator - marshalSize += 4; // this._padding2 - marshalSize += 4; // this._azimuthOffset - marshalSize += 4; // this._azimuthWidth - marshalSize += 4; // this._azimuthPullRate - marshalSize += 4; // this._azimuthPullAcceleration - marshalSize += 4; // this._elevationOffset - marshalSize += 4; // this._elevationWidth - marshalSize += 4; // this._elevationPullRate - marshalSize += 4; // this._elevationPullAcceleration - marshalSize += 4; // this._padding3 - return marshalSize; - } - - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "emitterNumber")] - public byte EmitterNumber - { - get - { - return this._emitterNumber; - } - - set - { - this._emitterNumber = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "beamNumber")] - public byte BeamNumber - { - get - { - return this._beamNumber; - } - - set - { - this._beamNumber = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "stateIndicator")] - public byte StateIndicator - { - get - { - return this._stateIndicator; - } - - set - { - this._stateIndicator = value; - } - } - - [XmlElement(Type = typeof(uint), ElementName = "padding2")] - public uint Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "azimuthOffset")] - public float AzimuthOffset - { - get - { - return this._azimuthOffset; - } - - set - { - this._azimuthOffset = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "azimuthWidth")] - public float AzimuthWidth - { - get - { - return this._azimuthWidth; - } - - set - { - this._azimuthWidth = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "azimuthPullRate")] - public float AzimuthPullRate - { - get - { - return this._azimuthPullRate; - } - - set - { - this._azimuthPullRate = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "azimuthPullAcceleration")] - public float AzimuthPullAcceleration - { - get - { - return this._azimuthPullAcceleration; - } - - set - { - this._azimuthPullAcceleration = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "elevationOffset")] - public float ElevationOffset - { - get - { - return this._elevationOffset; - } - - set - { - this._elevationOffset = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "elevationWidth")] - public float ElevationWidth - { - get - { - return this._elevationWidth; - } - - set - { - this._elevationWidth = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "elevationPullRate")] - public float ElevationPullRate - { - get - { - return this._elevationPullRate; - } - - set - { - this._elevationPullRate = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "elevationPullAcceleration")] - public float ElevationPullAcceleration - { - get - { - return this._elevationPullAcceleration; - } - - set - { - this._elevationPullAcceleration = value; - } - } - - [XmlElement(Type = typeof(uint), ElementName = "padding3")] - public uint Padding3 - { - get - { - return this._padding3; - } - - set - { - this._padding3 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedShort((ushort)this._padding); - dos.WriteUnsignedByte((byte)this._emitterNumber); - dos.WriteUnsignedByte((byte)this._beamNumber); - dos.WriteUnsignedByte((byte)this._stateIndicator); - dos.WriteUnsignedInt((uint)this._padding2); - dos.WriteFloat((float)this._azimuthOffset); - dos.WriteFloat((float)this._azimuthWidth); - dos.WriteFloat((float)this._azimuthPullRate); - dos.WriteFloat((float)this._azimuthPullAcceleration); - dos.WriteFloat((float)this._elevationOffset); - dos.WriteFloat((float)this._elevationWidth); - dos.WriteFloat((float)this._elevationPullRate); - dos.WriteFloat((float)this._elevationPullAcceleration); - dos.WriteUnsignedInt((uint)this._padding3); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - this._emitterNumber = dis.ReadUnsignedByte(); - this._beamNumber = dis.ReadUnsignedByte(); - this._stateIndicator = dis.ReadUnsignedByte(); - this._padding2 = dis.ReadUnsignedInt(); - this._azimuthOffset = dis.ReadFloat(); - this._azimuthWidth = dis.ReadFloat(); - this._azimuthPullRate = dis.ReadFloat(); - this._azimuthPullAcceleration = dis.ReadFloat(); - this._elevationOffset = dis.ReadFloat(); - this._elevationWidth = dis.ReadFloat(); - this._elevationPullRate = dis.ReadFloat(); - this._elevationPullAcceleration = dis.ReadFloat(); - this._padding3 = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._emitterNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._stateIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._azimuthOffset.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._azimuthWidth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._azimuthPullRate.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._azimuthPullAcceleration.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._elevationOffset.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._elevationWidth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._elevationPullRate.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._elevationPullAcceleration.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding3.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AngleDeception; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AngleDeception obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (this._emitterNumber != obj._emitterNumber) - { - ivarsEqual = false; - } - - if (this._beamNumber != obj._beamNumber) - { - ivarsEqual = false; - } - - if (this._stateIndicator != obj._stateIndicator) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._azimuthOffset != obj._azimuthOffset) - { - ivarsEqual = false; - } - - if (this._azimuthWidth != obj._azimuthWidth) - { - ivarsEqual = false; - } - - if (this._azimuthPullRate != obj._azimuthPullRate) - { - ivarsEqual = false; - } - - if (this._azimuthPullAcceleration != obj._azimuthPullAcceleration) - { - ivarsEqual = false; - } - - if (this._elevationOffset != obj._elevationOffset) - { - ivarsEqual = false; - } - - if (this._elevationWidth != obj._elevationWidth) - { - ivarsEqual = false; - } - - if (this._elevationPullRate != obj._elevationPullRate) - { - ivarsEqual = false; - } - - if (this._elevationPullAcceleration != obj._elevationPullAcceleration) - { - ivarsEqual = false; - } - - if (this._padding3 != obj._padding3) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._emitterNumber.GetHashCode(); - result = GenerateHash(result) ^ this._beamNumber.GetHashCode(); - result = GenerateHash(result) ^ this._stateIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._azimuthOffset.GetHashCode(); - result = GenerateHash(result) ^ this._azimuthWidth.GetHashCode(); - result = GenerateHash(result) ^ this._azimuthPullRate.GetHashCode(); - result = GenerateHash(result) ^ this._azimuthPullAcceleration.GetHashCode(); - result = GenerateHash(result) ^ this._elevationOffset.GetHashCode(); - result = GenerateHash(result) ^ this._elevationWidth.GetHashCode(); - result = GenerateHash(result) ^ this._elevationPullRate.GetHashCode(); - result = GenerateHash(result) ^ this._elevationPullAcceleration.GetHashCode(); - result = GenerateHash(result) ^ this._padding3.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AngularVelocityVector.cs b/tests/OpenDisNet.Reference/Generated/AngularVelocityVector.cs deleted file mode 100644 index 94e683c..0000000 --- a/tests/OpenDisNet.Reference/Generated/AngularVelocityVector.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Angular velocity measured in radians per second out each of the entity's own coordinate axes. Order of measurement is angular velocity around the x, y, and z axis of the entity. The positive direction is determined by the right hand rule. Section 6.2.7 - /// - [Serializable] - [XmlRoot] - public partial class AngularVelocityVector - { - /// - /// velocity about the x axis - /// - private float _x; - - /// - /// velocity about the y axis - /// - private float _y; - - /// - /// velocity about the zaxis - /// - private float _z; - - /// - /// Initializes a new instance of the class. - /// - public AngularVelocityVector() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AngularVelocityVector left, AngularVelocityVector right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AngularVelocityVector left, AngularVelocityVector right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._x - marshalSize += 4; // this._y - marshalSize += 4; // this._z - return marshalSize; - } - - /// - /// Gets or sets the velocity about the x axis - /// - [XmlElement(Type = typeof(float), ElementName = "x")] - public float X - { - get - { - return this._x; - } - - set - { - this._x = value; - } - } - - /// - /// Gets or sets the velocity about the y axis - /// - [XmlElement(Type = typeof(float), ElementName = "y")] - public float Y - { - get - { - return this._y; - } - - set - { - this._y = value; - } - } - - /// - /// Gets or sets the velocity about the zaxis - /// - [XmlElement(Type = typeof(float), ElementName = "z")] - public float Z - { - get - { - return this._z; - } - - set - { - this._z = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._x); - dos.WriteFloat((float)this._y); - dos.WriteFloat((float)this._z); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._x = dis.ReadFloat(); - this._y = dis.ReadFloat(); - this._z = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._x.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._y.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._z.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AngularVelocityVector; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AngularVelocityVector obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._x != obj._x) - { - ivarsEqual = false; - } - - if (this._y != obj._y) - { - ivarsEqual = false; - } - - if (this._z != obj._z) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._x.GetHashCode(); - result = GenerateHash(result) ^ this._y.GetHashCode(); - result = GenerateHash(result) ^ this._z.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AntennaLocation.cs b/tests/OpenDisNet.Reference/Generated/AntennaLocation.cs deleted file mode 100644 index 295c55f..0000000 --- a/tests/OpenDisNet.Reference/Generated/AntennaLocation.cs +++ /dev/null @@ -1,315 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Location of the radiating portion of the antenna, specified in world coordinates and entity coordinates. Section 6.2.8 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(Vector3Float))] - public partial class AntennaLocation - { - /// - /// Location of the radiating portion of the antenna in world coordinates - /// - private Vector3Double _antennaLocation = new Vector3Double(); - - /// - /// Location of the radiating portion of the antenna in entity coordinates - /// - private Vector3Float _relativeAntennaLocation = new Vector3Float(); - - /// - /// Initializes a new instance of the class. - /// - public AntennaLocation() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AntennaLocation left, AntennaLocation right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AntennaLocation left, AntennaLocation right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._antennaLocation.GetMarshalledSize(); // this._antennaLocation - marshalSize += this._relativeAntennaLocation.GetMarshalledSize(); // this._relativeAntennaLocation - return marshalSize; - } - - /// - /// Gets or sets the Location of the radiating portion of the antenna in world coordinates - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "antennaLocation")] - public Vector3Double AntennaLocation_ - { - get - { - return this._antennaLocation; - } - - set - { - this._antennaLocation = value; - } - } - - /// - /// Gets or sets the Location of the radiating portion of the antenna in entity coordinates - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "relativeAntennaLocation")] - public Vector3Float RelativeAntennaLocation - { - get - { - return this._relativeAntennaLocation; - } - - set - { - this._relativeAntennaLocation = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._antennaLocation.Marshal(dos); - this._relativeAntennaLocation.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._antennaLocation.Unmarshal(dis); - this._relativeAntennaLocation.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._antennaLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._relativeAntennaLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AntennaLocation; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AntennaLocation obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._antennaLocation.Equals(obj._antennaLocation)) - { - ivarsEqual = false; - } - - if (!this._relativeAntennaLocation.Equals(obj._relativeAntennaLocation)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._antennaLocation.GetHashCode(); - result = GenerateHash(result) ^ this._relativeAntennaLocation.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ArealObjectStatePdu.cs b/tests/OpenDisNet.Reference/Generated/ArealObjectStatePdu.cs deleted file mode 100644 index 5745e61..0000000 --- a/tests/OpenDisNet.Reference/Generated/ArealObjectStatePdu.cs +++ /dev/null @@ -1,685 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about the addition/modification of an oobject that is geometrically anchored to the terrain with a set of three or more points that come to a closure. Section 7.10.6 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EntityType))] - [XmlInclude(typeof(SimulationAddress))] - [XmlInclude(typeof(Vector3Double))] - public partial class ArealObjectStatePdu : SyntheticEnvironmentFamilyPdu, IEquatable - { - /// - /// Object in synthetic environment - /// - private EntityID _objectID = new EntityID(); - - /// - /// Object with which this point object is associated - /// - private EntityID _referencedObjectID = new EntityID(); - - /// - /// unique update number of each state transition of an object - /// - private ushort _updateNumber; - - /// - /// force ID - /// - private byte _forceID; - - /// - /// modifications enumeration - /// - private byte _modifications; - - /// - /// Object type - /// - private EntityType _objectType = new EntityType(); - - /// - /// Object appearance - /// - private uint _specificObjectAppearance; - - /// - /// Object appearance - /// - private ushort _generalObjectAppearance; - - /// - /// Number of points - /// - private ushort _numberOfPoints; - - /// - /// requesterID - /// - private SimulationAddress _requesterID = new SimulationAddress(); - - /// - /// receiver ID - /// - private SimulationAddress _receivingID = new SimulationAddress(); - - /// - /// location of object - /// - private List _objectLocation = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ArealObjectStatePdu() - { - PduType = (byte)45; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ArealObjectStatePdu left, ArealObjectStatePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ArealObjectStatePdu left, ArealObjectStatePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._objectID.GetMarshalledSize(); // this._objectID - marshalSize += this._referencedObjectID.GetMarshalledSize(); // this._referencedObjectID - marshalSize += 2; // this._updateNumber - marshalSize += 1; // this._forceID - marshalSize += 1; // this._modifications - marshalSize += this._objectType.GetMarshalledSize(); // this._objectType - marshalSize += 4; // this._specificObjectAppearance - marshalSize += 2; // this._generalObjectAppearance - marshalSize += 2; // this._numberOfPoints - marshalSize += this._requesterID.GetMarshalledSize(); // this._requesterID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - for (int idx = 0; idx < this._objectLocation.Count; idx++) - { - Vector3Double listElement = (Vector3Double)this._objectLocation[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Object in synthetic environment - /// - [XmlElement(Type = typeof(EntityID), ElementName = "objectID")] - public EntityID ObjectID - { - get - { - return this._objectID; - } - - set - { - this._objectID = value; - } - } - - /// - /// Gets or sets the Object with which this point object is associated - /// - [XmlElement(Type = typeof(EntityID), ElementName = "referencedObjectID")] - public EntityID ReferencedObjectID - { - get - { - return this._referencedObjectID; - } - - set - { - this._referencedObjectID = value; - } - } - - /// - /// Gets or sets the unique update number of each state transition of an object - /// - [XmlElement(Type = typeof(ushort), ElementName = "updateNumber")] - public ushort UpdateNumber - { - get - { - return this._updateNumber; - } - - set - { - this._updateNumber = value; - } - } - - /// - /// Gets or sets the force ID - /// - [XmlElement(Type = typeof(byte), ElementName = "forceID")] - public byte ForceID - { - get - { - return this._forceID; - } - - set - { - this._forceID = value; - } - } - - /// - /// Gets or sets the modifications enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "modifications")] - public byte Modifications - { - get - { - return this._modifications; - } - - set - { - this._modifications = value; - } - } - - /// - /// Gets or sets the Object type - /// - [XmlElement(Type = typeof(EntityType), ElementName = "objectType")] - public EntityType ObjectType - { - get - { - return this._objectType; - } - - set - { - this._objectType = value; - } - } - - /// - /// Gets or sets the Object appearance - /// - [XmlElement(Type = typeof(uint), ElementName = "specificObjectAppearance")] - public uint SpecificObjectAppearance - { - get - { - return this._specificObjectAppearance; - } - - set - { - this._specificObjectAppearance = value; - } - } - - /// - /// Gets or sets the Object appearance - /// - [XmlElement(Type = typeof(ushort), ElementName = "generalObjectAppearance")] - public ushort GeneralObjectAppearance - { - get - { - return this._generalObjectAppearance; - } - - set - { - this._generalObjectAppearance = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfPoints method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfPoints")] - public ushort NumberOfPoints - { - get - { - return this._numberOfPoints; - } - - set - { - this._numberOfPoints = value; - } - } - - /// - /// Gets or sets the requesterID - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "requesterID")] - public SimulationAddress RequesterID - { - get - { - return this._requesterID; - } - - set - { - this._requesterID = value; - } - } - - /// - /// Gets or sets the receiver ID - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "receivingID")] - public SimulationAddress ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the location of object - /// - [XmlElement(ElementName = "objectLocationList", Type = typeof(List))] - public List ObjectLocation - { - get - { - return this._objectLocation; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._objectID.Marshal(dos); - this._referencedObjectID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._updateNumber); - dos.WriteUnsignedByte((byte)this._forceID); - dos.WriteUnsignedByte((byte)this._modifications); - this._objectType.Marshal(dos); - dos.WriteUnsignedInt((uint)this._specificObjectAppearance); - dos.WriteUnsignedShort((ushort)this._generalObjectAppearance); - dos.WriteUnsignedShort((ushort)this._objectLocation.Count); - this._requesterID.Marshal(dos); - this._receivingID.Marshal(dos); - - for (int idx = 0; idx < this._objectLocation.Count; idx++) - { - Vector3Double aVector3Double = (Vector3Double)this._objectLocation[idx]; - aVector3Double.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._objectID.Unmarshal(dis); - this._referencedObjectID.Unmarshal(dis); - this._updateNumber = dis.ReadUnsignedShort(); - this._forceID = dis.ReadUnsignedByte(); - this._modifications = dis.ReadUnsignedByte(); - this._objectType.Unmarshal(dis); - this._specificObjectAppearance = dis.ReadUnsignedInt(); - this._generalObjectAppearance = dis.ReadUnsignedShort(); - this._numberOfPoints = dis.ReadUnsignedShort(); - this._requesterID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - for (int idx = 0; idx < this.NumberOfPoints; idx++) - { - Vector3Double anX = new Vector3Double(); - anX.Unmarshal(dis); - this._objectLocation.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._objectID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._referencedObjectID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._updateNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._forceID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._modifications.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._objectType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._specificObjectAppearance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._generalObjectAppearance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._objectLocation.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._requesterID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - for (int idx = 0; idx < this._objectLocation.Count; idx++) - { - sb.AppendLine(""); - Vector3Double aVector3Double = (Vector3Double)this._objectLocation[idx]; - aVector3Double.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ArealObjectStatePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ArealObjectStatePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._objectID.Equals(obj._objectID)) - { - ivarsEqual = false; - } - - if (!this._referencedObjectID.Equals(obj._referencedObjectID)) - { - ivarsEqual = false; - } - - if (this._updateNumber != obj._updateNumber) - { - ivarsEqual = false; - } - - if (this._forceID != obj._forceID) - { - ivarsEqual = false; - } - - if (this._modifications != obj._modifications) - { - ivarsEqual = false; - } - - if (!this._objectType.Equals(obj._objectType)) - { - ivarsEqual = false; - } - - if (this._specificObjectAppearance != obj._specificObjectAppearance) - { - ivarsEqual = false; - } - - if (this._generalObjectAppearance != obj._generalObjectAppearance) - { - ivarsEqual = false; - } - - if (this._numberOfPoints != obj._numberOfPoints) - { - ivarsEqual = false; - } - - if (!this._requesterID.Equals(obj._requesterID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (this._objectLocation.Count != obj._objectLocation.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._objectLocation.Count; idx++) - { - if (!this._objectLocation[idx].Equals(obj._objectLocation[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._objectID.GetHashCode(); - result = GenerateHash(result) ^ this._referencedObjectID.GetHashCode(); - result = GenerateHash(result) ^ this._updateNumber.GetHashCode(); - result = GenerateHash(result) ^ this._forceID.GetHashCode(); - result = GenerateHash(result) ^ this._modifications.GetHashCode(); - result = GenerateHash(result) ^ this._objectType.GetHashCode(); - result = GenerateHash(result) ^ this._specificObjectAppearance.GetHashCode(); - result = GenerateHash(result) ^ this._generalObjectAppearance.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfPoints.GetHashCode(); - result = GenerateHash(result) ^ this._requesterID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - - if (this._objectLocation.Count > 0) - { - for (int idx = 0; idx < this._objectLocation.Count; idx++) - { - result = GenerateHash(result) ^ this._objectLocation[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ArticulatedParts.cs b/tests/OpenDisNet.Reference/Generated/ArticulatedParts.cs deleted file mode 100644 index 2276f66..0000000 --- a/tests/OpenDisNet.Reference/Generated/ArticulatedParts.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// articulated parts for movable parts and a combination of moveable/attached parts of an entity. Section 6.2.93.2 - /// - [Serializable] - [XmlRoot] - public partial class ArticulatedParts - { - /// - /// the identification of the Variable Parameter record. Enumeration from EBV - /// - private byte _recordType; - - /// - /// indicate the change of any parameter for any articulated part. Starts at zero, incremented for each change - /// - private byte _changeIndicator; - - /// - /// the identification of the articulated part to which this articulation parameter is attached. This field shall be specified by a 16-bit unsigned integer. This field shall contain the value zero if the articulated part is attached directly to the entity. - /// - private ushort _partAttachedTo; - - /// - /// the type of parameter represented, 32 bit enumeration - /// - private uint _parameterType; - - /// - /// The definition of the 64 bits shall be determined based on the type of parameter specified in the Parameter Type field - /// - private ulong _parameterValue; - - /// - /// Initializes a new instance of the class. - /// - public ArticulatedParts() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ArticulatedParts left, ArticulatedParts right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ArticulatedParts left, ArticulatedParts right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._recordType - marshalSize += 1; // this._changeIndicator - marshalSize += 2; // this._partAttachedTo - marshalSize += 4; // this._parameterType - marshalSize += 8; // this._parameterValue - return marshalSize; - } - - /// - /// Gets or sets the the identification of the Variable Parameter record. Enumeration from EBV - /// - [XmlElement(Type = typeof(byte), ElementName = "recordType")] - public byte RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the indicate the change of any parameter for any articulated part. Starts at zero, incremented for each change - /// - [XmlElement(Type = typeof(byte), ElementName = "changeIndicator")] - public byte ChangeIndicator - { - get - { - return this._changeIndicator; - } - - set - { - this._changeIndicator = value; - } - } - - /// - /// Gets or sets the the identification of the articulated part to which this articulation parameter is attached. This field shall be specified by a 16-bit unsigned integer. This field shall contain the value zero if the articulated part is attached directly to the entity. - /// - [XmlElement(Type = typeof(ushort), ElementName = "partAttachedTo")] - public ushort PartAttachedTo - { - get - { - return this._partAttachedTo; - } - - set - { - this._partAttachedTo = value; - } - } - - /// - /// Gets or sets the the type of parameter represented, 32 bit enumeration - /// - [XmlElement(Type = typeof(uint), ElementName = "parameterType")] - public uint ParameterType - { - get - { - return this._parameterType; - } - - set - { - this._parameterType = value; - } - } - - /// - /// Gets or sets the The definition of the 64 bits shall be determined based on the type of parameter specified in the Parameter Type field - /// - [XmlElement(Type = typeof(ulong), ElementName = "parameterValue")] - public ulong ParameterValue - { - get - { - return this._parameterValue; - } - - set - { - this._parameterValue = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._recordType); - dos.WriteUnsignedByte((byte)this._changeIndicator); - dos.WriteUnsignedShort((ushort)this._partAttachedTo); - dos.WriteUnsignedInt((uint)this._parameterType); - dos.WriteUnsignedLong((ulong)this._parameterValue); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedByte(); - this._changeIndicator = dis.ReadUnsignedByte(); - this._partAttachedTo = dis.ReadUnsignedShort(); - this._parameterType = dis.ReadUnsignedInt(); - this._parameterValue = dis.ReadUnsignedLong(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._changeIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._partAttachedTo.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameterType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameterValue.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ArticulatedParts; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ArticulatedParts obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._changeIndicator != obj._changeIndicator) - { - ivarsEqual = false; - } - - if (this._partAttachedTo != obj._partAttachedTo) - { - ivarsEqual = false; - } - - if (this._parameterType != obj._parameterType) - { - ivarsEqual = false; - } - - if (this._parameterValue != obj._parameterValue) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._changeIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._partAttachedTo.GetHashCode(); - result = GenerateHash(result) ^ this._parameterType.GetHashCode(); - result = GenerateHash(result) ^ this._parameterValue.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Association.cs b/tests/OpenDisNet.Reference/Generated/Association.cs deleted file mode 100644 index 9e03f80..0000000 --- a/tests/OpenDisNet.Reference/Generated/Association.cs +++ /dev/null @@ -1,367 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// An entity's associations with other entities and/or locations. For each association, this record shall specify the type of the association, the associated entity's EntityID and/or the associated location's world coordinates. This record may be used (optionally) in a transfer transaction to send internal state data from the divesting simulation to the acquiring simulation (see 5.9.4). This record may also be used for other purposes. Section 6.2.10 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(Vector3Double))] - public partial class Association - { - private byte _associationType; - - private byte _padding4; - - /// - /// identity of associated entity. If none, NO_SPECIFIC_ENTITY - /// - private EntityID _associatedEntityID = new EntityID(); - - /// - /// location, in world coordinates - /// - private Vector3Double _associatedLocation = new Vector3Double(); - - /// - /// Initializes a new instance of the class. - /// - public Association() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Association left, Association right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Association left, Association right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._associationType - marshalSize += 1; // this._padding4 - marshalSize += this._associatedEntityID.GetMarshalledSize(); // this._associatedEntityID - marshalSize += this._associatedLocation.GetMarshalledSize(); // this._associatedLocation - return marshalSize; - } - - [XmlElement(Type = typeof(byte), ElementName = "associationType")] - public byte AssociationType - { - get - { - return this._associationType; - } - - set - { - this._associationType = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "padding4")] - public byte Padding4 - { - get - { - return this._padding4; - } - - set - { - this._padding4 = value; - } - } - - /// - /// Gets or sets the identity of associated entity. If none, NO_SPECIFIC_ENTITY - /// - [XmlElement(Type = typeof(EntityID), ElementName = "associatedEntityID")] - public EntityID AssociatedEntityID - { - get - { - return this._associatedEntityID; - } - - set - { - this._associatedEntityID = value; - } - } - - /// - /// Gets or sets the location, in world coordinates - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "associatedLocation")] - public Vector3Double AssociatedLocation - { - get - { - return this._associatedLocation; - } - - set - { - this._associatedLocation = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._associationType); - dos.WriteUnsignedByte((byte)this._padding4); - this._associatedEntityID.Marshal(dos); - this._associatedLocation.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._associationType = dis.ReadUnsignedByte(); - this._padding4 = dis.ReadUnsignedByte(); - this._associatedEntityID.Unmarshal(dis); - this._associatedLocation.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._associationType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding4.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._associatedEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._associatedLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Association; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Association obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._associationType != obj._associationType) - { - ivarsEqual = false; - } - - if (this._padding4 != obj._padding4) - { - ivarsEqual = false; - } - - if (!this._associatedEntityID.Equals(obj._associatedEntityID)) - { - ivarsEqual = false; - } - - if (!this._associatedLocation.Equals(obj._associatedLocation)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._associationType.GetHashCode(); - result = GenerateHash(result) ^ this._padding4.GetHashCode(); - result = GenerateHash(result) ^ this._associatedEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._associatedLocation.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AttachedParts.cs b/tests/OpenDisNet.Reference/Generated/AttachedParts.cs deleted file mode 100644 index 3e41b87..0000000 --- a/tests/OpenDisNet.Reference/Generated/AttachedParts.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Removable parts that may be attached to an entity. Section 6.2.93.3 - /// - [Serializable] - [XmlRoot] - public partial class AttachedParts - { - /// - /// the identification of the Variable Parameter record. Enumeration from EBV - /// - private byte _recordType = 1; - - /// - /// 0 = attached, 1 = detached. See I.2.3.1 for state transition diagram - /// - private byte _detachedIndicator; - - /// - /// the identification of the articulated part to which this articulation parameter is attached. This field shall be specified by a 16-bit unsigned integer. This field shall contain the value zero if the articulated part is attached directly to the entity. - /// - private ushort _partAttachedTo; - - /// - /// The location or station to which the part is attached - /// - private uint _parameterType; - - /// - /// The definition of the 64 bits shall be determined based on the type of parameter specified in the Parameter Type field - /// - private ulong _parameterValue; - - /// - /// Initializes a new instance of the class. - /// - public AttachedParts() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AttachedParts left, AttachedParts right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AttachedParts left, AttachedParts right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._recordType - marshalSize += 1; // this._detachedIndicator - marshalSize += 2; // this._partAttachedTo - marshalSize += 4; // this._parameterType - marshalSize += 8; // this._parameterValue - return marshalSize; - } - - /// - /// Gets or sets the the identification of the Variable Parameter record. Enumeration from EBV - /// - [XmlElement(Type = typeof(byte), ElementName = "recordType")] - public byte RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the 0 = attached, 1 = detached. See I.2.3.1 for state transition diagram - /// - [XmlElement(Type = typeof(byte), ElementName = "detachedIndicator")] - public byte DetachedIndicator - { - get - { - return this._detachedIndicator; - } - - set - { - this._detachedIndicator = value; - } - } - - /// - /// Gets or sets the the identification of the articulated part to which this articulation parameter is attached. This field shall be specified by a 16-bit unsigned integer. This field shall contain the value zero if the articulated part is attached directly to the entity. - /// - [XmlElement(Type = typeof(ushort), ElementName = "partAttachedTo")] - public ushort PartAttachedTo - { - get - { - return this._partAttachedTo; - } - - set - { - this._partAttachedTo = value; - } - } - - /// - /// Gets or sets the The location or station to which the part is attached - /// - [XmlElement(Type = typeof(uint), ElementName = "parameterType")] - public uint ParameterType - { - get - { - return this._parameterType; - } - - set - { - this._parameterType = value; - } - } - - /// - /// Gets or sets the The definition of the 64 bits shall be determined based on the type of parameter specified in the Parameter Type field - /// - [XmlElement(Type = typeof(ulong), ElementName = "parameterValue")] - public ulong ParameterValue - { - get - { - return this._parameterValue; - } - - set - { - this._parameterValue = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._recordType); - dos.WriteUnsignedByte((byte)this._detachedIndicator); - dos.WriteUnsignedShort((ushort)this._partAttachedTo); - dos.WriteUnsignedInt((uint)this._parameterType); - dos.WriteUnsignedLong((ulong)this._parameterValue); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedByte(); - this._detachedIndicator = dis.ReadUnsignedByte(); - this._partAttachedTo = dis.ReadUnsignedShort(); - this._parameterType = dis.ReadUnsignedInt(); - this._parameterValue = dis.ReadUnsignedLong(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._detachedIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._partAttachedTo.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameterType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameterValue.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AttachedParts; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AttachedParts obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._detachedIndicator != obj._detachedIndicator) - { - ivarsEqual = false; - } - - if (this._partAttachedTo != obj._partAttachedTo) - { - ivarsEqual = false; - } - - if (this._parameterType != obj._parameterType) - { - ivarsEqual = false; - } - - if (this._parameterValue != obj._parameterValue) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._detachedIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._partAttachedTo.GetHashCode(); - result = GenerateHash(result) ^ this._parameterType.GetHashCode(); - result = GenerateHash(result) ^ this._parameterValue.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Attribute.cs b/tests/OpenDisNet.Reference/Generated/Attribute.cs deleted file mode 100644 index af8503c..0000000 --- a/tests/OpenDisNet.Reference/Generated/Attribute.cs +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Used to convey information for one or more attributes. Attributes conform to the standard variable record format of 6.2.82. Section 6.2.11 - /// - [Serializable] - [XmlRoot] - public partial class Attribute - { - private uint _recordType; - - private byte _recordLength; - - private ulong _recordSpecificFields; - - /// - /// Initializes a new instance of the class. - /// - public Attribute() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Attribute left, Attribute right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Attribute left, Attribute right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 1; // this._recordLength - marshalSize += 8; // this._recordSpecificFields - return marshalSize; - } - - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "recordLength")] - public byte RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - [XmlElement(Type = typeof(ulong), ElementName = "recordSpecificFields")] - public ulong RecordSpecificFields - { - get - { - return this._recordSpecificFields; - } - - set - { - this._recordSpecificFields = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedByte((byte)this._recordLength); - dos.WriteUnsignedLong((ulong)this._recordSpecificFields); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedByte(); - this._recordSpecificFields = dis.ReadUnsignedLong(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordSpecificFields.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Attribute; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Attribute obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._recordSpecificFields != obj._recordSpecificFields) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._recordSpecificFields.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/AttributePdu.cs b/tests/OpenDisNet.Reference/Generated/AttributePdu.cs deleted file mode 100644 index 466a155..0000000 --- a/tests/OpenDisNet.Reference/Generated/AttributePdu.cs +++ /dev/null @@ -1,539 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about individual attributes for a particular entity, other object, or event may be communicated using an Attribute PDU. The Attribute PDU shall not be used to exchange data available in any other PDU except where explicitly mentioned in the PDU issuance instructions within this standard. See 5.3.6 for the information requirements and issuance and receipt rules for this PDU. Section 7.2.6. INCOMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class AttributePdu : EntityInformationFamilyPdu, IEquatable - { - /// - /// This field shall identify the simulation issuing the Attribute PDU. It shall be represented by a Simulation Address record (see 6.2.79). - /// - private SimulationAddress _originatingSimulationAddress = new SimulationAddress(); - - /// - /// Padding - /// - private int _padding1; - - /// - /// Padding - /// - private short _padding2; - - /// - /// This field shall represent the type of the PDU that is being extended or updated, if applicable. It shall be represented by an 8-bit enumeration. - /// - private byte _attributeRecordPduType; - - /// - /// This field shall indicate the Protocol Version associated with the Attribute Record PDU Type. It shall be represented by an 8-bit enumeration. - /// - private byte _attributeRecordProtocolVersion; - - /// - /// This field shall contain the Attribute record type of the Attribute records in the PDU if they all have the same Attribute record type. It shall be represented by a 32-bit enumeration. - /// - private uint _masterAttributeRecordType; - - /// - /// This field shall identify the action code applicable to this Attribute PDU. The Action Code shall apply to all Attribute records contained in the PDU. It shall be represented by an 8-bit enumeration. - /// - private byte _actionCode; - - /// - /// Padding - /// - private byte _padding3; - - /// - /// This field shall specify the number of Attribute Record Sets that make up the remainder of the PDU. It shall be represented by a 16-bit unsigned integer. - /// - private ushort _numberAttributeRecordSet; - - /// - /// Initializes a new instance of the class. - /// - public AttributePdu() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(AttributePdu left, AttributePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(AttributePdu left, AttributePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingSimulationAddress.GetMarshalledSize(); // this._originatingSimulationAddress - marshalSize += 4; // this._padding1 - marshalSize += 2; // this._padding2 - marshalSize += 1; // this._attributeRecordPduType - marshalSize += 1; // this._attributeRecordProtocolVersion - marshalSize += 4; // this._masterAttributeRecordType - marshalSize += 1; // this._actionCode - marshalSize += 1; // this._padding3 - marshalSize += 2; // this._numberAttributeRecordSet - return marshalSize; - } - - /// - /// Gets or sets the This field shall identify the simulation issuing the Attribute PDU. It shall be represented by a Simulation Address record (see 6.2.79). - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "originatingSimulationAddress")] - public SimulationAddress OriginatingSimulationAddress - { - get - { - return this._originatingSimulationAddress; - } - - set - { - this._originatingSimulationAddress = value; - } - } - - /// - /// Gets or sets the Padding - /// - [XmlElement(Type = typeof(int), ElementName = "padding1")] - public int Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the Padding - /// - [XmlElement(Type = typeof(short), ElementName = "padding2")] - public short Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Gets or sets the This field shall represent the type of the PDU that is being extended or updated, if applicable. It shall be represented by an 8-bit enumeration. - /// - [XmlElement(Type = typeof(byte), ElementName = "attributeRecordPduType")] - public byte AttributeRecordPduType - { - get - { - return this._attributeRecordPduType; - } - - set - { - this._attributeRecordPduType = value; - } - } - - /// - /// Gets or sets the This field shall indicate the Protocol Version associated with the Attribute Record PDU Type. It shall be represented by an 8-bit enumeration. - /// - [XmlElement(Type = typeof(byte), ElementName = "attributeRecordProtocolVersion")] - public byte AttributeRecordProtocolVersion - { - get - { - return this._attributeRecordProtocolVersion; - } - - set - { - this._attributeRecordProtocolVersion = value; - } - } - - /// - /// Gets or sets the This field shall contain the Attribute record type of the Attribute records in the PDU if they all have the same Attribute record type. It shall be represented by a 32-bit enumeration. - /// - [XmlElement(Type = typeof(uint), ElementName = "masterAttributeRecordType")] - public uint MasterAttributeRecordType - { - get - { - return this._masterAttributeRecordType; - } - - set - { - this._masterAttributeRecordType = value; - } - } - - /// - /// Gets or sets the This field shall identify the action code applicable to this Attribute PDU. The Action Code shall apply to all Attribute records contained in the PDU. It shall be represented by an 8-bit enumeration. - /// - [XmlElement(Type = typeof(byte), ElementName = "actionCode")] - public byte ActionCode - { - get - { - return this._actionCode; - } - - set - { - this._actionCode = value; - } - } - - /// - /// Gets or sets the Padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding3")] - public byte Padding3 - { - get - { - return this._padding3; - } - - set - { - this._padding3 = value; - } - } - - /// - /// Gets or sets the This field shall specify the number of Attribute Record Sets that make up the remainder of the PDU. It shall be represented by a 16-bit unsigned integer. - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberAttributeRecordSet")] - public ushort NumberAttributeRecordSet - { - get - { - return this._numberAttributeRecordSet; - } - - set - { - this._numberAttributeRecordSet = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingSimulationAddress.Marshal(dos); - dos.WriteInt((int)this._padding1); - dos.WriteShort((short)this._padding2); - dos.WriteUnsignedByte((byte)this._attributeRecordPduType); - dos.WriteUnsignedByte((byte)this._attributeRecordProtocolVersion); - dos.WriteUnsignedInt((uint)this._masterAttributeRecordType); - dos.WriteUnsignedByte((byte)this._actionCode); - dos.WriteByte((byte)this._padding3); - dos.WriteUnsignedShort((ushort)this._numberAttributeRecordSet); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingSimulationAddress.Unmarshal(dis); - this._padding1 = dis.ReadInt(); - this._padding2 = dis.ReadShort(); - this._attributeRecordPduType = dis.ReadUnsignedByte(); - this._attributeRecordProtocolVersion = dis.ReadUnsignedByte(); - this._masterAttributeRecordType = dis.ReadUnsignedInt(); - this._actionCode = dis.ReadUnsignedByte(); - this._padding3 = dis.ReadByte(); - this._numberAttributeRecordSet = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingSimulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._attributeRecordPduType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._attributeRecordProtocolVersion.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._masterAttributeRecordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._actionCode.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding3.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._numberAttributeRecordSet.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as AttributePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(AttributePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingSimulationAddress.Equals(obj._originatingSimulationAddress)) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._attributeRecordPduType != obj._attributeRecordPduType) - { - ivarsEqual = false; - } - - if (this._attributeRecordProtocolVersion != obj._attributeRecordProtocolVersion) - { - ivarsEqual = false; - } - - if (this._masterAttributeRecordType != obj._masterAttributeRecordType) - { - ivarsEqual = false; - } - - if (this._actionCode != obj._actionCode) - { - ivarsEqual = false; - } - - if (this._padding3 != obj._padding3) - { - ivarsEqual = false; - } - - if (this._numberAttributeRecordSet != obj._numberAttributeRecordSet) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingSimulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._attributeRecordPduType.GetHashCode(); - result = GenerateHash(result) ^ this._attributeRecordProtocolVersion.GetHashCode(); - result = GenerateHash(result) ^ this._masterAttributeRecordType.GetHashCode(); - result = GenerateHash(result) ^ this._actionCode.GetHashCode(); - result = GenerateHash(result) ^ this._padding3.GetHashCode(); - result = GenerateHash(result) ^ this._numberAttributeRecordSet.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/BeamAntennaPattern.cs b/tests/OpenDisNet.Reference/Generated/BeamAntennaPattern.cs deleted file mode 100644 index 32707ad..0000000 --- a/tests/OpenDisNet.Reference/Generated/BeamAntennaPattern.cs +++ /dev/null @@ -1,538 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Used when the antenna pattern type field has a value of 1. Specifies the direction, pattern, and polarization of radiation from an antenna. Section 6.2.9.2 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EulerAngles))] - public partial class BeamAntennaPattern - { - /// - /// The rotation that transforms the reference coordinate sytem into the beam coordinate system. Either world coordinates or entity coordinates may be used as the reference coordinate system, as specified by the reference system field of the antenna pattern record. - /// - private EulerAngles _beamDirection = new EulerAngles(); - - private float _azimuthBeamwidth; - - private float _elevationBeamwidth; - - private float _referenceSystem; - - private byte _padding1; - - private ushort _padding2; - - /// - /// This field shall specify the magnitude of the Z-component (in beam coordinates) of the Electrical field at some arbitrary single point in the main beam and in the far field of the antenna. - /// - private float _ez = 0.0F; - - /// - /// This field shall specify the magnitude of the X-component (in beam coordinates) of the Electri- cal field at some arbitrary single point in the main beam and in the far field of the antenna. - /// - private float _ex = 0.0F; - - /// - /// This field shall specify the phase angle between EZ and EX in radians. If fully omni-direc- tional antenna is modeled using beam pattern type one, the omni-directional antenna shall be repre- sented by beam direction Euler angles psi, theta, and phi of zero, an azimuth beamwidth of 2PI, and an elevation beamwidth of PI - /// - private float _phase = 0.0F; - - /// - /// padding - /// - private uint _padding3; - - /// - /// Initializes a new instance of the class. - /// - public BeamAntennaPattern() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(BeamAntennaPattern left, BeamAntennaPattern right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(BeamAntennaPattern left, BeamAntennaPattern right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._beamDirection.GetMarshalledSize(); // this._beamDirection - marshalSize += 4; // this._azimuthBeamwidth - marshalSize += 4; // this._elevationBeamwidth - marshalSize += 4; // this._referenceSystem - marshalSize += 1; // this._padding1 - marshalSize += 2; // this._padding2 - marshalSize += 4; // this._ez - marshalSize += 4; // this._ex - marshalSize += 4; // this._phase - marshalSize += 4; // this._padding3 - return marshalSize; - } - - /// - /// Gets or sets the The rotation that transforms the reference coordinate sytem into the beam coordinate system. Either world coordinates or entity coordinates may be used as the reference coordinate system, as specified by the reference system field of the antenna pattern record. - /// - [XmlElement(Type = typeof(EulerAngles), ElementName = "beamDirection")] - public EulerAngles BeamDirection - { - get - { - return this._beamDirection; - } - - set - { - this._beamDirection = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "azimuthBeamwidth")] - public float AzimuthBeamwidth - { - get - { - return this._azimuthBeamwidth; - } - - set - { - this._azimuthBeamwidth = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "elevationBeamwidth")] - public float ElevationBeamwidth - { - get - { - return this._elevationBeamwidth; - } - - set - { - this._elevationBeamwidth = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "referenceSystem")] - public float ReferenceSystem - { - get - { - return this._referenceSystem; - } - - set - { - this._referenceSystem = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "padding1")] - public byte Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "padding2")] - public ushort Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Gets or sets the This field shall specify the magnitude of the Z-component (in beam coordinates) of the Electrical field at some arbitrary single point in the main beam and in the far field of the antenna. - /// - [XmlElement(Type = typeof(float), ElementName = "ez")] - public float Ez - { - get - { - return this._ez; - } - - set - { - this._ez = value; - } - } - - /// - /// Gets or sets the This field shall specify the magnitude of the X-component (in beam coordinates) of the Electri- cal field at some arbitrary single point in the main beam and in the far field of the antenna. - /// - [XmlElement(Type = typeof(float), ElementName = "ex")] - public float Ex - { - get - { - return this._ex; - } - - set - { - this._ex = value; - } - } - - /// - /// Gets or sets the This field shall specify the phase angle between EZ and EX in radians. If fully omni-direc- tional antenna is modeled using beam pattern type one, the omni-directional antenna shall be repre- sented by beam direction Euler angles psi, theta, and phi of zero, an azimuth beamwidth of 2PI, and an elevation beamwidth of PI - /// - [XmlElement(Type = typeof(float), ElementName = "phase")] - public float Phase - { - get - { - return this._phase; - } - - set - { - this._phase = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(uint), ElementName = "padding3")] - public uint Padding3 - { - get - { - return this._padding3; - } - - set - { - this._padding3 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._beamDirection.Marshal(dos); - dos.WriteFloat((float)this._azimuthBeamwidth); - dos.WriteFloat((float)this._elevationBeamwidth); - dos.WriteFloat((float)this._referenceSystem); - dos.WriteUnsignedByte((byte)this._padding1); - dos.WriteUnsignedShort((ushort)this._padding2); - dos.WriteFloat((float)this._ez); - dos.WriteFloat((float)this._ex); - dos.WriteFloat((float)this._phase); - dos.WriteUnsignedInt((uint)this._padding3); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._beamDirection.Unmarshal(dis); - this._azimuthBeamwidth = dis.ReadFloat(); - this._elevationBeamwidth = dis.ReadFloat(); - this._referenceSystem = dis.ReadFloat(); - this._padding1 = dis.ReadUnsignedByte(); - this._padding2 = dis.ReadUnsignedShort(); - this._ez = dis.ReadFloat(); - this._ex = dis.ReadFloat(); - this._phase = dis.ReadFloat(); - this._padding3 = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._beamDirection.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._azimuthBeamwidth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._elevationBeamwidth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._referenceSystem.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._ez.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._ex.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._phase.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding3.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as BeamAntennaPattern; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(BeamAntennaPattern obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._beamDirection.Equals(obj._beamDirection)) - { - ivarsEqual = false; - } - - if (this._azimuthBeamwidth != obj._azimuthBeamwidth) - { - ivarsEqual = false; - } - - if (this._elevationBeamwidth != obj._elevationBeamwidth) - { - ivarsEqual = false; - } - - if (this._referenceSystem != obj._referenceSystem) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._ez != obj._ez) - { - ivarsEqual = false; - } - - if (this._ex != obj._ex) - { - ivarsEqual = false; - } - - if (this._phase != obj._phase) - { - ivarsEqual = false; - } - - if (this._padding3 != obj._padding3) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._beamDirection.GetHashCode(); - result = GenerateHash(result) ^ this._azimuthBeamwidth.GetHashCode(); - result = GenerateHash(result) ^ this._elevationBeamwidth.GetHashCode(); - result = GenerateHash(result) ^ this._referenceSystem.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._ez.GetHashCode(); - result = GenerateHash(result) ^ this._ex.GetHashCode(); - result = GenerateHash(result) ^ this._phase.GetHashCode(); - result = GenerateHash(result) ^ this._padding3.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/BeamData.cs b/tests/OpenDisNet.Reference/Generated/BeamData.cs deleted file mode 100644 index ccbe7a7..0000000 --- a/tests/OpenDisNet.Reference/Generated/BeamData.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Describes the scan volue of an emitter beam. Section 6.2.13. - /// - [Serializable] - [XmlRoot] - public partial class BeamData - { - /// - /// Specifies the beam azimuth an elevation centers and corresponding half-angles to describe the scan volume - /// - private float _beamAzimuthCenter; - - /// - /// Specifies the beam azimuth sweep to determine scan volume - /// - private float _beamAzimuthSweep; - - /// - /// Specifies the beam elevation center to determine scan volume - /// - private float _beamElevationCenter; - - /// - /// Specifies the beam elevation sweep to determine scan volume - /// - private float _beamElevationSweep; - - /// - /// allows receiver to synchronize its regenerated scan pattern to that of the emmitter. Specifies the percentage of time a scan is through its pattern from its origion. - /// - private float _beamSweepSync; - - /// - /// Initializes a new instance of the class. - /// - public BeamData() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(BeamData left, BeamData right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(BeamData left, BeamData right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._beamAzimuthCenter - marshalSize += 4; // this._beamAzimuthSweep - marshalSize += 4; // this._beamElevationCenter - marshalSize += 4; // this._beamElevationSweep - marshalSize += 4; // this._beamSweepSync - return marshalSize; - } - - /// - /// Gets or sets the Specifies the beam azimuth an elevation centers and corresponding half-angles to describe the scan volume - /// - [XmlElement(Type = typeof(float), ElementName = "beamAzimuthCenter")] - public float BeamAzimuthCenter - { - get - { - return this._beamAzimuthCenter; - } - - set - { - this._beamAzimuthCenter = value; - } - } - - /// - /// Gets or sets the Specifies the beam azimuth sweep to determine scan volume - /// - [XmlElement(Type = typeof(float), ElementName = "beamAzimuthSweep")] - public float BeamAzimuthSweep - { - get - { - return this._beamAzimuthSweep; - } - - set - { - this._beamAzimuthSweep = value; - } - } - - /// - /// Gets or sets the Specifies the beam elevation center to determine scan volume - /// - [XmlElement(Type = typeof(float), ElementName = "beamElevationCenter")] - public float BeamElevationCenter - { - get - { - return this._beamElevationCenter; - } - - set - { - this._beamElevationCenter = value; - } - } - - /// - /// Gets or sets the Specifies the beam elevation sweep to determine scan volume - /// - [XmlElement(Type = typeof(float), ElementName = "beamElevationSweep")] - public float BeamElevationSweep - { - get - { - return this._beamElevationSweep; - } - - set - { - this._beamElevationSweep = value; - } - } - - /// - /// Gets or sets the allows receiver to synchronize its regenerated scan pattern to that of the emmitter. Specifies the percentage of time a scan is through its pattern from its origion. - /// - [XmlElement(Type = typeof(float), ElementName = "beamSweepSync")] - public float BeamSweepSync - { - get - { - return this._beamSweepSync; - } - - set - { - this._beamSweepSync = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._beamAzimuthCenter); - dos.WriteFloat((float)this._beamAzimuthSweep); - dos.WriteFloat((float)this._beamElevationCenter); - dos.WriteFloat((float)this._beamElevationSweep); - dos.WriteFloat((float)this._beamSweepSync); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._beamAzimuthCenter = dis.ReadFloat(); - this._beamAzimuthSweep = dis.ReadFloat(); - this._beamElevationCenter = dis.ReadFloat(); - this._beamElevationSweep = dis.ReadFloat(); - this._beamSweepSync = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._beamAzimuthCenter.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamAzimuthSweep.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamElevationCenter.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamElevationSweep.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamSweepSync.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as BeamData; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(BeamData obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._beamAzimuthCenter != obj._beamAzimuthCenter) - { - ivarsEqual = false; - } - - if (this._beamAzimuthSweep != obj._beamAzimuthSweep) - { - ivarsEqual = false; - } - - if (this._beamElevationCenter != obj._beamElevationCenter) - { - ivarsEqual = false; - } - - if (this._beamElevationSweep != obj._beamElevationSweep) - { - ivarsEqual = false; - } - - if (this._beamSweepSync != obj._beamSweepSync) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._beamAzimuthCenter.GetHashCode(); - result = GenerateHash(result) ^ this._beamAzimuthSweep.GetHashCode(); - result = GenerateHash(result) ^ this._beamElevationCenter.GetHashCode(); - result = GenerateHash(result) ^ this._beamElevationSweep.GetHashCode(); - result = GenerateHash(result) ^ this._beamSweepSync.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/BeamStatus.cs b/tests/OpenDisNet.Reference/Generated/BeamStatus.cs deleted file mode 100644 index 44d9960..0000000 --- a/tests/OpenDisNet.Reference/Generated/BeamStatus.cs +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information related to the status of a beam. This is contained in the beam status field of the electromagnitec emission PDU. The first bit determines whether the beam is active (0) or deactivated (1). - /// - [Serializable] - [XmlRoot] - public partial class BeamStatus - { - /// - /// First bit zero means beam is active, first bit = 1 means deactivated. The rest is padding. - /// - private byte _beamState; - - /// - /// Initializes a new instance of the class. - /// - public BeamStatus() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(BeamStatus left, BeamStatus right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(BeamStatus left, BeamStatus right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._beamState - return marshalSize; - } - - /// - /// Gets or sets the First bit zero means beam is active, first bit = 1 means deactivated. The rest is padding. - /// - [XmlElement(Type = typeof(byte), ElementName = "beamState")] - public byte BeamState - { - get - { - return this._beamState; - } - - set - { - this._beamState = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._beamState); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._beamState = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._beamState.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as BeamStatus; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(BeamStatus obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._beamState != obj._beamState) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._beamState.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/BlankingSector.cs b/tests/OpenDisNet.Reference/Generated/BlankingSector.cs deleted file mode 100644 index f257d78..0000000 --- a/tests/OpenDisNet.Reference/Generated/BlankingSector.cs +++ /dev/null @@ -1,505 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The Blanking Sector attribute record may be used to convey persistent areas within a scan volume where emitter power for a specific active emitter beam is reduced to an insignificant value. Section 6.2.12 - /// - [Serializable] - [XmlRoot] - public partial class BlankingSector - { - private uint _recordType = 3500; - - private ushort _recordLength; - - private byte _emitterNumber; - - private byte _beamNumber; - - private byte _stateIndicator; - - private float _leftAzimuth; - - private float _rightAzimuth; - - private float _lowerElevation; - - private float _upperElevation; - - private float _residualPower; - - /// - /// Initializes a new instance of the class. - /// - public BlankingSector() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(BlankingSector left, BlankingSector right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(BlankingSector left, BlankingSector right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 1; // this._emitterNumber - marshalSize += 1; // this._beamNumber - marshalSize += 1; // this._stateIndicator - marshalSize += 4; // this._leftAzimuth - marshalSize += 4; // this._rightAzimuth - marshalSize += 4; // this._lowerElevation - marshalSize += 4; // this._upperElevation - marshalSize += 4; // this._residualPower - return marshalSize; - } - - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "emitterNumber")] - public byte EmitterNumber - { - get - { - return this._emitterNumber; - } - - set - { - this._emitterNumber = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "beamNumber")] - public byte BeamNumber - { - get - { - return this._beamNumber; - } - - set - { - this._beamNumber = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "stateIndicator")] - public byte StateIndicator - { - get - { - return this._stateIndicator; - } - - set - { - this._stateIndicator = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "leftAzimuth")] - public float LeftAzimuth - { - get - { - return this._leftAzimuth; - } - - set - { - this._leftAzimuth = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "rightAzimuth")] - public float RightAzimuth - { - get - { - return this._rightAzimuth; - } - - set - { - this._rightAzimuth = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "lowerElevation")] - public float LowerElevation - { - get - { - return this._lowerElevation; - } - - set - { - this._lowerElevation = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "upperElevation")] - public float UpperElevation - { - get - { - return this._upperElevation; - } - - set - { - this._upperElevation = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "residualPower")] - public float ResidualPower - { - get - { - return this._residualPower; - } - - set - { - this._residualPower = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedByte((byte)this._emitterNumber); - dos.WriteUnsignedByte((byte)this._beamNumber); - dos.WriteUnsignedByte((byte)this._stateIndicator); - dos.WriteFloat((float)this._leftAzimuth); - dos.WriteFloat((float)this._rightAzimuth); - dos.WriteFloat((float)this._lowerElevation); - dos.WriteFloat((float)this._upperElevation); - dos.WriteFloat((float)this._residualPower); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._emitterNumber = dis.ReadUnsignedByte(); - this._beamNumber = dis.ReadUnsignedByte(); - this._stateIndicator = dis.ReadUnsignedByte(); - this._leftAzimuth = dis.ReadFloat(); - this._rightAzimuth = dis.ReadFloat(); - this._lowerElevation = dis.ReadFloat(); - this._upperElevation = dis.ReadFloat(); - this._residualPower = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._emitterNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._stateIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._leftAzimuth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._rightAzimuth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._lowerElevation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._upperElevation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._residualPower.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as BlankingSector; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(BlankingSector obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._emitterNumber != obj._emitterNumber) - { - ivarsEqual = false; - } - - if (this._beamNumber != obj._beamNumber) - { - ivarsEqual = false; - } - - if (this._stateIndicator != obj._stateIndicator) - { - ivarsEqual = false; - } - - if (this._leftAzimuth != obj._leftAzimuth) - { - ivarsEqual = false; - } - - if (this._rightAzimuth != obj._rightAzimuth) - { - ivarsEqual = false; - } - - if (this._lowerElevation != obj._lowerElevation) - { - ivarsEqual = false; - } - - if (this._upperElevation != obj._upperElevation) - { - ivarsEqual = false; - } - - if (this._residualPower != obj._residualPower) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._emitterNumber.GetHashCode(); - result = GenerateHash(result) ^ this._beamNumber.GetHashCode(); - result = GenerateHash(result) ^ this._stateIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._leftAzimuth.GetHashCode(); - result = GenerateHash(result) ^ this._rightAzimuth.GetHashCode(); - result = GenerateHash(result) ^ this._lowerElevation.GetHashCode(); - result = GenerateHash(result) ^ this._upperElevation.GetHashCode(); - result = GenerateHash(result) ^ this._residualPower.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ChangeOptions.cs b/tests/OpenDisNet.Reference/Generated/ChangeOptions.cs deleted file mode 100644 index 92faa76..0000000 --- a/tests/OpenDisNet.Reference/Generated/ChangeOptions.cs +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// This is wrong and breaks serialization. See section 6.2.15 aka B.2.41 - /// - [Serializable] - [XmlRoot] - public partial class ChangeOptions - { - /// - /// Initializes a new instance of the class. - /// - public ChangeOptions() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ChangeOptions left, ChangeOptions right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ChangeOptions left, ChangeOptions right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - return marshalSize; - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ChangeOptions; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ChangeOptions obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ClockTime.cs b/tests/OpenDisNet.Reference/Generated/ClockTime.cs deleted file mode 100644 index a7348fd..0000000 --- a/tests/OpenDisNet.Reference/Generated/ClockTime.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Time measurements that exceed one hour are represented by this record. The first field is the hours since the unix epoch (Jan 1 1970, used by most Unix systems and java) and the second field the timestamp units since the top of the hour. Section 6.2.16 - /// - [Serializable] - [XmlRoot] - public partial class ClockTime - { - /// - /// Hours in UTC - /// - private uint _hour; - - /// - /// Time past the hour - /// - private uint _timePastHour; - - /// - /// Initializes a new instance of the class. - /// - public ClockTime() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ClockTime left, ClockTime right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ClockTime left, ClockTime right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._hour - marshalSize += 4; // this._timePastHour - return marshalSize; - } - - /// - /// Gets or sets the Hours in UTC - /// - [XmlElement(Type = typeof(uint), ElementName = "hour")] - public uint Hour - { - get - { - return this._hour; - } - - set - { - this._hour = value; - } - } - - /// - /// Gets or sets the Time past the hour - /// - [XmlElement(Type = typeof(uint), ElementName = "timePastHour")] - public uint TimePastHour - { - get - { - return this._timePastHour; - } - - set - { - this._timePastHour = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._hour); - dos.WriteUnsignedInt((uint)this._timePastHour); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._hour = dis.ReadUnsignedInt(); - this._timePastHour = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._hour.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._timePastHour.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ClockTime; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ClockTime obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._hour != obj._hour) - { - ivarsEqual = false; - } - - if (this._timePastHour != obj._timePastHour) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._hour.GetHashCode(); - result = GenerateHash(result) ^ this._timePastHour.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/CollisionElasticPdu.cs b/tests/OpenDisNet.Reference/Generated/CollisionElasticPdu.cs deleted file mode 100644 index 892252d..0000000 --- a/tests/OpenDisNet.Reference/Generated/CollisionElasticPdu.cs +++ /dev/null @@ -1,745 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about elastic collisions in a DIS exercise shall be communicated using a Collision-Elastic PDU. Section 7.2.4. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EventIdentifier))] - [XmlInclude(typeof(Vector3Float))] - public partial class CollisionElasticPdu : EntityInformationFamilyPdu, IEquatable - { - /// - /// This field shall identify the entity that is issuing the PDU and shall be represented by an Entity Identifier record (see 6.2.28) - /// - private EntityID _issuingEntityID = new EntityID(); - - /// - /// This field shall identify the entity that has collided with the issuing entity. This field shall be a valid identifier of an entity or server capable of responding to the receipt of this Collision-Elastic PDU. This field shall be represented by an Entity Identifier record (see 6.2.28). - /// - private EntityID _collidingEntityID = new EntityID(); - - /// - /// This field shall contain an identification generated by the issuing simulation application to associate related collision events. This field shall be represented by an Event Identifier record (see 6.2.34). - /// - private EventIdentifier _collisionEventID = new EventIdentifier(); - - /// - /// some padding - /// - private short _pad; - - /// - /// This field shall contain the velocity at the time the collision is detected at the point the collision is detected. The velocity shall be represented in world coordinates. This field shall be represented by the Linear Velocity Vector record [see 6.2.95 item c)] - /// - private Vector3Float _contactVelocity = new Vector3Float(); - - /// - /// This field shall contain the mass of the issuing entity and shall be represented by a 32-bit floating point number representing kilograms - /// - private float _mass; - - /// - /// This field shall specify the location of the collision with respect to the entity with which the issuing entity collided. This field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. - /// - private Vector3Float _locationOfImpact = new Vector3Float(); - - /// - /// These six records represent the six independent components of a positive semi-definite matrix formed by pre-multiplying and post-multiplying the tensor of inertia, by the anti-symmetric matrix generated by the moment arm, and shall be represented by 32-bit floating point numbers (see 5.3.4.4) - /// - private float _collisionIntermediateResultXX; - - /// - /// tensor values - /// - private float _collisionIntermediateResultXY; - - /// - /// tensor values - /// - private float _collisionIntermediateResultXZ; - - /// - /// tensor values - /// - private float _collisionIntermediateResultYY; - - /// - /// tensor values - /// - private float _collisionIntermediateResultYZ; - - /// - /// tensor values - /// - private float _collisionIntermediateResultZZ; - - /// - /// This record shall represent the normal vector to the surface at the point of collision detection. The surface normal shall be represented in world coordinates. This field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. - /// - private Vector3Float _unitSurfaceNormal = new Vector3Float(); - - /// - /// This field shall represent the degree to which energy is conserved in a collision and shall be represented by a 32-bit floating point number. In addition, it represents a free parameter by which simulation application developers may “tune” their collision interactions. - /// - private float _coefficientOfRestitution; - - /// - /// Initializes a new instance of the class. - /// - public CollisionElasticPdu() - { - PduType = (byte)66; - ProtocolFamily = (byte)1; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(CollisionElasticPdu left, CollisionElasticPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(CollisionElasticPdu left, CollisionElasticPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._issuingEntityID.GetMarshalledSize(); // this._issuingEntityID - marshalSize += this._collidingEntityID.GetMarshalledSize(); // this._collidingEntityID - marshalSize += this._collisionEventID.GetMarshalledSize(); // this._collisionEventID - marshalSize += 2; // this._pad - marshalSize += this._contactVelocity.GetMarshalledSize(); // this._contactVelocity - marshalSize += 4; // this._mass - marshalSize += this._locationOfImpact.GetMarshalledSize(); // this._locationOfImpact - marshalSize += 4; // this._collisionIntermediateResultXX - marshalSize += 4; // this._collisionIntermediateResultXY - marshalSize += 4; // this._collisionIntermediateResultXZ - marshalSize += 4; // this._collisionIntermediateResultYY - marshalSize += 4; // this._collisionIntermediateResultYZ - marshalSize += 4; // this._collisionIntermediateResultZZ - marshalSize += this._unitSurfaceNormal.GetMarshalledSize(); // this._unitSurfaceNormal - marshalSize += 4; // this._coefficientOfRestitution - return marshalSize; - } - - /// - /// Gets or sets the This field shall identify the entity that is issuing the PDU and shall be represented by an Entity Identifier record (see 6.2.28) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "issuingEntityID")] - public EntityID IssuingEntityID - { - get - { - return this._issuingEntityID; - } - - set - { - this._issuingEntityID = value; - } - } - - /// - /// Gets or sets the This field shall identify the entity that has collided with the issuing entity. This field shall be a valid identifier of an entity or server capable of responding to the receipt of this Collision-Elastic PDU. This field shall be represented by an Entity Identifier record (see 6.2.28). - /// - [XmlElement(Type = typeof(EntityID), ElementName = "collidingEntityID")] - public EntityID CollidingEntityID - { - get - { - return this._collidingEntityID; - } - - set - { - this._collidingEntityID = value; - } - } - - /// - /// Gets or sets the This field shall contain an identification generated by the issuing simulation application to associate related collision events. This field shall be represented by an Event Identifier record (see 6.2.34). - /// - [XmlElement(Type = typeof(EventIdentifier), ElementName = "collisionEventID")] - public EventIdentifier CollisionEventID - { - get - { - return this._collisionEventID; - } - - set - { - this._collisionEventID = value; - } - } - - /// - /// Gets or sets the some padding - /// - [XmlElement(Type = typeof(short), ElementName = "pad")] - public short Pad - { - get - { - return this._pad; - } - - set - { - this._pad = value; - } - } - - /// - /// Gets or sets the This field shall contain the velocity at the time the collision is detected at the point the collision is detected. The velocity shall be represented in world coordinates. This field shall be represented by the Linear Velocity Vector record [see 6.2.95 item c)] - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "contactVelocity")] - public Vector3Float ContactVelocity - { - get - { - return this._contactVelocity; - } - - set - { - this._contactVelocity = value; - } - } - - /// - /// Gets or sets the This field shall contain the mass of the issuing entity and shall be represented by a 32-bit floating point number representing kilograms - /// - [XmlElement(Type = typeof(float), ElementName = "mass")] - public float Mass - { - get - { - return this._mass; - } - - set - { - this._mass = value; - } - } - - /// - /// Gets or sets the This field shall specify the location of the collision with respect to the entity with which the issuing entity collided. This field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "locationOfImpact")] - public Vector3Float LocationOfImpact - { - get - { - return this._locationOfImpact; - } - - set - { - this._locationOfImpact = value; - } - } - - /// - /// Gets or sets the These six records represent the six independent components of a positive semi-definite matrix formed by pre-multiplying and post-multiplying the tensor of inertia, by the anti-symmetric matrix generated by the moment arm, and shall be represented by 32-bit floating point numbers (see 5.3.4.4) - /// - [XmlElement(Type = typeof(float), ElementName = "collisionIntermediateResultXX")] - public float CollisionIntermediateResultXX - { - get - { - return this._collisionIntermediateResultXX; - } - - set - { - this._collisionIntermediateResultXX = value; - } - } - - /// - /// Gets or sets the tensor values - /// - [XmlElement(Type = typeof(float), ElementName = "collisionIntermediateResultXY")] - public float CollisionIntermediateResultXY - { - get - { - return this._collisionIntermediateResultXY; - } - - set - { - this._collisionIntermediateResultXY = value; - } - } - - /// - /// Gets or sets the tensor values - /// - [XmlElement(Type = typeof(float), ElementName = "collisionIntermediateResultXZ")] - public float CollisionIntermediateResultXZ - { - get - { - return this._collisionIntermediateResultXZ; - } - - set - { - this._collisionIntermediateResultXZ = value; - } - } - - /// - /// Gets or sets the tensor values - /// - [XmlElement(Type = typeof(float), ElementName = "collisionIntermediateResultYY")] - public float CollisionIntermediateResultYY - { - get - { - return this._collisionIntermediateResultYY; - } - - set - { - this._collisionIntermediateResultYY = value; - } - } - - /// - /// Gets or sets the tensor values - /// - [XmlElement(Type = typeof(float), ElementName = "collisionIntermediateResultYZ")] - public float CollisionIntermediateResultYZ - { - get - { - return this._collisionIntermediateResultYZ; - } - - set - { - this._collisionIntermediateResultYZ = value; - } - } - - /// - /// Gets or sets the tensor values - /// - [XmlElement(Type = typeof(float), ElementName = "collisionIntermediateResultZZ")] - public float CollisionIntermediateResultZZ - { - get - { - return this._collisionIntermediateResultZZ; - } - - set - { - this._collisionIntermediateResultZZ = value; - } - } - - /// - /// Gets or sets the This record shall represent the normal vector to the surface at the point of collision detection. The surface normal shall be represented in world coordinates. This field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "unitSurfaceNormal")] - public Vector3Float UnitSurfaceNormal - { - get - { - return this._unitSurfaceNormal; - } - - set - { - this._unitSurfaceNormal = value; - } - } - - /// - /// Gets or sets the This field shall represent the degree to which energy is conserved in a collision and shall be represented by a 32-bit floating point number. In addition, it represents a free parameter by which simulation application developers may “tune” their collision interactions. - /// - [XmlElement(Type = typeof(float), ElementName = "coefficientOfRestitution")] - public float CoefficientOfRestitution - { - get - { - return this._coefficientOfRestitution; - } - - set - { - this._coefficientOfRestitution = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._issuingEntityID.Marshal(dos); - this._collidingEntityID.Marshal(dos); - this._collisionEventID.Marshal(dos); - dos.WriteShort((short)this._pad); - this._contactVelocity.Marshal(dos); - dos.WriteFloat((float)this._mass); - this._locationOfImpact.Marshal(dos); - dos.WriteFloat((float)this._collisionIntermediateResultXX); - dos.WriteFloat((float)this._collisionIntermediateResultXY); - dos.WriteFloat((float)this._collisionIntermediateResultXZ); - dos.WriteFloat((float)this._collisionIntermediateResultYY); - dos.WriteFloat((float)this._collisionIntermediateResultYZ); - dos.WriteFloat((float)this._collisionIntermediateResultZZ); - this._unitSurfaceNormal.Marshal(dos); - dos.WriteFloat((float)this._coefficientOfRestitution); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._issuingEntityID.Unmarshal(dis); - this._collidingEntityID.Unmarshal(dis); - this._collisionEventID.Unmarshal(dis); - this._pad = dis.ReadShort(); - this._contactVelocity.Unmarshal(dis); - this._mass = dis.ReadFloat(); - this._locationOfImpact.Unmarshal(dis); - this._collisionIntermediateResultXX = dis.ReadFloat(); - this._collisionIntermediateResultXY = dis.ReadFloat(); - this._collisionIntermediateResultXZ = dis.ReadFloat(); - this._collisionIntermediateResultYY = dis.ReadFloat(); - this._collisionIntermediateResultYZ = dis.ReadFloat(); - this._collisionIntermediateResultZZ = dis.ReadFloat(); - this._unitSurfaceNormal.Unmarshal(dis); - this._coefficientOfRestitution = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._issuingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._collidingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._collisionEventID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._pad.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._contactVelocity.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._mass.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._locationOfImpact.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._collisionIntermediateResultXX.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._collisionIntermediateResultXY.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._collisionIntermediateResultXZ.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._collisionIntermediateResultYY.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._collisionIntermediateResultYZ.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._collisionIntermediateResultZZ.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._unitSurfaceNormal.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._coefficientOfRestitution.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as CollisionElasticPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(CollisionElasticPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._issuingEntityID.Equals(obj._issuingEntityID)) - { - ivarsEqual = false; - } - - if (!this._collidingEntityID.Equals(obj._collidingEntityID)) - { - ivarsEqual = false; - } - - if (!this._collisionEventID.Equals(obj._collisionEventID)) - { - ivarsEqual = false; - } - - if (this._pad != obj._pad) - { - ivarsEqual = false; - } - - if (!this._contactVelocity.Equals(obj._contactVelocity)) - { - ivarsEqual = false; - } - - if (this._mass != obj._mass) - { - ivarsEqual = false; - } - - if (!this._locationOfImpact.Equals(obj._locationOfImpact)) - { - ivarsEqual = false; - } - - if (this._collisionIntermediateResultXX != obj._collisionIntermediateResultXX) - { - ivarsEqual = false; - } - - if (this._collisionIntermediateResultXY != obj._collisionIntermediateResultXY) - { - ivarsEqual = false; - } - - if (this._collisionIntermediateResultXZ != obj._collisionIntermediateResultXZ) - { - ivarsEqual = false; - } - - if (this._collisionIntermediateResultYY != obj._collisionIntermediateResultYY) - { - ivarsEqual = false; - } - - if (this._collisionIntermediateResultYZ != obj._collisionIntermediateResultYZ) - { - ivarsEqual = false; - } - - if (this._collisionIntermediateResultZZ != obj._collisionIntermediateResultZZ) - { - ivarsEqual = false; - } - - if (!this._unitSurfaceNormal.Equals(obj._unitSurfaceNormal)) - { - ivarsEqual = false; - } - - if (this._coefficientOfRestitution != obj._coefficientOfRestitution) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._issuingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._collidingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._collisionEventID.GetHashCode(); - result = GenerateHash(result) ^ this._pad.GetHashCode(); - result = GenerateHash(result) ^ this._contactVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._mass.GetHashCode(); - result = GenerateHash(result) ^ this._locationOfImpact.GetHashCode(); - result = GenerateHash(result) ^ this._collisionIntermediateResultXX.GetHashCode(); - result = GenerateHash(result) ^ this._collisionIntermediateResultXY.GetHashCode(); - result = GenerateHash(result) ^ this._collisionIntermediateResultXZ.GetHashCode(); - result = GenerateHash(result) ^ this._collisionIntermediateResultYY.GetHashCode(); - result = GenerateHash(result) ^ this._collisionIntermediateResultYZ.GetHashCode(); - result = GenerateHash(result) ^ this._collisionIntermediateResultZZ.GetHashCode(); - result = GenerateHash(result) ^ this._unitSurfaceNormal.GetHashCode(); - result = GenerateHash(result) ^ this._coefficientOfRestitution.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/CollisionPdu.cs b/tests/OpenDisNet.Reference/Generated/CollisionPdu.cs deleted file mode 100644 index c4d4e5a..0000000 --- a/tests/OpenDisNet.Reference/Generated/CollisionPdu.cs +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.2.3 Collisions between entities shall be communicated by issuing a Collision PDU. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EventIdentifier))] - [XmlInclude(typeof(Vector3Float))] - public partial class CollisionPdu : EntityInformationFamilyPdu, IEquatable - { - /// - /// This field shall identify the entity that is issuing the PDU, and shall be represented by an Entity Identifier record (see 6.2.28). - /// - private EntityID _issuingEntityID = new EntityID(); - - /// - /// This field shall identify the entity that has collided with the issuing entity (see 5.3.3.4). This field shall be represented by an Entity Identifier record (see 6.2.28). - /// - private EntityID _collidingEntityID = new EntityID(); - - /// - /// This field shall contain an identification generated by the issuing simulation application to associate related collision events. This field shall be represented by an Event Identifier record (see 6.2.34). - /// - private EventIdentifier _eventID = new EventIdentifier(); - - /// - /// This field shall identify the type of collision. The Collision Type field shall be represented by an 8-bit record of enumerations - /// - private byte _collisionType; - - /// - /// some padding - /// - private byte _pad; - - /// - /// This field shall contain the velocity (at the time the collision is detected) of the issuing entity. The velocity shall be represented in world coordinates. This field shall be represented by the Linear Velocity Vector record [see 6.2.95 item c)]. - /// - private Vector3Float _velocity = new Vector3Float(); - - /// - /// This field shall contain the mass of the issuing entity, and shall be represented by a 32-bit floating point number representing kilograms. - /// - private float _mass; - - /// - /// This field shall specify the location of the collision with respect to the entity with which the issuing entity collided. The Location field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. - /// - private Vector3Float _location = new Vector3Float(); - - /// - /// Initializes a new instance of the class. - /// - public CollisionPdu() - { - PduType = (byte)4; - ProtocolFamily = (byte)1; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(CollisionPdu left, CollisionPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(CollisionPdu left, CollisionPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._issuingEntityID.GetMarshalledSize(); // this._issuingEntityID - marshalSize += this._collidingEntityID.GetMarshalledSize(); // this._collidingEntityID - marshalSize += this._eventID.GetMarshalledSize(); // this._eventID - marshalSize += 1; // this._collisionType - marshalSize += 1; // this._pad - marshalSize += this._velocity.GetMarshalledSize(); // this._velocity - marshalSize += 4; // this._mass - marshalSize += this._location.GetMarshalledSize(); // this._location - return marshalSize; - } - - /// - /// Gets or sets the This field shall identify the entity that is issuing the PDU, and shall be represented by an Entity Identifier record (see 6.2.28). - /// - [XmlElement(Type = typeof(EntityID), ElementName = "issuingEntityID")] - public EntityID IssuingEntityID - { - get - { - return this._issuingEntityID; - } - - set - { - this._issuingEntityID = value; - } - } - - /// - /// Gets or sets the This field shall identify the entity that has collided with the issuing entity (see 5.3.3.4). This field shall be represented by an Entity Identifier record (see 6.2.28). - /// - [XmlElement(Type = typeof(EntityID), ElementName = "collidingEntityID")] - public EntityID CollidingEntityID - { - get - { - return this._collidingEntityID; - } - - set - { - this._collidingEntityID = value; - } - } - - /// - /// Gets or sets the This field shall contain an identification generated by the issuing simulation application to associate related collision events. This field shall be represented by an Event Identifier record (see 6.2.34). - /// - [XmlElement(Type = typeof(EventIdentifier), ElementName = "eventID")] - public EventIdentifier EventID - { - get - { - return this._eventID; - } - - set - { - this._eventID = value; - } - } - - /// - /// Gets or sets the This field shall identify the type of collision. The Collision Type field shall be represented by an 8-bit record of enumerations - /// - [XmlElement(Type = typeof(byte), ElementName = "collisionType")] - public byte CollisionType - { - get - { - return this._collisionType; - } - - set - { - this._collisionType = value; - } - } - - /// - /// Gets or sets the some padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad")] - public byte Pad - { - get - { - return this._pad; - } - - set - { - this._pad = value; - } - } - - /// - /// Gets or sets the This field shall contain the velocity (at the time the collision is detected) of the issuing entity. The velocity shall be represented in world coordinates. This field shall be represented by the Linear Velocity Vector record [see 6.2.95 item c)]. - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "velocity")] - public Vector3Float Velocity - { - get - { - return this._velocity; - } - - set - { - this._velocity = value; - } - } - - /// - /// Gets or sets the This field shall contain the mass of the issuing entity, and shall be represented by a 32-bit floating point number representing kilograms. - /// - [XmlElement(Type = typeof(float), ElementName = "mass")] - public float Mass - { - get - { - return this._mass; - } - - set - { - this._mass = value; - } - } - - /// - /// Gets or sets the This field shall specify the location of the collision with respect to the entity with which the issuing entity collided. The Location field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)]. - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "location")] - public Vector3Float Location - { - get - { - return this._location; - } - - set - { - this._location = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._issuingEntityID.Marshal(dos); - this._collidingEntityID.Marshal(dos); - this._eventID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._collisionType); - dos.WriteByte((byte)this._pad); - this._velocity.Marshal(dos); - dos.WriteFloat((float)this._mass); - this._location.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._issuingEntityID.Unmarshal(dis); - this._collidingEntityID.Unmarshal(dis); - this._eventID.Unmarshal(dis); - this._collisionType = dis.ReadUnsignedByte(); - this._pad = dis.ReadByte(); - this._velocity.Unmarshal(dis); - this._mass = dis.ReadFloat(); - this._location.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._issuingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._collidingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._eventID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._collisionType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._velocity.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._mass.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._location.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as CollisionPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(CollisionPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._issuingEntityID.Equals(obj._issuingEntityID)) - { - ivarsEqual = false; - } - - if (!this._collidingEntityID.Equals(obj._collidingEntityID)) - { - ivarsEqual = false; - } - - if (!this._eventID.Equals(obj._eventID)) - { - ivarsEqual = false; - } - - if (this._collisionType != obj._collisionType) - { - ivarsEqual = false; - } - - if (this._pad != obj._pad) - { - ivarsEqual = false; - } - - if (!this._velocity.Equals(obj._velocity)) - { - ivarsEqual = false; - } - - if (this._mass != obj._mass) - { - ivarsEqual = false; - } - - if (!this._location.Equals(obj._location)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._issuingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._collidingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._eventID.GetHashCode(); - result = GenerateHash(result) ^ this._collisionType.GetHashCode(); - result = GenerateHash(result) ^ this._pad.GetHashCode(); - result = GenerateHash(result) ^ this._velocity.GetHashCode(); - result = GenerateHash(result) ^ this._mass.GetHashCode(); - result = GenerateHash(result) ^ this._location.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/CommentPdu.cs b/tests/OpenDisNet.Reference/Generated/CommentPdu.cs deleted file mode 100644 index 1e6645a..0000000 --- a/tests/OpenDisNet.Reference/Generated/CommentPdu.cs +++ /dev/null @@ -1,455 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Arbitrary messages can be entered into the data stream via use of this PDU. Section 7.5.13 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class CommentPdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Number of fixed datum records - /// - private uint _numberOfFixedDatumRecords; - - /// - /// Number of variable datum records - /// - private uint _numberOfVariableDatumRecords; - - /// - /// variable length list of fixed datums - /// - private List _fixedDatums = new List(); - - /// - /// variable length list of variable length datums - /// - private List _variableDatums = new List(); - - /// - /// Initializes a new instance of the class. - /// - public CommentPdu() - { - PduType = (byte)22; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(CommentPdu left, CommentPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(CommentPdu left, CommentPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the variable length list of fixed datums - /// - [XmlElement(ElementName = "fixedDatumsList", Type = typeof(List))] - public List FixedDatums - { - get - { - return this._fixedDatums; - } - } - - /// - /// Gets or sets the variable length list of variable length datums - /// - [XmlElement(ElementName = "variableDatumsList", Type = typeof(List))] - public List VariableDatums - { - get - { - return this._variableDatums; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._fixedDatums.Count); - dos.WriteUnsignedInt((uint)this._variableDatums.Count); - - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatums.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatums.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._fixedDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as CommentPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(CommentPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatums.Count != obj._fixedDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - if (!this._fixedDatums[idx].Equals(obj._fixedDatums[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatums.Count != obj._variableDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - if (!this._variableDatums[idx].Equals(obj._variableDatums[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatums.Count > 0) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatums[idx].GetHashCode(); - } - } - - if (this._variableDatums.Count > 0) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatums[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/CommentReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/CommentReliablePdu.cs deleted file mode 100644 index 51b5b58..0000000 --- a/tests/OpenDisNet.Reference/Generated/CommentReliablePdu.cs +++ /dev/null @@ -1,455 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.12: Arbitrary messages. Only reliable this time. Neds manual intervention to fix padding in variable datums. UNFINISHED - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class CommentReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// Fixed datum record count - /// - private uint _numberOfFixedDatumRecords; - - /// - /// variable datum record count - /// - private uint _numberOfVariableDatumRecords; - - /// - /// Fixed datum records - /// - private List _fixedDatumRecords = new List(); - - /// - /// Variable datum records - /// - private List _variableDatumRecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public CommentReliablePdu() - { - PduType = (byte)62; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(CommentReliablePdu left, CommentReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(CommentReliablePdu left, CommentReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the Fixed datum records - /// - [XmlElement(ElementName = "fixedDatumRecordsList", Type = typeof(List))] - public List FixedDatumRecords - { - get - { - return this._fixedDatumRecords; - } - } - - /// - /// Gets or sets the Variable datum records - /// - [XmlElement(ElementName = "variableDatumRecordsList", Type = typeof(List))] - public List VariableDatumRecords - { - get - { - return this._variableDatumRecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._fixedDatumRecords.Count); - dos.WriteUnsignedInt((uint)this._variableDatumRecords.Count); - - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatumRecords.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatumRecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._fixedDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as CommentReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(CommentReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatumRecords.Count != obj._fixedDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - if (!this._fixedDatumRecords[idx].Equals(obj._fixedDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumRecords.Count != obj._variableDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - if (!this._variableDatumRecords[idx].Equals(obj._variableDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumRecords[idx].GetHashCode(); - } - } - - if (this._variableDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumRecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/CommunicationsNodeID.cs b/tests/OpenDisNet.Reference/Generated/CommunicationsNodeID.cs deleted file mode 100644 index 4d76215..0000000 --- a/tests/OpenDisNet.Reference/Generated/CommunicationsNodeID.cs +++ /dev/null @@ -1,300 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Identity of a communications node. Section 6.2.49.4 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class CommunicationsNodeID - { - private EntityID _entityID = new EntityID(); - - private ushort _elementID; - - /// - /// Initializes a new instance of the class. - /// - public CommunicationsNodeID() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(CommunicationsNodeID left, CommunicationsNodeID right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(CommunicationsNodeID left, CommunicationsNodeID right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._entityID.GetMarshalledSize(); // this._entityID - marshalSize += 2; // this._elementID - return marshalSize; - } - - [XmlElement(Type = typeof(EntityID), ElementName = "entityID")] - public EntityID EntityID - { - get - { - return this._entityID; - } - - set - { - this._entityID = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "elementID")] - public ushort ElementID - { - get - { - return this._elementID; - } - - set - { - this._elementID = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._entityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._elementID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._entityID.Unmarshal(dis); - this._elementID = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._entityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._elementID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as CommunicationsNodeID; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(CommunicationsNodeID obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._entityID.Equals(obj._entityID)) - { - ivarsEqual = false; - } - - if (this._elementID != obj._elementID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._entityID.GetHashCode(); - result = GenerateHash(result) ^ this._elementID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/CreateEntityPdu.cs b/tests/OpenDisNet.Reference/Generated/CreateEntityPdu.cs deleted file mode 100644 index f8a1a5d..0000000 --- a/tests/OpenDisNet.Reference/Generated/CreateEntityPdu.cs +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.2. Create a new entity. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class CreateEntityPdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Identifier for the request - /// - private EntityID _originatingID = new EntityID(); - - /// - /// Identifier for the request - /// - private EntityID _receivingID = new EntityID(); - - /// - /// Identifier for the request. See 6.2.75 - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public CreateEntityPdu() - { - PduType = (byte)11; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(CreateEntityPdu left, CreateEntityPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(CreateEntityPdu left, CreateEntityPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingID.GetMarshalledSize(); // this._originatingID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the Identifier for the request - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingID")] - public EntityID OriginatingID - { - get - { - return this._originatingID; - } - - set - { - this._originatingID = value; - } - } - - /// - /// Gets or sets the Identifier for the request - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingID")] - public EntityID ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the Identifier for the request. See 6.2.75 - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingID.Marshal(dos); - this._receivingID.Marshal(dos); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as CreateEntityPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(CreateEntityPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingID.Equals(obj._originatingID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/CreateEntityReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/CreateEntityReliablePdu.cs deleted file mode 100644 index b5ab76f..0000000 --- a/tests/OpenDisNet.Reference/Generated/CreateEntityReliablePdu.cs +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.1: creation of an entity , reliable. COMPLETE - /// - [Serializable] - [XmlRoot] - public partial class CreateEntityReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// level of reliability service used for this transaction - /// - private byte _requiredReliabilityService; - - /// - /// padding - /// - private ushort _pad1; - - /// - /// padding - /// - private byte _pad2; - - /// - /// Request ID - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public CreateEntityReliablePdu() - { - PduType = (byte)51; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(CreateEntityReliablePdu left, CreateEntityReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(CreateEntityReliablePdu left, CreateEntityReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 1; // this._requiredReliabilityService - marshalSize += 2; // this._pad1 - marshalSize += 1; // this._pad2 - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the level of reliability service used for this transaction - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliabilityService")] - public byte RequiredReliabilityService - { - get - { - return this._requiredReliabilityService; - } - - set - { - this._requiredReliabilityService = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad1")] - public ushort Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad2")] - public byte Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Gets or sets the Request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._requiredReliabilityService); - dos.WriteUnsignedShort((ushort)this._pad1); - dos.WriteUnsignedByte((byte)this._pad2); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requiredReliabilityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedShort(); - this._pad2 = dis.ReadUnsignedByte(); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as CreateEntityReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(CreateEntityReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requiredReliabilityService != obj._requiredReliabilityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requiredReliabilityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DataPdu.cs b/tests/OpenDisNet.Reference/Generated/DataPdu.cs deleted file mode 100644 index 5586918..0000000 --- a/tests/OpenDisNet.Reference/Generated/DataPdu.cs +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information issued in response to a data query pdu or a set data pdu is communicated using a data pdu. Section 7.5.11 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class DataPdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// ID of request - /// - private uint _requestID; - - /// - /// padding - /// - private uint _padding1; - - /// - /// Number of fixed datum records - /// - private uint _numberOfFixedDatumRecords; - - /// - /// Number of variable datum records - /// - private uint _numberOfVariableDatumRecords; - - /// - /// variable length list of fixed datums - /// - private List _fixedDatums = new List(); - - /// - /// variable length list of variable length datums - /// - private List _variableDatums = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DataPdu() - { - PduType = (byte)20; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DataPdu left, DataPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DataPdu left, DataPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._requestID - marshalSize += 4; // this._padding1 - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the ID of request - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(uint), ElementName = "padding1")] - public uint Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the variable length list of fixed datums - /// - [XmlElement(ElementName = "fixedDatumsList", Type = typeof(List))] - public List FixedDatums - { - get - { - return this._fixedDatums; - } - } - - /// - /// Gets or sets the variable length list of variable length datums - /// - [XmlElement(ElementName = "variableDatumsList", Type = typeof(List))] - public List VariableDatums - { - get - { - return this._variableDatums; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._padding1); - dos.WriteUnsignedInt((uint)this._fixedDatums.Count); - dos.WriteUnsignedInt((uint)this._variableDatums.Count); - - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requestID = dis.ReadUnsignedInt(); - this._padding1 = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatums.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatums.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DataPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DataPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatums.Count != obj._fixedDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - if (!this._fixedDatums[idx].Equals(obj._fixedDatums[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatums.Count != obj._variableDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - if (!this._variableDatums[idx].Equals(obj._variableDatums[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatums.Count > 0) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatums[idx].GetHashCode(); - } - } - - if (this._variableDatums.Count > 0) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatums[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DataQueryDatumSpecification.cs b/tests/OpenDisNet.Reference/Generated/DataQueryDatumSpecification.cs deleted file mode 100644 index d2d4ef0..0000000 --- a/tests/OpenDisNet.Reference/Generated/DataQueryDatumSpecification.cs +++ /dev/null @@ -1,451 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// List of fixed and variable datum records. Section 6.2.18 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(UnsignedDISInteger))] - [XmlInclude(typeof(UnsignedDISInteger))] - public partial class DataQueryDatumSpecification - { - /// - /// Number of fixed datums - /// - private uint _numberOfFixedDatums; - - /// - /// Number of variable datums - /// - private uint _numberOfVariableDatums; - - /// - /// variable length list fixed datum IDs - /// - private List _fixedDatumIDList = new List(); - - /// - /// variable length list variable datum IDs - /// - private List _variableDatumIDList = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DataQueryDatumSpecification() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DataQueryDatumSpecification left, DataQueryDatumSpecification right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DataQueryDatumSpecification left, DataQueryDatumSpecification right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._numberOfFixedDatums - marshalSize += 4; // this._numberOfVariableDatums - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - UnsignedDISInteger listElement = (UnsignedDISInteger)this._fixedDatumIDList[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - UnsignedDISInteger listElement = (UnsignedDISInteger)this._variableDatumIDList[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatums method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatums")] - public uint NumberOfFixedDatums - { - get - { - return this._numberOfFixedDatums; - } - - set - { - this._numberOfFixedDatums = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatums method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatums")] - public uint NumberOfVariableDatums - { - get - { - return this._numberOfVariableDatums; - } - - set - { - this._numberOfVariableDatums = value; - } - } - - /// - /// Gets or sets the variable length list fixed datum IDs - /// - [XmlElement(ElementName = "fixedDatumIDListList", Type = typeof(List))] - public List FixedDatumIDList - { - get - { - return this._fixedDatumIDList; - } - } - - /// - /// Gets or sets the variable length list variable datum IDs - /// - [XmlElement(ElementName = "variableDatumIDListList", Type = typeof(List))] - public List VariableDatumIDList - { - get - { - return this._variableDatumIDList; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._fixedDatumIDList.Count); - dos.WriteUnsignedInt((uint)this._variableDatumIDList.Count); - - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - UnsignedDISInteger aUnsignedDISInteger = (UnsignedDISInteger)this._fixedDatumIDList[idx]; - aUnsignedDISInteger.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - UnsignedDISInteger aUnsignedDISInteger = (UnsignedDISInteger)this._variableDatumIDList[idx]; - aUnsignedDISInteger.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._numberOfFixedDatums = dis.ReadUnsignedInt(); - this._numberOfVariableDatums = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatums; idx++) - { - UnsignedDISInteger anX = new UnsignedDISInteger(); - anX.Unmarshal(dis); - this._fixedDatumIDList.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatums; idx++) - { - UnsignedDISInteger anX = new UnsignedDISInteger(); - anX.Unmarshal(dis); - this._variableDatumIDList.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._fixedDatumIDList.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumIDList.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - sb.AppendLine(""); - UnsignedDISInteger aUnsignedDISInteger = (UnsignedDISInteger)this._fixedDatumIDList[idx]; - aUnsignedDISInteger.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - sb.AppendLine(""); - UnsignedDISInteger aUnsignedDISInteger = (UnsignedDISInteger)this._variableDatumIDList[idx]; - aUnsignedDISInteger.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DataQueryDatumSpecification; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DataQueryDatumSpecification obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._numberOfFixedDatums != obj._numberOfFixedDatums) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatums != obj._numberOfVariableDatums) - { - ivarsEqual = false; - } - - if (this._fixedDatumIDList.Count != obj._fixedDatumIDList.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - if (!this._fixedDatumIDList[idx].Equals(obj._fixedDatumIDList[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumIDList.Count != obj._variableDatumIDList.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - if (!this._variableDatumIDList[idx].Equals(obj._variableDatumIDList[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._numberOfFixedDatums.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatums.GetHashCode(); - - if (this._fixedDatumIDList.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumIDList[idx].GetHashCode(); - } - } - - if (this._variableDatumIDList.Count > 0) - { - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumIDList[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DataQueryPdu.cs b/tests/OpenDisNet.Reference/Generated/DataQueryPdu.cs deleted file mode 100644 index 619fb99..0000000 --- a/tests/OpenDisNet.Reference/Generated/DataQueryPdu.cs +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.9. Request for data from an entity. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class DataQueryPdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// ID of request - /// - private uint _requestID; - - /// - /// time issues between issues of Data PDUs. Zero means send once only. - /// - private uint _timeInterval; - - /// - /// Number of fixed datum records - /// - private uint _numberOfFixedDatumRecords; - - /// - /// Number of variable datum records - /// - private uint _numberOfVariableDatumRecords; - - /// - /// variable length list of fixed datums - /// - private List _fixedDatums = new List(); - - /// - /// variable length list of variable length datums - /// - private List _variableDatums = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DataQueryPdu() - { - PduType = (byte)18; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DataQueryPdu left, DataQueryPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DataQueryPdu left, DataQueryPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._requestID - marshalSize += 4; // this._timeInterval - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the ID of request - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the time issues between issues of Data PDUs. Zero means send once only. - /// - [XmlElement(Type = typeof(uint), ElementName = "timeInterval")] - public uint TimeInterval - { - get - { - return this._timeInterval; - } - - set - { - this._timeInterval = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the variable length list of fixed datums - /// - [XmlElement(ElementName = "fixedDatumsList", Type = typeof(List))] - public List FixedDatums - { - get - { - return this._fixedDatums; - } - } - - /// - /// Gets or sets the variable length list of variable length datums - /// - [XmlElement(ElementName = "variableDatumsList", Type = typeof(List))] - public List VariableDatums - { - get - { - return this._variableDatums; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._timeInterval); - dos.WriteUnsignedInt((uint)this._fixedDatums.Count); - dos.WriteUnsignedInt((uint)this._variableDatums.Count); - - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requestID = dis.ReadUnsignedInt(); - this._timeInterval = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatums.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatums.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._timeInterval.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DataQueryPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DataQueryPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._timeInterval != obj._timeInterval) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatums.Count != obj._fixedDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - if (!this._fixedDatums[idx].Equals(obj._fixedDatums[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatums.Count != obj._variableDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - if (!this._variableDatums[idx].Equals(obj._variableDatums[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._timeInterval.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatums.Count > 0) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatums[idx].GetHashCode(); - } - } - - if (this._variableDatums.Count > 0) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatums[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DataQueryReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/DataQueryReliablePdu.cs deleted file mode 100644 index 715efb2..0000000 --- a/tests/OpenDisNet.Reference/Generated/DataQueryReliablePdu.cs +++ /dev/null @@ -1,615 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.8: request for data from an entity. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class DataQueryReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// level of reliability service used for this transaction - /// - private byte _requiredReliabilityService; - - /// - /// padding - /// - private ushort _pad1; - - /// - /// padding - /// - private byte _pad2; - - /// - /// request ID - /// - private uint _requestID; - - /// - /// time interval between issuing data query PDUs - /// - private uint _timeInterval; - - /// - /// Fixed datum record count - /// - private uint _numberOfFixedDatumRecords; - - /// - /// variable datum record count - /// - private uint _numberOfVariableDatumRecords; - - /// - /// Fixed datum records - /// - private List _fixedDatumRecords = new List(); - - /// - /// Variable datum records - /// - private List _variableDatumRecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DataQueryReliablePdu() - { - PduType = (byte)58; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DataQueryReliablePdu left, DataQueryReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DataQueryReliablePdu left, DataQueryReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 1; // this._requiredReliabilityService - marshalSize += 2; // this._pad1 - marshalSize += 1; // this._pad2 - marshalSize += 4; // this._requestID - marshalSize += 4; // this._timeInterval - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the level of reliability service used for this transaction - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliabilityService")] - public byte RequiredReliabilityService - { - get - { - return this._requiredReliabilityService; - } - - set - { - this._requiredReliabilityService = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad1")] - public ushort Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad2")] - public byte Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Gets or sets the request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the time interval between issuing data query PDUs - /// - [XmlElement(Type = typeof(uint), ElementName = "timeInterval")] - public uint TimeInterval - { - get - { - return this._timeInterval; - } - - set - { - this._timeInterval = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the Fixed datum records - /// - [XmlElement(ElementName = "fixedDatumRecordsList", Type = typeof(List))] - public List FixedDatumRecords - { - get - { - return this._fixedDatumRecords; - } - } - - /// - /// Gets or sets the Variable datum records - /// - [XmlElement(ElementName = "variableDatumRecordsList", Type = typeof(List))] - public List VariableDatumRecords - { - get - { - return this._variableDatumRecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._requiredReliabilityService); - dos.WriteUnsignedShort((ushort)this._pad1); - dos.WriteUnsignedByte((byte)this._pad2); - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._timeInterval); - dos.WriteUnsignedInt((uint)this._fixedDatumRecords.Count); - dos.WriteUnsignedInt((uint)this._variableDatumRecords.Count); - - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requiredReliabilityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedShort(); - this._pad2 = dis.ReadUnsignedByte(); - this._requestID = dis.ReadUnsignedInt(); - this._timeInterval = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatumRecords.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatumRecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._timeInterval.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DataQueryReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DataQueryReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requiredReliabilityService != obj._requiredReliabilityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._timeInterval != obj._timeInterval) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatumRecords.Count != obj._fixedDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - if (!this._fixedDatumRecords[idx].Equals(obj._fixedDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumRecords.Count != obj._variableDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - if (!this._variableDatumRecords[idx].Equals(obj._variableDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requiredReliabilityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._timeInterval.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumRecords[idx].GetHashCode(); - } - } - - if (this._variableDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumRecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DataReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/DataReliablePdu.cs deleted file mode 100644 index 02100a4..0000000 --- a/tests/OpenDisNet.Reference/Generated/DataReliablePdu.cs +++ /dev/null @@ -1,583 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.10: issued in response to a data query R or set dataR pdu. Needs manual intervention to fix padding on variable datums. UNFINSIHED - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class DataReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// Request ID - /// - private uint _requestID; - - /// - /// level of reliability service used for this transaction - /// - private byte _requiredReliabilityService; - - /// - /// padding - /// - private ushort _pad1; - - /// - /// padding - /// - private byte _pad2; - - /// - /// Fixed datum record count - /// - private uint _numberOfFixedDatumRecords; - - /// - /// variable datum record count - /// - private uint _numberOfVariableDatumRecords; - - /// - /// Fixed datum records - /// - private List _fixedDatumRecords = new List(); - - /// - /// Variable datum records - /// - private List _variableDatumRecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DataReliablePdu() - { - PduType = (byte)60; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DataReliablePdu left, DataReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DataReliablePdu left, DataReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._requestID - marshalSize += 1; // this._requiredReliabilityService - marshalSize += 2; // this._pad1 - marshalSize += 1; // this._pad2 - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the level of reliability service used for this transaction - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliabilityService")] - public byte RequiredReliabilityService - { - get - { - return this._requiredReliabilityService; - } - - set - { - this._requiredReliabilityService = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad1")] - public ushort Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad2")] - public byte Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the Fixed datum records - /// - [XmlElement(ElementName = "fixedDatumRecordsList", Type = typeof(List))] - public List FixedDatumRecords - { - get - { - return this._fixedDatumRecords; - } - } - - /// - /// Gets or sets the Variable datum records - /// - [XmlElement(ElementName = "variableDatumRecordsList", Type = typeof(List))] - public List VariableDatumRecords - { - get - { - return this._variableDatumRecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedByte((byte)this._requiredReliabilityService); - dos.WriteUnsignedShort((ushort)this._pad1); - dos.WriteUnsignedByte((byte)this._pad2); - dos.WriteUnsignedInt((uint)this._fixedDatumRecords.Count); - dos.WriteUnsignedInt((uint)this._variableDatumRecords.Count); - - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requestID = dis.ReadUnsignedInt(); - this._requiredReliabilityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedShort(); - this._pad2 = dis.ReadUnsignedByte(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatumRecords.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatumRecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DataReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DataReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._requiredReliabilityService != obj._requiredReliabilityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatumRecords.Count != obj._fixedDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - if (!this._fixedDatumRecords[idx].Equals(obj._fixedDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumRecords.Count != obj._variableDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - if (!this._variableDatumRecords[idx].Equals(obj._variableDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._requiredReliabilityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumRecords[idx].GetHashCode(); - } - } - - if (this._variableDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumRecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DatumSpecification.cs b/tests/OpenDisNet.Reference/Generated/DatumSpecification.cs deleted file mode 100644 index 815c1e4..0000000 --- a/tests/OpenDisNet.Reference/Generated/DatumSpecification.cs +++ /dev/null @@ -1,451 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// List of fixed and variable datum records. Section 6.2.19 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class DatumSpecification - { - /// - /// Number of fixed datums - /// - private uint _numberOfFixedDatums; - - /// - /// Number of variable datums - /// - private uint _numberOfVariableDatums; - - /// - /// variable length list fixed datums - /// - private List _fixedDatumIDList = new List(); - - /// - /// variable length list variable datums - /// - private List _variableDatumIDList = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DatumSpecification() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DatumSpecification left, DatumSpecification right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DatumSpecification left, DatumSpecification right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._numberOfFixedDatums - marshalSize += 4; // this._numberOfVariableDatums - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatumIDList[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatumIDList[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatums method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatums")] - public uint NumberOfFixedDatums - { - get - { - return this._numberOfFixedDatums; - } - - set - { - this._numberOfFixedDatums = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatums method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatums")] - public uint NumberOfVariableDatums - { - get - { - return this._numberOfVariableDatums; - } - - set - { - this._numberOfVariableDatums = value; - } - } - - /// - /// Gets or sets the variable length list fixed datums - /// - [XmlElement(ElementName = "fixedDatumIDListList", Type = typeof(List))] - public List FixedDatumIDList - { - get - { - return this._fixedDatumIDList; - } - } - - /// - /// Gets or sets the variable length list variable datums - /// - [XmlElement(ElementName = "variableDatumIDListList", Type = typeof(List))] - public List VariableDatumIDList - { - get - { - return this._variableDatumIDList; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._fixedDatumIDList.Count); - dos.WriteUnsignedInt((uint)this._variableDatumIDList.Count); - - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumIDList[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumIDList[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._numberOfFixedDatums = dis.ReadUnsignedInt(); - this._numberOfVariableDatums = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatums; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatumIDList.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatums; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatumIDList.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._fixedDatumIDList.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumIDList.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumIDList[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumIDList[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DatumSpecification; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DatumSpecification obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._numberOfFixedDatums != obj._numberOfFixedDatums) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatums != obj._numberOfVariableDatums) - { - ivarsEqual = false; - } - - if (this._fixedDatumIDList.Count != obj._fixedDatumIDList.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - if (!this._fixedDatumIDList[idx].Equals(obj._fixedDatumIDList[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumIDList.Count != obj._variableDatumIDList.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - if (!this._variableDatumIDList[idx].Equals(obj._variableDatumIDList[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._numberOfFixedDatums.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatums.GetHashCode(); - - if (this._fixedDatumIDList.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumIDList.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumIDList[idx].GetHashCode(); - } - } - - if (this._variableDatumIDList.Count > 0) - { - for (int idx = 0; idx < this._variableDatumIDList.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumIDList[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DeadReckoningParameters.cs b/tests/OpenDisNet.Reference/Generated/DeadReckoningParameters.cs deleted file mode 100644 index 2e66b03..0000000 --- a/tests/OpenDisNet.Reference/Generated/DeadReckoningParameters.cs +++ /dev/null @@ -1,404 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Not specified in the standard. This is used by the ESPDU - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(Vector3Float))] - public partial class DeadReckoningParameters - { - /// - /// Algorithm to use in computing dead reckoning. See EBV doc. - /// - private byte _deadReckoningAlgorithm; - - /// - /// Dead reckoning parameters. Contents depends on algorithm. - /// - private byte[] _parameters = new byte[15]; - - /// - /// Linear acceleration of the entity - /// - private Vector3Float _entityLinearAcceleration = new Vector3Float(); - - /// - /// Angular velocity of the entity - /// - private Vector3Float _entityAngularVelocity = new Vector3Float(); - - /// - /// Initializes a new instance of the class. - /// - public DeadReckoningParameters() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DeadReckoningParameters left, DeadReckoningParameters right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DeadReckoningParameters left, DeadReckoningParameters right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._deadReckoningAlgorithm - marshalSize += 15 * 1; // _parameters - marshalSize += this._entityLinearAcceleration.GetMarshalledSize(); // this._entityLinearAcceleration - marshalSize += this._entityAngularVelocity.GetMarshalledSize(); // this._entityAngularVelocity - return marshalSize; - } - - /// - /// Gets or sets the Algorithm to use in computing dead reckoning. See EBV doc. - /// - [XmlElement(Type = typeof(byte), ElementName = "deadReckoningAlgorithm")] - public byte DeadReckoningAlgorithm - { - get - { - return this._deadReckoningAlgorithm; - } - - set - { - this._deadReckoningAlgorithm = value; - } - } - - /// - /// Gets or sets the Dead reckoning parameters. Contents depends on algorithm. - /// - [XmlArray(ElementName = "parameters")] - public byte[] Parameters - { - get - { - return this._parameters; - } - - set - { - this._parameters = value; - } -} - - /// - /// Gets or sets the Linear acceleration of the entity - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "entityLinearAcceleration")] - public Vector3Float EntityLinearAcceleration - { - get - { - return this._entityLinearAcceleration; - } - - set - { - this._entityLinearAcceleration = value; - } - } - - /// - /// Gets or sets the Angular velocity of the entity - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "entityAngularVelocity")] - public Vector3Float EntityAngularVelocity - { - get - { - return this._entityAngularVelocity; - } - - set - { - this._entityAngularVelocity = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._deadReckoningAlgorithm); - - for (int idx = 0; idx < this._parameters.Length; idx++) - { - dos.WriteUnsignedByte(this._parameters[idx]); - } - this._entityLinearAcceleration.Marshal(dos); - this._entityAngularVelocity.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._deadReckoningAlgorithm = dis.ReadUnsignedByte(); - for (int idx = 0; idx < this._parameters.Length; idx++) - { - this._parameters[idx] = dis.ReadUnsignedByte(); - } - this._entityLinearAcceleration.Unmarshal(dis); - this._entityAngularVelocity.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._deadReckoningAlgorithm.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._parameters.Length; idx++) - { - sb.AppendLine("" + this._parameters[idx] + ""); - } - - sb.AppendLine(""); - this._entityLinearAcceleration.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._entityAngularVelocity.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DeadReckoningParameters; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DeadReckoningParameters obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._deadReckoningAlgorithm != obj._deadReckoningAlgorithm) - { - ivarsEqual = false; - } - - if (obj._parameters.Length != 15) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 15; idx++) - { - if (this._parameters[idx] != obj._parameters[idx]) - { - ivarsEqual = false; - } - } - } - - if (!this._entityLinearAcceleration.Equals(obj._entityLinearAcceleration)) - { - ivarsEqual = false; - } - - if (!this._entityAngularVelocity.Equals(obj._entityAngularVelocity)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._deadReckoningAlgorithm.GetHashCode(); - - for (int idx = 0; idx < 15; idx++) - { - result = GenerateHash(result) ^ this._parameters[idx].GetHashCode(); - } - result = GenerateHash(result) ^ this._entityLinearAcceleration.GetHashCode(); - result = GenerateHash(result) ^ this._entityAngularVelocity.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DesignatorPdu.cs b/tests/OpenDisNet.Reference/Generated/DesignatorPdu.cs deleted file mode 100644 index d7ecdd2..0000000 --- a/tests/OpenDisNet.Reference/Generated/DesignatorPdu.cs +++ /dev/null @@ -1,646 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.7.2. Handles designating operations. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(Vector3Double))] - public partial class DesignatorPdu : DistributedEmissionsFamilyPdu, IEquatable - { - /// - /// ID of the entity designating - /// - private EntityID _designatingEntityID = new EntityID(); - - /// - /// This field shall specify a unique emitter database number assigned to differentiate between otherwise similar or identical emitter beams within an emitter system. - /// - private ushort _codeName; - - /// - /// ID of the entity being designated - /// - private EntityID _designatedEntityID = new EntityID(); - - /// - /// This field shall identify the designator code being used by the designating entity - /// - private ushort _designatorCode; - - /// - /// This field shall identify the designator output power in watts - /// - private float _designatorPower; - - /// - /// This field shall identify the designator wavelength in units of microns - /// - private float _designatorWavelength; - - /// - /// designtor spot wrt the designated entity - /// - private Vector3Float _designatorSpotWrtDesignated = new Vector3Float(); - - /// - /// designtor spot wrt the designated entity - /// - private Vector3Double _designatorSpotLocation = new Vector3Double(); - - /// - /// Dead reckoning algorithm - /// - private byte _deadReckoningAlgorithm; - - /// - /// padding - /// - private ushort _padding1; - - /// - /// padding - /// - private byte _padding2; - - /// - /// linear accelleration of entity - /// - private Vector3Float _entityLinearAcceleration = new Vector3Float(); - - /// - /// Initializes a new instance of the class. - /// - public DesignatorPdu() - { - PduType = (byte)24; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DesignatorPdu left, DesignatorPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DesignatorPdu left, DesignatorPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._designatingEntityID.GetMarshalledSize(); // this._designatingEntityID - marshalSize += 2; // this._codeName - marshalSize += this._designatedEntityID.GetMarshalledSize(); // this._designatedEntityID - marshalSize += 2; // this._designatorCode - marshalSize += 4; // this._designatorPower - marshalSize += 4; // this._designatorWavelength - marshalSize += this._designatorSpotWrtDesignated.GetMarshalledSize(); // this._designatorSpotWrtDesignated - marshalSize += this._designatorSpotLocation.GetMarshalledSize(); // this._designatorSpotLocation - marshalSize += 1; // this._deadReckoningAlgorithm - marshalSize += 2; // this._padding1 - marshalSize += 1; // this._padding2 - marshalSize += this._entityLinearAcceleration.GetMarshalledSize(); // this._entityLinearAcceleration - return marshalSize; - } - - /// - /// Gets or sets the ID of the entity designating - /// - [XmlElement(Type = typeof(EntityID), ElementName = "designatingEntityID")] - public EntityID DesignatingEntityID - { - get - { - return this._designatingEntityID; - } - - set - { - this._designatingEntityID = value; - } - } - - /// - /// Gets or sets the This field shall specify a unique emitter database number assigned to differentiate between otherwise similar or identical emitter beams within an emitter system. - /// - [XmlElement(Type = typeof(ushort), ElementName = "codeName")] - public ushort CodeName - { - get - { - return this._codeName; - } - - set - { - this._codeName = value; - } - } - - /// - /// Gets or sets the ID of the entity being designated - /// - [XmlElement(Type = typeof(EntityID), ElementName = "designatedEntityID")] - public EntityID DesignatedEntityID - { - get - { - return this._designatedEntityID; - } - - set - { - this._designatedEntityID = value; - } - } - - /// - /// Gets or sets the This field shall identify the designator code being used by the designating entity - /// - [XmlElement(Type = typeof(ushort), ElementName = "designatorCode")] - public ushort DesignatorCode - { - get - { - return this._designatorCode; - } - - set - { - this._designatorCode = value; - } - } - - /// - /// Gets or sets the This field shall identify the designator output power in watts - /// - [XmlElement(Type = typeof(float), ElementName = "designatorPower")] - public float DesignatorPower - { - get - { - return this._designatorPower; - } - - set - { - this._designatorPower = value; - } - } - - /// - /// Gets or sets the This field shall identify the designator wavelength in units of microns - /// - [XmlElement(Type = typeof(float), ElementName = "designatorWavelength")] - public float DesignatorWavelength - { - get - { - return this._designatorWavelength; - } - - set - { - this._designatorWavelength = value; - } - } - - /// - /// Gets or sets the designtor spot wrt the designated entity - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "designatorSpotWrtDesignated")] - public Vector3Float DesignatorSpotWrtDesignated - { - get - { - return this._designatorSpotWrtDesignated; - } - - set - { - this._designatorSpotWrtDesignated = value; - } - } - - /// - /// Gets or sets the designtor spot wrt the designated entity - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "designatorSpotLocation")] - public Vector3Double DesignatorSpotLocation - { - get - { - return this._designatorSpotLocation; - } - - set - { - this._designatorSpotLocation = value; - } - } - - /// - /// Gets or sets the Dead reckoning algorithm - /// - [XmlElement(Type = typeof(byte), ElementName = "deadReckoningAlgorithm")] - public byte DeadReckoningAlgorithm - { - get - { - return this._deadReckoningAlgorithm; - } - - set - { - this._deadReckoningAlgorithm = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding1")] - public ushort Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding2")] - public byte Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Gets or sets the linear accelleration of entity - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "entityLinearAcceleration")] - public Vector3Float EntityLinearAcceleration - { - get - { - return this._entityLinearAcceleration; - } - - set - { - this._entityLinearAcceleration = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._designatingEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._codeName); - this._designatedEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._designatorCode); - dos.WriteFloat((float)this._designatorPower); - dos.WriteFloat((float)this._designatorWavelength); - this._designatorSpotWrtDesignated.Marshal(dos); - this._designatorSpotLocation.Marshal(dos); - dos.WriteByte((byte)this._deadReckoningAlgorithm); - dos.WriteUnsignedShort((ushort)this._padding1); - dos.WriteByte((byte)this._padding2); - this._entityLinearAcceleration.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._designatingEntityID.Unmarshal(dis); - this._codeName = dis.ReadUnsignedShort(); - this._designatedEntityID.Unmarshal(dis); - this._designatorCode = dis.ReadUnsignedShort(); - this._designatorPower = dis.ReadFloat(); - this._designatorWavelength = dis.ReadFloat(); - this._designatorSpotWrtDesignated.Unmarshal(dis); - this._designatorSpotLocation.Unmarshal(dis); - this._deadReckoningAlgorithm = dis.ReadByte(); - this._padding1 = dis.ReadUnsignedShort(); - this._padding2 = dis.ReadByte(); - this._entityLinearAcceleration.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._designatingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._codeName.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._designatedEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._designatorCode.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._designatorPower.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._designatorWavelength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._designatorSpotWrtDesignated.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._designatorSpotLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._deadReckoningAlgorithm.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._entityLinearAcceleration.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DesignatorPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DesignatorPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._designatingEntityID.Equals(obj._designatingEntityID)) - { - ivarsEqual = false; - } - - if (this._codeName != obj._codeName) - { - ivarsEqual = false; - } - - if (!this._designatedEntityID.Equals(obj._designatedEntityID)) - { - ivarsEqual = false; - } - - if (this._designatorCode != obj._designatorCode) - { - ivarsEqual = false; - } - - if (this._designatorPower != obj._designatorPower) - { - ivarsEqual = false; - } - - if (this._designatorWavelength != obj._designatorWavelength) - { - ivarsEqual = false; - } - - if (!this._designatorSpotWrtDesignated.Equals(obj._designatorSpotWrtDesignated)) - { - ivarsEqual = false; - } - - if (!this._designatorSpotLocation.Equals(obj._designatorSpotLocation)) - { - ivarsEqual = false; - } - - if (this._deadReckoningAlgorithm != obj._deadReckoningAlgorithm) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (!this._entityLinearAcceleration.Equals(obj._entityLinearAcceleration)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._designatingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._codeName.GetHashCode(); - result = GenerateHash(result) ^ this._designatedEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._designatorCode.GetHashCode(); - result = GenerateHash(result) ^ this._designatorPower.GetHashCode(); - result = GenerateHash(result) ^ this._designatorWavelength.GetHashCode(); - result = GenerateHash(result) ^ this._designatorSpotWrtDesignated.GetHashCode(); - result = GenerateHash(result) ^ this._designatorSpotLocation.GetHashCode(); - result = GenerateHash(result) ^ this._deadReckoningAlgorithm.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._entityLinearAcceleration.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DetonationPdu.cs b/tests/OpenDisNet.Reference/Generated/DetonationPdu.cs deleted file mode 100644 index 7fa0ebe..0000000 --- a/tests/OpenDisNet.Reference/Generated/DetonationPdu.cs +++ /dev/null @@ -1,625 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Detonation or impact of munitions, as well as, non-munition explosions, the burst or initial bloom of chaff, and the ignition of a flare shall be indicated. Section 7.3.3 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EventIdentifier))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(MunitionDescriptor))] - [XmlInclude(typeof(VariableParameter))] - public partial class DetonationPdu : WarfareFamilyPdu, IEquatable - { - /// - /// ID of the expendable entity, Section 7.3.3 - /// - private EntityID _explodingEntityID = new EntityID(); - - /// - /// ID of event, Section 7.3.3 - /// - private EventIdentifier _eventID = new EventIdentifier(); - - /// - /// velocity of the munition immediately before detonation/impact, Section 7.3.3 - /// - private Vector3Float _velocity = new Vector3Float(); - - /// - /// location of the munition detonation, the expendable detonation, Section 7.3.3 - /// - private Vector3Double _locationInWorldCoordinates = new Vector3Double(); - - /// - /// Describes the detonation represented, Section 7.3.3 - /// - private MunitionDescriptor _descriptor = new MunitionDescriptor(); - - /// - /// Velocity of the ammunition, Section 7.3.3 - /// - private Vector3Float _locationOfEntityCoordinates = new Vector3Float(); - - /// - /// result of the detonation, Section 7.3.3 - /// - private byte _detonationResult; - - /// - /// How many articulation parameters we have, Section 7.3.3 - /// - private byte _numberOfVariableParameters; - - /// - /// padding - /// - private ushort _pad; - - /// - /// specify the parameter values for each Variable Parameter record, Section 7.3.3 - /// - private List _variableParameters = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DetonationPdu() - { - PduType = (byte)3; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DetonationPdu left, DetonationPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DetonationPdu left, DetonationPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._explodingEntityID.GetMarshalledSize(); // this._explodingEntityID - marshalSize += this._eventID.GetMarshalledSize(); // this._eventID - marshalSize += this._velocity.GetMarshalledSize(); // this._velocity - marshalSize += this._locationInWorldCoordinates.GetMarshalledSize(); // this._locationInWorldCoordinates - marshalSize += this._descriptor.GetMarshalledSize(); // this._descriptor - marshalSize += this._locationOfEntityCoordinates.GetMarshalledSize(); // this._locationOfEntityCoordinates - marshalSize += 1; // this._detonationResult - marshalSize += 1; // this._numberOfVariableParameters - marshalSize += 2; // this._pad - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - VariableParameter listElement = (VariableParameter)this._variableParameters[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the ID of the expendable entity, Section 7.3.3 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "explodingEntityID")] - public EntityID ExplodingEntityID - { - get - { - return this._explodingEntityID; - } - - set - { - this._explodingEntityID = value; - } - } - - /// - /// Gets or sets the ID of event, Section 7.3.3 - /// - [XmlElement(Type = typeof(EventIdentifier), ElementName = "eventID")] - public EventIdentifier EventID - { - get - { - return this._eventID; - } - - set - { - this._eventID = value; - } - } - - /// - /// Gets or sets the velocity of the munition immediately before detonation/impact, Section 7.3.3 - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "velocity")] - public Vector3Float Velocity - { - get - { - return this._velocity; - } - - set - { - this._velocity = value; - } - } - - /// - /// Gets or sets the location of the munition detonation, the expendable detonation, Section 7.3.3 - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "locationInWorldCoordinates")] - public Vector3Double LocationInWorldCoordinates - { - get - { - return this._locationInWorldCoordinates; - } - - set - { - this._locationInWorldCoordinates = value; - } - } - - /// - /// Gets or sets the Describes the detonation represented, Section 7.3.3 - /// - [XmlElement(Type = typeof(MunitionDescriptor), ElementName = "descriptor")] - public MunitionDescriptor Descriptor - { - get - { - return this._descriptor; - } - - set - { - this._descriptor = value; - } - } - - /// - /// Gets or sets the Velocity of the ammunition, Section 7.3.3 - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "locationOfEntityCoordinates")] - public Vector3Float LocationOfEntityCoordinates - { - get - { - return this._locationOfEntityCoordinates; - } - - set - { - this._locationOfEntityCoordinates = value; - } - } - - /// - /// Gets or sets the result of the detonation, Section 7.3.3 - /// - [XmlElement(Type = typeof(byte), ElementName = "detonationResult")] - public byte DetonationResult - { - get - { - return this._detonationResult; - } - - set - { - this._detonationResult = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableParameters method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfVariableParameters")] - public byte NumberOfVariableParameters - { - get - { - return this._numberOfVariableParameters; - } - - set - { - this._numberOfVariableParameters = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad")] - public ushort Pad - { - get - { - return this._pad; - } - - set - { - this._pad = value; - } - } - - /// - /// Gets or sets the specify the parameter values for each Variable Parameter record, Section 7.3.3 - /// - [XmlElement(ElementName = "variableParametersList", Type = typeof(List))] - public List VariableParameters - { - get - { - return this._variableParameters; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._explodingEntityID.Marshal(dos); - this._eventID.Marshal(dos); - this._velocity.Marshal(dos); - this._locationInWorldCoordinates.Marshal(dos); - this._descriptor.Marshal(dos); - this._locationOfEntityCoordinates.Marshal(dos); - dos.WriteUnsignedByte((byte)this._detonationResult); - dos.WriteUnsignedByte((byte)this._variableParameters.Count); - dos.WriteUnsignedShort((ushort)this._pad); - - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - VariableParameter aVariableParameter = (VariableParameter)this._variableParameters[idx]; - aVariableParameter.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._explodingEntityID.Unmarshal(dis); - this._eventID.Unmarshal(dis); - this._velocity.Unmarshal(dis); - this._locationInWorldCoordinates.Unmarshal(dis); - this._descriptor.Unmarshal(dis); - this._locationOfEntityCoordinates.Unmarshal(dis); - this._detonationResult = dis.ReadUnsignedByte(); - this._numberOfVariableParameters = dis.ReadUnsignedByte(); - this._pad = dis.ReadUnsignedShort(); - for (int idx = 0; idx < this.NumberOfVariableParameters; idx++) - { - VariableParameter anX = new VariableParameter(); - anX.Unmarshal(dis); - this._variableParameters.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._explodingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._eventID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._velocity.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._locationInWorldCoordinates.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._descriptor.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._locationOfEntityCoordinates.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._detonationResult.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableParameters.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - sb.AppendLine(""); - VariableParameter aVariableParameter = (VariableParameter)this._variableParameters[idx]; - aVariableParameter.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DetonationPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DetonationPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._explodingEntityID.Equals(obj._explodingEntityID)) - { - ivarsEqual = false; - } - - if (!this._eventID.Equals(obj._eventID)) - { - ivarsEqual = false; - } - - if (!this._velocity.Equals(obj._velocity)) - { - ivarsEqual = false; - } - - if (!this._locationInWorldCoordinates.Equals(obj._locationInWorldCoordinates)) - { - ivarsEqual = false; - } - - if (!this._descriptor.Equals(obj._descriptor)) - { - ivarsEqual = false; - } - - if (!this._locationOfEntityCoordinates.Equals(obj._locationOfEntityCoordinates)) - { - ivarsEqual = false; - } - - if (this._detonationResult != obj._detonationResult) - { - ivarsEqual = false; - } - - if (this._numberOfVariableParameters != obj._numberOfVariableParameters) - { - ivarsEqual = false; - } - - if (this._pad != obj._pad) - { - ivarsEqual = false; - } - - if (this._variableParameters.Count != obj._variableParameters.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - if (!this._variableParameters[idx].Equals(obj._variableParameters[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._explodingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._eventID.GetHashCode(); - result = GenerateHash(result) ^ this._velocity.GetHashCode(); - result = GenerateHash(result) ^ this._locationInWorldCoordinates.GetHashCode(); - result = GenerateHash(result) ^ this._descriptor.GetHashCode(); - result = GenerateHash(result) ^ this._locationOfEntityCoordinates.GetHashCode(); - result = GenerateHash(result) ^ this._detonationResult.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableParameters.GetHashCode(); - result = GenerateHash(result) ^ this._pad.GetHashCode(); - - if (this._variableParameters.Count > 0) - { - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - result = GenerateHash(result) ^ this._variableParameters[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DirectedEnergyAreaAimpoint.cs b/tests/OpenDisNet.Reference/Generated/DirectedEnergyAreaAimpoint.cs deleted file mode 100644 index aed713a..0000000 --- a/tests/OpenDisNet.Reference/Generated/DirectedEnergyAreaAimpoint.cs +++ /dev/null @@ -1,547 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// DE Precision Aimpoint Record. NOT COMPLETE. Section 6.2.21.2 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(BeamAntennaPattern))] - [XmlInclude(typeof(DirectedEnergyTargetEnergyDeposition))] - public partial class DirectedEnergyAreaAimpoint - { - /// - /// Type of Record - /// - private uint _recordType = 4001; - - /// - /// Length of Record - /// - private ushort _recordLength; - - /// - /// Padding - /// - private ushort _padding; - - /// - /// Number of beam antenna pattern records - /// - private ushort _beamAntennaPatternRecordCount; - - /// - /// Number of DE target energy depositon records - /// - private ushort _directedEnergyTargetEnergyDepositionRecordCount; - - /// - /// list of beam antenna records. See 6.2.9.2 - /// - private List _beamAntennaParameterList = new List(); - - /// - /// list of DE target deposition records. See 6.2.21.4 - /// - private List _directedEnergyTargetEnergyDepositionRecordList = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DirectedEnergyAreaAimpoint() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DirectedEnergyAreaAimpoint left, DirectedEnergyAreaAimpoint right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DirectedEnergyAreaAimpoint left, DirectedEnergyAreaAimpoint right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 2; // this._padding - marshalSize += 2; // this._beamAntennaPatternRecordCount - marshalSize += 2; // this._directedEnergyTargetEnergyDepositionRecordCount - for (int idx = 0; idx < this._beamAntennaParameterList.Count; idx++) - { - BeamAntennaPattern listElement = (BeamAntennaPattern)this._beamAntennaParameterList[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._directedEnergyTargetEnergyDepositionRecordList.Count; idx++) - { - DirectedEnergyTargetEnergyDeposition listElement = (DirectedEnergyTargetEnergyDeposition)this._directedEnergyTargetEnergyDepositionRecordList[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Type of Record - /// - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the Length of Record - /// - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - /// - /// Gets or sets the Padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getbeamAntennaPatternRecordCount method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "beamAntennaPatternRecordCount")] - public ushort BeamAntennaPatternRecordCount - { - get - { - return this._beamAntennaPatternRecordCount; - } - - set - { - this._beamAntennaPatternRecordCount = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getdirectedEnergyTargetEnergyDepositionRecordCount method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "directedEnergyTargetEnergyDepositionRecordCount")] - public ushort DirectedEnergyTargetEnergyDepositionRecordCount - { - get - { - return this._directedEnergyTargetEnergyDepositionRecordCount; - } - - set - { - this._directedEnergyTargetEnergyDepositionRecordCount = value; - } - } - - /// - /// Gets or sets the list of beam antenna records. See 6.2.9.2 - /// - [XmlElement(ElementName = "beamAntennaParameterListList", Type = typeof(List))] - public List BeamAntennaParameterList - { - get - { - return this._beamAntennaParameterList; - } - } - - /// - /// Gets or sets the list of DE target deposition records. See 6.2.21.4 - /// - [XmlElement(ElementName = "directedEnergyTargetEnergyDepositionRecordListList", Type = typeof(List))] - public List DirectedEnergyTargetEnergyDepositionRecordList - { - get - { - return this._directedEnergyTargetEnergyDepositionRecordList; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedShort((ushort)this._padding); - dos.WriteUnsignedShort((ushort)this._beamAntennaParameterList.Count); - dos.WriteUnsignedShort((ushort)this._directedEnergyTargetEnergyDepositionRecordList.Count); - - for (int idx = 0; idx < this._beamAntennaParameterList.Count; idx++) - { - BeamAntennaPattern aBeamAntennaPattern = (BeamAntennaPattern)this._beamAntennaParameterList[idx]; - aBeamAntennaPattern.Marshal(dos); - } - - for (int idx = 0; idx < this._directedEnergyTargetEnergyDepositionRecordList.Count; idx++) - { - DirectedEnergyTargetEnergyDeposition aDirectedEnergyTargetEnergyDeposition = (DirectedEnergyTargetEnergyDeposition)this._directedEnergyTargetEnergyDepositionRecordList[idx]; - aDirectedEnergyTargetEnergyDeposition.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - this._beamAntennaPatternRecordCount = dis.ReadUnsignedShort(); - this._directedEnergyTargetEnergyDepositionRecordCount = dis.ReadUnsignedShort(); - for (int idx = 0; idx < this.BeamAntennaPatternRecordCount; idx++) - { - BeamAntennaPattern anX = new BeamAntennaPattern(); - anX.Unmarshal(dis); - this._beamAntennaParameterList.Add(anX); - }; - - for (int idx = 0; idx < this.DirectedEnergyTargetEnergyDepositionRecordCount; idx++) - { - DirectedEnergyTargetEnergyDeposition anX = new DirectedEnergyTargetEnergyDeposition(); - anX.Unmarshal(dis); - this._directedEnergyTargetEnergyDepositionRecordList.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamAntennaParameterList.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._directedEnergyTargetEnergyDepositionRecordList.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._beamAntennaParameterList.Count; idx++) - { - sb.AppendLine(""); - BeamAntennaPattern aBeamAntennaPattern = (BeamAntennaPattern)this._beamAntennaParameterList[idx]; - aBeamAntennaPattern.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._directedEnergyTargetEnergyDepositionRecordList.Count; idx++) - { - sb.AppendLine(""); - DirectedEnergyTargetEnergyDeposition aDirectedEnergyTargetEnergyDeposition = (DirectedEnergyTargetEnergyDeposition)this._directedEnergyTargetEnergyDepositionRecordList[idx]; - aDirectedEnergyTargetEnergyDeposition.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DirectedEnergyAreaAimpoint; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DirectedEnergyAreaAimpoint obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (this._beamAntennaPatternRecordCount != obj._beamAntennaPatternRecordCount) - { - ivarsEqual = false; - } - - if (this._directedEnergyTargetEnergyDepositionRecordCount != obj._directedEnergyTargetEnergyDepositionRecordCount) - { - ivarsEqual = false; - } - - if (this._beamAntennaParameterList.Count != obj._beamAntennaParameterList.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._beamAntennaParameterList.Count; idx++) - { - if (!this._beamAntennaParameterList[idx].Equals(obj._beamAntennaParameterList[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._directedEnergyTargetEnergyDepositionRecordList.Count != obj._directedEnergyTargetEnergyDepositionRecordList.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._directedEnergyTargetEnergyDepositionRecordList.Count; idx++) - { - if (!this._directedEnergyTargetEnergyDepositionRecordList[idx].Equals(obj._directedEnergyTargetEnergyDepositionRecordList[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._beamAntennaPatternRecordCount.GetHashCode(); - result = GenerateHash(result) ^ this._directedEnergyTargetEnergyDepositionRecordCount.GetHashCode(); - - if (this._beamAntennaParameterList.Count > 0) - { - for (int idx = 0; idx < this._beamAntennaParameterList.Count; idx++) - { - result = GenerateHash(result) ^ this._beamAntennaParameterList[idx].GetHashCode(); - } - } - - if (this._directedEnergyTargetEnergyDepositionRecordList.Count > 0) - { - for (int idx = 0; idx < this._directedEnergyTargetEnergyDepositionRecordList.Count; idx++) - { - result = GenerateHash(result) ^ this._directedEnergyTargetEnergyDepositionRecordList[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DirectedEnergyDamage.cs b/tests/OpenDisNet.Reference/Generated/DirectedEnergyDamage.cs deleted file mode 100644 index f7d5330..0000000 --- a/tests/OpenDisNet.Reference/Generated/DirectedEnergyDamage.cs +++ /dev/null @@ -1,635 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Damage sustained by an entity due to directed energy. Location of the damage based on a relative x,y,z location from the center of the entity. Section 6.2.17.2 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(EventIdentifier))] - public partial class DirectedEnergyDamage - { - /// - /// DE Record Type. - /// - private uint _recordType = 4500; - - /// - /// DE Record Length (bytes). - /// - private ushort _recordLength = 40; - - /// - /// padding. - /// - private ushort _padding; - - /// - /// location of damage, relative to center of entity - /// - private Vector3Float _damageLocation = new Vector3Float(); - - /// - /// Size of damaged area, in meters. - /// - private float _damageDiameter; - - /// - /// average temp of the damaged area, in degrees celsius. If firing entitty does not model this, use a value of -273.15 - /// - private float _temperature = -273.15F; - - /// - /// enumeration - /// - private byte _componentIdentification; - - /// - /// enumeration - /// - private byte _componentDamageStatus; - - /// - /// enumeration - /// - private byte _componentVisualDamageStatus; - - /// - /// enumeration - /// - private byte _componentVisualSmokeColor; - - /// - /// For any component damage resulting this field shall be set to the fire event ID from that PDU. - /// - private EventIdentifier _fireEventID = new EventIdentifier(); - - /// - /// padding - /// - private ushort _padding2; - - /// - /// Initializes a new instance of the class. - /// - public DirectedEnergyDamage() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DirectedEnergyDamage left, DirectedEnergyDamage right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DirectedEnergyDamage left, DirectedEnergyDamage right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 2; // this._padding - marshalSize += this._damageLocation.GetMarshalledSize(); // this._damageLocation - marshalSize += 4; // this._damageDiameter - marshalSize += 4; // this._temperature - marshalSize += 1; // this._componentIdentification - marshalSize += 1; // this._componentDamageStatus - marshalSize += 1; // this._componentVisualDamageStatus - marshalSize += 1; // this._componentVisualSmokeColor - marshalSize += this._fireEventID.GetMarshalledSize(); // this._fireEventID - marshalSize += 2; // this._padding2 - return marshalSize; - } - - /// - /// Gets or sets the DE Record Type. - /// - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the DE Record Length (bytes). - /// - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - /// - /// Gets or sets the padding. - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Gets or sets the location of damage, relative to center of entity - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "damageLocation")] - public Vector3Float DamageLocation - { - get - { - return this._damageLocation; - } - - set - { - this._damageLocation = value; - } - } - - /// - /// Gets or sets the Size of damaged area, in meters. - /// - [XmlElement(Type = typeof(float), ElementName = "damageDiameter")] - public float DamageDiameter - { - get - { - return this._damageDiameter; - } - - set - { - this._damageDiameter = value; - } - } - - /// - /// Gets or sets the average temp of the damaged area, in degrees celsius. If firing entitty does not model this, use a value of -273.15 - /// - [XmlElement(Type = typeof(float), ElementName = "temperature")] - public float Temperature - { - get - { - return this._temperature; - } - - set - { - this._temperature = value; - } - } - - /// - /// Gets or sets the enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "componentIdentification")] - public byte ComponentIdentification - { - get - { - return this._componentIdentification; - } - - set - { - this._componentIdentification = value; - } - } - - /// - /// Gets or sets the enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "componentDamageStatus")] - public byte ComponentDamageStatus - { - get - { - return this._componentDamageStatus; - } - - set - { - this._componentDamageStatus = value; - } - } - - /// - /// Gets or sets the enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "componentVisualDamageStatus")] - public byte ComponentVisualDamageStatus - { - get - { - return this._componentVisualDamageStatus; - } - - set - { - this._componentVisualDamageStatus = value; - } - } - - /// - /// Gets or sets the enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "componentVisualSmokeColor")] - public byte ComponentVisualSmokeColor - { - get - { - return this._componentVisualSmokeColor; - } - - set - { - this._componentVisualSmokeColor = value; - } - } - - /// - /// Gets or sets the For any component damage resulting this field shall be set to the fire event ID from that PDU. - /// - [XmlElement(Type = typeof(EventIdentifier), ElementName = "fireEventID")] - public EventIdentifier FireEventID - { - get - { - return this._fireEventID; - } - - set - { - this._fireEventID = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding2")] - public ushort Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedShort((ushort)this._padding); - this._damageLocation.Marshal(dos); - dos.WriteFloat((float)this._damageDiameter); - dos.WriteFloat((float)this._temperature); - dos.WriteUnsignedByte((byte)this._componentIdentification); - dos.WriteUnsignedByte((byte)this._componentDamageStatus); - dos.WriteUnsignedByte((byte)this._componentVisualDamageStatus); - dos.WriteUnsignedByte((byte)this._componentVisualSmokeColor); - this._fireEventID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._padding2); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - this._damageLocation.Unmarshal(dis); - this._damageDiameter = dis.ReadFloat(); - this._temperature = dis.ReadFloat(); - this._componentIdentification = dis.ReadUnsignedByte(); - this._componentDamageStatus = dis.ReadUnsignedByte(); - this._componentVisualDamageStatus = dis.ReadUnsignedByte(); - this._componentVisualSmokeColor = dis.ReadUnsignedByte(); - this._fireEventID.Unmarshal(dis); - this._padding2 = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._damageLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._damageDiameter.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._temperature.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._componentIdentification.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._componentDamageStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._componentVisualDamageStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._componentVisualSmokeColor.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._fireEventID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DirectedEnergyDamage; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DirectedEnergyDamage obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (!this._damageLocation.Equals(obj._damageLocation)) - { - ivarsEqual = false; - } - - if (this._damageDiameter != obj._damageDiameter) - { - ivarsEqual = false; - } - - if (this._temperature != obj._temperature) - { - ivarsEqual = false; - } - - if (this._componentIdentification != obj._componentIdentification) - { - ivarsEqual = false; - } - - if (this._componentDamageStatus != obj._componentDamageStatus) - { - ivarsEqual = false; - } - - if (this._componentVisualDamageStatus != obj._componentVisualDamageStatus) - { - ivarsEqual = false; - } - - if (this._componentVisualSmokeColor != obj._componentVisualSmokeColor) - { - ivarsEqual = false; - } - - if (!this._fireEventID.Equals(obj._fireEventID)) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._damageLocation.GetHashCode(); - result = GenerateHash(result) ^ this._damageDiameter.GetHashCode(); - result = GenerateHash(result) ^ this._temperature.GetHashCode(); - result = GenerateHash(result) ^ this._componentIdentification.GetHashCode(); - result = GenerateHash(result) ^ this._componentDamageStatus.GetHashCode(); - result = GenerateHash(result) ^ this._componentVisualDamageStatus.GetHashCode(); - result = GenerateHash(result) ^ this._componentVisualSmokeColor.GetHashCode(); - result = GenerateHash(result) ^ this._fireEventID.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DirectedEnergyFirePdu.cs b/tests/OpenDisNet.Reference/Generated/DirectedEnergyFirePdu.cs deleted file mode 100644 index 4ce5f99..0000000 --- a/tests/OpenDisNet.Reference/Generated/DirectedEnergyFirePdu.cs +++ /dev/null @@ -1,809 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Firing of a directed energy weapon shall be communicated by issuing a Directed Energy Fire PDU Section 7.3.4 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - [XmlInclude(typeof(ClockTime))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(StandardVariableSpecification))] - public partial class DirectedEnergyFirePdu : WarfareFamilyPdu, IEquatable - { - /// - /// Field shall identify the munition type enumeration for the DE weapon beam, Section 7.3.4 - /// - private EntityType _munitionType = new EntityType(); - - /// - /// Field shall indicate the simulation time at start of the shot, Section 7.3.4 - /// - private ClockTime _shotStartTime = new ClockTime(); - - /// - /// Field shall indicate the current cumulative duration of the shot, Section 7.3.4 - /// - private float _commulativeShotTime; - - /// - /// Field shall identify the location of the DE weapon aperture/emitter, Section 7.3.4 - /// - private Vector3Float _ApertureEmitterLocation = new Vector3Float(); - - /// - /// Field shall identify the beam diameter at the aperture/emitter, Section 7.3.4 - /// - private float _apertureDiameter; - - /// - /// Field shall identify the emissions wavelength in units of meters, Section 7.3.4 - /// - private float _wavelength; - - /// - /// Field shall identify the current peak irradiance of emissions in units of Watts per square meter, Section 7.3.4 - /// - private float _peakIrradiance; - - /// - /// field shall identify the current pulse repetition frequency in units of cycles per second (Hertz), Section 7.3.4 - /// - private float _pulseRepetitionFrequency; - - /// - /// field shall identify the pulse width emissions in units of seconds, Section 7.3.4 - /// - private int _pulseWidth; - - /// - /// 16bit Boolean field shall contain various flags to indicate status information needed to process a DE, Section 7.3.4 - /// - private int _flags; - - /// - /// Field shall identify the pulse shape and shall be represented as an 8-bit enumeration, Section 7.3.4 - /// - private byte _pulseShape; - - /// - /// padding, Section 7.3.4 - /// - private byte _padding1; - - /// - /// padding, Section 7.3.4 - /// - private uint _padding2; - - /// - /// padding, Section 7.3.4 - /// - private ushort _padding3; - - /// - /// Field shall specify the number of DE records, Section 7.3.4 - /// - private ushort _numberOfDERecords; - - /// - /// Fields shall contain one or more DE records, records shall conform to the variable record format (Section6.2.82), Section 7.3.4 - /// - private List _dERecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public DirectedEnergyFirePdu() - { - PduType = (byte)68; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DirectedEnergyFirePdu left, DirectedEnergyFirePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DirectedEnergyFirePdu left, DirectedEnergyFirePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._munitionType.GetMarshalledSize(); // this._munitionType - marshalSize += this._shotStartTime.GetMarshalledSize(); // this._shotStartTime - marshalSize += 4; // this._commulativeShotTime - marshalSize += this._ApertureEmitterLocation.GetMarshalledSize(); // this._ApertureEmitterLocation - marshalSize += 4; // this._apertureDiameter - marshalSize += 4; // this._wavelength - marshalSize += 4; // this._peakIrradiance - marshalSize += 4; // this._pulseRepetitionFrequency - marshalSize += 4; // this._pulseWidth - marshalSize += 4; // this._flags - marshalSize += 1; // this._pulseShape - marshalSize += 1; // this._padding1 - marshalSize += 4; // this._padding2 - marshalSize += 2; // this._padding3 - marshalSize += 2; // this._numberOfDERecords - for (int idx = 0; idx < this._dERecords.Count; idx++) - { - StandardVariableSpecification listElement = (StandardVariableSpecification)this._dERecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Field shall identify the munition type enumeration for the DE weapon beam, Section 7.3.4 - /// - [XmlElement(Type = typeof(EntityType), ElementName = "munitionType")] - public EntityType MunitionType - { - get - { - return this._munitionType; - } - - set - { - this._munitionType = value; - } - } - - /// - /// Gets or sets the Field shall indicate the simulation time at start of the shot, Section 7.3.4 - /// - [XmlElement(Type = typeof(ClockTime), ElementName = "shotStartTime")] - public ClockTime ShotStartTime - { - get - { - return this._shotStartTime; - } - - set - { - this._shotStartTime = value; - } - } - - /// - /// Gets or sets the Field shall indicate the current cumulative duration of the shot, Section 7.3.4 - /// - [XmlElement(Type = typeof(float), ElementName = "commulativeShotTime")] - public float CommulativeShotTime - { - get - { - return this._commulativeShotTime; - } - - set - { - this._commulativeShotTime = value; - } - } - - /// - /// Gets or sets the Field shall identify the location of the DE weapon aperture/emitter, Section 7.3.4 - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "ApertureEmitterLocation")] - public Vector3Float ApertureEmitterLocation - { - get - { - return this._ApertureEmitterLocation; - } - - set - { - this._ApertureEmitterLocation = value; - } - } - - /// - /// Gets or sets the Field shall identify the beam diameter at the aperture/emitter, Section 7.3.4 - /// - [XmlElement(Type = typeof(float), ElementName = "apertureDiameter")] - public float ApertureDiameter - { - get - { - return this._apertureDiameter; - } - - set - { - this._apertureDiameter = value; - } - } - - /// - /// Gets or sets the Field shall identify the emissions wavelength in units of meters, Section 7.3.4 - /// - [XmlElement(Type = typeof(float), ElementName = "wavelength")] - public float Wavelength - { - get - { - return this._wavelength; - } - - set - { - this._wavelength = value; - } - } - - /// - /// Gets or sets the Field shall identify the current peak irradiance of emissions in units of Watts per square meter, Section 7.3.4 - /// - [XmlElement(Type = typeof(float), ElementName = "peakIrradiance")] - public float PeakIrradiance - { - get - { - return this._peakIrradiance; - } - - set - { - this._peakIrradiance = value; - } - } - - /// - /// Gets or sets the field shall identify the current pulse repetition frequency in units of cycles per second (Hertz), Section 7.3.4 - /// - [XmlElement(Type = typeof(float), ElementName = "pulseRepetitionFrequency")] - public float PulseRepetitionFrequency - { - get - { - return this._pulseRepetitionFrequency; - } - - set - { - this._pulseRepetitionFrequency = value; - } - } - - /// - /// Gets or sets the field shall identify the pulse width emissions in units of seconds, Section 7.3.4 - /// - [XmlElement(Type = typeof(int), ElementName = "pulseWidth")] - public int PulseWidth - { - get - { - return this._pulseWidth; - } - - set - { - this._pulseWidth = value; - } - } - - /// - /// Gets or sets the 16bit Boolean field shall contain various flags to indicate status information needed to process a DE, Section 7.3.4 - /// - [XmlElement(Type = typeof(int), ElementName = "flags")] - public int Flags - { - get - { - return this._flags; - } - - set - { - this._flags = value; - } - } - - /// - /// Gets or sets the Field shall identify the pulse shape and shall be represented as an 8-bit enumeration, Section 7.3.4 - /// - [XmlElement(Type = typeof(byte), ElementName = "pulseShape")] - public byte PulseShape - { - get - { - return this._pulseShape; - } - - set - { - this._pulseShape = value; - } - } - - /// - /// Gets or sets the padding, Section 7.3.4 - /// - [XmlElement(Type = typeof(byte), ElementName = "padding1")] - public byte Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the padding, Section 7.3.4 - /// - [XmlElement(Type = typeof(uint), ElementName = "padding2")] - public uint Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Gets or sets the padding, Section 7.3.4 - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding3")] - public ushort Padding3 - { - get - { - return this._padding3; - } - - set - { - this._padding3 = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfDERecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfDERecords")] - public ushort NumberOfDERecords - { - get - { - return this._numberOfDERecords; - } - - set - { - this._numberOfDERecords = value; - } - } - - /// - /// Gets or sets the Fields shall contain one or more DE records, records shall conform to the variable record format (Section6.2.82), Section 7.3.4 - /// - [XmlElement(ElementName = "dERecordsList", Type = typeof(List))] - public List DERecords - { - get - { - return this._dERecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._munitionType.Marshal(dos); - this._shotStartTime.Marshal(dos); - dos.WriteFloat((float)this._commulativeShotTime); - this._ApertureEmitterLocation.Marshal(dos); - dos.WriteFloat((float)this._apertureDiameter); - dos.WriteFloat((float)this._wavelength); - dos.WriteFloat((float)this._peakIrradiance); - dos.WriteFloat((float)this._pulseRepetitionFrequency); - dos.WriteInt((int)this._pulseWidth); - dos.WriteInt((int)this._flags); - dos.WriteByte((byte)this._pulseShape); - dos.WriteUnsignedByte((byte)this._padding1); - dos.WriteUnsignedInt((uint)this._padding2); - dos.WriteUnsignedShort((ushort)this._padding3); - dos.WriteUnsignedShort((ushort)this._dERecords.Count); - - for (int idx = 0; idx < this._dERecords.Count; idx++) - { - StandardVariableSpecification aStandardVariableSpecification = (StandardVariableSpecification)this._dERecords[idx]; - aStandardVariableSpecification.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._munitionType.Unmarshal(dis); - this._shotStartTime.Unmarshal(dis); - this._commulativeShotTime = dis.ReadFloat(); - this._ApertureEmitterLocation.Unmarshal(dis); - this._apertureDiameter = dis.ReadFloat(); - this._wavelength = dis.ReadFloat(); - this._peakIrradiance = dis.ReadFloat(); - this._pulseRepetitionFrequency = dis.ReadFloat(); - this._pulseWidth = dis.ReadInt(); - this._flags = dis.ReadInt(); - this._pulseShape = dis.ReadByte(); - this._padding1 = dis.ReadUnsignedByte(); - this._padding2 = dis.ReadUnsignedInt(); - this._padding3 = dis.ReadUnsignedShort(); - this._numberOfDERecords = dis.ReadUnsignedShort(); - for (int idx = 0; idx < this.NumberOfDERecords; idx++) - { - StandardVariableSpecification anX = new StandardVariableSpecification(); - anX.Unmarshal(dis); - this._dERecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._munitionType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._shotStartTime.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._commulativeShotTime.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._ApertureEmitterLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._apertureDiameter.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._wavelength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._peakIrradiance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pulseRepetitionFrequency.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pulseWidth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._flags.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pulseShape.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding3.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._dERecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._dERecords.Count; idx++) - { - sb.AppendLine(""); - StandardVariableSpecification aStandardVariableSpecification = (StandardVariableSpecification)this._dERecords[idx]; - aStandardVariableSpecification.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DirectedEnergyFirePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DirectedEnergyFirePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._munitionType.Equals(obj._munitionType)) - { - ivarsEqual = false; - } - - if (!this._shotStartTime.Equals(obj._shotStartTime)) - { - ivarsEqual = false; - } - - if (this._commulativeShotTime != obj._commulativeShotTime) - { - ivarsEqual = false; - } - - if (!this._ApertureEmitterLocation.Equals(obj._ApertureEmitterLocation)) - { - ivarsEqual = false; - } - - if (this._apertureDiameter != obj._apertureDiameter) - { - ivarsEqual = false; - } - - if (this._wavelength != obj._wavelength) - { - ivarsEqual = false; - } - - if (this._peakIrradiance != obj._peakIrradiance) - { - ivarsEqual = false; - } - - if (this._pulseRepetitionFrequency != obj._pulseRepetitionFrequency) - { - ivarsEqual = false; - } - - if (this._pulseWidth != obj._pulseWidth) - { - ivarsEqual = false; - } - - if (this._flags != obj._flags) - { - ivarsEqual = false; - } - - if (this._pulseShape != obj._pulseShape) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._padding3 != obj._padding3) - { - ivarsEqual = false; - } - - if (this._numberOfDERecords != obj._numberOfDERecords) - { - ivarsEqual = false; - } - - if (this._dERecords.Count != obj._dERecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._dERecords.Count; idx++) - { - if (!this._dERecords[idx].Equals(obj._dERecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._munitionType.GetHashCode(); - result = GenerateHash(result) ^ this._shotStartTime.GetHashCode(); - result = GenerateHash(result) ^ this._commulativeShotTime.GetHashCode(); - result = GenerateHash(result) ^ this._ApertureEmitterLocation.GetHashCode(); - result = GenerateHash(result) ^ this._apertureDiameter.GetHashCode(); - result = GenerateHash(result) ^ this._wavelength.GetHashCode(); - result = GenerateHash(result) ^ this._peakIrradiance.GetHashCode(); - result = GenerateHash(result) ^ this._pulseRepetitionFrequency.GetHashCode(); - result = GenerateHash(result) ^ this._pulseWidth.GetHashCode(); - result = GenerateHash(result) ^ this._flags.GetHashCode(); - result = GenerateHash(result) ^ this._pulseShape.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._padding3.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfDERecords.GetHashCode(); - - if (this._dERecords.Count > 0) - { - for (int idx = 0; idx < this._dERecords.Count; idx++) - { - result = GenerateHash(result) ^ this._dERecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DirectedEnergyPrecisionAimpoint.cs b/tests/OpenDisNet.Reference/Generated/DirectedEnergyPrecisionAimpoint.cs deleted file mode 100644 index 1eeda49..0000000 --- a/tests/OpenDisNet.Reference/Generated/DirectedEnergyPrecisionAimpoint.cs +++ /dev/null @@ -1,674 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// DE Precision Aimpoint Record. Section 6.2.21.3 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(EntityID))] - public partial class DirectedEnergyPrecisionAimpoint - { - /// - /// Type of Record - /// - private uint _recordType = 4000; - - /// - /// Length of Record - /// - private ushort _recordLength = 88; - - /// - /// Padding - /// - private ushort _padding; - - /// - /// Position of Target Spot in World Coordinates. - /// - private Vector3Double _targetSpotLocation = new Vector3Double(); - - /// - /// Position (meters) of Target Spot relative to Entity Position. - /// - private Vector3Float _targetSpotEntityLocation = new Vector3Float(); - - /// - /// Velocity (meters/sec) of Target Spot. - /// - private Vector3Float _targetSpotVelocity = new Vector3Float(); - - /// - /// Acceleration (meters/sec/sec) of Target Spot. - /// - private Vector3Float _targetSpotAcceleration = new Vector3Float(); - - /// - /// Unique ID of the target entity. - /// - private EntityID _targetEntityID = new EntityID(); - - /// - /// Target Component ID ENUM, same as in DamageDescriptionRecord. - /// - private byte _targetComponentID; - - /// - /// Spot Shape ENUM. - /// - private byte _SpotShape; - - /// - /// Beam Spot Cross Section Semi-Major Axis. - /// - private float _BeamSpotXSecSemiMajorAxis; - - /// - /// Beam Spot Cross Section Semi-Major Axis. - /// - private float _BeamSpotCrossSectionSemiMinorAxis; - - /// - /// Beam Spot Cross Section Orientation Angle. - /// - private float _BeamSpotCrossSectionOrientAngle; - - /// - /// Initializes a new instance of the class. - /// - public DirectedEnergyPrecisionAimpoint() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DirectedEnergyPrecisionAimpoint left, DirectedEnergyPrecisionAimpoint right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DirectedEnergyPrecisionAimpoint left, DirectedEnergyPrecisionAimpoint right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 2; // this._padding - marshalSize += this._targetSpotLocation.GetMarshalledSize(); // this._targetSpotLocation - marshalSize += this._targetSpotEntityLocation.GetMarshalledSize(); // this._targetSpotEntityLocation - marshalSize += this._targetSpotVelocity.GetMarshalledSize(); // this._targetSpotVelocity - marshalSize += this._targetSpotAcceleration.GetMarshalledSize(); // this._targetSpotAcceleration - marshalSize += this._targetEntityID.GetMarshalledSize(); // this._targetEntityID - marshalSize += 1; // this._targetComponentID - marshalSize += 1; // this._SpotShape - marshalSize += 4; // this._BeamSpotXSecSemiMajorAxis - marshalSize += 4; // this._BeamSpotCrossSectionSemiMinorAxis - marshalSize += 4; // this._BeamSpotCrossSectionOrientAngle - return marshalSize; - } - - /// - /// Gets or sets the Type of Record - /// - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the Length of Record - /// - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - /// - /// Gets or sets the Padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Gets or sets the Position of Target Spot in World Coordinates. - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "targetSpotLocation")] - public Vector3Double TargetSpotLocation - { - get - { - return this._targetSpotLocation; - } - - set - { - this._targetSpotLocation = value; - } - } - - /// - /// Gets or sets the Position (meters) of Target Spot relative to Entity Position. - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "targetSpotEntityLocation")] - public Vector3Float TargetSpotEntityLocation - { - get - { - return this._targetSpotEntityLocation; - } - - set - { - this._targetSpotEntityLocation = value; - } - } - - /// - /// Gets or sets the Velocity (meters/sec) of Target Spot. - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "targetSpotVelocity")] - public Vector3Float TargetSpotVelocity - { - get - { - return this._targetSpotVelocity; - } - - set - { - this._targetSpotVelocity = value; - } - } - - /// - /// Gets or sets the Acceleration (meters/sec/sec) of Target Spot. - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "targetSpotAcceleration")] - public Vector3Float TargetSpotAcceleration - { - get - { - return this._targetSpotAcceleration; - } - - set - { - this._targetSpotAcceleration = value; - } - } - - /// - /// Gets or sets the Unique ID of the target entity. - /// - [XmlElement(Type = typeof(EntityID), ElementName = "targetEntityID")] - public EntityID TargetEntityID - { - get - { - return this._targetEntityID; - } - - set - { - this._targetEntityID = value; - } - } - - /// - /// Gets or sets the Target Component ID ENUM, same as in DamageDescriptionRecord. - /// - [XmlElement(Type = typeof(byte), ElementName = "targetComponentID")] - public byte TargetComponentID - { - get - { - return this._targetComponentID; - } - - set - { - this._targetComponentID = value; - } - } - - /// - /// Gets or sets the Spot Shape ENUM. - /// - [XmlElement(Type = typeof(byte), ElementName = "SpotShape")] - public byte SpotShape - { - get - { - return this._SpotShape; - } - - set - { - this._SpotShape = value; - } - } - - /// - /// Gets or sets the Beam Spot Cross Section Semi-Major Axis. - /// - [XmlElement(Type = typeof(float), ElementName = "BeamSpotXSecSemiMajorAxis")] - public float BeamSpotXSecSemiMajorAxis - { - get - { - return this._BeamSpotXSecSemiMajorAxis; - } - - set - { - this._BeamSpotXSecSemiMajorAxis = value; - } - } - - /// - /// Gets or sets the Beam Spot Cross Section Semi-Major Axis. - /// - [XmlElement(Type = typeof(float), ElementName = "BeamSpotCrossSectionSemiMinorAxis")] - public float BeamSpotCrossSectionSemiMinorAxis - { - get - { - return this._BeamSpotCrossSectionSemiMinorAxis; - } - - set - { - this._BeamSpotCrossSectionSemiMinorAxis = value; - } - } - - /// - /// Gets or sets the Beam Spot Cross Section Orientation Angle. - /// - [XmlElement(Type = typeof(float), ElementName = "BeamSpotCrossSectionOrientAngle")] - public float BeamSpotCrossSectionOrientAngle - { - get - { - return this._BeamSpotCrossSectionOrientAngle; - } - - set - { - this._BeamSpotCrossSectionOrientAngle = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedShort((ushort)this._padding); - this._targetSpotLocation.Marshal(dos); - this._targetSpotEntityLocation.Marshal(dos); - this._targetSpotVelocity.Marshal(dos); - this._targetSpotAcceleration.Marshal(dos); - this._targetEntityID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._targetComponentID); - dos.WriteUnsignedByte((byte)this._SpotShape); - dos.WriteFloat((float)this._BeamSpotXSecSemiMajorAxis); - dos.WriteFloat((float)this._BeamSpotCrossSectionSemiMinorAxis); - dos.WriteFloat((float)this._BeamSpotCrossSectionOrientAngle); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - this._targetSpotLocation.Unmarshal(dis); - this._targetSpotEntityLocation.Unmarshal(dis); - this._targetSpotVelocity.Unmarshal(dis); - this._targetSpotAcceleration.Unmarshal(dis); - this._targetEntityID.Unmarshal(dis); - this._targetComponentID = dis.ReadUnsignedByte(); - this._SpotShape = dis.ReadUnsignedByte(); - this._BeamSpotXSecSemiMajorAxis = dis.ReadFloat(); - this._BeamSpotCrossSectionSemiMinorAxis = dis.ReadFloat(); - this._BeamSpotCrossSectionOrientAngle = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._targetSpotLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._targetSpotEntityLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._targetSpotVelocity.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._targetSpotAcceleration.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._targetEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._targetComponentID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._SpotShape.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._BeamSpotXSecSemiMajorAxis.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._BeamSpotCrossSectionSemiMinorAxis.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._BeamSpotCrossSectionOrientAngle.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DirectedEnergyPrecisionAimpoint; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DirectedEnergyPrecisionAimpoint obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (!this._targetSpotLocation.Equals(obj._targetSpotLocation)) - { - ivarsEqual = false; - } - - if (!this._targetSpotEntityLocation.Equals(obj._targetSpotEntityLocation)) - { - ivarsEqual = false; - } - - if (!this._targetSpotVelocity.Equals(obj._targetSpotVelocity)) - { - ivarsEqual = false; - } - - if (!this._targetSpotAcceleration.Equals(obj._targetSpotAcceleration)) - { - ivarsEqual = false; - } - - if (!this._targetEntityID.Equals(obj._targetEntityID)) - { - ivarsEqual = false; - } - - if (this._targetComponentID != obj._targetComponentID) - { - ivarsEqual = false; - } - - if (this._SpotShape != obj._SpotShape) - { - ivarsEqual = false; - } - - if (this._BeamSpotXSecSemiMajorAxis != obj._BeamSpotXSecSemiMajorAxis) - { - ivarsEqual = false; - } - - if (this._BeamSpotCrossSectionSemiMinorAxis != obj._BeamSpotCrossSectionSemiMinorAxis) - { - ivarsEqual = false; - } - - if (this._BeamSpotCrossSectionOrientAngle != obj._BeamSpotCrossSectionOrientAngle) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._targetSpotLocation.GetHashCode(); - result = GenerateHash(result) ^ this._targetSpotEntityLocation.GetHashCode(); - result = GenerateHash(result) ^ this._targetSpotVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._targetSpotAcceleration.GetHashCode(); - result = GenerateHash(result) ^ this._targetEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._targetComponentID.GetHashCode(); - result = GenerateHash(result) ^ this._SpotShape.GetHashCode(); - result = GenerateHash(result) ^ this._BeamSpotXSecSemiMajorAxis.GetHashCode(); - result = GenerateHash(result) ^ this._BeamSpotCrossSectionSemiMinorAxis.GetHashCode(); - result = GenerateHash(result) ^ this._BeamSpotCrossSectionOrientAngle.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DirectedEnergyTargetEnergyDeposition.cs b/tests/OpenDisNet.Reference/Generated/DirectedEnergyTargetEnergyDeposition.cs deleted file mode 100644 index 1b0a133..0000000 --- a/tests/OpenDisNet.Reference/Generated/DirectedEnergyTargetEnergyDeposition.cs +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// DE energy depostion properties for a target entity. Section 6.2.21.4 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class DirectedEnergyTargetEnergyDeposition - { - /// - /// Unique ID of the target entity. - /// - private EntityID _targetEntityID = new EntityID(); - - /// - /// padding - /// - private ushort _padding; - - /// - /// Peak irrandiance - /// - private float _peakIrradiance; - - /// - /// Initializes a new instance of the class. - /// - public DirectedEnergyTargetEnergyDeposition() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DirectedEnergyTargetEnergyDeposition left, DirectedEnergyTargetEnergyDeposition right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DirectedEnergyTargetEnergyDeposition left, DirectedEnergyTargetEnergyDeposition right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._targetEntityID.GetMarshalledSize(); // this._targetEntityID - marshalSize += 2; // this._padding - marshalSize += 4; // this._peakIrradiance - return marshalSize; - } - - /// - /// Gets or sets the Unique ID of the target entity. - /// - [XmlElement(Type = typeof(EntityID), ElementName = "targetEntityID")] - public EntityID TargetEntityID - { - get - { - return this._targetEntityID; - } - - set - { - this._targetEntityID = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Gets or sets the Peak irrandiance - /// - [XmlElement(Type = typeof(float), ElementName = "peakIrradiance")] - public float PeakIrradiance - { - get - { - return this._peakIrradiance; - } - - set - { - this._peakIrradiance = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._targetEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._padding); - dos.WriteFloat((float)this._peakIrradiance); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._targetEntityID.Unmarshal(dis); - this._padding = dis.ReadUnsignedShort(); - this._peakIrradiance = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._targetEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._peakIrradiance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DirectedEnergyTargetEnergyDeposition; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DirectedEnergyTargetEnergyDeposition obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._targetEntityID.Equals(obj._targetEntityID)) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (this._peakIrradiance != obj._peakIrradiance) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._targetEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._peakIrradiance.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/DistributedEmissionsFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/DistributedEmissionsFamilyPdu.cs deleted file mode 100644 index 1afa67b..0000000 --- a/tests/OpenDisNet.Reference/Generated/DistributedEmissionsFamilyPdu.cs +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.7. Electronic Emissions. Abstract superclass for distirubted emissions PDU - /// - [Serializable] - [XmlRoot] - public partial class DistributedEmissionsFamilyPdu : Pdu, IEquatable - { - /// - /// Initializes a new instance of the class. - /// - public DistributedEmissionsFamilyPdu() - { - ProtocolFamily = (byte)6; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(DistributedEmissionsFamilyPdu left, DistributedEmissionsFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(DistributedEmissionsFamilyPdu left, DistributedEmissionsFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - return marshalSize; - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as DistributedEmissionsFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(DistributedEmissionsFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EEFundamentalParameterData.cs b/tests/OpenDisNet.Reference/Generated/EEFundamentalParameterData.cs deleted file mode 100644 index d6d6483..0000000 --- a/tests/OpenDisNet.Reference/Generated/EEFundamentalParameterData.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Contains electromagnetic emmission regeneration parameters that are variable throught a scenario. Section 6.2.22. - /// - [Serializable] - [XmlRoot] - public partial class EEFundamentalParameterData - { - /// - /// center frequency of the emission in hertz. - /// - private float _frequency; - - /// - /// Bandwidth of the frequencies corresponding to the fequency field. - /// - private float _frequencyRange; - - /// - /// Effective radiated power for the emission in DdBm. For a radar noise jammer, indicates the peak of the transmitted power. - /// - private float _effectiveRadiatedPower; - - /// - /// Average repetition frequency of the emission in hertz. - /// - private float _pulseRepetitionFrequency; - - /// - /// Average pulse width of the emission in microseconds. - /// - private float _pulseWidth; - - /// - /// Initializes a new instance of the class. - /// - public EEFundamentalParameterData() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EEFundamentalParameterData left, EEFundamentalParameterData right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EEFundamentalParameterData left, EEFundamentalParameterData right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._frequency - marshalSize += 4; // this._frequencyRange - marshalSize += 4; // this._effectiveRadiatedPower - marshalSize += 4; // this._pulseRepetitionFrequency - marshalSize += 4; // this._pulseWidth - return marshalSize; - } - - /// - /// Gets or sets the center frequency of the emission in hertz. - /// - [XmlElement(Type = typeof(float), ElementName = "frequency")] - public float Frequency - { - get - { - return this._frequency; - } - - set - { - this._frequency = value; - } - } - - /// - /// Gets or sets the Bandwidth of the frequencies corresponding to the fequency field. - /// - [XmlElement(Type = typeof(float), ElementName = "frequencyRange")] - public float FrequencyRange - { - get - { - return this._frequencyRange; - } - - set - { - this._frequencyRange = value; - } - } - - /// - /// Gets or sets the Effective radiated power for the emission in DdBm. For a radar noise jammer, indicates the peak of the transmitted power. - /// - [XmlElement(Type = typeof(float), ElementName = "effectiveRadiatedPower")] - public float EffectiveRadiatedPower - { - get - { - return this._effectiveRadiatedPower; - } - - set - { - this._effectiveRadiatedPower = value; - } - } - - /// - /// Gets or sets the Average repetition frequency of the emission in hertz. - /// - [XmlElement(Type = typeof(float), ElementName = "pulseRepetitionFrequency")] - public float PulseRepetitionFrequency - { - get - { - return this._pulseRepetitionFrequency; - } - - set - { - this._pulseRepetitionFrequency = value; - } - } - - /// - /// Gets or sets the Average pulse width of the emission in microseconds. - /// - [XmlElement(Type = typeof(float), ElementName = "pulseWidth")] - public float PulseWidth - { - get - { - return this._pulseWidth; - } - - set - { - this._pulseWidth = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._frequency); - dos.WriteFloat((float)this._frequencyRange); - dos.WriteFloat((float)this._effectiveRadiatedPower); - dos.WriteFloat((float)this._pulseRepetitionFrequency); - dos.WriteFloat((float)this._pulseWidth); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._frequency = dis.ReadFloat(); - this._frequencyRange = dis.ReadFloat(); - this._effectiveRadiatedPower = dis.ReadFloat(); - this._pulseRepetitionFrequency = dis.ReadFloat(); - this._pulseWidth = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._frequency.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._frequencyRange.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._effectiveRadiatedPower.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pulseRepetitionFrequency.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pulseWidth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EEFundamentalParameterData; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EEFundamentalParameterData obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._frequency != obj._frequency) - { - ivarsEqual = false; - } - - if (this._frequencyRange != obj._frequencyRange) - { - ivarsEqual = false; - } - - if (this._effectiveRadiatedPower != obj._effectiveRadiatedPower) - { - ivarsEqual = false; - } - - if (this._pulseRepetitionFrequency != obj._pulseRepetitionFrequency) - { - ivarsEqual = false; - } - - if (this._pulseWidth != obj._pulseWidth) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._frequency.GetHashCode(); - result = GenerateHash(result) ^ this._frequencyRange.GetHashCode(); - result = GenerateHash(result) ^ this._effectiveRadiatedPower.GetHashCode(); - result = GenerateHash(result) ^ this._pulseRepetitionFrequency.GetHashCode(); - result = GenerateHash(result) ^ this._pulseWidth.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EightByteChunk.cs b/tests/OpenDisNet.Reference/Generated/EightByteChunk.cs deleted file mode 100644 index 188fa8d..0000000 --- a/tests/OpenDisNet.Reference/Generated/EightByteChunk.cs +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// 64 bit piece of data - /// - [Serializable] - [XmlRoot] - public partial class EightByteChunk - { - /// - /// Eight bytes of arbitrary data - /// - private byte[] _otherParameters = new byte[8]; - - /// - /// Initializes a new instance of the class. - /// - public EightByteChunk() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EightByteChunk left, EightByteChunk right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EightByteChunk left, EightByteChunk right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 8 * 1; // _otherParameters - return marshalSize; - } - - /// - /// Gets or sets the Eight bytes of arbitrary data - /// - [XmlArray(ElementName = "otherParameters")] - public byte[] OtherParameters - { - get - { - return this._otherParameters; - } - - set - { - this._otherParameters = value; - } -} - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - dos.WriteByte(this._otherParameters[idx]); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - this._otherParameters[idx] = dis.ReadByte(); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - sb.AppendLine("" + this._otherParameters[idx] + ""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EightByteChunk; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EightByteChunk obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (obj._otherParameters.Length != 8) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 8; idx++) - { - if (this._otherParameters[idx] != obj._otherParameters[idx]) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - - for (int idx = 0; idx < 8; idx++) - { - result = GenerateHash(result) ^ this._otherParameters[idx].GetHashCode(); - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ElectronicEmissionsPdu.cs b/tests/OpenDisNet.Reference/Generated/ElectronicEmissionsPdu.cs deleted file mode 100644 index 35133a0..0000000 --- a/tests/OpenDisNet.Reference/Generated/ElectronicEmissionsPdu.cs +++ /dev/null @@ -1,620 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.7.1. Information about active electronic warfare (EW) emissions and active EW countermeasures shall be communicated using an Electromagnetic Emission PDU. NOT COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EventIdentifier))] - [XmlInclude(typeof(EmitterSystem))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(Vector3Float))] - public partial class ElectronicEmissionsPdu : DistributedEmissionsFamilyPdu, IEquatable - { - /// - /// ID of the entity emitting - /// - private EntityID _emittingEntityID = new EntityID(); - - /// - /// ID of event - /// - private EventIdentifier _eventID = new EventIdentifier(); - - /// - /// This field shall be used to indicate if the data in the PDU represents a state update or just data that has changed since issuance of the last Electromagnetic Emission PDU [relative to the identified entity and emission system(s)]. - /// - private byte _stateUpdateIndicator; - - /// - /// This field shall specify the number of emission systems being described in the current PDU. - /// - private byte _numberOfSystems; - - /// - /// padding - /// - private ushort _paddingForEmissionsPdu; - - /// - /// this field shall specify the length of this emitter system's data in 32-bit words. - /// - private byte _systemDataLength; - - /// - /// the number of beams being described in the current PDU for the emitter system being described. - /// - private byte _numberOfBeams; - - /// - /// information about a particular emitter system and shall be represented by an Emitter System record (see 6.2.23). - /// - private EmitterSystem _emitterSystem = new EmitterSystem(); - - /// - /// the location of the antenna beam source with respect to the emitting entity's coordinate system. This location shall be the origin of the emitter coordinate system that shall have the same orientation as the entity coordinate system. This field shall be represented by an Entity Coordinate Vector record see 6.2.95 - /// - private Vector3Float _location = new Vector3Float(); - - /// - /// Electronic emmissions systems THIS IS WRONG. It has the WRONG class type and will cause problems in any marshalling. - /// - private List _systems = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ElectronicEmissionsPdu() - { - PduType = (byte)23; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ElectronicEmissionsPdu left, ElectronicEmissionsPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ElectronicEmissionsPdu left, ElectronicEmissionsPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._emittingEntityID.GetMarshalledSize(); // this._emittingEntityID - marshalSize += this._eventID.GetMarshalledSize(); // this._eventID - marshalSize += 1; // this._stateUpdateIndicator - marshalSize += 1; // this._numberOfSystems - marshalSize += 2; // this._paddingForEmissionsPdu - marshalSize += 1; // this._systemDataLength - marshalSize += 1; // this._numberOfBeams - marshalSize += this._emitterSystem.GetMarshalledSize(); // this._emitterSystem - marshalSize += this._location.GetMarshalledSize(); // this._location - for (int idx = 0; idx < this._systems.Count; idx++) - { - Vector3Float listElement = (Vector3Float)this._systems[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the ID of the entity emitting - /// - [XmlElement(Type = typeof(EntityID), ElementName = "emittingEntityID")] - public EntityID EmittingEntityID - { - get - { - return this._emittingEntityID; - } - - set - { - this._emittingEntityID = value; - } - } - - /// - /// Gets or sets the ID of event - /// - [XmlElement(Type = typeof(EventIdentifier), ElementName = "eventID")] - public EventIdentifier EventID - { - get - { - return this._eventID; - } - - set - { - this._eventID = value; - } - } - - /// - /// Gets or sets the This field shall be used to indicate if the data in the PDU represents a state update or just data that has changed since issuance of the last Electromagnetic Emission PDU [relative to the identified entity and emission system(s)]. - /// - [XmlElement(Type = typeof(byte), ElementName = "stateUpdateIndicator")] - public byte StateUpdateIndicator - { - get - { - return this._stateUpdateIndicator; - } - - set - { - this._stateUpdateIndicator = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfSystems method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfSystems")] - public byte NumberOfSystems - { - get - { - return this._numberOfSystems; - } - - set - { - this._numberOfSystems = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "paddingForEmissionsPdu")] - public ushort PaddingForEmissionsPdu - { - get - { - return this._paddingForEmissionsPdu; - } - - set - { - this._paddingForEmissionsPdu = value; - } - } - - /// - /// Gets or sets the this field shall specify the length of this emitter system's data in 32-bit words. - /// - [XmlElement(Type = typeof(byte), ElementName = "systemDataLength")] - public byte SystemDataLength - { - get - { - return this._systemDataLength; - } - - set - { - this._systemDataLength = value; - } - } - - /// - /// Gets or sets the the number of beams being described in the current PDU for the emitter system being described. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfBeams")] - public byte NumberOfBeams - { - get - { - return this._numberOfBeams; - } - - set - { - this._numberOfBeams = value; - } - } - - /// - /// Gets or sets the information about a particular emitter system and shall be represented by an Emitter System record (see 6.2.23). - /// - [XmlElement(Type = typeof(EmitterSystem), ElementName = "emitterSystem")] - public EmitterSystem EmitterSystem - { - get - { - return this._emitterSystem; - } - - set - { - this._emitterSystem = value; - } - } - - /// - /// Gets or sets the the location of the antenna beam source with respect to the emitting entity's coordinate system. This location shall be the origin of the emitter coordinate system that shall have the same orientation as the entity coordinate system. This field shall be represented by an Entity Coordinate Vector record see 6.2.95 - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "location")] - public Vector3Float Location - { - get - { - return this._location; - } - - set - { - this._location = value; - } - } - - /// - /// Gets or sets the Electronic emmissions systems THIS IS WRONG. It has the WRONG class type and will cause problems in any marshalling. - /// - [XmlElement(ElementName = "systemsList", Type = typeof(List))] - public List Systems - { - get - { - return this._systems; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._emittingEntityID.Marshal(dos); - this._eventID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._stateUpdateIndicator); - dos.WriteUnsignedByte((byte)this._systems.Count); - dos.WriteUnsignedShort((ushort)this._paddingForEmissionsPdu); - dos.WriteUnsignedByte((byte)this._systemDataLength); - dos.WriteUnsignedByte((byte)this._numberOfBeams); - this._emitterSystem.Marshal(dos); - this._location.Marshal(dos); - - for (int idx = 0; idx < this._systems.Count; idx++) - { - Vector3Float aVector3Float = (Vector3Float)this._systems[idx]; - aVector3Float.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._emittingEntityID.Unmarshal(dis); - this._eventID.Unmarshal(dis); - this._stateUpdateIndicator = dis.ReadUnsignedByte(); - this._numberOfSystems = dis.ReadUnsignedByte(); - this._paddingForEmissionsPdu = dis.ReadUnsignedShort(); - this._systemDataLength = dis.ReadUnsignedByte(); - this._numberOfBeams = dis.ReadUnsignedByte(); - this._emitterSystem.Unmarshal(dis); - this._location.Unmarshal(dis); - for (int idx = 0; idx < this.NumberOfSystems; idx++) - { - Vector3Float anX = new Vector3Float(); - anX.Unmarshal(dis); - this._systems.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._emittingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._eventID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._stateUpdateIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._systems.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._paddingForEmissionsPdu.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._systemDataLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._numberOfBeams.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._emitterSystem.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._location.Reflection(sb); - sb.AppendLine(""); - for (int idx = 0; idx < this._systems.Count; idx++) - { - sb.AppendLine(""); - Vector3Float aVector3Float = (Vector3Float)this._systems[idx]; - aVector3Float.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ElectronicEmissionsPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ElectronicEmissionsPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._emittingEntityID.Equals(obj._emittingEntityID)) - { - ivarsEqual = false; - } - - if (!this._eventID.Equals(obj._eventID)) - { - ivarsEqual = false; - } - - if (this._stateUpdateIndicator != obj._stateUpdateIndicator) - { - ivarsEqual = false; - } - - if (this._numberOfSystems != obj._numberOfSystems) - { - ivarsEqual = false; - } - - if (this._paddingForEmissionsPdu != obj._paddingForEmissionsPdu) - { - ivarsEqual = false; - } - - if (this._systemDataLength != obj._systemDataLength) - { - ivarsEqual = false; - } - - if (this._numberOfBeams != obj._numberOfBeams) - { - ivarsEqual = false; - } - - if (!this._emitterSystem.Equals(obj._emitterSystem)) - { - ivarsEqual = false; - } - - if (!this._location.Equals(obj._location)) - { - ivarsEqual = false; - } - - if (this._systems.Count != obj._systems.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._systems.Count; idx++) - { - if (!this._systems[idx].Equals(obj._systems[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._emittingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._eventID.GetHashCode(); - result = GenerateHash(result) ^ this._stateUpdateIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfSystems.GetHashCode(); - result = GenerateHash(result) ^ this._paddingForEmissionsPdu.GetHashCode(); - result = GenerateHash(result) ^ this._systemDataLength.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfBeams.GetHashCode(); - result = GenerateHash(result) ^ this._emitterSystem.GetHashCode(); - result = GenerateHash(result) ^ this._location.GetHashCode(); - - if (this._systems.Count > 0) - { - for (int idx = 0; idx < this._systems.Count; idx++) - { - result = GenerateHash(result) ^ this._systems[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EmitterSystem.cs b/tests/OpenDisNet.Reference/Generated/EmitterSystem.cs deleted file mode 100644 index 102f3f9..0000000 --- a/tests/OpenDisNet.Reference/Generated/EmitterSystem.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// This field shall specify information about a particular emitter system. Section 6.2.23. - /// - [Serializable] - [XmlRoot] - public partial class EmitterSystem - { - /// - /// Name of the emitter, 16 bit enumeration - /// - private ushort _emitterName; - - /// - /// function of the emitter, 8 bit enumeration - /// - private byte _function; - - /// - /// emitter ID, 8 bit enumeration - /// - private byte _emitterIdNumber; - - /// - /// Initializes a new instance of the class. - /// - public EmitterSystem() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EmitterSystem left, EmitterSystem right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EmitterSystem left, EmitterSystem right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._emitterName - marshalSize += 1; // this._function - marshalSize += 1; // this._emitterIdNumber - return marshalSize; - } - - /// - /// Gets or sets the Name of the emitter, 16 bit enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "emitterName")] - public ushort EmitterName - { - get - { - return this._emitterName; - } - - set - { - this._emitterName = value; - } - } - - /// - /// Gets or sets the function of the emitter, 8 bit enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "function")] - public byte Function - { - get - { - return this._function; - } - - set - { - this._function = value; - } - } - - /// - /// Gets or sets the emitter ID, 8 bit enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "emitterIdNumber")] - public byte EmitterIdNumber - { - get - { - return this._emitterIdNumber; - } - - set - { - this._emitterIdNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._emitterName); - dos.WriteUnsignedByte((byte)this._function); - dos.WriteUnsignedByte((byte)this._emitterIdNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._emitterName = dis.ReadUnsignedShort(); - this._function = dis.ReadUnsignedByte(); - this._emitterIdNumber = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._emitterName.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._function.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._emitterIdNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EmitterSystem; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EmitterSystem obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._emitterName != obj._emitterName) - { - ivarsEqual = false; - } - - if (this._function != obj._function) - { - ivarsEqual = false; - } - - if (this._emitterIdNumber != obj._emitterIdNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._emitterName.GetHashCode(); - result = GenerateHash(result) ^ this._function.GetHashCode(); - result = GenerateHash(result) ^ this._emitterIdNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EngineFuel.cs b/tests/OpenDisNet.Reference/Generated/EngineFuel.cs deleted file mode 100644 index ee06643..0000000 --- a/tests/OpenDisNet.Reference/Generated/EngineFuel.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about an entity's engine fuel. Section 6.2.24. - /// - [Serializable] - [XmlRoot] - public partial class EngineFuel - { - /// - /// Fuel quantity, units specified by next field - /// - private uint _fuelQuantity; - - /// - /// Units in which the fuel is measured - /// - private byte _fuelMeasurementUnits; - - /// - /// Type of fuel - /// - private byte _fuelType; - - /// - /// Location of fuel as related to entity. See section 14 of EBV document - /// - private byte _fuelLocation; - - /// - /// padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public EngineFuel() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EngineFuel left, EngineFuel right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EngineFuel left, EngineFuel right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._fuelQuantity - marshalSize += 1; // this._fuelMeasurementUnits - marshalSize += 1; // this._fuelType - marshalSize += 1; // this._fuelLocation - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the Fuel quantity, units specified by next field - /// - [XmlElement(Type = typeof(uint), ElementName = "fuelQuantity")] - public uint FuelQuantity - { - get - { - return this._fuelQuantity; - } - - set - { - this._fuelQuantity = value; - } - } - - /// - /// Gets or sets the Units in which the fuel is measured - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelMeasurementUnits")] - public byte FuelMeasurementUnits - { - get - { - return this._fuelMeasurementUnits; - } - - set - { - this._fuelMeasurementUnits = value; - } - } - - /// - /// Gets or sets the Type of fuel - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelType")] - public byte FuelType - { - get - { - return this._fuelType; - } - - set - { - this._fuelType = value; - } - } - - /// - /// Gets or sets the Location of fuel as related to entity. See section 14 of EBV document - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelLocation")] - public byte FuelLocation - { - get - { - return this._fuelLocation; - } - - set - { - this._fuelLocation = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._fuelQuantity); - dos.WriteUnsignedByte((byte)this._fuelMeasurementUnits); - dos.WriteUnsignedByte((byte)this._fuelType); - dos.WriteUnsignedByte((byte)this._fuelLocation); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._fuelQuantity = dis.ReadUnsignedInt(); - this._fuelMeasurementUnits = dis.ReadUnsignedByte(); - this._fuelType = dis.ReadUnsignedByte(); - this._fuelLocation = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._fuelQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelMeasurementUnits.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EngineFuel; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EngineFuel obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._fuelQuantity != obj._fuelQuantity) - { - ivarsEqual = false; - } - - if (this._fuelMeasurementUnits != obj._fuelMeasurementUnits) - { - ivarsEqual = false; - } - - if (this._fuelType != obj._fuelType) - { - ivarsEqual = false; - } - - if (this._fuelLocation != obj._fuelLocation) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._fuelQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._fuelMeasurementUnits.GetHashCode(); - result = GenerateHash(result) ^ this._fuelType.GetHashCode(); - result = GenerateHash(result) ^ this._fuelLocation.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EngineFuelReload.cs b/tests/OpenDisNet.Reference/Generated/EngineFuelReload.cs deleted file mode 100644 index 9685423..0000000 --- a/tests/OpenDisNet.Reference/Generated/EngineFuelReload.cs +++ /dev/null @@ -1,469 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// For each type or location of engine fuell, this record specifies the type, location, fuel measurement units, and reload quantity and maximum quantity. Section 6.2.25. - /// - [Serializable] - [XmlRoot] - public partial class EngineFuelReload - { - /// - /// standard quantity of fuel loaded - /// - private uint _standardQuantity; - - /// - /// maximum quantity of fuel loaded - /// - private uint _maximumQuantity; - - /// - /// seconds normally required to to reload standard qty - /// - private uint _standardQuantityReloadTime; - - /// - /// seconds normally required to to reload maximum qty - /// - private uint _maximumQuantityReloadTime; - - /// - /// Units of measure - /// - private byte _fuelMeasurmentUnits; - - /// - /// fuel location as related to the entity - /// - private byte _fuelLocation; - - /// - /// padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public EngineFuelReload() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EngineFuelReload left, EngineFuelReload right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EngineFuelReload left, EngineFuelReload right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._standardQuantity - marshalSize += 4; // this._maximumQuantity - marshalSize += 4; // this._standardQuantityReloadTime - marshalSize += 4; // this._maximumQuantityReloadTime - marshalSize += 1; // this._fuelMeasurmentUnits - marshalSize += 1; // this._fuelLocation - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the standard quantity of fuel loaded - /// - [XmlElement(Type = typeof(uint), ElementName = "standardQuantity")] - public uint StandardQuantity - { - get - { - return this._standardQuantity; - } - - set - { - this._standardQuantity = value; - } - } - - /// - /// Gets or sets the maximum quantity of fuel loaded - /// - [XmlElement(Type = typeof(uint), ElementName = "maximumQuantity")] - public uint MaximumQuantity - { - get - { - return this._maximumQuantity; - } - - set - { - this._maximumQuantity = value; - } - } - - /// - /// Gets or sets the seconds normally required to to reload standard qty - /// - [XmlElement(Type = typeof(uint), ElementName = "standardQuantityReloadTime")] - public uint StandardQuantityReloadTime - { - get - { - return this._standardQuantityReloadTime; - } - - set - { - this._standardQuantityReloadTime = value; - } - } - - /// - /// Gets or sets the seconds normally required to to reload maximum qty - /// - [XmlElement(Type = typeof(uint), ElementName = "maximumQuantityReloadTime")] - public uint MaximumQuantityReloadTime - { - get - { - return this._maximumQuantityReloadTime; - } - - set - { - this._maximumQuantityReloadTime = value; - } - } - - /// - /// Gets or sets the Units of measure - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelMeasurmentUnits")] - public byte FuelMeasurmentUnits - { - get - { - return this._fuelMeasurmentUnits; - } - - set - { - this._fuelMeasurmentUnits = value; - } - } - - /// - /// Gets or sets the fuel location as related to the entity - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelLocation")] - public byte FuelLocation - { - get - { - return this._fuelLocation; - } - - set - { - this._fuelLocation = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._standardQuantity); - dos.WriteUnsignedInt((uint)this._maximumQuantity); - dos.WriteUnsignedInt((uint)this._standardQuantityReloadTime); - dos.WriteUnsignedInt((uint)this._maximumQuantityReloadTime); - dos.WriteUnsignedByte((byte)this._fuelMeasurmentUnits); - dos.WriteUnsignedByte((byte)this._fuelLocation); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._standardQuantity = dis.ReadUnsignedInt(); - this._maximumQuantity = dis.ReadUnsignedInt(); - this._standardQuantityReloadTime = dis.ReadUnsignedInt(); - this._maximumQuantityReloadTime = dis.ReadUnsignedInt(); - this._fuelMeasurmentUnits = dis.ReadUnsignedByte(); - this._fuelLocation = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._standardQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._maximumQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._standardQuantityReloadTime.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._maximumQuantityReloadTime.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelMeasurmentUnits.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EngineFuelReload; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EngineFuelReload obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._standardQuantity != obj._standardQuantity) - { - ivarsEqual = false; - } - - if (this._maximumQuantity != obj._maximumQuantity) - { - ivarsEqual = false; - } - - if (this._standardQuantityReloadTime != obj._standardQuantityReloadTime) - { - ivarsEqual = false; - } - - if (this._maximumQuantityReloadTime != obj._maximumQuantityReloadTime) - { - ivarsEqual = false; - } - - if (this._fuelMeasurmentUnits != obj._fuelMeasurmentUnits) - { - ivarsEqual = false; - } - - if (this._fuelLocation != obj._fuelLocation) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._standardQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._maximumQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._standardQuantityReloadTime.GetHashCode(); - result = GenerateHash(result) ^ this._maximumQuantityReloadTime.GetHashCode(); - result = GenerateHash(result) ^ this._fuelMeasurmentUnits.GetHashCode(); - result = GenerateHash(result) ^ this._fuelLocation.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityAssociation.cs b/tests/OpenDisNet.Reference/Generated/EntityAssociation.cs deleted file mode 100644 index 4e89f43..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityAssociation.cs +++ /dev/null @@ -1,536 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Association or disassociation of two entities. Section 6.2.93.4 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class EntityAssociation - { - /// - /// the identification of the Variable Parameter record. Enumeration from EBV - /// - private byte _recordType = 2; - - /// - /// Indicates if this VP has changed since last issuance - /// - private byte _changeIndicator; - - /// - /// Indicates association status between two entities; 8 bit enum - /// - private byte _associationStatus; - - /// - /// Type of association; 8 bit enum - /// - private byte _associationType; - - /// - /// Object ID of entity associated with this entity - /// - private EntityID _entityID = new EntityID(); - - /// - /// Station location on one's own entity. EBV doc. - /// - private ushort _owsSttionLocation; - - /// - /// Type of physical connection. EBV doc - /// - private ushort _physicalConnectionType; - - /// - /// Type of member the entity is within th egroup - /// - private byte _groupMemberType; - - /// - /// Group if any to which the entity belongs - /// - private ushort _groupNumber; - - /// - /// Initializes a new instance of the class. - /// - public EntityAssociation() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityAssociation left, EntityAssociation right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityAssociation left, EntityAssociation right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._recordType - marshalSize += 1; // this._changeIndicator - marshalSize += 1; // this._associationStatus - marshalSize += 1; // this._associationType - marshalSize += this._entityID.GetMarshalledSize(); // this._entityID - marshalSize += 2; // this._owsSttionLocation - marshalSize += 2; // this._physicalConnectionType - marshalSize += 1; // this._groupMemberType - marshalSize += 2; // this._groupNumber - return marshalSize; - } - - /// - /// Gets or sets the the identification of the Variable Parameter record. Enumeration from EBV - /// - [XmlElement(Type = typeof(byte), ElementName = "recordType")] - public byte RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the Indicates if this VP has changed since last issuance - /// - [XmlElement(Type = typeof(byte), ElementName = "changeIndicator")] - public byte ChangeIndicator - { - get - { - return this._changeIndicator; - } - - set - { - this._changeIndicator = value; - } - } - - /// - /// Gets or sets the Indicates association status between two entities; 8 bit enum - /// - [XmlElement(Type = typeof(byte), ElementName = "associationStatus")] - public byte AssociationStatus - { - get - { - return this._associationStatus; - } - - set - { - this._associationStatus = value; - } - } - - /// - /// Gets or sets the Type of association; 8 bit enum - /// - [XmlElement(Type = typeof(byte), ElementName = "associationType")] - public byte AssociationType - { - get - { - return this._associationType; - } - - set - { - this._associationType = value; - } - } - - /// - /// Gets or sets the Object ID of entity associated with this entity - /// - [XmlElement(Type = typeof(EntityID), ElementName = "entityID")] - public EntityID EntityID - { - get - { - return this._entityID; - } - - set - { - this._entityID = value; - } - } - - /// - /// Gets or sets the Station location on one's own entity. EBV doc. - /// - [XmlElement(Type = typeof(ushort), ElementName = "owsSttionLocation")] - public ushort OwsSttionLocation - { - get - { - return this._owsSttionLocation; - } - - set - { - this._owsSttionLocation = value; - } - } - - /// - /// Gets or sets the Type of physical connection. EBV doc - /// - [XmlElement(Type = typeof(ushort), ElementName = "physicalConnectionType")] - public ushort PhysicalConnectionType - { - get - { - return this._physicalConnectionType; - } - - set - { - this._physicalConnectionType = value; - } - } - - /// - /// Gets or sets the Type of member the entity is within th egroup - /// - [XmlElement(Type = typeof(byte), ElementName = "groupMemberType")] - public byte GroupMemberType - { - get - { - return this._groupMemberType; - } - - set - { - this._groupMemberType = value; - } - } - - /// - /// Gets or sets the Group if any to which the entity belongs - /// - [XmlElement(Type = typeof(ushort), ElementName = "groupNumber")] - public ushort GroupNumber - { - get - { - return this._groupNumber; - } - - set - { - this._groupNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._recordType); - dos.WriteUnsignedByte((byte)this._changeIndicator); - dos.WriteUnsignedByte((byte)this._associationStatus); - dos.WriteUnsignedByte((byte)this._associationType); - this._entityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._owsSttionLocation); - dos.WriteUnsignedShort((ushort)this._physicalConnectionType); - dos.WriteUnsignedByte((byte)this._groupMemberType); - dos.WriteUnsignedShort((ushort)this._groupNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedByte(); - this._changeIndicator = dis.ReadUnsignedByte(); - this._associationStatus = dis.ReadUnsignedByte(); - this._associationType = dis.ReadUnsignedByte(); - this._entityID.Unmarshal(dis); - this._owsSttionLocation = dis.ReadUnsignedShort(); - this._physicalConnectionType = dis.ReadUnsignedShort(); - this._groupMemberType = dis.ReadUnsignedByte(); - this._groupNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._changeIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._associationStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._associationType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._entityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._owsSttionLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._physicalConnectionType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._groupMemberType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._groupNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityAssociation; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityAssociation obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._changeIndicator != obj._changeIndicator) - { - ivarsEqual = false; - } - - if (this._associationStatus != obj._associationStatus) - { - ivarsEqual = false; - } - - if (this._associationType != obj._associationType) - { - ivarsEqual = false; - } - - if (!this._entityID.Equals(obj._entityID)) - { - ivarsEqual = false; - } - - if (this._owsSttionLocation != obj._owsSttionLocation) - { - ivarsEqual = false; - } - - if (this._physicalConnectionType != obj._physicalConnectionType) - { - ivarsEqual = false; - } - - if (this._groupMemberType != obj._groupMemberType) - { - ivarsEqual = false; - } - - if (this._groupNumber != obj._groupNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._changeIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._associationStatus.GetHashCode(); - result = GenerateHash(result) ^ this._associationType.GetHashCode(); - result = GenerateHash(result) ^ this._entityID.GetHashCode(); - result = GenerateHash(result) ^ this._owsSttionLocation.GetHashCode(); - result = GenerateHash(result) ^ this._physicalConnectionType.GetHashCode(); - result = GenerateHash(result) ^ this._groupMemberType.GetHashCode(); - result = GenerateHash(result) ^ this._groupNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityDamageStatusPdu.cs b/tests/OpenDisNet.Reference/Generated/EntityDamageStatusPdu.cs deleted file mode 100644 index 061469b..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityDamageStatusPdu.cs +++ /dev/null @@ -1,451 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// shall be used to communicate detailed damage information sustained by an entity regardless of the source of the damage Section 7.3.5 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(DirectedEnergyDamage))] - public partial class EntityDamageStatusPdu : WarfareFamilyPdu, IEquatable - { - /// - /// Field shall identify the damaged entity (see 6.2.28), Section 7.3.4 COMPLETE - /// - private EntityID _damagedEntityID = new EntityID(); - - /// - /// Padding. - /// - private ushort _padding1; - - /// - /// Padding. - /// - private ushort _padding2; - - /// - /// field shall specify the number of Damage Description records, Section 7.3.5 - /// - private ushort _numberOfDamageDescription; - - /// - /// Fields shall contain one or more Damage Description records (see 6.2.17) and may contain other Standard Variable records, Section 7.3.5 - /// - private List _damageDescriptionRecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public EntityDamageStatusPdu() - { - PduType = (byte)69; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityDamageStatusPdu left, EntityDamageStatusPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityDamageStatusPdu left, EntityDamageStatusPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._damagedEntityID.GetMarshalledSize(); // this._damagedEntityID - marshalSize += 2; // this._padding1 - marshalSize += 2; // this._padding2 - marshalSize += 2; // this._numberOfDamageDescription - for (int idx = 0; idx < this._damageDescriptionRecords.Count; idx++) - { - DirectedEnergyDamage listElement = (DirectedEnergyDamage)this._damageDescriptionRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Field shall identify the damaged entity (see 6.2.28), Section 7.3.4 COMPLETE - /// - [XmlElement(Type = typeof(EntityID), ElementName = "damagedEntityID")] - public EntityID DamagedEntityID - { - get - { - return this._damagedEntityID; - } - - set - { - this._damagedEntityID = value; - } - } - - /// - /// Gets or sets the Padding. - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding1")] - public ushort Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the Padding. - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding2")] - public ushort Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfDamageDescription method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfDamageDescription")] - public ushort NumberOfDamageDescription - { - get - { - return this._numberOfDamageDescription; - } - - set - { - this._numberOfDamageDescription = value; - } - } - - /// - /// Gets or sets the Fields shall contain one or more Damage Description records (see 6.2.17) and may contain other Standard Variable records, Section 7.3.5 - /// - [XmlElement(ElementName = "damageDescriptionRecordsList", Type = typeof(List))] - public List DamageDescriptionRecords - { - get - { - return this._damageDescriptionRecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._damagedEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._padding1); - dos.WriteUnsignedShort((ushort)this._padding2); - dos.WriteUnsignedShort((ushort)this._damageDescriptionRecords.Count); - - for (int idx = 0; idx < this._damageDescriptionRecords.Count; idx++) - { - DirectedEnergyDamage aDirectedEnergyDamage = (DirectedEnergyDamage)this._damageDescriptionRecords[idx]; - aDirectedEnergyDamage.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._damagedEntityID.Unmarshal(dis); - this._padding1 = dis.ReadUnsignedShort(); - this._padding2 = dis.ReadUnsignedShort(); - this._numberOfDamageDescription = dis.ReadUnsignedShort(); - for (int idx = 0; idx < this.NumberOfDamageDescription; idx++) - { - DirectedEnergyDamage anX = new DirectedEnergyDamage(); - anX.Unmarshal(dis); - this._damageDescriptionRecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._damagedEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._damageDescriptionRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._damageDescriptionRecords.Count; idx++) - { - sb.AppendLine(""); - DirectedEnergyDamage aDirectedEnergyDamage = (DirectedEnergyDamage)this._damageDescriptionRecords[idx]; - aDirectedEnergyDamage.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityDamageStatusPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityDamageStatusPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._damagedEntityID.Equals(obj._damagedEntityID)) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._numberOfDamageDescription != obj._numberOfDamageDescription) - { - ivarsEqual = false; - } - - if (this._damageDescriptionRecords.Count != obj._damageDescriptionRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._damageDescriptionRecords.Count; idx++) - { - if (!this._damageDescriptionRecords[idx].Equals(obj._damageDescriptionRecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._damagedEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfDamageDescription.GetHashCode(); - - if (this._damageDescriptionRecords.Count > 0) - { - for (int idx = 0; idx < this._damageDescriptionRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._damageDescriptionRecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityID.cs b/tests/OpenDisNet.Reference/Generated/EntityID.cs deleted file mode 100644 index dcada8d..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityID.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Entity Identifier. Unique ID for entities in the world. Consists of an simulation address and a entity number. Section 6.2.28. - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class EntityID - { - /// - /// Site and application IDs - /// - private SimulationAddress _simulationAddress = new SimulationAddress(); - - /// - /// Entity number - /// - private ushort _entityNumber; - - /// - /// Initializes a new instance of the class. - /// - public EntityID() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityID left, EntityID right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityID left, EntityID right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._entityNumber - return marshalSize; - } - - /// - /// Gets or sets the Site and application IDs - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "simulationAddress")] - public SimulationAddress SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - /// - /// Gets or sets the Entity number - /// - [XmlElement(Type = typeof(ushort), ElementName = "entityNumber")] - public ushort EntityNumber - { - get - { - return this._entityNumber; - } - - set - { - this._entityNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._entityNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._entityNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._entityNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityID; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityID obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._entityNumber != obj._entityNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._entityNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityInformationFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/EntityInformationFamilyPdu.cs deleted file mode 100644 index 1670732..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityInformationFamilyPdu.cs +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.3. Common superclass for EntityState, Collision, collision-elastic, and entity state update PDUs. This should be abstract. COMPLETE - /// - [Serializable] - [XmlRoot] - public partial class EntityInformationFamilyPdu : Pdu, IEquatable - { - /// - /// Initializes a new instance of the class. - /// - public EntityInformationFamilyPdu() - { - ProtocolFamily = (byte)1; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityInformationFamilyPdu left, EntityInformationFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityInformationFamilyPdu left, EntityInformationFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - return marshalSize; - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityInformationFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityInformationFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityManagementFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/EntityManagementFamilyPdu.cs deleted file mode 100644 index b7473c8..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityManagementFamilyPdu.cs +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Managment of grouping of PDUs, and more. Section 7.8 - /// - [Serializable] - [XmlRoot] - public partial class EntityManagementFamilyPdu : Pdu, IEquatable - { - /// - /// Initializes a new instance of the class. - /// - public EntityManagementFamilyPdu() - { - ProtocolFamily = (byte)7; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityManagementFamilyPdu left, EntityManagementFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityManagementFamilyPdu left, EntityManagementFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - return marshalSize; - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityManagementFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityManagementFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityMarking.cs b/tests/OpenDisNet.Reference/Generated/EntityMarking.cs deleted file mode 100644 index daa8304..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityMarking.cs +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Specifies the character set used inthe first byte, followed by 11 characters of text data. Section 6.29 - /// - [Serializable] - [XmlRoot] - public partial class EntityMarking - { - /// - /// The character set - /// - private byte _characterSet; - - /// - /// The characters - /// - private byte[] _characters = new byte[11]; - - /// - /// Initializes a new instance of the class. - /// - public EntityMarking() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityMarking left, EntityMarking right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityMarking left, EntityMarking right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._characterSet - marshalSize += 11 * 1; // _characters - return marshalSize; - } - - /// - /// Gets or sets the The character set - /// - [XmlElement(Type = typeof(byte), ElementName = "characterSet")] - public byte CharacterSet - { - get - { - return this._characterSet; - } - - set - { - this._characterSet = value; - } - } - - /// - /// Gets or sets the The characters - /// - [XmlArray(ElementName = "characters")] - public byte[] Characters - { - get - { - return this._characters; - } - - set - { - this._characters = value; - } -} - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._characterSet); - - for (int idx = 0; idx < this._characters.Length; idx++) - { - dos.WriteByte(this._characters[idx]); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._characterSet = dis.ReadUnsignedByte(); - for (int idx = 0; idx < this._characters.Length; idx++) - { - this._characters[idx] = dis.ReadByte(); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._characterSet.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._characters.Length; idx++) - { - sb.AppendLine("" + this._characters[idx] + ""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityMarking; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityMarking obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._characterSet != obj._characterSet) - { - ivarsEqual = false; - } - - if (obj._characters.Length != 11) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 11; idx++) - { - if (this._characters[idx] != obj._characters[idx]) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._characterSet.GetHashCode(); - - for (int idx = 0; idx < 11; idx++) - { - result = GenerateHash(result) ^ this._characters[idx].GetHashCode(); - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityStatePdu.cs b/tests/OpenDisNet.Reference/Generated/EntityStatePdu.cs deleted file mode 100644 index e98b77d..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityStatePdu.cs +++ /dev/null @@ -1,721 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Represents the postion and state of one entity in the world. Section 7.2.2. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EntityType))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(EulerAngles))] - [XmlInclude(typeof(DeadReckoningParameters))] - [XmlInclude(typeof(EntityMarking))] - [XmlInclude(typeof(VariableParameter))] - public partial class EntityStatePdu : EntityInformationFamilyPdu, IEquatable - { - /// - /// Unique ID for an entity that is tied to this state information - /// - private EntityID _entityID = new EntityID(); - - /// - /// What force this entity is affiliated with, eg red, blue, neutral, etc - /// - private byte _forceId; - - /// - /// How many variable parameters are in the variable length list. In earlier versions of DIS these were known as articulation parameters - /// - private byte _numberOfVariableParameters; - - /// - /// Describes the type of entity in the world - /// - private EntityType _entityType = new EntityType(); - - private EntityType _alternativeEntityType = new EntityType(); - - /// - /// Describes the speed of the entity in the world - /// - private Vector3Float _entityLinearVelocity = new Vector3Float(); - - /// - /// describes the location of the entity in the world - /// - private Vector3Double _entityLocation = new Vector3Double(); - - /// - /// describes the orientation of the entity, in euler angles - /// - private EulerAngles _entityOrientation = new EulerAngles(); - - /// - /// a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. - /// - private uint _entityAppearance; - - /// - /// parameters used for dead reckoning - /// - private DeadReckoningParameters _deadReckoningParameters = new DeadReckoningParameters(); - - /// - /// characters that can be used for debugging, or to draw unique strings on the side of entities in the world - /// - private EntityMarking _marking = new EntityMarking(); - - /// - /// a series of bit flags - /// - private uint _capabilities; - - /// - /// variable length list of variable parameters. In earlier DIS versions this was articulation parameters. - /// - private List _variableParameters = new List(); - - /// - /// Initializes a new instance of the class. - /// - public EntityStatePdu() - { - PduType = (byte)1; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityStatePdu left, EntityStatePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityStatePdu left, EntityStatePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._entityID.GetMarshalledSize(); // this._entityID - marshalSize += 1; // this._forceId - marshalSize += 1; // this._numberOfVariableParameters - marshalSize += this._entityType.GetMarshalledSize(); // this._entityType - marshalSize += this._alternativeEntityType.GetMarshalledSize(); // this._alternativeEntityType - marshalSize += this._entityLinearVelocity.GetMarshalledSize(); // this._entityLinearVelocity - marshalSize += this._entityLocation.GetMarshalledSize(); // this._entityLocation - marshalSize += this._entityOrientation.GetMarshalledSize(); // this._entityOrientation - marshalSize += 4; // this._entityAppearance - marshalSize += this._deadReckoningParameters.GetMarshalledSize(); // this._deadReckoningParameters - marshalSize += this._marking.GetMarshalledSize(); // this._marking - marshalSize += 4; // this._capabilities - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - VariableParameter listElement = (VariableParameter)this._variableParameters[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Unique ID for an entity that is tied to this state information - /// - [XmlElement(Type = typeof(EntityID), ElementName = "entityID")] - public EntityID EntityID - { - get - { - return this._entityID; - } - - set - { - this._entityID = value; - } - } - - /// - /// Gets or sets the What force this entity is affiliated with, eg red, blue, neutral, etc - /// - [XmlElement(Type = typeof(byte), ElementName = "forceId")] - public byte ForceId - { - get - { - return this._forceId; - } - - set - { - this._forceId = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableParameters method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfVariableParameters")] - public byte NumberOfVariableParameters - { - get - { - return this._numberOfVariableParameters; - } - - set - { - this._numberOfVariableParameters = value; - } - } - - /// - /// Gets or sets the Describes the type of entity in the world - /// - [XmlElement(Type = typeof(EntityType), ElementName = "entityType")] - public EntityType EntityType - { - get - { - return this._entityType; - } - - set - { - this._entityType = value; - } - } - - [XmlElement(Type = typeof(EntityType), ElementName = "alternativeEntityType")] - public EntityType AlternativeEntityType - { - get - { - return this._alternativeEntityType; - } - - set - { - this._alternativeEntityType = value; - } - } - - /// - /// Gets or sets the Describes the speed of the entity in the world - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "entityLinearVelocity")] - public Vector3Float EntityLinearVelocity - { - get - { - return this._entityLinearVelocity; - } - - set - { - this._entityLinearVelocity = value; - } - } - - /// - /// Gets or sets the describes the location of the entity in the world - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "entityLocation")] - public Vector3Double EntityLocation - { - get - { - return this._entityLocation; - } - - set - { - this._entityLocation = value; - } - } - - /// - /// Gets or sets the describes the orientation of the entity, in euler angles - /// - [XmlElement(Type = typeof(EulerAngles), ElementName = "entityOrientation")] - public EulerAngles EntityOrientation - { - get - { - return this._entityOrientation; - } - - set - { - this._entityOrientation = value; - } - } - - /// - /// Gets or sets the a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. - /// - [XmlElement(Type = typeof(uint), ElementName = "entityAppearance")] - public uint EntityAppearance - { - get - { - return this._entityAppearance; - } - - set - { - this._entityAppearance = value; - } - } - - /// - /// Gets or sets the parameters used for dead reckoning - /// - [XmlElement(Type = typeof(DeadReckoningParameters), ElementName = "deadReckoningParameters")] - public DeadReckoningParameters DeadReckoningParameters - { - get - { - return this._deadReckoningParameters; - } - - set - { - this._deadReckoningParameters = value; - } - } - - /// - /// Gets or sets the characters that can be used for debugging, or to draw unique strings on the side of entities in the world - /// - [XmlElement(Type = typeof(EntityMarking), ElementName = "marking")] - public EntityMarking Marking - { - get - { - return this._marking; - } - - set - { - this._marking = value; - } - } - - /// - /// Gets or sets the a series of bit flags - /// - [XmlElement(Type = typeof(uint), ElementName = "capabilities")] - public uint Capabilities - { - get - { - return this._capabilities; - } - - set - { - this._capabilities = value; - } - } - - /// - /// Gets or sets the variable length list of variable parameters. In earlier DIS versions this was articulation parameters. - /// - [XmlElement(ElementName = "variableParametersList", Type = typeof(List))] - public List VariableParameters - { - get - { - return this._variableParameters; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._entityID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._forceId); - dos.WriteUnsignedByte((byte)this._variableParameters.Count); - this._entityType.Marshal(dos); - this._alternativeEntityType.Marshal(dos); - this._entityLinearVelocity.Marshal(dos); - this._entityLocation.Marshal(dos); - this._entityOrientation.Marshal(dos); - dos.WriteUnsignedInt((uint)this._entityAppearance); - this._deadReckoningParameters.Marshal(dos); - this._marking.Marshal(dos); - dos.WriteUnsignedInt((uint)this._capabilities); - - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - VariableParameter aVariableParameter = (VariableParameter)this._variableParameters[idx]; - aVariableParameter.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._entityID.Unmarshal(dis); - this._forceId = dis.ReadUnsignedByte(); - this._numberOfVariableParameters = dis.ReadUnsignedByte(); - this._entityType.Unmarshal(dis); - this._alternativeEntityType.Unmarshal(dis); - this._entityLinearVelocity.Unmarshal(dis); - this._entityLocation.Unmarshal(dis); - this._entityOrientation.Unmarshal(dis); - this._entityAppearance = dis.ReadUnsignedInt(); - this._deadReckoningParameters.Unmarshal(dis); - this._marking.Unmarshal(dis); - this._capabilities = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfVariableParameters; idx++) - { - VariableParameter anX = new VariableParameter(); - anX.Unmarshal(dis); - this._variableParameters.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._entityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._forceId.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableParameters.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._entityType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._alternativeEntityType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._entityLinearVelocity.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._entityLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._entityOrientation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._entityAppearance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._deadReckoningParameters.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._marking.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._capabilities.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - sb.AppendLine(""); - VariableParameter aVariableParameter = (VariableParameter)this._variableParameters[idx]; - aVariableParameter.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityStatePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityStatePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._entityID.Equals(obj._entityID)) - { - ivarsEqual = false; - } - - if (this._forceId != obj._forceId) - { - ivarsEqual = false; - } - - if (this._numberOfVariableParameters != obj._numberOfVariableParameters) - { - ivarsEqual = false; - } - - if (!this._entityType.Equals(obj._entityType)) - { - ivarsEqual = false; - } - - if (!this._alternativeEntityType.Equals(obj._alternativeEntityType)) - { - ivarsEqual = false; - } - - if (!this._entityLinearVelocity.Equals(obj._entityLinearVelocity)) - { - ivarsEqual = false; - } - - if (!this._entityLocation.Equals(obj._entityLocation)) - { - ivarsEqual = false; - } - - if (!this._entityOrientation.Equals(obj._entityOrientation)) - { - ivarsEqual = false; - } - - if (this._entityAppearance != obj._entityAppearance) - { - ivarsEqual = false; - } - - if (!this._deadReckoningParameters.Equals(obj._deadReckoningParameters)) - { - ivarsEqual = false; - } - - if (!this._marking.Equals(obj._marking)) - { - ivarsEqual = false; - } - - if (this._capabilities != obj._capabilities) - { - ivarsEqual = false; - } - - if (this._variableParameters.Count != obj._variableParameters.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - if (!this._variableParameters[idx].Equals(obj._variableParameters[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._entityID.GetHashCode(); - result = GenerateHash(result) ^ this._forceId.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableParameters.GetHashCode(); - result = GenerateHash(result) ^ this._entityType.GetHashCode(); - result = GenerateHash(result) ^ this._alternativeEntityType.GetHashCode(); - result = GenerateHash(result) ^ this._entityLinearVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._entityLocation.GetHashCode(); - result = GenerateHash(result) ^ this._entityOrientation.GetHashCode(); - result = GenerateHash(result) ^ this._entityAppearance.GetHashCode(); - result = GenerateHash(result) ^ this._deadReckoningParameters.GetHashCode(); - result = GenerateHash(result) ^ this._marking.GetHashCode(); - result = GenerateHash(result) ^ this._capabilities.GetHashCode(); - - if (this._variableParameters.Count > 0) - { - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - result = GenerateHash(result) ^ this._variableParameters[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityStateUpdatePdu.cs b/tests/OpenDisNet.Reference/Generated/EntityStateUpdatePdu.cs deleted file mode 100644 index 5d4e53d..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityStateUpdatePdu.cs +++ /dev/null @@ -1,557 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Nonstatic information about a particular entity may be communicated by issuing an Entity State Update PDU. Section 7.2.5. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(EulerAngles))] - [XmlInclude(typeof(VariableParameter))] - public partial class EntityStateUpdatePdu : EntityInformationFamilyPdu, IEquatable - { - /// - /// This field shall identify the entity issuing the PDU, and shall be represented by an Entity Identifier record (see 6.2.28). - /// - private EntityID _entityID = new EntityID(); - - /// - /// Padding - /// - private byte _padding1; - - /// - /// This field shall specify the number of variable parameters present. This field shall be represented by an 8-bit unsigned integer (see Annex I). - /// - private byte _numberOfVariableParameters; - - /// - /// This field shall specify an entity’s linear velocity. The coordinate system for an entity’s linear velocity depends on the dead reckoning algorithm used. This field shall be represented by a Linear Velocity Vector record [see 6.2.95 item c)]). - /// - private Vector3Float _entityLinearVelocity = new Vector3Float(); - - /// - /// This field shall specify an entity’s physical location in the simulated world and shall be represented by a World Coordinates record (see 6.2.97). - /// - private Vector3Double _entityLocation = new Vector3Double(); - - /// - /// This field shall specify an entity’s orientation and shall be represented by an Euler Angles record (see 6.2.33). - /// - private EulerAngles _entityOrientation = new EulerAngles(); - - /// - /// This field shall specify the dynamic changes to the entity’s appearance attributes. This field shall be represented by an Entity Appearance record (see 6.2.26). - /// - private uint _entityAppearance; - - /// - /// This field shall specify the parameter values for each Variable Parameter record that is included (see 6.2.93 and Annex I). - /// - private List _variableParameters = new List(); - - /// - /// Initializes a new instance of the class. - /// - public EntityStateUpdatePdu() - { - PduType = (byte)67; - ProtocolFamily = (byte)1; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityStateUpdatePdu left, EntityStateUpdatePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityStateUpdatePdu left, EntityStateUpdatePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._entityID.GetMarshalledSize(); // this._entityID - marshalSize += 1; // this._padding1 - marshalSize += 1; // this._numberOfVariableParameters - marshalSize += this._entityLinearVelocity.GetMarshalledSize(); // this._entityLinearVelocity - marshalSize += this._entityLocation.GetMarshalledSize(); // this._entityLocation - marshalSize += this._entityOrientation.GetMarshalledSize(); // this._entityOrientation - marshalSize += 4; // this._entityAppearance - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - VariableParameter listElement = (VariableParameter)this._variableParameters[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the This field shall identify the entity issuing the PDU, and shall be represented by an Entity Identifier record (see 6.2.28). - /// - [XmlElement(Type = typeof(EntityID), ElementName = "entityID")] - public EntityID EntityID - { - get - { - return this._entityID; - } - - set - { - this._entityID = value; - } - } - - /// - /// Gets or sets the Padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding1")] - public byte Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableParameters method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfVariableParameters")] - public byte NumberOfVariableParameters - { - get - { - return this._numberOfVariableParameters; - } - - set - { - this._numberOfVariableParameters = value; - } - } - - /// - /// Gets or sets the This field shall specify an entity’s linear velocity. The coordinate system for an entity’s linear velocity depends on the dead reckoning algorithm used. This field shall be represented by a Linear Velocity Vector record [see 6.2.95 item c)]). - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "entityLinearVelocity")] - public Vector3Float EntityLinearVelocity - { - get - { - return this._entityLinearVelocity; - } - - set - { - this._entityLinearVelocity = value; - } - } - - /// - /// Gets or sets the This field shall specify an entity’s physical location in the simulated world and shall be represented by a World Coordinates record (see 6.2.97). - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "entityLocation")] - public Vector3Double EntityLocation - { - get - { - return this._entityLocation; - } - - set - { - this._entityLocation = value; - } - } - - /// - /// Gets or sets the This field shall specify an entity’s orientation and shall be represented by an Euler Angles record (see 6.2.33). - /// - [XmlElement(Type = typeof(EulerAngles), ElementName = "entityOrientation")] - public EulerAngles EntityOrientation - { - get - { - return this._entityOrientation; - } - - set - { - this._entityOrientation = value; - } - } - - /// - /// Gets or sets the This field shall specify the dynamic changes to the entity’s appearance attributes. This field shall be represented by an Entity Appearance record (see 6.2.26). - /// - [XmlElement(Type = typeof(uint), ElementName = "entityAppearance")] - public uint EntityAppearance - { - get - { - return this._entityAppearance; - } - - set - { - this._entityAppearance = value; - } - } - - /// - /// Gets or sets the This field shall specify the parameter values for each Variable Parameter record that is included (see 6.2.93 and Annex I). - /// - [XmlElement(ElementName = "variableParametersList", Type = typeof(List))] - public List VariableParameters - { - get - { - return this._variableParameters; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._entityID.Marshal(dos); - dos.WriteByte((byte)this._padding1); - dos.WriteUnsignedByte((byte)this._variableParameters.Count); - this._entityLinearVelocity.Marshal(dos); - this._entityLocation.Marshal(dos); - this._entityOrientation.Marshal(dos); - dos.WriteUnsignedInt((uint)this._entityAppearance); - - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - VariableParameter aVariableParameter = (VariableParameter)this._variableParameters[idx]; - aVariableParameter.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._entityID.Unmarshal(dis); - this._padding1 = dis.ReadByte(); - this._numberOfVariableParameters = dis.ReadUnsignedByte(); - this._entityLinearVelocity.Unmarshal(dis); - this._entityLocation.Unmarshal(dis); - this._entityOrientation.Unmarshal(dis); - this._entityAppearance = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfVariableParameters; idx++) - { - VariableParameter anX = new VariableParameter(); - anX.Unmarshal(dis); - this._variableParameters.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._entityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableParameters.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._entityLinearVelocity.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._entityLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._entityOrientation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._entityAppearance.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - sb.AppendLine(""); - VariableParameter aVariableParameter = (VariableParameter)this._variableParameters[idx]; - aVariableParameter.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityStateUpdatePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityStateUpdatePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._entityID.Equals(obj._entityID)) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._numberOfVariableParameters != obj._numberOfVariableParameters) - { - ivarsEqual = false; - } - - if (!this._entityLinearVelocity.Equals(obj._entityLinearVelocity)) - { - ivarsEqual = false; - } - - if (!this._entityLocation.Equals(obj._entityLocation)) - { - ivarsEqual = false; - } - - if (!this._entityOrientation.Equals(obj._entityOrientation)) - { - ivarsEqual = false; - } - - if (this._entityAppearance != obj._entityAppearance) - { - ivarsEqual = false; - } - - if (this._variableParameters.Count != obj._variableParameters.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - if (!this._variableParameters[idx].Equals(obj._variableParameters[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._entityID.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableParameters.GetHashCode(); - result = GenerateHash(result) ^ this._entityLinearVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._entityLocation.GetHashCode(); - result = GenerateHash(result) ^ this._entityOrientation.GetHashCode(); - result = GenerateHash(result) ^ this._entityAppearance.GetHashCode(); - - if (this._variableParameters.Count > 0) - { - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - result = GenerateHash(result) ^ this._variableParameters[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityType.cs b/tests/OpenDisNet.Reference/Generated/EntityType.cs deleted file mode 100644 index b47ca07..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityType.cs +++ /dev/null @@ -1,463 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Identifies the type of entity, including kind of entity, domain (surface, subsurface, air, etc) country, category, etc. Section 6.2.30 - /// - [Serializable] - [XmlRoot] - public partial class EntityType - { - /// - /// Kind of entity - /// - private byte _entityKind; - - /// - /// Domain of entity (air, surface, subsurface, space, etc) - /// - private byte _domain; - - /// - /// country to which the design of the entity is attributed - /// - private ushort _country; - - /// - /// category of entity - /// - private byte _category; - - /// - /// subcategory of entity - /// - private byte _subcategory; - - /// - /// specific info based on subcategory field. Renamed from specific because that is a reserved word in SQL. - /// - private byte _specific; - - private byte _extra; - - /// - /// Initializes a new instance of the class. - /// - public EntityType() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityType left, EntityType right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityType left, EntityType right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._entityKind - marshalSize += 1; // this._domain - marshalSize += 2; // this._country - marshalSize += 1; // this._category - marshalSize += 1; // this._subcategory - marshalSize += 1; // this._specific - marshalSize += 1; // this._extra - return marshalSize; - } - - /// - /// Gets or sets the Kind of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "entityKind")] - public byte EntityKind - { - get - { - return this._entityKind; - } - - set - { - this._entityKind = value; - } - } - - /// - /// Gets or sets the Domain of entity (air, surface, subsurface, space, etc) - /// - [XmlElement(Type = typeof(byte), ElementName = "domain")] - public byte Domain - { - get - { - return this._domain; - } - - set - { - this._domain = value; - } - } - - /// - /// Gets or sets the country to which the design of the entity is attributed - /// - [XmlElement(Type = typeof(ushort), ElementName = "country")] - public ushort Country - { - get - { - return this._country; - } - - set - { - this._country = value; - } - } - - /// - /// Gets or sets the category of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "category")] - public byte Category - { - get - { - return this._category; - } - - set - { - this._category = value; - } - } - - /// - /// Gets or sets the subcategory of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "subcategory")] - public byte Subcategory - { - get - { - return this._subcategory; - } - - set - { - this._subcategory = value; - } - } - - /// - /// Gets or sets the specific info based on subcategory field. Renamed from specific because that is a reserved word in SQL. - /// - [XmlElement(Type = typeof(byte), ElementName = "specific")] - public byte Specific - { - get - { - return this._specific; - } - - set - { - this._specific = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "extra")] - public byte Extra - { - get - { - return this._extra; - } - - set - { - this._extra = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._entityKind); - dos.WriteUnsignedByte((byte)this._domain); - dos.WriteUnsignedShort((ushort)this._country); - dos.WriteUnsignedByte((byte)this._category); - dos.WriteUnsignedByte((byte)this._subcategory); - dos.WriteUnsignedByte((byte)this._specific); - dos.WriteUnsignedByte((byte)this._extra); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._entityKind = dis.ReadUnsignedByte(); - this._domain = dis.ReadUnsignedByte(); - this._country = dis.ReadUnsignedShort(); - this._category = dis.ReadUnsignedByte(); - this._subcategory = dis.ReadUnsignedByte(); - this._specific = dis.ReadUnsignedByte(); - this._extra = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._entityKind.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._domain.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._country.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._category.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._subcategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._specific.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._extra.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityType; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityType obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._entityKind != obj._entityKind) - { - ivarsEqual = false; - } - - if (this._domain != obj._domain) - { - ivarsEqual = false; - } - - if (this._country != obj._country) - { - ivarsEqual = false; - } - - if (this._category != obj._category) - { - ivarsEqual = false; - } - - if (this._subcategory != obj._subcategory) - { - ivarsEqual = false; - } - - if (this._specific != obj._specific) - { - ivarsEqual = false; - } - - if (this._extra != obj._extra) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._entityKind.GetHashCode(); - result = GenerateHash(result) ^ this._domain.GetHashCode(); - result = GenerateHash(result) ^ this._country.GetHashCode(); - result = GenerateHash(result) ^ this._category.GetHashCode(); - result = GenerateHash(result) ^ this._subcategory.GetHashCode(); - result = GenerateHash(result) ^ this._specific.GetHashCode(); - result = GenerateHash(result) ^ this._extra.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EntityTypeVP.cs b/tests/OpenDisNet.Reference/Generated/EntityTypeVP.cs deleted file mode 100644 index 7d6b6c8..0000000 --- a/tests/OpenDisNet.Reference/Generated/EntityTypeVP.cs +++ /dev/null @@ -1,408 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Association or disassociation of two entities. Section 6.2.93.5 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class EntityTypeVP - { - /// - /// the identification of the Variable Parameter record. Enumeration from EBV - /// - private byte _recordType = 3; - - /// - /// Indicates if this VP has changed since last issuance - /// - private byte _changeIndicator; - - /// - /// - /// - private EntityType _entityType = new EntityType(); - - /// - /// padding - /// - private ushort _padding; - - /// - /// padding - /// - private uint _padding1; - - /// - /// Initializes a new instance of the class. - /// - public EntityTypeVP() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EntityTypeVP left, EntityTypeVP right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EntityTypeVP left, EntityTypeVP right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._recordType - marshalSize += 1; // this._changeIndicator - marshalSize += this._entityType.GetMarshalledSize(); // this._entityType - marshalSize += 2; // this._padding - marshalSize += 4; // this._padding1 - return marshalSize; - } - - /// - /// Gets or sets the the identification of the Variable Parameter record. Enumeration from EBV - /// - [XmlElement(Type = typeof(byte), ElementName = "recordType")] - public byte RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the Indicates if this VP has changed since last issuance - /// - [XmlElement(Type = typeof(byte), ElementName = "changeIndicator")] - public byte ChangeIndicator - { - get - { - return this._changeIndicator; - } - - set - { - this._changeIndicator = value; - } - } - - /// - /// Gets or sets the - /// - [XmlElement(Type = typeof(EntityType), ElementName = "entityType")] - public EntityType EntityType - { - get - { - return this._entityType; - } - - set - { - this._entityType = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(uint), ElementName = "padding1")] - public uint Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._recordType); - dos.WriteUnsignedByte((byte)this._changeIndicator); - this._entityType.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._padding); - dos.WriteUnsignedInt((uint)this._padding1); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedByte(); - this._changeIndicator = dis.ReadUnsignedByte(); - this._entityType.Unmarshal(dis); - this._padding = dis.ReadUnsignedShort(); - this._padding1 = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._changeIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._entityType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EntityTypeVP; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EntityTypeVP obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._changeIndicator != obj._changeIndicator) - { - ivarsEqual = false; - } - - if (!this._entityType.Equals(obj._entityType)) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._changeIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._entityType.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Environment.cs b/tests/OpenDisNet.Reference/Generated/Environment.cs deleted file mode 100644 index 1e12306..0000000 --- a/tests/OpenDisNet.Reference/Generated/Environment.cs +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Incomplete environment record; requires hand coding to fix. Section 6.2.31.1 - /// - [Serializable] - [XmlRoot] - public partial class Environment - { - /// - /// type - /// - private uint _environmentType; - - /// - /// length, in bits, of the record - /// - private ushort _length; - - /// - /// identifies the sequntially numbered record index - /// - private byte _index; - - /// - /// padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public Environment() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Environment left, Environment right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Environment left, Environment right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._environmentType - marshalSize += 2; // this._length - marshalSize += 1; // this._index - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the type - /// - [XmlElement(Type = typeof(uint), ElementName = "environmentType")] - public uint EnvironmentType - { - get - { - return this._environmentType; - } - - set - { - this._environmentType = value; - } - } - - /// - /// Gets or sets the length, in bits, of the record - /// - [XmlElement(Type = typeof(ushort), ElementName = "length")] - public ushort Length - { - get - { - return this._length; - } - - set - { - this._length = value; - } - } - - /// - /// Gets or sets the identifies the sequntially numbered record index - /// - [XmlElement(Type = typeof(byte), ElementName = "index")] - public byte Index - { - get - { - return this._index; - } - - set - { - this._index = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._environmentType); - dos.WriteUnsignedShort((ushort)this._length); - dos.WriteUnsignedByte((byte)this._index); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._environmentType = dis.ReadUnsignedInt(); - this._length = dis.ReadUnsignedShort(); - this._index = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._environmentType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._length.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._index.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Environment; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Environment obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._environmentType != obj._environmentType) - { - ivarsEqual = false; - } - - if (this._length != obj._length) - { - ivarsEqual = false; - } - - if (this._index != obj._index) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._environmentType.GetHashCode(); - result = GenerateHash(result) ^ this._length.GetHashCode(); - result = GenerateHash(result) ^ this._index.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EnvironmentGeneral.cs b/tests/OpenDisNet.Reference/Generated/EnvironmentGeneral.cs deleted file mode 100644 index 1724b06..0000000 --- a/tests/OpenDisNet.Reference/Generated/EnvironmentGeneral.cs +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about a geometry, a state associated with a geometry, a bounding volume, or an associated entity ID. NOTE: this class requires hand coding. 6.2.31 - /// - [Serializable] - [XmlRoot] - public partial class EnvironmentGeneral - { - /// - /// Record type - /// - private uint _environmentType; - - /// - /// length, in bits - /// - private byte _length; - - /// - /// Identify the sequentially numbered record index - /// - private byte _index; - - /// - /// padding - /// - private byte _padding1; - - /// - /// Geometry or state record - /// - private byte _geometry; - - /// - /// padding to bring the total size up to a 64 bit boundry - /// - private byte _padding2; - - /// - /// Initializes a new instance of the class. - /// - public EnvironmentGeneral() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EnvironmentGeneral left, EnvironmentGeneral right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EnvironmentGeneral left, EnvironmentGeneral right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._environmentType - marshalSize += 1; // this._length - marshalSize += 1; // this._index - marshalSize += 1; // this._padding1 - marshalSize += 1; // this._geometry - marshalSize += 1; // this._padding2 - return marshalSize; - } - - /// - /// Gets or sets the Record type - /// - [XmlElement(Type = typeof(uint), ElementName = "environmentType")] - public uint EnvironmentType - { - get - { - return this._environmentType; - } - - set - { - this._environmentType = value; - } - } - - /// - /// Gets or sets the length, in bits - /// - [XmlElement(Type = typeof(byte), ElementName = "length")] - public byte Length - { - get - { - return this._length; - } - - set - { - this._length = value; - } - } - - /// - /// Gets or sets the Identify the sequentially numbered record index - /// - [XmlElement(Type = typeof(byte), ElementName = "index")] - public byte Index - { - get - { - return this._index; - } - - set - { - this._index = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding1")] - public byte Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the Geometry or state record - /// - [XmlElement(Type = typeof(byte), ElementName = "geometry")] - public byte Geometry - { - get - { - return this._geometry; - } - - set - { - this._geometry = value; - } - } - - /// - /// Gets or sets the padding to bring the total size up to a 64 bit boundry - /// - [XmlElement(Type = typeof(byte), ElementName = "padding2")] - public byte Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._environmentType); - dos.WriteUnsignedByte((byte)this._length); - dos.WriteUnsignedByte((byte)this._index); - dos.WriteUnsignedByte((byte)this._padding1); - dos.WriteUnsignedByte((byte)this._geometry); - dos.WriteUnsignedByte((byte)this._padding2); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._environmentType = dis.ReadUnsignedInt(); - this._length = dis.ReadUnsignedByte(); - this._index = dis.ReadUnsignedByte(); - this._padding1 = dis.ReadUnsignedByte(); - this._geometry = dis.ReadUnsignedByte(); - this._padding2 = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._environmentType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._length.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._index.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._geometry.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EnvironmentGeneral; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EnvironmentGeneral obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._environmentType != obj._environmentType) - { - ivarsEqual = false; - } - - if (this._length != obj._length) - { - ivarsEqual = false; - } - - if (this._index != obj._index) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._geometry != obj._geometry) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._environmentType.GetHashCode(); - result = GenerateHash(result) ^ this._length.GetHashCode(); - result = GenerateHash(result) ^ this._index.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._geometry.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EnvironmentType.cs b/tests/OpenDisNet.Reference/Generated/EnvironmentType.cs deleted file mode 100644 index 94072fb..0000000 --- a/tests/OpenDisNet.Reference/Generated/EnvironmentType.cs +++ /dev/null @@ -1,463 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Description of environmental data in environmental process and gridded data PDUs. Section 6.2.32 - /// - [Serializable] - [XmlRoot] - public partial class EnvironmentType - { - /// - /// Kind of entity - /// - private byte _entityKind; - - /// - /// Domain of entity (air, surface, subsurface, space, etc) - /// - private byte _domain; - - /// - /// class of environmental entity - /// - private ushort _entityClass; - - /// - /// category of entity - /// - private byte _category; - - /// - /// subcategory of entity - /// - private byte _subcategory; - - /// - /// specific info based on subcategory field - /// - private byte _specific; - - private byte _extra; - - /// - /// Initializes a new instance of the class. - /// - public EnvironmentType() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EnvironmentType left, EnvironmentType right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EnvironmentType left, EnvironmentType right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._entityKind - marshalSize += 1; // this._domain - marshalSize += 2; // this._entityClass - marshalSize += 1; // this._category - marshalSize += 1; // this._subcategory - marshalSize += 1; // this._specific - marshalSize += 1; // this._extra - return marshalSize; - } - - /// - /// Gets or sets the Kind of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "entityKind")] - public byte EntityKind - { - get - { - return this._entityKind; - } - - set - { - this._entityKind = value; - } - } - - /// - /// Gets or sets the Domain of entity (air, surface, subsurface, space, etc) - /// - [XmlElement(Type = typeof(byte), ElementName = "domain")] - public byte Domain - { - get - { - return this._domain; - } - - set - { - this._domain = value; - } - } - - /// - /// Gets or sets the class of environmental entity - /// - [XmlElement(Type = typeof(ushort), ElementName = "entityClass")] - public ushort EntityClass - { - get - { - return this._entityClass; - } - - set - { - this._entityClass = value; - } - } - - /// - /// Gets or sets the category of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "category")] - public byte Category - { - get - { - return this._category; - } - - set - { - this._category = value; - } - } - - /// - /// Gets or sets the subcategory of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "subcategory")] - public byte Subcategory - { - get - { - return this._subcategory; - } - - set - { - this._subcategory = value; - } - } - - /// - /// Gets or sets the specific info based on subcategory field - /// - [XmlElement(Type = typeof(byte), ElementName = "specific")] - public byte Specific - { - get - { - return this._specific; - } - - set - { - this._specific = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "extra")] - public byte Extra - { - get - { - return this._extra; - } - - set - { - this._extra = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._entityKind); - dos.WriteUnsignedByte((byte)this._domain); - dos.WriteUnsignedShort((ushort)this._entityClass); - dos.WriteUnsignedByte((byte)this._category); - dos.WriteUnsignedByte((byte)this._subcategory); - dos.WriteUnsignedByte((byte)this._specific); - dos.WriteUnsignedByte((byte)this._extra); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._entityKind = dis.ReadUnsignedByte(); - this._domain = dis.ReadUnsignedByte(); - this._entityClass = dis.ReadUnsignedShort(); - this._category = dis.ReadUnsignedByte(); - this._subcategory = dis.ReadUnsignedByte(); - this._specific = dis.ReadUnsignedByte(); - this._extra = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._entityKind.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._domain.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._entityClass.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._category.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._subcategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._specific.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._extra.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EnvironmentType; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EnvironmentType obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._entityKind != obj._entityKind) - { - ivarsEqual = false; - } - - if (this._domain != obj._domain) - { - ivarsEqual = false; - } - - if (this._entityClass != obj._entityClass) - { - ivarsEqual = false; - } - - if (this._category != obj._category) - { - ivarsEqual = false; - } - - if (this._subcategory != obj._subcategory) - { - ivarsEqual = false; - } - - if (this._specific != obj._specific) - { - ivarsEqual = false; - } - - if (this._extra != obj._extra) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._entityKind.GetHashCode(); - result = GenerateHash(result) ^ this._domain.GetHashCode(); - result = GenerateHash(result) ^ this._entityClass.GetHashCode(); - result = GenerateHash(result) ^ this._category.GetHashCode(); - result = GenerateHash(result) ^ this._subcategory.GetHashCode(); - result = GenerateHash(result) ^ this._specific.GetHashCode(); - result = GenerateHash(result) ^ this._extra.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EulerAngles.cs b/tests/OpenDisNet.Reference/Generated/EulerAngles.cs deleted file mode 100644 index 16d7243..0000000 --- a/tests/OpenDisNet.Reference/Generated/EulerAngles.cs +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Three floating point values representing an orientation, psi, theta, and phi, aka the euler angles, in radians. Section 6.2.33 - /// - [Serializable] - [XmlRoot] - public partial class EulerAngles - { - private float _psi; - - private float _theta; - - private float _phi; - - /// - /// Initializes a new instance of the class. - /// - public EulerAngles() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EulerAngles left, EulerAngles right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EulerAngles left, EulerAngles right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._psi - marshalSize += 4; // this._theta - marshalSize += 4; // this._phi - return marshalSize; - } - - [XmlElement(Type = typeof(float), ElementName = "psi")] - public float Psi - { - get - { - return this._psi; - } - - set - { - this._psi = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "theta")] - public float Theta - { - get - { - return this._theta; - } - - set - { - this._theta = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "phi")] - public float Phi - { - get - { - return this._phi; - } - - set - { - this._phi = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._psi); - dos.WriteFloat((float)this._theta); - dos.WriteFloat((float)this._phi); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._psi = dis.ReadFloat(); - this._theta = dis.ReadFloat(); - this._phi = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._psi.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._theta.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._phi.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EulerAngles; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EulerAngles obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._psi != obj._psi) - { - ivarsEqual = false; - } - - if (this._theta != obj._theta) - { - ivarsEqual = false; - } - - if (this._phi != obj._phi) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._psi.GetHashCode(); - result = GenerateHash(result) ^ this._theta.GetHashCode(); - result = GenerateHash(result) ^ this._phi.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EventIdentifier.cs b/tests/OpenDisNet.Reference/Generated/EventIdentifier.cs deleted file mode 100644 index 7be27fa..0000000 --- a/tests/OpenDisNet.Reference/Generated/EventIdentifier.cs +++ /dev/null @@ -1,306 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Identifies an event in the world. Use this format for every PDU EXCEPT the LiveEntityPdu. Section 6.2.34. - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class EventIdentifier - { - /// - /// Site and application IDs - /// - private SimulationAddress _simulationAddress = new SimulationAddress(); - - private ushort _eventNumber; - - /// - /// Initializes a new instance of the class. - /// - public EventIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EventIdentifier left, EventIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EventIdentifier left, EventIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._eventNumber - return marshalSize; - } - - /// - /// Gets or sets the Site and application IDs - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "simulationAddress")] - public SimulationAddress SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "eventNumber")] - public ushort EventNumber - { - get - { - return this._eventNumber; - } - - set - { - this._eventNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._eventNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._eventNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._eventNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EventIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EventIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._eventNumber != obj._eventNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._eventNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EventIdentifierLiveEntity.cs b/tests/OpenDisNet.Reference/Generated/EventIdentifierLiveEntity.cs deleted file mode 100644 index 7d9bf3e..0000000 --- a/tests/OpenDisNet.Reference/Generated/EventIdentifierLiveEntity.cs +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Identifies an event in the world. Use this format for ONLY the LiveEntityPdu. Section 6.2.34. - /// - [Serializable] - [XmlRoot] - public partial class EventIdentifierLiveEntity - { - private byte _siteNumber; - - private byte _applicationNumber; - - private ushort _eventNumber; - - /// - /// Initializes a new instance of the class. - /// - public EventIdentifierLiveEntity() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EventIdentifierLiveEntity left, EventIdentifierLiveEntity right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EventIdentifierLiveEntity left, EventIdentifierLiveEntity right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._siteNumber - marshalSize += 1; // this._applicationNumber - marshalSize += 2; // this._eventNumber - return marshalSize; - } - - [XmlElement(Type = typeof(byte), ElementName = "siteNumber")] - public byte SiteNumber - { - get - { - return this._siteNumber; - } - - set - { - this._siteNumber = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "applicationNumber")] - public byte ApplicationNumber - { - get - { - return this._applicationNumber; - } - - set - { - this._applicationNumber = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "eventNumber")] - public ushort EventNumber - { - get - { - return this._eventNumber; - } - - set - { - this._eventNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._siteNumber); - dos.WriteUnsignedByte((byte)this._applicationNumber); - dos.WriteUnsignedShort((ushort)this._eventNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._siteNumber = dis.ReadUnsignedByte(); - this._applicationNumber = dis.ReadUnsignedByte(); - this._eventNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._siteNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._applicationNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._eventNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EventIdentifierLiveEntity; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EventIdentifierLiveEntity obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._siteNumber != obj._siteNumber) - { - ivarsEqual = false; - } - - if (this._applicationNumber != obj._applicationNumber) - { - ivarsEqual = false; - } - - if (this._eventNumber != obj._eventNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._siteNumber.GetHashCode(); - result = GenerateHash(result) ^ this._applicationNumber.GetHashCode(); - result = GenerateHash(result) ^ this._eventNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EventReportPdu.cs b/tests/OpenDisNet.Reference/Generated/EventReportPdu.cs deleted file mode 100644 index 84d3bfa..0000000 --- a/tests/OpenDisNet.Reference/Generated/EventReportPdu.cs +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Reports occurance of a significant event to the simulation manager. Section 7.5.12. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class EventReportPdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Type of event - /// - private uint _eventType; - - /// - /// padding - /// - private uint _padding1; - - /// - /// Number of fixed datum records - /// - private uint _numberOfFixedDatumRecords; - - /// - /// Number of variable datum records - /// - private uint _numberOfVariableDatumRecords; - - /// - /// variable length list of fixed datums - /// - private List _fixedDatums = new List(); - - /// - /// variable length list of variable length datums - /// - private List _variableDatums = new List(); - - /// - /// Initializes a new instance of the class. - /// - public EventReportPdu() - { - PduType = (byte)21; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EventReportPdu left, EventReportPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EventReportPdu left, EventReportPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._eventType - marshalSize += 4; // this._padding1 - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Type of event - /// - [XmlElement(Type = typeof(uint), ElementName = "eventType")] - public uint EventType - { - get - { - return this._eventType; - } - - set - { - this._eventType = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(uint), ElementName = "padding1")] - public uint Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the variable length list of fixed datums - /// - [XmlElement(ElementName = "fixedDatumsList", Type = typeof(List))] - public List FixedDatums - { - get - { - return this._fixedDatums; - } - } - - /// - /// Gets or sets the variable length list of variable length datums - /// - [XmlElement(ElementName = "variableDatumsList", Type = typeof(List))] - public List VariableDatums - { - get - { - return this._variableDatums; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._eventType); - dos.WriteUnsignedInt((uint)this._padding1); - dos.WriteUnsignedInt((uint)this._fixedDatums.Count); - dos.WriteUnsignedInt((uint)this._variableDatums.Count); - - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._eventType = dis.ReadUnsignedInt(); - this._padding1 = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatums.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatums.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._eventType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EventReportPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EventReportPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._eventType != obj._eventType) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatums.Count != obj._fixedDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - if (!this._fixedDatums[idx].Equals(obj._fixedDatums[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatums.Count != obj._variableDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - if (!this._variableDatums[idx].Equals(obj._variableDatums[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._eventType.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatums.Count > 0) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatums[idx].GetHashCode(); - } - } - - if (this._variableDatums.Count > 0) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatums[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/EventReportReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/EventReportReliablePdu.cs deleted file mode 100644 index a2c1d50..0000000 --- a/tests/OpenDisNet.Reference/Generated/EventReportReliablePdu.cs +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.11: reports the occurance of a significatnt event to the simulation manager. Needs manual intervention to fix padding in variable datums. UNFINISHED. - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class EventReportReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// Event type - /// - private ushort _eventType; - - /// - /// padding - /// - private uint _pad1; - - /// - /// Fixed datum record count - /// - private uint _numberOfFixedDatumRecords; - - /// - /// variable datum record count - /// - private uint _numberOfVariableDatumRecords; - - /// - /// Fixed datum records - /// - private List _fixedDatumRecords = new List(); - - /// - /// Variable datum records - /// - private List _variableDatumRecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public EventReportReliablePdu() - { - PduType = (byte)61; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(EventReportReliablePdu left, EventReportReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(EventReportReliablePdu left, EventReportReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 2; // this._eventType - marshalSize += 4; // this._pad1 - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Event type - /// - [XmlElement(Type = typeof(ushort), ElementName = "eventType")] - public ushort EventType - { - get - { - return this._eventType; - } - - set - { - this._eventType = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(uint), ElementName = "pad1")] - public uint Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the Fixed datum records - /// - [XmlElement(ElementName = "fixedDatumRecordsList", Type = typeof(List))] - public List FixedDatumRecords - { - get - { - return this._fixedDatumRecords; - } - } - - /// - /// Gets or sets the Variable datum records - /// - [XmlElement(ElementName = "variableDatumRecordsList", Type = typeof(List))] - public List VariableDatumRecords - { - get - { - return this._variableDatumRecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._eventType); - dos.WriteUnsignedInt((uint)this._pad1); - dos.WriteUnsignedInt((uint)this._fixedDatumRecords.Count); - dos.WriteUnsignedInt((uint)this._variableDatumRecords.Count); - - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._eventType = dis.ReadUnsignedShort(); - this._pad1 = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatumRecords.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatumRecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._eventType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as EventReportReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(EventReportReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._eventType != obj._eventType) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatumRecords.Count != obj._fixedDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - if (!this._fixedDatumRecords[idx].Equals(obj._fixedDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumRecords.Count != obj._variableDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - if (!this._variableDatumRecords[idx].Equals(obj._variableDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._eventType.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumRecords[idx].GetHashCode(); - } - } - - if (this._variableDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumRecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Expendable.cs b/tests/OpenDisNet.Reference/Generated/Expendable.cs deleted file mode 100644 index 7b8aeaa..0000000 --- a/tests/OpenDisNet.Reference/Generated/Expendable.cs +++ /dev/null @@ -1,384 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// An entity's expendable (chaff, flares, etc) information. Section 6.2.36 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class Expendable - { - /// - /// Type of expendable - /// - private EntityType _expendable = new EntityType(); - - private uint _station; - - private ushort _quantity; - - private byte _expendableStatus; - - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public Expendable() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Expendable left, Expendable right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Expendable left, Expendable right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._expendable.GetMarshalledSize(); // this._expendable - marshalSize += 4; // this._station - marshalSize += 2; // this._quantity - marshalSize += 1; // this._expendableStatus - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the Type of expendable - /// - [XmlElement(Type = typeof(EntityType), ElementName = "expendable")] - public EntityType Expendable_ - { - get - { - return this._expendable; - } - - set - { - this._expendable = value; - } - } - - [XmlElement(Type = typeof(uint), ElementName = "station")] - public uint Station - { - get - { - return this._station; - } - - set - { - this._station = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "quantity")] - public ushort Quantity - { - get - { - return this._quantity; - } - - set - { - this._quantity = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "expendableStatus")] - public byte ExpendableStatus - { - get - { - return this._expendableStatus; - } - - set - { - this._expendableStatus = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._expendable.Marshal(dos); - dos.WriteUnsignedInt((uint)this._station); - dos.WriteUnsignedShort((ushort)this._quantity); - dos.WriteUnsignedByte((byte)this._expendableStatus); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._expendable.Unmarshal(dis); - this._station = dis.ReadUnsignedInt(); - this._quantity = dis.ReadUnsignedShort(); - this._expendableStatus = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._expendable.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._station.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._quantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._expendableStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Expendable; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Expendable obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._expendable.Equals(obj._expendable)) - { - ivarsEqual = false; - } - - if (this._station != obj._station) - { - ivarsEqual = false; - } - - if (this._quantity != obj._quantity) - { - ivarsEqual = false; - } - - if (this._expendableStatus != obj._expendableStatus) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._expendable.GetHashCode(); - result = GenerateHash(result) ^ this._station.GetHashCode(); - result = GenerateHash(result) ^ this._quantity.GetHashCode(); - result = GenerateHash(result) ^ this._expendableStatus.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ExpendableDescriptor.cs b/tests/OpenDisNet.Reference/Generated/ExpendableDescriptor.cs deleted file mode 100644 index 0949309..0000000 --- a/tests/OpenDisNet.Reference/Generated/ExpendableDescriptor.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Burst of chaff or expendible device. Section 6.2.20.4 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class ExpendableDescriptor - { - /// - /// Type of the object that exploded - /// - private EntityType _expendableType = new EntityType(); - - /// - /// Padding - /// - private long _padding; - - /// - /// Initializes a new instance of the class. - /// - public ExpendableDescriptor() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ExpendableDescriptor left, ExpendableDescriptor right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ExpendableDescriptor left, ExpendableDescriptor right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._expendableType.GetMarshalledSize(); // this._expendableType - marshalSize += 8; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the Type of the object that exploded - /// - [XmlElement(Type = typeof(EntityType), ElementName = "expendableType")] - public EntityType ExpendableType - { - get - { - return this._expendableType; - } - - set - { - this._expendableType = value; - } - } - - /// - /// Gets or sets the Padding - /// - [XmlElement(Type = typeof(long), ElementName = "padding")] - public long Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._expendableType.Marshal(dos); - dos.WriteLong((long)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._expendableType.Unmarshal(dis); - this._padding = dis.ReadLong(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._expendableType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ExpendableDescriptor; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ExpendableDescriptor obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._expendableType.Equals(obj._expendableType)) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._expendableType.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ExpendableReload.cs b/tests/OpenDisNet.Reference/Generated/ExpendableReload.cs deleted file mode 100644 index 4e12354..0000000 --- a/tests/OpenDisNet.Reference/Generated/ExpendableReload.cs +++ /dev/null @@ -1,410 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// An entity's expendable (chaff, flares, etc) information. Section 6.2.37 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class ExpendableReload - { - /// - /// Type of expendable - /// - private EntityType _expendable = new EntityType(); - - private uint _station; - - private ushort _standardQuantity; - - private ushort _maximumQuantity; - - private uint _standardQuantityReloadTime; - - private uint _maximumQuantityReloadTime; - - /// - /// Initializes a new instance of the class. - /// - public ExpendableReload() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ExpendableReload left, ExpendableReload right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ExpendableReload left, ExpendableReload right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._expendable.GetMarshalledSize(); // this._expendable - marshalSize += 4; // this._station - marshalSize += 2; // this._standardQuantity - marshalSize += 2; // this._maximumQuantity - marshalSize += 4; // this._standardQuantityReloadTime - marshalSize += 4; // this._maximumQuantityReloadTime - return marshalSize; - } - - /// - /// Gets or sets the Type of expendable - /// - [XmlElement(Type = typeof(EntityType), ElementName = "expendable")] - public EntityType Expendable - { - get - { - return this._expendable; - } - - set - { - this._expendable = value; - } - } - - [XmlElement(Type = typeof(uint), ElementName = "station")] - public uint Station - { - get - { - return this._station; - } - - set - { - this._station = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "standardQuantity")] - public ushort StandardQuantity - { - get - { - return this._standardQuantity; - } - - set - { - this._standardQuantity = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "maximumQuantity")] - public ushort MaximumQuantity - { - get - { - return this._maximumQuantity; - } - - set - { - this._maximumQuantity = value; - } - } - - [XmlElement(Type = typeof(uint), ElementName = "standardQuantityReloadTime")] - public uint StandardQuantityReloadTime - { - get - { - return this._standardQuantityReloadTime; - } - - set - { - this._standardQuantityReloadTime = value; - } - } - - [XmlElement(Type = typeof(uint), ElementName = "maximumQuantityReloadTime")] - public uint MaximumQuantityReloadTime - { - get - { - return this._maximumQuantityReloadTime; - } - - set - { - this._maximumQuantityReloadTime = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._expendable.Marshal(dos); - dos.WriteUnsignedInt((uint)this._station); - dos.WriteUnsignedShort((ushort)this._standardQuantity); - dos.WriteUnsignedShort((ushort)this._maximumQuantity); - dos.WriteUnsignedInt((uint)this._standardQuantityReloadTime); - dos.WriteUnsignedInt((uint)this._maximumQuantityReloadTime); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._expendable.Unmarshal(dis); - this._station = dis.ReadUnsignedInt(); - this._standardQuantity = dis.ReadUnsignedShort(); - this._maximumQuantity = dis.ReadUnsignedShort(); - this._standardQuantityReloadTime = dis.ReadUnsignedInt(); - this._maximumQuantityReloadTime = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._expendable.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._station.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._standardQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._maximumQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._standardQuantityReloadTime.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._maximumQuantityReloadTime.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ExpendableReload; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ExpendableReload obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._expendable.Equals(obj._expendable)) - { - ivarsEqual = false; - } - - if (this._station != obj._station) - { - ivarsEqual = false; - } - - if (this._standardQuantity != obj._standardQuantity) - { - ivarsEqual = false; - } - - if (this._maximumQuantity != obj._maximumQuantity) - { - ivarsEqual = false; - } - - if (this._standardQuantityReloadTime != obj._standardQuantityReloadTime) - { - ivarsEqual = false; - } - - if (this._maximumQuantityReloadTime != obj._maximumQuantityReloadTime) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._expendable.GetHashCode(); - result = GenerateHash(result) ^ this._station.GetHashCode(); - result = GenerateHash(result) ^ this._standardQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._maximumQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._standardQuantityReloadTime.GetHashCode(); - result = GenerateHash(result) ^ this._maximumQuantityReloadTime.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ExplosionDescriptor.cs b/tests/OpenDisNet.Reference/Generated/ExplosionDescriptor.cs deleted file mode 100644 index 41e58e6..0000000 --- a/tests/OpenDisNet.Reference/Generated/ExplosionDescriptor.cs +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Explosion of a non-munition. Section 6.2.20.3 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class ExplosionDescriptor - { - /// - /// Type of the object that exploded. See 6.2.30 - /// - private EntityType _explodingObject = new EntityType(); - - /// - /// Material that exploded. Can be grain dust, tnt, gasoline, etc. - /// - private ushort _explosiveMaterial; - - /// - /// padding - /// - private ushort _padding; - - /// - /// Force of explosion, in equivalent KG of TNT - /// - private float _explosiveForce; - - /// - /// Initializes a new instance of the class. - /// - public ExplosionDescriptor() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ExplosionDescriptor left, ExplosionDescriptor right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ExplosionDescriptor left, ExplosionDescriptor right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._explodingObject.GetMarshalledSize(); // this._explodingObject - marshalSize += 2; // this._explosiveMaterial - marshalSize += 2; // this._padding - marshalSize += 4; // this._explosiveForce - return marshalSize; - } - - /// - /// Gets or sets the Type of the object that exploded. See 6.2.30 - /// - [XmlElement(Type = typeof(EntityType), ElementName = "explodingObject")] - public EntityType ExplodingObject - { - get - { - return this._explodingObject; - } - - set - { - this._explodingObject = value; - } - } - - /// - /// Gets or sets the Material that exploded. Can be grain dust, tnt, gasoline, etc. - /// - [XmlElement(Type = typeof(ushort), ElementName = "explosiveMaterial")] - public ushort ExplosiveMaterial - { - get - { - return this._explosiveMaterial; - } - - set - { - this._explosiveMaterial = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Gets or sets the Force of explosion, in equivalent KG of TNT - /// - [XmlElement(Type = typeof(float), ElementName = "explosiveForce")] - public float ExplosiveForce - { - get - { - return this._explosiveForce; - } - - set - { - this._explosiveForce = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._explodingObject.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._explosiveMaterial); - dos.WriteUnsignedShort((ushort)this._padding); - dos.WriteFloat((float)this._explosiveForce); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._explodingObject.Unmarshal(dis); - this._explosiveMaterial = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - this._explosiveForce = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._explodingObject.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._explosiveMaterial.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._explosiveForce.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ExplosionDescriptor; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ExplosionDescriptor obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._explodingObject.Equals(obj._explodingObject)) - { - ivarsEqual = false; - } - - if (this._explosiveMaterial != obj._explosiveMaterial) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (this._explosiveForce != obj._explosiveForce) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._explodingObject.GetHashCode(); - result = GenerateHash(result) ^ this._explosiveMaterial.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._explosiveForce.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/FalseTargetsAttribute.cs b/tests/OpenDisNet.Reference/Generated/FalseTargetsAttribute.cs deleted file mode 100644 index 35534c4..0000000 --- a/tests/OpenDisNet.Reference/Generated/FalseTargetsAttribute.cs +++ /dev/null @@ -1,609 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The False Targets attribute record shall be used to communicate discrete values that are associated with false targets jamming that cannot be referenced to an emitter mode. The values provided in the False Targets attri- bute record shall be considered valid only for the victim radar beams listed in the jamming beam's Track/Jam Data records (provided in the associated Electromagnetic Emission PDU). Section 6.2.12.3 - /// - [Serializable] - [XmlRoot] - public partial class FalseTargetsAttribute - { - private uint _recordType = 3502; - - private ushort _recordLength = 40; - - private ushort _padding; - - private byte _emitterNumber; - - private byte _beamNumber; - - private byte _stateIndicator; - - private byte _padding2; - - private float _falseTargetCount; - - private float _walkSpeed; - - private float _walkAcceleration; - - private float _maximumWalkDistance; - - private float _keepTime; - - private float _echoSpacing; - - private uint _padding3; - - /// - /// Initializes a new instance of the class. - /// - public FalseTargetsAttribute() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(FalseTargetsAttribute left, FalseTargetsAttribute right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(FalseTargetsAttribute left, FalseTargetsAttribute right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 2; // this._padding - marshalSize += 1; // this._emitterNumber - marshalSize += 1; // this._beamNumber - marshalSize += 1; // this._stateIndicator - marshalSize += 1; // this._padding2 - marshalSize += 4; // this._falseTargetCount - marshalSize += 4; // this._walkSpeed - marshalSize += 4; // this._walkAcceleration - marshalSize += 4; // this._maximumWalkDistance - marshalSize += 4; // this._keepTime - marshalSize += 4; // this._echoSpacing - marshalSize += 4; // this._padding3 - return marshalSize; - } - - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "emitterNumber")] - public byte EmitterNumber - { - get - { - return this._emitterNumber; - } - - set - { - this._emitterNumber = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "beamNumber")] - public byte BeamNumber - { - get - { - return this._beamNumber; - } - - set - { - this._beamNumber = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "stateIndicator")] - public byte StateIndicator - { - get - { - return this._stateIndicator; - } - - set - { - this._stateIndicator = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "padding2")] - public byte Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "falseTargetCount")] - public float FalseTargetCount - { - get - { - return this._falseTargetCount; - } - - set - { - this._falseTargetCount = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "walkSpeed")] - public float WalkSpeed - { - get - { - return this._walkSpeed; - } - - set - { - this._walkSpeed = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "walkAcceleration")] - public float WalkAcceleration - { - get - { - return this._walkAcceleration; - } - - set - { - this._walkAcceleration = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "maximumWalkDistance")] - public float MaximumWalkDistance - { - get - { - return this._maximumWalkDistance; - } - - set - { - this._maximumWalkDistance = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "keepTime")] - public float KeepTime - { - get - { - return this._keepTime; - } - - set - { - this._keepTime = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "echoSpacing")] - public float EchoSpacing - { - get - { - return this._echoSpacing; - } - - set - { - this._echoSpacing = value; - } - } - - [XmlElement(Type = typeof(uint), ElementName = "padding3")] - public uint Padding3 - { - get - { - return this._padding3; - } - - set - { - this._padding3 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedShort((ushort)this._padding); - dos.WriteUnsignedByte((byte)this._emitterNumber); - dos.WriteUnsignedByte((byte)this._beamNumber); - dos.WriteUnsignedByte((byte)this._stateIndicator); - dos.WriteUnsignedByte((byte)this._padding2); - dos.WriteFloat((float)this._falseTargetCount); - dos.WriteFloat((float)this._walkSpeed); - dos.WriteFloat((float)this._walkAcceleration); - dos.WriteFloat((float)this._maximumWalkDistance); - dos.WriteFloat((float)this._keepTime); - dos.WriteFloat((float)this._echoSpacing); - dos.WriteUnsignedInt((uint)this._padding3); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - this._emitterNumber = dis.ReadUnsignedByte(); - this._beamNumber = dis.ReadUnsignedByte(); - this._stateIndicator = dis.ReadUnsignedByte(); - this._padding2 = dis.ReadUnsignedByte(); - this._falseTargetCount = dis.ReadFloat(); - this._walkSpeed = dis.ReadFloat(); - this._walkAcceleration = dis.ReadFloat(); - this._maximumWalkDistance = dis.ReadFloat(); - this._keepTime = dis.ReadFloat(); - this._echoSpacing = dis.ReadFloat(); - this._padding3 = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._emitterNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._stateIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._falseTargetCount.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._walkSpeed.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._walkAcceleration.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._maximumWalkDistance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._keepTime.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._echoSpacing.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding3.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as FalseTargetsAttribute; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(FalseTargetsAttribute obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (this._emitterNumber != obj._emitterNumber) - { - ivarsEqual = false; - } - - if (this._beamNumber != obj._beamNumber) - { - ivarsEqual = false; - } - - if (this._stateIndicator != obj._stateIndicator) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._falseTargetCount != obj._falseTargetCount) - { - ivarsEqual = false; - } - - if (this._walkSpeed != obj._walkSpeed) - { - ivarsEqual = false; - } - - if (this._walkAcceleration != obj._walkAcceleration) - { - ivarsEqual = false; - } - - if (this._maximumWalkDistance != obj._maximumWalkDistance) - { - ivarsEqual = false; - } - - if (this._keepTime != obj._keepTime) - { - ivarsEqual = false; - } - - if (this._echoSpacing != obj._echoSpacing) - { - ivarsEqual = false; - } - - if (this._padding3 != obj._padding3) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._emitterNumber.GetHashCode(); - result = GenerateHash(result) ^ this._beamNumber.GetHashCode(); - result = GenerateHash(result) ^ this._stateIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._falseTargetCount.GetHashCode(); - result = GenerateHash(result) ^ this._walkSpeed.GetHashCode(); - result = GenerateHash(result) ^ this._walkAcceleration.GetHashCode(); - result = GenerateHash(result) ^ this._maximumWalkDistance.GetHashCode(); - result = GenerateHash(result) ^ this._keepTime.GetHashCode(); - result = GenerateHash(result) ^ this._echoSpacing.GetHashCode(); - result = GenerateHash(result) ^ this._padding3.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/FastEntityStatePdu.cs b/tests/OpenDisNet.Reference/Generated/FastEntityStatePdu.cs deleted file mode 100644 index 4c45e08..0000000 --- a/tests/OpenDisNet.Reference/Generated/FastEntityStatePdu.cs +++ /dev/null @@ -1,1590 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Represents the postion and state of one entity in the world. This is identical in function to entity state pdu, but generates less garbage to collect in the Java world. Section 7.2.2. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(VariableParameter))] - public partial class FastEntityStatePdu : EntityInformationFamilyPdu, IEquatable - { - /// - /// The site ID - /// - private ushort _site; - - /// - /// The application ID - /// - private ushort _application; - - /// - /// the entity ID - /// - private ushort _entity; - - /// - /// what force this entity is affiliated with, eg red, blue, neutral, etc - /// - private byte _forceId; - - /// - /// How many variable (nee articulation) parameters are in the variable length list - /// - private byte _numberOfVariableParameters; - - /// - /// Kind of entity - /// - private byte _entityKind; - - /// - /// Domain of entity (air, surface, subsurface, space, etc) - /// - private byte _domain; - - /// - /// country to which the design of the entity is attributed - /// - private ushort _country; - - /// - /// category of entity - /// - private byte _category; - - /// - /// subcategory of entity - /// - private byte _subcategory; - - /// - /// specific info based on subcategory field - /// - private byte _specific; - - private byte _extra; - - /// - /// Kind of entity - /// - private byte _altEntityKind; - - /// - /// Domain of entity (air, surface, subsurface, space, etc) - /// - private byte _altDomain; - - /// - /// country to which the design of the entity is attributed - /// - private ushort _altCountry; - - /// - /// category of entity - /// - private byte _altCategory; - - /// - /// subcategory of entity - /// - private byte _altSubcategory; - - /// - /// specific info based on subcategory field - /// - private byte _altSpecific; - - private byte _altExtra; - - /// - /// X velo - /// - private float _xVelocity; - - /// - /// y Value - /// - private float _yVelocity; - - /// - /// Z value - /// - private float _zVelocity; - - /// - /// X value - /// - private double _xLocation; - - /// - /// y Value - /// - private double _yLocation; - - /// - /// Z value - /// - private double _zLocation; - - private float _psi; - - private float _theta; - - private float _phi; - - /// - /// a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. - /// - private int _entityAppearance; - - /// - /// enumeration of what dead reckoning algorighm to use - /// - private byte _deadReckoningAlgorithm; - - /// - /// other parameters to use in the dead reckoning algorithm - /// - private byte[] _otherParameters = new byte[15]; - - /// - /// X value - /// - private float _xAcceleration; - - /// - /// y Value - /// - private float _yAcceleration; - - /// - /// Z value - /// - private float _zAcceleration; - - /// - /// X value - /// - private float _xAngularVelocity; - - /// - /// y Value - /// - private float _yAngularVelocity; - - /// - /// Z value - /// - private float _zAngularVelocity; - - /// - /// characters that can be used for debugging, or to draw unique strings on the side of entities in the world - /// - private byte[] _marking = new byte[12]; - - /// - /// a series of bit flags - /// - private int _capabilities; - - /// - /// variable length list of variable parameters. In earlier versions of DIS these were known as articulation parameters - /// - private List _variableParameters = new List(); - - /// - /// Initializes a new instance of the class. - /// - public FastEntityStatePdu() - { - PduType = (byte)1; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(FastEntityStatePdu left, FastEntityStatePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(FastEntityStatePdu left, FastEntityStatePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 2; // this._site - marshalSize += 2; // this._application - marshalSize += 2; // this._entity - marshalSize += 1; // this._forceId - marshalSize += 1; // this._numberOfVariableParameters - marshalSize += 1; // this._entityKind - marshalSize += 1; // this._domain - marshalSize += 2; // this._country - marshalSize += 1; // this._category - marshalSize += 1; // this._subcategory - marshalSize += 1; // this._specific - marshalSize += 1; // this._extra - marshalSize += 1; // this._altEntityKind - marshalSize += 1; // this._altDomain - marshalSize += 2; // this._altCountry - marshalSize += 1; // this._altCategory - marshalSize += 1; // this._altSubcategory - marshalSize += 1; // this._altSpecific - marshalSize += 1; // this._altExtra - marshalSize += 4; // this._xVelocity - marshalSize += 4; // this._yVelocity - marshalSize += 4; // this._zVelocity - marshalSize += 8; // this._xLocation - marshalSize += 8; // this._yLocation - marshalSize += 8; // this._zLocation - marshalSize += 4; // this._psi - marshalSize += 4; // this._theta - marshalSize += 4; // this._phi - marshalSize += 4; // this._entityAppearance - marshalSize += 1; // this._deadReckoningAlgorithm - marshalSize += 15 * 1; // _otherParameters - marshalSize += 4; // this._xAcceleration - marshalSize += 4; // this._yAcceleration - marshalSize += 4; // this._zAcceleration - marshalSize += 4; // this._xAngularVelocity - marshalSize += 4; // this._yAngularVelocity - marshalSize += 4; // this._zAngularVelocity - marshalSize += 12 * 1; // _marking - marshalSize += 4; // this._capabilities - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - VariableParameter listElement = (VariableParameter)this._variableParameters[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the The site ID - /// - [XmlElement(Type = typeof(ushort), ElementName = "site")] - public ushort Site - { - get - { - return this._site; - } - - set - { - this._site = value; - } - } - - /// - /// Gets or sets the The application ID - /// - [XmlElement(Type = typeof(ushort), ElementName = "application")] - public ushort Application - { - get - { - return this._application; - } - - set - { - this._application = value; - } - } - - /// - /// Gets or sets the the entity ID - /// - [XmlElement(Type = typeof(ushort), ElementName = "entity")] - public ushort Entity - { - get - { - return this._entity; - } - - set - { - this._entity = value; - } - } - - /// - /// Gets or sets the what force this entity is affiliated with, eg red, blue, neutral, etc - /// - [XmlElement(Type = typeof(byte), ElementName = "forceId")] - public byte ForceId - { - get - { - return this._forceId; - } - - set - { - this._forceId = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableParameters method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfVariableParameters")] - public byte NumberOfVariableParameters - { - get - { - return this._numberOfVariableParameters; - } - - set - { - this._numberOfVariableParameters = value; - } - } - - /// - /// Gets or sets the Kind of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "entityKind")] - public byte EntityKind - { - get - { - return this._entityKind; - } - - set - { - this._entityKind = value; - } - } - - /// - /// Gets or sets the Domain of entity (air, surface, subsurface, space, etc) - /// - [XmlElement(Type = typeof(byte), ElementName = "domain")] - public byte Domain - { - get - { - return this._domain; - } - - set - { - this._domain = value; - } - } - - /// - /// Gets or sets the country to which the design of the entity is attributed - /// - [XmlElement(Type = typeof(ushort), ElementName = "country")] - public ushort Country - { - get - { - return this._country; - } - - set - { - this._country = value; - } - } - - /// - /// Gets or sets the category of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "category")] - public byte Category - { - get - { - return this._category; - } - - set - { - this._category = value; - } - } - - /// - /// Gets or sets the subcategory of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "subcategory")] - public byte Subcategory - { - get - { - return this._subcategory; - } - - set - { - this._subcategory = value; - } - } - - /// - /// Gets or sets the specific info based on subcategory field - /// - [XmlElement(Type = typeof(byte), ElementName = "specific")] - public byte Specific - { - get - { - return this._specific; - } - - set - { - this._specific = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "extra")] - public byte Extra - { - get - { - return this._extra; - } - - set - { - this._extra = value; - } - } - - /// - /// Gets or sets the Kind of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "altEntityKind")] - public byte AltEntityKind - { - get - { - return this._altEntityKind; - } - - set - { - this._altEntityKind = value; - } - } - - /// - /// Gets or sets the Domain of entity (air, surface, subsurface, space, etc) - /// - [XmlElement(Type = typeof(byte), ElementName = "altDomain")] - public byte AltDomain - { - get - { - return this._altDomain; - } - - set - { - this._altDomain = value; - } - } - - /// - /// Gets or sets the country to which the design of the entity is attributed - /// - [XmlElement(Type = typeof(ushort), ElementName = "altCountry")] - public ushort AltCountry - { - get - { - return this._altCountry; - } - - set - { - this._altCountry = value; - } - } - - /// - /// Gets or sets the category of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "altCategory")] - public byte AltCategory - { - get - { - return this._altCategory; - } - - set - { - this._altCategory = value; - } - } - - /// - /// Gets or sets the subcategory of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "altSubcategory")] - public byte AltSubcategory - { - get - { - return this._altSubcategory; - } - - set - { - this._altSubcategory = value; - } - } - - /// - /// Gets or sets the specific info based on subcategory field - /// - [XmlElement(Type = typeof(byte), ElementName = "altSpecific")] - public byte AltSpecific - { - get - { - return this._altSpecific; - } - - set - { - this._altSpecific = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "altExtra")] - public byte AltExtra - { - get - { - return this._altExtra; - } - - set - { - this._altExtra = value; - } - } - - /// - /// Gets or sets the X velo - /// - [XmlElement(Type = typeof(float), ElementName = "xVelocity")] - public float XVelocity - { - get - { - return this._xVelocity; - } - - set - { - this._xVelocity = value; - } - } - - /// - /// Gets or sets the y Value - /// - [XmlElement(Type = typeof(float), ElementName = "yVelocity")] - public float YVelocity - { - get - { - return this._yVelocity; - } - - set - { - this._yVelocity = value; - } - } - - /// - /// Gets or sets the Z value - /// - [XmlElement(Type = typeof(float), ElementName = "zVelocity")] - public float ZVelocity - { - get - { - return this._zVelocity; - } - - set - { - this._zVelocity = value; - } - } - - /// - /// Gets or sets the X value - /// - [XmlElement(Type = typeof(double), ElementName = "xLocation")] - public double XLocation - { - get - { - return this._xLocation; - } - - set - { - this._xLocation = value; - } - } - - /// - /// Gets or sets the y Value - /// - [XmlElement(Type = typeof(double), ElementName = "yLocation")] - public double YLocation - { - get - { - return this._yLocation; - } - - set - { - this._yLocation = value; - } - } - - /// - /// Gets or sets the Z value - /// - [XmlElement(Type = typeof(double), ElementName = "zLocation")] - public double ZLocation - { - get - { - return this._zLocation; - } - - set - { - this._zLocation = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "psi")] - public float Psi - { - get - { - return this._psi; - } - - set - { - this._psi = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "theta")] - public float Theta - { - get - { - return this._theta; - } - - set - { - this._theta = value; - } - } - - [XmlElement(Type = typeof(float), ElementName = "phi")] - public float Phi - { - get - { - return this._phi; - } - - set - { - this._phi = value; - } - } - - /// - /// Gets or sets the a series of bit flags that are used to help draw the entity, such as smoking, on fire, etc. - /// - [XmlElement(Type = typeof(int), ElementName = "entityAppearance")] - public int EntityAppearance - { - get - { - return this._entityAppearance; - } - - set - { - this._entityAppearance = value; - } - } - - /// - /// Gets or sets the enumeration of what dead reckoning algorighm to use - /// - [XmlElement(Type = typeof(byte), ElementName = "deadReckoningAlgorithm")] - public byte DeadReckoningAlgorithm - { - get - { - return this._deadReckoningAlgorithm; - } - - set - { - this._deadReckoningAlgorithm = value; - } - } - - /// - /// Gets or sets the other parameters to use in the dead reckoning algorithm - /// - [XmlArray(ElementName = "otherParameters")] - public byte[] OtherParameters - { - get - { - return this._otherParameters; - } - - set - { - this._otherParameters = value; - } -} - - /// - /// Gets or sets the X value - /// - [XmlElement(Type = typeof(float), ElementName = "xAcceleration")] - public float XAcceleration - { - get - { - return this._xAcceleration; - } - - set - { - this._xAcceleration = value; - } - } - - /// - /// Gets or sets the y Value - /// - [XmlElement(Type = typeof(float), ElementName = "yAcceleration")] - public float YAcceleration - { - get - { - return this._yAcceleration; - } - - set - { - this._yAcceleration = value; - } - } - - /// - /// Gets or sets the Z value - /// - [XmlElement(Type = typeof(float), ElementName = "zAcceleration")] - public float ZAcceleration - { - get - { - return this._zAcceleration; - } - - set - { - this._zAcceleration = value; - } - } - - /// - /// Gets or sets the X value - /// - [XmlElement(Type = typeof(float), ElementName = "xAngularVelocity")] - public float XAngularVelocity - { - get - { - return this._xAngularVelocity; - } - - set - { - this._xAngularVelocity = value; - } - } - - /// - /// Gets or sets the y Value - /// - [XmlElement(Type = typeof(float), ElementName = "yAngularVelocity")] - public float YAngularVelocity - { - get - { - return this._yAngularVelocity; - } - - set - { - this._yAngularVelocity = value; - } - } - - /// - /// Gets or sets the Z value - /// - [XmlElement(Type = typeof(float), ElementName = "zAngularVelocity")] - public float ZAngularVelocity - { - get - { - return this._zAngularVelocity; - } - - set - { - this._zAngularVelocity = value; - } - } - - /// - /// Gets or sets the characters that can be used for debugging, or to draw unique strings on the side of entities in the world - /// - [XmlArray(ElementName = "marking")] - public byte[] Marking - { - get - { - return this._marking; - } - - set - { - this._marking = value; - } -} - - /// - /// Gets or sets the a series of bit flags - /// - [XmlElement(Type = typeof(int), ElementName = "capabilities")] - public int Capabilities - { - get - { - return this._capabilities; - } - - set - { - this._capabilities = value; - } - } - - /// - /// Gets or sets the variable length list of variable parameters. In earlier versions of DIS these were known as articulation parameters - /// - [XmlElement(ElementName = "variableParametersList", Type = typeof(List))] - public List VariableParameters - { - get - { - return this._variableParameters; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._site); - dos.WriteUnsignedShort((ushort)this._application); - dos.WriteUnsignedShort((ushort)this._entity); - dos.WriteUnsignedByte((byte)this._forceId); - dos.WriteByte((byte)this._variableParameters.Count); - dos.WriteUnsignedByte((byte)this._entityKind); - dos.WriteUnsignedByte((byte)this._domain); - dos.WriteUnsignedShort((ushort)this._country); - dos.WriteUnsignedByte((byte)this._category); - dos.WriteUnsignedByte((byte)this._subcategory); - dos.WriteUnsignedByte((byte)this._specific); - dos.WriteUnsignedByte((byte)this._extra); - dos.WriteUnsignedByte((byte)this._altEntityKind); - dos.WriteUnsignedByte((byte)this._altDomain); - dos.WriteUnsignedShort((ushort)this._altCountry); - dos.WriteUnsignedByte((byte)this._altCategory); - dos.WriteUnsignedByte((byte)this._altSubcategory); - dos.WriteUnsignedByte((byte)this._altSpecific); - dos.WriteUnsignedByte((byte)this._altExtra); - dos.WriteFloat((float)this._xVelocity); - dos.WriteFloat((float)this._yVelocity); - dos.WriteFloat((float)this._zVelocity); - dos.WriteDouble((double)this._xLocation); - dos.WriteDouble((double)this._yLocation); - dos.WriteDouble((double)this._zLocation); - dos.WriteFloat((float)this._psi); - dos.WriteFloat((float)this._theta); - dos.WriteFloat((float)this._phi); - dos.WriteInt((int)this._entityAppearance); - dos.WriteUnsignedByte((byte)this._deadReckoningAlgorithm); - - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - dos.WriteByte(this._otherParameters[idx]); - } - dos.WriteFloat((float)this._xAcceleration); - dos.WriteFloat((float)this._yAcceleration); - dos.WriteFloat((float)this._zAcceleration); - dos.WriteFloat((float)this._xAngularVelocity); - dos.WriteFloat((float)this._yAngularVelocity); - dos.WriteFloat((float)this._zAngularVelocity); - - for (int idx = 0; idx < this._marking.Length; idx++) - { - dos.WriteByte(this._marking[idx]); - } - dos.WriteInt((int)this._capabilities); - - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - VariableParameter aVariableParameter = (VariableParameter)this._variableParameters[idx]; - aVariableParameter.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._site = dis.ReadUnsignedShort(); - this._application = dis.ReadUnsignedShort(); - this._entity = dis.ReadUnsignedShort(); - this._forceId = dis.ReadUnsignedByte(); - this._numberOfVariableParameters = dis.ReadByte(); - this._entityKind = dis.ReadUnsignedByte(); - this._domain = dis.ReadUnsignedByte(); - this._country = dis.ReadUnsignedShort(); - this._category = dis.ReadUnsignedByte(); - this._subcategory = dis.ReadUnsignedByte(); - this._specific = dis.ReadUnsignedByte(); - this._extra = dis.ReadUnsignedByte(); - this._altEntityKind = dis.ReadUnsignedByte(); - this._altDomain = dis.ReadUnsignedByte(); - this._altCountry = dis.ReadUnsignedShort(); - this._altCategory = dis.ReadUnsignedByte(); - this._altSubcategory = dis.ReadUnsignedByte(); - this._altSpecific = dis.ReadUnsignedByte(); - this._altExtra = dis.ReadUnsignedByte(); - this._xVelocity = dis.ReadFloat(); - this._yVelocity = dis.ReadFloat(); - this._zVelocity = dis.ReadFloat(); - this._xLocation = dis.ReadDouble(); - this._yLocation = dis.ReadDouble(); - this._zLocation = dis.ReadDouble(); - this._psi = dis.ReadFloat(); - this._theta = dis.ReadFloat(); - this._phi = dis.ReadFloat(); - this._entityAppearance = dis.ReadInt(); - this._deadReckoningAlgorithm = dis.ReadUnsignedByte(); - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - this._otherParameters[idx] = dis.ReadByte(); - } - this._xAcceleration = dis.ReadFloat(); - this._yAcceleration = dis.ReadFloat(); - this._zAcceleration = dis.ReadFloat(); - this._xAngularVelocity = dis.ReadFloat(); - this._yAngularVelocity = dis.ReadFloat(); - this._zAngularVelocity = dis.ReadFloat(); - for (int idx = 0; idx < this._marking.Length; idx++) - { - this._marking[idx] = dis.ReadByte(); - } - this._capabilities = dis.ReadInt(); - for (int idx = 0; idx < this.NumberOfVariableParameters; idx++) - { - VariableParameter anX = new VariableParameter(); - anX.Unmarshal(dis); - this._variableParameters.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._site.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._application.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._entity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._forceId.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableParameters.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._entityKind.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._domain.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._country.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._category.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._subcategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._specific.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._extra.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._altEntityKind.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._altDomain.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._altCountry.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._altCategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._altSubcategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._altSpecific.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._altExtra.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._xVelocity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._yVelocity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._zVelocity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._xLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._yLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._zLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._psi.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._theta.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._phi.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._entityAppearance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._deadReckoningAlgorithm.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - sb.AppendLine("" + this._otherParameters[idx] + ""); - } - - sb.AppendLine("" + this._xAcceleration.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._yAcceleration.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._zAcceleration.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._xAngularVelocity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._yAngularVelocity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._zAngularVelocity.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._marking.Length; idx++) - { - sb.AppendLine("" + this._marking[idx] + ""); - } - - sb.AppendLine("" + this._capabilities.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - sb.AppendLine(""); - VariableParameter aVariableParameter = (VariableParameter)this._variableParameters[idx]; - aVariableParameter.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as FastEntityStatePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(FastEntityStatePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._site != obj._site) - { - ivarsEqual = false; - } - - if (this._application != obj._application) - { - ivarsEqual = false; - } - - if (this._entity != obj._entity) - { - ivarsEqual = false; - } - - if (this._forceId != obj._forceId) - { - ivarsEqual = false; - } - - if (this._numberOfVariableParameters != obj._numberOfVariableParameters) - { - ivarsEqual = false; - } - - if (this._entityKind != obj._entityKind) - { - ivarsEqual = false; - } - - if (this._domain != obj._domain) - { - ivarsEqual = false; - } - - if (this._country != obj._country) - { - ivarsEqual = false; - } - - if (this._category != obj._category) - { - ivarsEqual = false; - } - - if (this._subcategory != obj._subcategory) - { - ivarsEqual = false; - } - - if (this._specific != obj._specific) - { - ivarsEqual = false; - } - - if (this._extra != obj._extra) - { - ivarsEqual = false; - } - - if (this._altEntityKind != obj._altEntityKind) - { - ivarsEqual = false; - } - - if (this._altDomain != obj._altDomain) - { - ivarsEqual = false; - } - - if (this._altCountry != obj._altCountry) - { - ivarsEqual = false; - } - - if (this._altCategory != obj._altCategory) - { - ivarsEqual = false; - } - - if (this._altSubcategory != obj._altSubcategory) - { - ivarsEqual = false; - } - - if (this._altSpecific != obj._altSpecific) - { - ivarsEqual = false; - } - - if (this._altExtra != obj._altExtra) - { - ivarsEqual = false; - } - - if (this._xVelocity != obj._xVelocity) - { - ivarsEqual = false; - } - - if (this._yVelocity != obj._yVelocity) - { - ivarsEqual = false; - } - - if (this._zVelocity != obj._zVelocity) - { - ivarsEqual = false; - } - - if (this._xLocation != obj._xLocation) - { - ivarsEqual = false; - } - - if (this._yLocation != obj._yLocation) - { - ivarsEqual = false; - } - - if (this._zLocation != obj._zLocation) - { - ivarsEqual = false; - } - - if (this._psi != obj._psi) - { - ivarsEqual = false; - } - - if (this._theta != obj._theta) - { - ivarsEqual = false; - } - - if (this._phi != obj._phi) - { - ivarsEqual = false; - } - - if (this._entityAppearance != obj._entityAppearance) - { - ivarsEqual = false; - } - - if (this._deadReckoningAlgorithm != obj._deadReckoningAlgorithm) - { - ivarsEqual = false; - } - - if (obj._otherParameters.Length != 15) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 15; idx++) - { - if (this._otherParameters[idx] != obj._otherParameters[idx]) - { - ivarsEqual = false; - } - } - } - - if (this._xAcceleration != obj._xAcceleration) - { - ivarsEqual = false; - } - - if (this._yAcceleration != obj._yAcceleration) - { - ivarsEqual = false; - } - - if (this._zAcceleration != obj._zAcceleration) - { - ivarsEqual = false; - } - - if (this._xAngularVelocity != obj._xAngularVelocity) - { - ivarsEqual = false; - } - - if (this._yAngularVelocity != obj._yAngularVelocity) - { - ivarsEqual = false; - } - - if (this._zAngularVelocity != obj._zAngularVelocity) - { - ivarsEqual = false; - } - - if (obj._marking.Length != 12) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 12; idx++) - { - if (this._marking[idx] != obj._marking[idx]) - { - ivarsEqual = false; - } - } - } - - if (this._capabilities != obj._capabilities) - { - ivarsEqual = false; - } - - if (this._variableParameters.Count != obj._variableParameters.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - if (!this._variableParameters[idx].Equals(obj._variableParameters[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._site.GetHashCode(); - result = GenerateHash(result) ^ this._application.GetHashCode(); - result = GenerateHash(result) ^ this._entity.GetHashCode(); - result = GenerateHash(result) ^ this._forceId.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableParameters.GetHashCode(); - result = GenerateHash(result) ^ this._entityKind.GetHashCode(); - result = GenerateHash(result) ^ this._domain.GetHashCode(); - result = GenerateHash(result) ^ this._country.GetHashCode(); - result = GenerateHash(result) ^ this._category.GetHashCode(); - result = GenerateHash(result) ^ this._subcategory.GetHashCode(); - result = GenerateHash(result) ^ this._specific.GetHashCode(); - result = GenerateHash(result) ^ this._extra.GetHashCode(); - result = GenerateHash(result) ^ this._altEntityKind.GetHashCode(); - result = GenerateHash(result) ^ this._altDomain.GetHashCode(); - result = GenerateHash(result) ^ this._altCountry.GetHashCode(); - result = GenerateHash(result) ^ this._altCategory.GetHashCode(); - result = GenerateHash(result) ^ this._altSubcategory.GetHashCode(); - result = GenerateHash(result) ^ this._altSpecific.GetHashCode(); - result = GenerateHash(result) ^ this._altExtra.GetHashCode(); - result = GenerateHash(result) ^ this._xVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._yVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._zVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._xLocation.GetHashCode(); - result = GenerateHash(result) ^ this._yLocation.GetHashCode(); - result = GenerateHash(result) ^ this._zLocation.GetHashCode(); - result = GenerateHash(result) ^ this._psi.GetHashCode(); - result = GenerateHash(result) ^ this._theta.GetHashCode(); - result = GenerateHash(result) ^ this._phi.GetHashCode(); - result = GenerateHash(result) ^ this._entityAppearance.GetHashCode(); - result = GenerateHash(result) ^ this._deadReckoningAlgorithm.GetHashCode(); - - for (int idx = 0; idx < 15; idx++) - { - result = GenerateHash(result) ^ this._otherParameters[idx].GetHashCode(); - } - result = GenerateHash(result) ^ this._xAcceleration.GetHashCode(); - result = GenerateHash(result) ^ this._yAcceleration.GetHashCode(); - result = GenerateHash(result) ^ this._zAcceleration.GetHashCode(); - result = GenerateHash(result) ^ this._xAngularVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._yAngularVelocity.GetHashCode(); - result = GenerateHash(result) ^ this._zAngularVelocity.GetHashCode(); - - for (int idx = 0; idx < 12; idx++) - { - result = GenerateHash(result) ^ this._marking[idx].GetHashCode(); - } - result = GenerateHash(result) ^ this._capabilities.GetHashCode(); - - if (this._variableParameters.Count > 0) - { - for (int idx = 0; idx < this._variableParameters.Count; idx++) - { - result = GenerateHash(result) ^ this._variableParameters[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/FirePdu.cs b/tests/OpenDisNet.Reference/Generated/FirePdu.cs deleted file mode 100644 index 9f8490e..0000000 --- a/tests/OpenDisNet.Reference/Generated/FirePdu.cs +++ /dev/null @@ -1,488 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The firing of a weapon or expendable shall be communicated by issuing a Fire PDU. Sectioin 7.3.2. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EventIdentifier))] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(MunitionDescriptor))] - [XmlInclude(typeof(Vector3Float))] - public partial class FirePdu : WarfareFamilyPdu, IEquatable - { - /// - /// This field shall specify the entity identification of the fired munition or expendable. This field shall be represented by an Entity Identifier record (see 6.2.28). - /// - private EntityID _munitionExpendibleID = new EntityID(); - - /// - /// This field shall contain an identification generated by the firing entity to associate related firing and detonation events. This field shall be represented by an Event Identifier record (see 6.2.34). - /// - private EventIdentifier _eventID = new EventIdentifier(); - - /// - /// This field shall identify the fire mission (see 5.4.3.3). This field shall be representedby a 32-bit unsigned integer. - /// - private uint _fireMissionIndex; - - /// - /// This field shall specify the location, in world coordinates, from which the munition was launched, and shall be represented by a World Coordinates record (see 6.2.97). - /// - private Vector3Double _locationInWorldCoordinates = new Vector3Double(); - - /// - /// This field shall describe the firing or launch of a munition or expendable represented by one of the following types of Descriptor records: Munition Descriptor (6.2.20.2) or Expendable Descriptor (6.2.20.4). - /// - private MunitionDescriptor _descriptor = new MunitionDescriptor(); - - /// - /// This field shall specify the velocity of the fired munition at the point when the issuing simulation application intends the externally visible effects of the launch (e.g. exhaust plume or muzzle blast) to first become apparent. The velocity shall be represented in world coordinates. This field shall be represented by a Linear Velocity Vector record [see 6.2.95 item c)]. - /// - private Vector3Float _velocity = new Vector3Float(); - - /// - /// This field shall specify the range that an entity’s fire control system has assumed in computing the fire control solution. This field shall be represented by a 32-bit floating point number in meters. For systems where range is unknown or unavailable, this field shall contain a value of zero. - /// - private float _range; - - /// - /// Initializes a new instance of the class. - /// - public FirePdu() - { - PduType = (byte)2; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(FirePdu left, FirePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(FirePdu left, FirePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._munitionExpendibleID.GetMarshalledSize(); // this._munitionExpendibleID - marshalSize += this._eventID.GetMarshalledSize(); // this._eventID - marshalSize += 4; // this._fireMissionIndex - marshalSize += this._locationInWorldCoordinates.GetMarshalledSize(); // this._locationInWorldCoordinates - marshalSize += this._descriptor.GetMarshalledSize(); // this._descriptor - marshalSize += this._velocity.GetMarshalledSize(); // this._velocity - marshalSize += 4; // this._range - return marshalSize; - } - - /// - /// Gets or sets the This field shall specify the entity identification of the fired munition or expendable. This field shall be represented by an Entity Identifier record (see 6.2.28). - /// - [XmlElement(Type = typeof(EntityID), ElementName = "munitionExpendibleID")] - public EntityID MunitionExpendibleID - { - get - { - return this._munitionExpendibleID; - } - - set - { - this._munitionExpendibleID = value; - } - } - - /// - /// Gets or sets the This field shall contain an identification generated by the firing entity to associate related firing and detonation events. This field shall be represented by an Event Identifier record (see 6.2.34). - /// - [XmlElement(Type = typeof(EventIdentifier), ElementName = "eventID")] - public EventIdentifier EventID - { - get - { - return this._eventID; - } - - set - { - this._eventID = value; - } - } - - /// - /// Gets or sets the This field shall identify the fire mission (see 5.4.3.3). This field shall be representedby a 32-bit unsigned integer. - /// - [XmlElement(Type = typeof(uint), ElementName = "fireMissionIndex")] - public uint FireMissionIndex - { - get - { - return this._fireMissionIndex; - } - - set - { - this._fireMissionIndex = value; - } - } - - /// - /// Gets or sets the This field shall specify the location, in world coordinates, from which the munition was launched, and shall be represented by a World Coordinates record (see 6.2.97). - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "locationInWorldCoordinates")] - public Vector3Double LocationInWorldCoordinates - { - get - { - return this._locationInWorldCoordinates; - } - - set - { - this._locationInWorldCoordinates = value; - } - } - - /// - /// Gets or sets the This field shall describe the firing or launch of a munition or expendable represented by one of the following types of Descriptor records: Munition Descriptor (6.2.20.2) or Expendable Descriptor (6.2.20.4). - /// - [XmlElement(Type = typeof(MunitionDescriptor), ElementName = "descriptor")] - public MunitionDescriptor Descriptor - { - get - { - return this._descriptor; - } - - set - { - this._descriptor = value; - } - } - - /// - /// Gets or sets the This field shall specify the velocity of the fired munition at the point when the issuing simulation application intends the externally visible effects of the launch (e.g. exhaust plume or muzzle blast) to first become apparent. The velocity shall be represented in world coordinates. This field shall be represented by a Linear Velocity Vector record [see 6.2.95 item c)]. - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "velocity")] - public Vector3Float Velocity - { - get - { - return this._velocity; - } - - set - { - this._velocity = value; - } - } - - /// - /// Gets or sets the This field shall specify the range that an entity’s fire control system has assumed in computing the fire control solution. This field shall be represented by a 32-bit floating point number in meters. For systems where range is unknown or unavailable, this field shall contain a value of zero. - /// - [XmlElement(Type = typeof(float), ElementName = "range")] - public float Range - { - get - { - return this._range; - } - - set - { - this._range = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._munitionExpendibleID.Marshal(dos); - this._eventID.Marshal(dos); - dos.WriteUnsignedInt((uint)this._fireMissionIndex); - this._locationInWorldCoordinates.Marshal(dos); - this._descriptor.Marshal(dos); - this._velocity.Marshal(dos); - dos.WriteFloat((float)this._range); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._munitionExpendibleID.Unmarshal(dis); - this._eventID.Unmarshal(dis); - this._fireMissionIndex = dis.ReadUnsignedInt(); - this._locationInWorldCoordinates.Unmarshal(dis); - this._descriptor.Unmarshal(dis); - this._velocity.Unmarshal(dis); - this._range = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._munitionExpendibleID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._eventID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._fireMissionIndex.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._locationInWorldCoordinates.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._descriptor.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._velocity.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._range.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as FirePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(FirePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._munitionExpendibleID.Equals(obj._munitionExpendibleID)) - { - ivarsEqual = false; - } - - if (!this._eventID.Equals(obj._eventID)) - { - ivarsEqual = false; - } - - if (this._fireMissionIndex != obj._fireMissionIndex) - { - ivarsEqual = false; - } - - if (!this._locationInWorldCoordinates.Equals(obj._locationInWorldCoordinates)) - { - ivarsEqual = false; - } - - if (!this._descriptor.Equals(obj._descriptor)) - { - ivarsEqual = false; - } - - if (!this._velocity.Equals(obj._velocity)) - { - ivarsEqual = false; - } - - if (this._range != obj._range) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._munitionExpendibleID.GetHashCode(); - result = GenerateHash(result) ^ this._eventID.GetHashCode(); - result = GenerateHash(result) ^ this._fireMissionIndex.GetHashCode(); - result = GenerateHash(result) ^ this._locationInWorldCoordinates.GetHashCode(); - result = GenerateHash(result) ^ this._descriptor.GetHashCode(); - result = GenerateHash(result) ^ this._velocity.GetHashCode(); - result = GenerateHash(result) ^ this._range.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/FixedDatum.cs b/tests/OpenDisNet.Reference/Generated/FixedDatum.cs deleted file mode 100644 index 8c840dc..0000000 --- a/tests/OpenDisNet.Reference/Generated/FixedDatum.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Fixed Datum Record. Section 6.2.38 - /// - [Serializable] - [XmlRoot] - public partial class FixedDatum - { - /// - /// ID of the fixed datum, an enumeration - /// - private uint _fixedDatumID; - - /// - /// Value for the fixed datum - /// - private uint _fixedDatumValue; - - /// - /// Initializes a new instance of the class. - /// - public FixedDatum() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(FixedDatum left, FixedDatum right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(FixedDatum left, FixedDatum right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._fixedDatumID - marshalSize += 4; // this._fixedDatumValue - return marshalSize; - } - - /// - /// Gets or sets the ID of the fixed datum, an enumeration - /// - [XmlElement(Type = typeof(uint), ElementName = "fixedDatumID")] - public uint FixedDatumID - { - get - { - return this._fixedDatumID; - } - - set - { - this._fixedDatumID = value; - } - } - - /// - /// Gets or sets the Value for the fixed datum - /// - [XmlElement(Type = typeof(uint), ElementName = "fixedDatumValue")] - public uint FixedDatumValue - { - get - { - return this._fixedDatumValue; - } - - set - { - this._fixedDatumValue = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._fixedDatumID); - dos.WriteUnsignedInt((uint)this._fixedDatumValue); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._fixedDatumID = dis.ReadUnsignedInt(); - this._fixedDatumValue = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._fixedDatumID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatumValue.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as FixedDatum; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(FixedDatum obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._fixedDatumID != obj._fixedDatumID) - { - ivarsEqual = false; - } - - if (this._fixedDatumValue != obj._fixedDatumValue) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._fixedDatumID.GetHashCode(); - result = GenerateHash(result) ^ this._fixedDatumValue.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/FourByteChunk.cs b/tests/OpenDisNet.Reference/Generated/FourByteChunk.cs deleted file mode 100644 index b459c13..0000000 --- a/tests/OpenDisNet.Reference/Generated/FourByteChunk.cs +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// 32 bit piece of data - /// - [Serializable] - [XmlRoot] - public partial class FourByteChunk - { - /// - /// four bytes of arbitrary data - /// - private byte[] _otherParameters = new byte[4]; - - /// - /// Initializes a new instance of the class. - /// - public FourByteChunk() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(FourByteChunk left, FourByteChunk right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(FourByteChunk left, FourByteChunk right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4 * 1; // _otherParameters - return marshalSize; - } - - /// - /// Gets or sets the four bytes of arbitrary data - /// - [XmlArray(ElementName = "otherParameters")] - public byte[] OtherParameters - { - get - { - return this._otherParameters; - } - - set - { - this._otherParameters = value; - } -} - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - dos.WriteByte(this._otherParameters[idx]); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - this._otherParameters[idx] = dis.ReadByte(); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - sb.AppendLine("" + this._otherParameters[idx] + ""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as FourByteChunk; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(FourByteChunk obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (obj._otherParameters.Length != 4) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 4; idx++) - { - if (this._otherParameters[idx] != obj._otherParameters[idx]) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - - for (int idx = 0; idx < 4; idx++) - { - result = GenerateHash(result) ^ this._otherParameters[idx].GetHashCode(); - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/FundamentalOperationalData.cs b/tests/OpenDisNet.Reference/Generated/FundamentalOperationalData.cs deleted file mode 100644 index 64f43b3..0000000 --- a/tests/OpenDisNet.Reference/Generated/FundamentalOperationalData.cs +++ /dev/null @@ -1,565 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Basic operational data for IFF. Section 6.2.40. - /// - [Serializable] - [XmlRoot] - public partial class FundamentalOperationalData - { - /// - /// system status - /// - private byte _systemStatus; - - /// - /// data field 1 - /// - private byte _dataField1; - - /// - /// eight boolean fields - /// - private byte _informationLayers; - - /// - /// enumeration - /// - private byte _dataField2; - - /// - /// parameter, enumeration - /// - private ushort _parameter1; - - /// - /// parameter, enumeration - /// - private ushort _parameter2; - - /// - /// parameter, enumeration - /// - private ushort _parameter3; - - /// - /// parameter, enumeration - /// - private ushort _parameter4; - - /// - /// parameter, enumeration - /// - private ushort _parameter5; - - /// - /// parameter, enumeration - /// - private ushort _parameter6; - - /// - /// Initializes a new instance of the class. - /// - public FundamentalOperationalData() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(FundamentalOperationalData left, FundamentalOperationalData right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(FundamentalOperationalData left, FundamentalOperationalData right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._systemStatus - marshalSize += 1; // this._dataField1 - marshalSize += 1; // this._informationLayers - marshalSize += 1; // this._dataField2 - marshalSize += 2; // this._parameter1 - marshalSize += 2; // this._parameter2 - marshalSize += 2; // this._parameter3 - marshalSize += 2; // this._parameter4 - marshalSize += 2; // this._parameter5 - marshalSize += 2; // this._parameter6 - return marshalSize; - } - - /// - /// Gets or sets the system status - /// - [XmlElement(Type = typeof(byte), ElementName = "systemStatus")] - public byte SystemStatus - { - get - { - return this._systemStatus; - } - - set - { - this._systemStatus = value; - } - } - - /// - /// Gets or sets the data field 1 - /// - [XmlElement(Type = typeof(byte), ElementName = "dataField1")] - public byte DataField1 - { - get - { - return this._dataField1; - } - - set - { - this._dataField1 = value; - } - } - - /// - /// Gets or sets the eight boolean fields - /// - [XmlElement(Type = typeof(byte), ElementName = "informationLayers")] - public byte InformationLayers - { - get - { - return this._informationLayers; - } - - set - { - this._informationLayers = value; - } - } - - /// - /// Gets or sets the enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "dataField2")] - public byte DataField2 - { - get - { - return this._dataField2; - } - - set - { - this._dataField2 = value; - } - } - - /// - /// Gets or sets the parameter, enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "parameter1")] - public ushort Parameter1 - { - get - { - return this._parameter1; - } - - set - { - this._parameter1 = value; - } - } - - /// - /// Gets or sets the parameter, enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "parameter2")] - public ushort Parameter2 - { - get - { - return this._parameter2; - } - - set - { - this._parameter2 = value; - } - } - - /// - /// Gets or sets the parameter, enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "parameter3")] - public ushort Parameter3 - { - get - { - return this._parameter3; - } - - set - { - this._parameter3 = value; - } - } - - /// - /// Gets or sets the parameter, enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "parameter4")] - public ushort Parameter4 - { - get - { - return this._parameter4; - } - - set - { - this._parameter4 = value; - } - } - - /// - /// Gets or sets the parameter, enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "parameter5")] - public ushort Parameter5 - { - get - { - return this._parameter5; - } - - set - { - this._parameter5 = value; - } - } - - /// - /// Gets or sets the parameter, enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "parameter6")] - public ushort Parameter6 - { - get - { - return this._parameter6; - } - - set - { - this._parameter6 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._systemStatus); - dos.WriteUnsignedByte((byte)this._dataField1); - dos.WriteUnsignedByte((byte)this._informationLayers); - dos.WriteUnsignedByte((byte)this._dataField2); - dos.WriteUnsignedShort((ushort)this._parameter1); - dos.WriteUnsignedShort((ushort)this._parameter2); - dos.WriteUnsignedShort((ushort)this._parameter3); - dos.WriteUnsignedShort((ushort)this._parameter4); - dos.WriteUnsignedShort((ushort)this._parameter5); - dos.WriteUnsignedShort((ushort)this._parameter6); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._systemStatus = dis.ReadUnsignedByte(); - this._dataField1 = dis.ReadUnsignedByte(); - this._informationLayers = dis.ReadUnsignedByte(); - this._dataField2 = dis.ReadUnsignedByte(); - this._parameter1 = dis.ReadUnsignedShort(); - this._parameter2 = dis.ReadUnsignedShort(); - this._parameter3 = dis.ReadUnsignedShort(); - this._parameter4 = dis.ReadUnsignedShort(); - this._parameter5 = dis.ReadUnsignedShort(); - this._parameter6 = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._systemStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._dataField1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._informationLayers.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._dataField2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameter1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameter2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameter3.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameter4.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameter5.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._parameter6.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as FundamentalOperationalData; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(FundamentalOperationalData obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._systemStatus != obj._systemStatus) - { - ivarsEqual = false; - } - - if (this._dataField1 != obj._dataField1) - { - ivarsEqual = false; - } - - if (this._informationLayers != obj._informationLayers) - { - ivarsEqual = false; - } - - if (this._dataField2 != obj._dataField2) - { - ivarsEqual = false; - } - - if (this._parameter1 != obj._parameter1) - { - ivarsEqual = false; - } - - if (this._parameter2 != obj._parameter2) - { - ivarsEqual = false; - } - - if (this._parameter3 != obj._parameter3) - { - ivarsEqual = false; - } - - if (this._parameter4 != obj._parameter4) - { - ivarsEqual = false; - } - - if (this._parameter5 != obj._parameter5) - { - ivarsEqual = false; - } - - if (this._parameter6 != obj._parameter6) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._systemStatus.GetHashCode(); - result = GenerateHash(result) ^ this._dataField1.GetHashCode(); - result = GenerateHash(result) ^ this._informationLayers.GetHashCode(); - result = GenerateHash(result) ^ this._dataField2.GetHashCode(); - result = GenerateHash(result) ^ this._parameter1.GetHashCode(); - result = GenerateHash(result) ^ this._parameter2.GetHashCode(); - result = GenerateHash(result) ^ this._parameter3.GetHashCode(); - result = GenerateHash(result) ^ this._parameter4.GetHashCode(); - result = GenerateHash(result) ^ this._parameter5.GetHashCode(); - result = GenerateHash(result) ^ this._parameter6.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/GridAxis.cs b/tests/OpenDisNet.Reference/Generated/GridAxis.cs deleted file mode 100644 index 661f51d..0000000 --- a/tests/OpenDisNet.Reference/Generated/GridAxis.cs +++ /dev/null @@ -1,469 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Grid axis record for fixed data. Section 6.2.41 - /// - [Serializable] - [XmlRoot] - public partial class GridAxis - { - /// - /// coordinate of the grid origin or initial value - /// - private double _domainInitialXi; - - /// - /// coordinate of the endpoint or final value - /// - private double _domainFinalXi; - - /// - /// The number of grid points along the Xi domain axis for the enviornmental state data - /// - private ushort _domainPointsXi; - - /// - /// interleaf factor along the domain axis. - /// - private byte _interleafFactor; - - /// - /// type of grid axis - /// - private byte _axisType; - - /// - /// Number of grid locations along Xi axis - /// - private ushort _numberOfPointsOnXiAxis; - - /// - /// initial grid point for the current pdu - /// - private ushort _initialIndex; - - /// - /// Initializes a new instance of the class. - /// - public GridAxis() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(GridAxis left, GridAxis right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(GridAxis left, GridAxis right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 8; // this._domainInitialXi - marshalSize += 8; // this._domainFinalXi - marshalSize += 2; // this._domainPointsXi - marshalSize += 1; // this._interleafFactor - marshalSize += 1; // this._axisType - marshalSize += 2; // this._numberOfPointsOnXiAxis - marshalSize += 2; // this._initialIndex - return marshalSize; - } - - /// - /// Gets or sets the coordinate of the grid origin or initial value - /// - [XmlElement(Type = typeof(double), ElementName = "domainInitialXi")] - public double DomainInitialXi - { - get - { - return this._domainInitialXi; - } - - set - { - this._domainInitialXi = value; - } - } - - /// - /// Gets or sets the coordinate of the endpoint or final value - /// - [XmlElement(Type = typeof(double), ElementName = "domainFinalXi")] - public double DomainFinalXi - { - get - { - return this._domainFinalXi; - } - - set - { - this._domainFinalXi = value; - } - } - - /// - /// Gets or sets the The number of grid points along the Xi domain axis for the enviornmental state data - /// - [XmlElement(Type = typeof(ushort), ElementName = "domainPointsXi")] - public ushort DomainPointsXi - { - get - { - return this._domainPointsXi; - } - - set - { - this._domainPointsXi = value; - } - } - - /// - /// Gets or sets the interleaf factor along the domain axis. - /// - [XmlElement(Type = typeof(byte), ElementName = "interleafFactor")] - public byte InterleafFactor - { - get - { - return this._interleafFactor; - } - - set - { - this._interleafFactor = value; - } - } - - /// - /// Gets or sets the type of grid axis - /// - [XmlElement(Type = typeof(byte), ElementName = "axisType")] - public byte AxisType - { - get - { - return this._axisType; - } - - set - { - this._axisType = value; - } - } - - /// - /// Gets or sets the Number of grid locations along Xi axis - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfPointsOnXiAxis")] - public ushort NumberOfPointsOnXiAxis - { - get - { - return this._numberOfPointsOnXiAxis; - } - - set - { - this._numberOfPointsOnXiAxis = value; - } - } - - /// - /// Gets or sets the initial grid point for the current pdu - /// - [XmlElement(Type = typeof(ushort), ElementName = "initialIndex")] - public ushort InitialIndex - { - get - { - return this._initialIndex; - } - - set - { - this._initialIndex = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteDouble((double)this._domainInitialXi); - dos.WriteDouble((double)this._domainFinalXi); - dos.WriteUnsignedShort((ushort)this._domainPointsXi); - dos.WriteUnsignedByte((byte)this._interleafFactor); - dos.WriteUnsignedByte((byte)this._axisType); - dos.WriteUnsignedShort((ushort)this._numberOfPointsOnXiAxis); - dos.WriteUnsignedShort((ushort)this._initialIndex); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._domainInitialXi = dis.ReadDouble(); - this._domainFinalXi = dis.ReadDouble(); - this._domainPointsXi = dis.ReadUnsignedShort(); - this._interleafFactor = dis.ReadUnsignedByte(); - this._axisType = dis.ReadUnsignedByte(); - this._numberOfPointsOnXiAxis = dis.ReadUnsignedShort(); - this._initialIndex = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._domainInitialXi.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._domainFinalXi.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._domainPointsXi.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._interleafFactor.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._axisType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._numberOfPointsOnXiAxis.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._initialIndex.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as GridAxis; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(GridAxis obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._domainInitialXi != obj._domainInitialXi) - { - ivarsEqual = false; - } - - if (this._domainFinalXi != obj._domainFinalXi) - { - ivarsEqual = false; - } - - if (this._domainPointsXi != obj._domainPointsXi) - { - ivarsEqual = false; - } - - if (this._interleafFactor != obj._interleafFactor) - { - ivarsEqual = false; - } - - if (this._axisType != obj._axisType) - { - ivarsEqual = false; - } - - if (this._numberOfPointsOnXiAxis != obj._numberOfPointsOnXiAxis) - { - ivarsEqual = false; - } - - if (this._initialIndex != obj._initialIndex) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._domainInitialXi.GetHashCode(); - result = GenerateHash(result) ^ this._domainFinalXi.GetHashCode(); - result = GenerateHash(result) ^ this._domainPointsXi.GetHashCode(); - result = GenerateHash(result) ^ this._interleafFactor.GetHashCode(); - result = GenerateHash(result) ^ this._axisType.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfPointsOnXiAxis.GetHashCode(); - result = GenerateHash(result) ^ this._initialIndex.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/GroupIdentifier.cs b/tests/OpenDisNet.Reference/Generated/GroupIdentifier.cs deleted file mode 100644 index 02bc7a2..0000000 --- a/tests/OpenDisNet.Reference/Generated/GroupIdentifier.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Unique designation of a group of entities contained in the isGroupOfPdu. Represents a group of entities rather than a single entity. Section 6.2.43 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class GroupIdentifier - { - /// - /// Simulation address (site and application number) - /// - private EntityType _simulationAddress = new EntityType(); - - /// - /// group number - /// - private ushort _groupNumber; - - /// - /// Initializes a new instance of the class. - /// - public GroupIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(GroupIdentifier left, GroupIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(GroupIdentifier left, GroupIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._groupNumber - return marshalSize; - } - - /// - /// Gets or sets the Simulation address (site and application number) - /// - [XmlElement(Type = typeof(EntityType), ElementName = "simulationAddress")] - public EntityType SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - /// - /// Gets or sets the group number - /// - [XmlElement(Type = typeof(ushort), ElementName = "groupNumber")] - public ushort GroupNumber - { - get - { - return this._groupNumber; - } - - set - { - this._groupNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._groupNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._groupNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._groupNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as GroupIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(GroupIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._groupNumber != obj._groupNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._groupNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/IFFFundamentalParameterData.cs b/tests/OpenDisNet.Reference/Generated/IFFFundamentalParameterData.cs deleted file mode 100644 index 05c8e57..0000000 --- a/tests/OpenDisNet.Reference/Generated/IFFFundamentalParameterData.cs +++ /dev/null @@ -1,495 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Fundamental IFF atc data. Section 6.2.45 - /// - [Serializable] - [XmlRoot] - public partial class IFFFundamentalParameterData - { - /// - /// ERP - /// - private float _erp; - - /// - /// frequency - /// - private float _frequency; - - /// - /// pgrf - /// - private float _pgrf; - - /// - /// Pulse width - /// - private float _pulseWidth; - - /// - /// Burst length - /// - private uint _burstLength; - - /// - /// Applicable modes enumeration - /// - private byte _applicableModes; - - /// - /// System-specific data - /// - private byte[] _systemSpecificData = new byte[3]; - - /// - /// Initializes a new instance of the class. - /// - public IFFFundamentalParameterData() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(IFFFundamentalParameterData left, IFFFundamentalParameterData right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(IFFFundamentalParameterData left, IFFFundamentalParameterData right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._erp - marshalSize += 4; // this._frequency - marshalSize += 4; // this._pgrf - marshalSize += 4; // this._pulseWidth - marshalSize += 4; // this._burstLength - marshalSize += 1; // this._applicableModes - marshalSize += 3 * 1; // _systemSpecificData - return marshalSize; - } - - /// - /// Gets or sets the ERP - /// - [XmlElement(Type = typeof(float), ElementName = "erp")] - public float Erp - { - get - { - return this._erp; - } - - set - { - this._erp = value; - } - } - - /// - /// Gets or sets the frequency - /// - [XmlElement(Type = typeof(float), ElementName = "frequency")] - public float Frequency - { - get - { - return this._frequency; - } - - set - { - this._frequency = value; - } - } - - /// - /// Gets or sets the pgrf - /// - [XmlElement(Type = typeof(float), ElementName = "pgrf")] - public float Pgrf - { - get - { - return this._pgrf; - } - - set - { - this._pgrf = value; - } - } - - /// - /// Gets or sets the Pulse width - /// - [XmlElement(Type = typeof(float), ElementName = "pulseWidth")] - public float PulseWidth - { - get - { - return this._pulseWidth; - } - - set - { - this._pulseWidth = value; - } - } - - /// - /// Gets or sets the Burst length - /// - [XmlElement(Type = typeof(uint), ElementName = "burstLength")] - public uint BurstLength - { - get - { - return this._burstLength; - } - - set - { - this._burstLength = value; - } - } - - /// - /// Gets or sets the Applicable modes enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "applicableModes")] - public byte ApplicableModes - { - get - { - return this._applicableModes; - } - - set - { - this._applicableModes = value; - } - } - - /// - /// Gets or sets the System-specific data - /// - [XmlArray(ElementName = "systemSpecificData")] - public byte[] SystemSpecificData - { - get - { - return this._systemSpecificData; - } - - set - { - this._systemSpecificData = value; - } -} - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._erp); - dos.WriteFloat((float)this._frequency); - dos.WriteFloat((float)this._pgrf); - dos.WriteFloat((float)this._pulseWidth); - dos.WriteUnsignedInt((uint)this._burstLength); - dos.WriteUnsignedByte((byte)this._applicableModes); - - for (int idx = 0; idx < this._systemSpecificData.Length; idx++) - { - dos.WriteUnsignedByte(this._systemSpecificData[idx]); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._erp = dis.ReadFloat(); - this._frequency = dis.ReadFloat(); - this._pgrf = dis.ReadFloat(); - this._pulseWidth = dis.ReadFloat(); - this._burstLength = dis.ReadUnsignedInt(); - this._applicableModes = dis.ReadUnsignedByte(); - for (int idx = 0; idx < this._systemSpecificData.Length; idx++) - { - this._systemSpecificData[idx] = dis.ReadUnsignedByte(); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._erp.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._frequency.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pgrf.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pulseWidth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._burstLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._applicableModes.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._systemSpecificData.Length; idx++) - { - sb.AppendLine("" + this._systemSpecificData[idx] + ""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as IFFFundamentalParameterData; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(IFFFundamentalParameterData obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._erp != obj._erp) - { - ivarsEqual = false; - } - - if (this._frequency != obj._frequency) - { - ivarsEqual = false; - } - - if (this._pgrf != obj._pgrf) - { - ivarsEqual = false; - } - - if (this._pulseWidth != obj._pulseWidth) - { - ivarsEqual = false; - } - - if (this._burstLength != obj._burstLength) - { - ivarsEqual = false; - } - - if (this._applicableModes != obj._applicableModes) - { - ivarsEqual = false; - } - - if (obj._systemSpecificData.Length != 3) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 3; idx++) - { - if (this._systemSpecificData[idx] != obj._systemSpecificData[idx]) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._erp.GetHashCode(); - result = GenerateHash(result) ^ this._frequency.GetHashCode(); - result = GenerateHash(result) ^ this._pgrf.GetHashCode(); - result = GenerateHash(result) ^ this._pulseWidth.GetHashCode(); - result = GenerateHash(result) ^ this._burstLength.GetHashCode(); - result = GenerateHash(result) ^ this._applicableModes.GetHashCode(); - - for (int idx = 0; idx < 3; idx++) - { - result = GenerateHash(result) ^ this._systemSpecificData[idx].GetHashCode(); - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/IOCommunicationsNode.cs b/tests/OpenDisNet.Reference/Generated/IOCommunicationsNode.cs deleted file mode 100644 index 9fcd7c4..0000000 --- a/tests/OpenDisNet.Reference/Generated/IOCommunicationsNode.cs +++ /dev/null @@ -1,404 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// A communications node that is part of a simulted communcations network. Section 6.2.49.2 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class IOCommunicationsNode - { - private uint _recordType = 5501; - - private ushort _recordLength = 16; - - private byte _communcationsNodeType; - - private byte _padding; - - private EntityID _communicationsNode = new EntityID(); - - private ushort _elementID; - - /// - /// Initializes a new instance of the class. - /// - public IOCommunicationsNode() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(IOCommunicationsNode left, IOCommunicationsNode right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(IOCommunicationsNode left, IOCommunicationsNode right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 1; // this._communcationsNodeType - marshalSize += 1; // this._padding - marshalSize += this._communicationsNode.GetMarshalledSize(); // this._communicationsNode - marshalSize += 2; // this._elementID - return marshalSize; - } - - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "communcationsNodeType")] - public byte CommuncationsNodeType - { - get - { - return this._communcationsNodeType; - } - - set - { - this._communcationsNodeType = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - [XmlElement(Type = typeof(EntityID), ElementName = "communicationsNode")] - public EntityID CommunicationsNode - { - get - { - return this._communicationsNode; - } - - set - { - this._communicationsNode = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "elementID")] - public ushort ElementID - { - get - { - return this._elementID; - } - - set - { - this._elementID = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedByte((byte)this._communcationsNodeType); - dos.WriteUnsignedByte((byte)this._padding); - this._communicationsNode.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._elementID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._communcationsNodeType = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - this._communicationsNode.Unmarshal(dis); - this._elementID = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._communcationsNodeType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._communicationsNode.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._elementID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as IOCommunicationsNode; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(IOCommunicationsNode obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._communcationsNodeType != obj._communcationsNodeType) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (!this._communicationsNode.Equals(obj._communicationsNode)) - { - ivarsEqual = false; - } - - if (this._elementID != obj._elementID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._communcationsNodeType.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._communicationsNode.GetHashCode(); - result = GenerateHash(result) ^ this._elementID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/IOEffect.cs b/tests/OpenDisNet.Reference/Generated/IOEffect.cs deleted file mode 100644 index 326dd68..0000000 --- a/tests/OpenDisNet.Reference/Generated/IOEffect.cs +++ /dev/null @@ -1,482 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Effect of IO on an entity. Section 6.2.49.3 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class IOEffect - { - private uint _recordType = 5500; - - private ushort _recordLength = 16; - - private byte _ioStatus; - - private byte _ioLinkType; - - private EntityID _ioEffect = new EntityID(); - - private byte _ioEffectDutyCycle; - - private ushort _ioEffectDuration; - - private ushort _ioProcess; - - private ushort _padding; - - /// - /// Initializes a new instance of the class. - /// - public IOEffect() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(IOEffect left, IOEffect right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(IOEffect left, IOEffect right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 1; // this._ioStatus - marshalSize += 1; // this._ioLinkType - marshalSize += this._ioEffect.GetMarshalledSize(); // this._ioEffect - marshalSize += 1; // this._ioEffectDutyCycle - marshalSize += 2; // this._ioEffectDuration - marshalSize += 2; // this._ioProcess - marshalSize += 2; // this._padding - return marshalSize; - } - - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "ioStatus")] - public byte IoStatus - { - get - { - return this._ioStatus; - } - - set - { - this._ioStatus = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "ioLinkType")] - public byte IoLinkType - { - get - { - return this._ioLinkType; - } - - set - { - this._ioLinkType = value; - } - } - - [XmlElement(Type = typeof(EntityID), ElementName = "ioEffect")] - public EntityID IoEffect - { - get - { - return this._ioEffect; - } - - set - { - this._ioEffect = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "ioEffectDutyCycle")] - public byte IoEffectDutyCycle - { - get - { - return this._ioEffectDutyCycle; - } - - set - { - this._ioEffectDutyCycle = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "ioEffectDuration")] - public ushort IoEffectDuration - { - get - { - return this._ioEffectDuration; - } - - set - { - this._ioEffectDuration = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "ioProcess")] - public ushort IoProcess - { - get - { - return this._ioProcess; - } - - set - { - this._ioProcess = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedByte((byte)this._ioStatus); - dos.WriteUnsignedByte((byte)this._ioLinkType); - this._ioEffect.Marshal(dos); - dos.WriteUnsignedByte((byte)this._ioEffectDutyCycle); - dos.WriteUnsignedShort((ushort)this._ioEffectDuration); - dos.WriteUnsignedShort((ushort)this._ioProcess); - dos.WriteUnsignedShort((ushort)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._ioStatus = dis.ReadUnsignedByte(); - this._ioLinkType = dis.ReadUnsignedByte(); - this._ioEffect.Unmarshal(dis); - this._ioEffectDutyCycle = dis.ReadUnsignedByte(); - this._ioEffectDuration = dis.ReadUnsignedShort(); - this._ioProcess = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._ioStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._ioLinkType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._ioEffect.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._ioEffectDutyCycle.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._ioEffectDuration.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._ioProcess.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as IOEffect; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(IOEffect obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._ioStatus != obj._ioStatus) - { - ivarsEqual = false; - } - - if (this._ioLinkType != obj._ioLinkType) - { - ivarsEqual = false; - } - - if (!this._ioEffect.Equals(obj._ioEffect)) - { - ivarsEqual = false; - } - - if (this._ioEffectDutyCycle != obj._ioEffectDutyCycle) - { - ivarsEqual = false; - } - - if (this._ioEffectDuration != obj._ioEffectDuration) - { - ivarsEqual = false; - } - - if (this._ioProcess != obj._ioProcess) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._ioStatus.GetHashCode(); - result = GenerateHash(result) ^ this._ioLinkType.GetHashCode(); - result = GenerateHash(result) ^ this._ioEffect.GetHashCode(); - result = GenerateHash(result) ^ this._ioEffectDutyCycle.GetHashCode(); - result = GenerateHash(result) ^ this._ioEffectDuration.GetHashCode(); - result = GenerateHash(result) ^ this._ioProcess.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/IffDataSpecification.cs b/tests/OpenDisNet.Reference/Generated/IffDataSpecification.cs deleted file mode 100644 index 74e753d..0000000 --- a/tests/OpenDisNet.Reference/Generated/IffDataSpecification.cs +++ /dev/null @@ -1,280 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Requires hand coding to be useful. Section 6.2.44 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class IffDataSpecification - { - /// - /// Number of iff records - /// - private EntityType _numberOfIffDataRecords = new EntityType(); - - /// - /// Initializes a new instance of the class. - /// - public IffDataSpecification() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(IffDataSpecification left, IffDataSpecification right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(IffDataSpecification left, IffDataSpecification right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._numberOfIffDataRecords.GetMarshalledSize(); // this._numberOfIffDataRecords - return marshalSize; - } - - /// - /// Gets or sets the Number of iff records - /// - [XmlElement(Type = typeof(EntityType), ElementName = "numberOfIffDataRecords")] - public EntityType NumberOfIffDataRecords - { - get - { - return this._numberOfIffDataRecords; - } - - set - { - this._numberOfIffDataRecords = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._numberOfIffDataRecords.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._numberOfIffDataRecords.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._numberOfIffDataRecords.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as IffDataSpecification; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(IffDataSpecification obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._numberOfIffDataRecords.Equals(obj._numberOfIffDataRecords)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._numberOfIffDataRecords.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/IntercomCommunicationsParameters.cs b/tests/OpenDisNet.Reference/Generated/IntercomCommunicationsParameters.cs deleted file mode 100644 index bfb68d8..0000000 --- a/tests/OpenDisNet.Reference/Generated/IntercomCommunicationsParameters.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Intercom communcations parameters. Section 6.2.47. This requires hand coding - /// - [Serializable] - [XmlRoot] - public partial class IntercomCommunicationsParameters - { - /// - /// Type of intercom parameters record - /// - private ushort _recordType; - - /// - /// length of record - /// - private ushort _recordLength; - - /// - /// This is a placeholder. - /// - private uint _recordSpecificField; - - /// - /// Initializes a new instance of the class. - /// - public IntercomCommunicationsParameters() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(IntercomCommunicationsParameters left, IntercomCommunicationsParameters right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(IntercomCommunicationsParameters left, IntercomCommunicationsParameters right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._recordType - marshalSize += 2; // this._recordLength - marshalSize += 4; // this._recordSpecificField - return marshalSize; - } - - /// - /// Gets or sets the Type of intercom parameters record - /// - [XmlElement(Type = typeof(ushort), ElementName = "recordType")] - public ushort RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the length of record - /// - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - /// - /// Gets or sets the This is a placeholder. - /// - [XmlElement(Type = typeof(uint), ElementName = "recordSpecificField")] - public uint RecordSpecificField - { - get - { - return this._recordSpecificField; - } - - set - { - this._recordSpecificField = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._recordType); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedInt((uint)this._recordSpecificField); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedShort(); - this._recordLength = dis.ReadUnsignedShort(); - this._recordSpecificField = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordSpecificField.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as IntercomCommunicationsParameters; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(IntercomCommunicationsParameters obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._recordSpecificField != obj._recordSpecificField) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._recordSpecificField.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/IntercomIdentifier.cs b/tests/OpenDisNet.Reference/Generated/IntercomIdentifier.cs deleted file mode 100644 index 68a1a3b..0000000 --- a/tests/OpenDisNet.Reference/Generated/IntercomIdentifier.cs +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Unique designation of an attached or unattached intercom in an event or exercirse. Section 6.2.48 - /// - [Serializable] - [XmlRoot] - public partial class IntercomIdentifier - { - private ushort _siteNumber; - - private ushort _applicationNumber; - - private ushort _referenceNumber; - - private ushort _intercomNumber; - - /// - /// Initializes a new instance of the class. - /// - public IntercomIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(IntercomIdentifier left, IntercomIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(IntercomIdentifier left, IntercomIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._siteNumber - marshalSize += 2; // this._applicationNumber - marshalSize += 2; // this._referenceNumber - marshalSize += 2; // this._intercomNumber - return marshalSize; - } - - [XmlElement(Type = typeof(ushort), ElementName = "siteNumber")] - public ushort SiteNumber - { - get - { - return this._siteNumber; - } - - set - { - this._siteNumber = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "applicationNumber")] - public ushort ApplicationNumber - { - get - { - return this._applicationNumber; - } - - set - { - this._applicationNumber = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "referenceNumber")] - public ushort ReferenceNumber - { - get - { - return this._referenceNumber; - } - - set - { - this._referenceNumber = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "intercomNumber")] - public ushort IntercomNumber - { - get - { - return this._intercomNumber; - } - - set - { - this._intercomNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._siteNumber); - dos.WriteUnsignedShort((ushort)this._applicationNumber); - dos.WriteUnsignedShort((ushort)this._referenceNumber); - dos.WriteUnsignedShort((ushort)this._intercomNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._siteNumber = dis.ReadUnsignedShort(); - this._applicationNumber = dis.ReadUnsignedShort(); - this._referenceNumber = dis.ReadUnsignedShort(); - this._intercomNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._siteNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._applicationNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._referenceNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._intercomNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as IntercomIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(IntercomIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._siteNumber != obj._siteNumber) - { - ivarsEqual = false; - } - - if (this._applicationNumber != obj._applicationNumber) - { - ivarsEqual = false; - } - - if (this._referenceNumber != obj._referenceNumber) - { - ivarsEqual = false; - } - - if (this._intercomNumber != obj._intercomNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._siteNumber.GetHashCode(); - result = GenerateHash(result) ^ this._applicationNumber.GetHashCode(); - result = GenerateHash(result) ^ this._referenceNumber.GetHashCode(); - result = GenerateHash(result) ^ this._intercomNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/IntercomSignalPdu.cs b/tests/OpenDisNet.Reference/Generated/IntercomSignalPdu.cs deleted file mode 100644 index e4e952e..0000000 --- a/tests/OpenDisNet.Reference/Generated/IntercomSignalPdu.cs +++ /dev/null @@ -1,525 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Actual transmission of intercome voice data. Section 7.7.5. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(OneByteChunk))] - public partial class IntercomSignalPdu : RadioCommunicationsFamilyPdu, IEquatable - { - /// - /// entity ID - /// - private EntityID _entityID = new EntityID(); - - /// - /// ID of communications device - /// - private ushort _communicationsDeviceID; - - /// - /// encoding scheme - /// - private ushort _encodingScheme; - - /// - /// tactical data link type - /// - private ushort _tdlType; - - /// - /// sample rate - /// - private uint _sampleRate; - - /// - /// data length - /// - private ushort _dataLength; - - /// - /// samples - /// - private ushort _samples; - - /// - /// data bytes - /// - private byte[] _data; - - /// - /// Initializes a new instance of the class. - /// - public IntercomSignalPdu() - { - PduType = (byte)31; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(IntercomSignalPdu left, IntercomSignalPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(IntercomSignalPdu left, IntercomSignalPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._entityID.GetMarshalledSize(); // this._entityID - marshalSize += 2; // this._communicationsDeviceID - marshalSize += 2; // this._encodingScheme - marshalSize += 2; // this._tdlType - marshalSize += 4; // this._sampleRate - marshalSize += 2; // this._dataLength - marshalSize += 2; // this._samples - marshalSize += this._data.Length; - return marshalSize; - } - - /// - /// Gets or sets the entity ID - /// - [XmlElement(Type = typeof(EntityID), ElementName = "entityID")] - public EntityID EntityID - { - get - { - return this._entityID; - } - - set - { - this._entityID = value; - } - } - - /// - /// Gets or sets the ID of communications device - /// - [XmlElement(Type = typeof(ushort), ElementName = "communicationsDeviceID")] - public ushort CommunicationsDeviceID - { - get - { - return this._communicationsDeviceID; - } - - set - { - this._communicationsDeviceID = value; - } - } - - /// - /// Gets or sets the encoding scheme - /// - [XmlElement(Type = typeof(ushort), ElementName = "encodingScheme")] - public ushort EncodingScheme - { - get - { - return this._encodingScheme; - } - - set - { - this._encodingScheme = value; - } - } - - /// - /// Gets or sets the tactical data link type - /// - [XmlElement(Type = typeof(ushort), ElementName = "tdlType")] - public ushort TdlType - { - get - { - return this._tdlType; - } - - set - { - this._tdlType = value; - } - } - - /// - /// Gets or sets the sample rate - /// - [XmlElement(Type = typeof(uint), ElementName = "sampleRate")] - public uint SampleRate - { - get - { - return this._sampleRate; - } - - set - { - this._sampleRate = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getdataLength method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "dataLength")] - public ushort DataLength - { - get - { - return this._dataLength; - } - - set - { - this._dataLength = value; - } - } - - /// - /// Gets or sets the samples - /// - [XmlElement(Type = typeof(ushort), ElementName = "samples")] - public ushort Samples - { - get - { - return this._samples; - } - - set - { - this._samples = value; - } - } - - /// - /// Gets or sets the data bytes - /// - [XmlElement(ElementName = "dataList", DataType = "hexBinary")] - public byte[] Data - { - get - { - return this._data; - } - - set - { - this._data = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._entityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._communicationsDeviceID); - dos.WriteUnsignedShort((ushort)this._encodingScheme); - dos.WriteUnsignedShort((ushort)this._tdlType); - dos.WriteUnsignedInt((uint)this._sampleRate); - dos.WriteUnsignedShort((ushort)this._data.Length); - dos.WriteUnsignedShort((ushort)this._samples); - dos.WriteByte (this._data); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._entityID.Unmarshal(dis); - this._communicationsDeviceID = dis.ReadUnsignedShort(); - this._encodingScheme = dis.ReadUnsignedShort(); - this._tdlType = dis.ReadUnsignedShort(); - this._sampleRate = dis.ReadUnsignedInt(); - this._dataLength = dis.ReadUnsignedShort(); - this._samples = dis.ReadUnsignedShort(); - this._data = dis.ReadByteArray(this._dataLength); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._entityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._communicationsDeviceID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._encodingScheme.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._tdlType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._sampleRate.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._data.Length.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._samples.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - foreach (byte b in this._data) - { - sb.Append(b.ToString("X2", CultureInfo.InvariantCulture)); - } - - sb.AppendLine(""); - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as IntercomSignalPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(IntercomSignalPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._entityID.Equals(obj._entityID)) - { - ivarsEqual = false; - } - - if (this._communicationsDeviceID != obj._communicationsDeviceID) - { - ivarsEqual = false; - } - - if (this._encodingScheme != obj._encodingScheme) - { - ivarsEqual = false; - } - - if (this._tdlType != obj._tdlType) - { - ivarsEqual = false; - } - - if (this._sampleRate != obj._sampleRate) - { - ivarsEqual = false; - } - - if (this._dataLength != obj._dataLength) - { - ivarsEqual = false; - } - - if (this._samples != obj._samples) - { - ivarsEqual = false; - } - - if (!this._data.Equals(obj._data)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._entityID.GetHashCode(); - result = GenerateHash(result) ^ this._communicationsDeviceID.GetHashCode(); - result = GenerateHash(result) ^ this._encodingScheme.GetHashCode(); - result = GenerateHash(result) ^ this._tdlType.GetHashCode(); - result = GenerateHash(result) ^ this._sampleRate.GetHashCode(); - result = GenerateHash(result) ^ this._dataLength.GetHashCode(); - result = GenerateHash(result) ^ this._samples.GetHashCode(); - - if (this._data.Length > 0) - { - for (int idx = 0; idx < this._data.Length; idx++) - { - result = GenerateHash(result) ^ this._data[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/IsPartOfPdu.cs b/tests/OpenDisNet.Reference/Generated/IsPartOfPdu.cs deleted file mode 100644 index de30790..0000000 --- a/tests/OpenDisNet.Reference/Generated/IsPartOfPdu.cs +++ /dev/null @@ -1,458 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The joining of two or more simulation entities is communicated by this PDU. Section 7.8.5 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(Relationship))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(NamedLocationIdentification))] - [XmlInclude(typeof(EntityType))] - public partial class IsPartOfPdu : EntityManagementFamilyPdu, IEquatable - { - /// - /// ID of entity originating PDU - /// - private EntityID _orginatingEntityID = new EntityID(); - - /// - /// ID of entity receiving PDU - /// - private EntityID _receivingEntityID = new EntityID(); - - /// - /// relationship of joined parts - /// - private Relationship _relationship = new Relationship(); - - /// - /// location of part; centroid of part in host's coordinate system. x=range, y=bearing, z=0 - /// - private Vector3Float _partLocation = new Vector3Float(); - - /// - /// named location - /// - private NamedLocationIdentification _namedLocationID = new NamedLocationIdentification(); - - /// - /// entity type - /// - private EntityType _partEntityType = new EntityType(); - - /// - /// Initializes a new instance of the class. - /// - public IsPartOfPdu() - { - PduType = (byte)36; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(IsPartOfPdu left, IsPartOfPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(IsPartOfPdu left, IsPartOfPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._orginatingEntityID.GetMarshalledSize(); // this._orginatingEntityID - marshalSize += this._receivingEntityID.GetMarshalledSize(); // this._receivingEntityID - marshalSize += this._relationship.GetMarshalledSize(); // this._relationship - marshalSize += this._partLocation.GetMarshalledSize(); // this._partLocation - marshalSize += this._namedLocationID.GetMarshalledSize(); // this._namedLocationID - marshalSize += this._partEntityType.GetMarshalledSize(); // this._partEntityType - return marshalSize; - } - - /// - /// Gets or sets the ID of entity originating PDU - /// - [XmlElement(Type = typeof(EntityID), ElementName = "orginatingEntityID")] - public EntityID OrginatingEntityID - { - get - { - return this._orginatingEntityID; - } - - set - { - this._orginatingEntityID = value; - } - } - - /// - /// Gets or sets the ID of entity receiving PDU - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingEntityID")] - public EntityID ReceivingEntityID - { - get - { - return this._receivingEntityID; - } - - set - { - this._receivingEntityID = value; - } - } - - /// - /// Gets or sets the relationship of joined parts - /// - [XmlElement(Type = typeof(Relationship), ElementName = "relationship")] - public Relationship Relationship - { - get - { - return this._relationship; - } - - set - { - this._relationship = value; - } - } - - /// - /// Gets or sets the location of part; centroid of part in host's coordinate system. x=range, y=bearing, z=0 - /// - [XmlElement(Type = typeof(Vector3Float), ElementName = "partLocation")] - public Vector3Float PartLocation - { - get - { - return this._partLocation; - } - - set - { - this._partLocation = value; - } - } - - /// - /// Gets or sets the named location - /// - [XmlElement(Type = typeof(NamedLocationIdentification), ElementName = "namedLocationID")] - public NamedLocationIdentification NamedLocationID - { - get - { - return this._namedLocationID; - } - - set - { - this._namedLocationID = value; - } - } - - /// - /// Gets or sets the entity type - /// - [XmlElement(Type = typeof(EntityType), ElementName = "partEntityType")] - public EntityType PartEntityType - { - get - { - return this._partEntityType; - } - - set - { - this._partEntityType = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._orginatingEntityID.Marshal(dos); - this._receivingEntityID.Marshal(dos); - this._relationship.Marshal(dos); - this._partLocation.Marshal(dos); - this._namedLocationID.Marshal(dos); - this._partEntityType.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._orginatingEntityID.Unmarshal(dis); - this._receivingEntityID.Unmarshal(dis); - this._relationship.Unmarshal(dis); - this._partLocation.Unmarshal(dis); - this._namedLocationID.Unmarshal(dis); - this._partEntityType.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._orginatingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._relationship.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._partLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._namedLocationID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._partEntityType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as IsPartOfPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(IsPartOfPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._orginatingEntityID.Equals(obj._orginatingEntityID)) - { - ivarsEqual = false; - } - - if (!this._receivingEntityID.Equals(obj._receivingEntityID)) - { - ivarsEqual = false; - } - - if (!this._relationship.Equals(obj._relationship)) - { - ivarsEqual = false; - } - - if (!this._partLocation.Equals(obj._partLocation)) - { - ivarsEqual = false; - } - - if (!this._namedLocationID.Equals(obj._namedLocationID)) - { - ivarsEqual = false; - } - - if (!this._partEntityType.Equals(obj._partEntityType)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._orginatingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._relationship.GetHashCode(); - result = GenerateHash(result) ^ this._partLocation.GetHashCode(); - result = GenerateHash(result) ^ this._namedLocationID.GetHashCode(); - result = GenerateHash(result) ^ this._partEntityType.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/JammingTechnique.cs b/tests/OpenDisNet.Reference/Generated/JammingTechnique.cs deleted file mode 100644 index bed5994..0000000 --- a/tests/OpenDisNet.Reference/Generated/JammingTechnique.cs +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Jamming technique. Section 6.2.50 - /// - [Serializable] - [XmlRoot] - public partial class JammingTechnique - { - private byte _kind; - - private byte _category; - - private byte _subcategory; - - private byte _specific; - - /// - /// Initializes a new instance of the class. - /// - public JammingTechnique() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(JammingTechnique left, JammingTechnique right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(JammingTechnique left, JammingTechnique right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._kind - marshalSize += 1; // this._category - marshalSize += 1; // this._subcategory - marshalSize += 1; // this._specific - return marshalSize; - } - - [XmlElement(Type = typeof(byte), ElementName = "kind")] - public byte Kind - { - get - { - return this._kind; - } - - set - { - this._kind = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "category")] - public byte Category - { - get - { - return this._category; - } - - set - { - this._category = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "subcategory")] - public byte Subcategory - { - get - { - return this._subcategory; - } - - set - { - this._subcategory = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "specific")] - public byte Specific - { - get - { - return this._specific; - } - - set - { - this._specific = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._kind); - dos.WriteUnsignedByte((byte)this._category); - dos.WriteUnsignedByte((byte)this._subcategory); - dos.WriteUnsignedByte((byte)this._specific); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._kind = dis.ReadUnsignedByte(); - this._category = dis.ReadUnsignedByte(); - this._subcategory = dis.ReadUnsignedByte(); - this._specific = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._kind.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._category.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._subcategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._specific.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as JammingTechnique; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(JammingTechnique obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._kind != obj._kind) - { - ivarsEqual = false; - } - - if (this._category != obj._category) - { - ivarsEqual = false; - } - - if (this._subcategory != obj._subcategory) - { - ivarsEqual = false; - } - - if (this._specific != obj._specific) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._kind.GetHashCode(); - result = GenerateHash(result) ^ this._category.GetHashCode(); - result = GenerateHash(result) ^ this._subcategory.GetHashCode(); - result = GenerateHash(result) ^ this._specific.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/LaunchedMunitionRecord.cs b/tests/OpenDisNet.Reference/Generated/LaunchedMunitionRecord.cs deleted file mode 100644 index 8bbb052..0000000 --- a/tests/OpenDisNet.Reference/Generated/LaunchedMunitionRecord.cs +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Identity of a communications node. Section 6.2.51 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EventIdentifier))] - [XmlInclude(typeof(Vector3Double))] - public partial class LaunchedMunitionRecord - { - private EventIdentifier _fireEventID = new EventIdentifier(); - - private ushort _padding; - - private EventIdentifier _firingEntityID = new EventIdentifier(); - - private ushort _padding2; - - private EventIdentifier _targetEntityID = new EventIdentifier(); - - private ushort _padding3; - - private Vector3Double _targetLocation = new Vector3Double(); - - /// - /// Initializes a new instance of the class. - /// - public LaunchedMunitionRecord() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(LaunchedMunitionRecord left, LaunchedMunitionRecord right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(LaunchedMunitionRecord left, LaunchedMunitionRecord right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._fireEventID.GetMarshalledSize(); // this._fireEventID - marshalSize += 2; // this._padding - marshalSize += this._firingEntityID.GetMarshalledSize(); // this._firingEntityID - marshalSize += 2; // this._padding2 - marshalSize += this._targetEntityID.GetMarshalledSize(); // this._targetEntityID - marshalSize += 2; // this._padding3 - marshalSize += this._targetLocation.GetMarshalledSize(); // this._targetLocation - return marshalSize; - } - - [XmlElement(Type = typeof(EventIdentifier), ElementName = "fireEventID")] - public EventIdentifier FireEventID - { - get - { - return this._fireEventID; - } - - set - { - this._fireEventID = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - [XmlElement(Type = typeof(EventIdentifier), ElementName = "firingEntityID")] - public EventIdentifier FiringEntityID - { - get - { - return this._firingEntityID; - } - - set - { - this._firingEntityID = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "padding2")] - public ushort Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - [XmlElement(Type = typeof(EventIdentifier), ElementName = "targetEntityID")] - public EventIdentifier TargetEntityID - { - get - { - return this._targetEntityID; - } - - set - { - this._targetEntityID = value; - } - } - - [XmlElement(Type = typeof(ushort), ElementName = "padding3")] - public ushort Padding3 - { - get - { - return this._padding3; - } - - set - { - this._padding3 = value; - } - } - - [XmlElement(Type = typeof(Vector3Double), ElementName = "targetLocation")] - public Vector3Double TargetLocation - { - get - { - return this._targetLocation; - } - - set - { - this._targetLocation = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._fireEventID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._padding); - this._firingEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._padding2); - this._targetEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._padding3); - this._targetLocation.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._fireEventID.Unmarshal(dis); - this._padding = dis.ReadUnsignedShort(); - this._firingEntityID.Unmarshal(dis); - this._padding2 = dis.ReadUnsignedShort(); - this._targetEntityID.Unmarshal(dis); - this._padding3 = dis.ReadUnsignedShort(); - this._targetLocation.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._fireEventID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._firingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._targetEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding3.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._targetLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as LaunchedMunitionRecord; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(LaunchedMunitionRecord obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._fireEventID.Equals(obj._fireEventID)) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - if (!this._firingEntityID.Equals(obj._firingEntityID)) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (!this._targetEntityID.Equals(obj._targetEntityID)) - { - ivarsEqual = false; - } - - if (this._padding3 != obj._padding3) - { - ivarsEqual = false; - } - - if (!this._targetLocation.Equals(obj._targetLocation)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._fireEventID.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - result = GenerateHash(result) ^ this._firingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._targetEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._padding3.GetHashCode(); - result = GenerateHash(result) ^ this._targetLocation.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/LayerHeader.cs b/tests/OpenDisNet.Reference/Generated/LayerHeader.cs deleted file mode 100644 index aedfeaf..0000000 --- a/tests/OpenDisNet.Reference/Generated/LayerHeader.cs +++ /dev/null @@ -1,335 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The identification of the additional information layer number, layer-specific information, and the length of the layer. Section 6.2.52 - /// - [Serializable] - [XmlRoot] - public partial class LayerHeader - { - private byte _layerNumber; - - /// - /// field shall specify layer-specific information that varies by System Type (see 6.2.86) and Layer Number. - /// - private byte _layerSpecificInformation; - - /// - /// This field shall specify the length in octets of the layer, including the Layer Header record - /// - private ushort _length; - - /// - /// Initializes a new instance of the class. - /// - public LayerHeader() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(LayerHeader left, LayerHeader right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(LayerHeader left, LayerHeader right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._layerNumber - marshalSize += 1; // this._layerSpecificInformation - marshalSize += 2; // this._length - return marshalSize; - } - - [XmlElement(Type = typeof(byte), ElementName = "layerNumber")] - public byte LayerNumber - { - get - { - return this._layerNumber; - } - - set - { - this._layerNumber = value; - } - } - - /// - /// Gets or sets the field shall specify layer-specific information that varies by System Type (see 6.2.86) and Layer Number. - /// - [XmlElement(Type = typeof(byte), ElementName = "layerSpecificInformation")] - public byte LayerSpecificInformation - { - get - { - return this._layerSpecificInformation; - } - - set - { - this._layerSpecificInformation = value; - } - } - - /// - /// Gets or sets the This field shall specify the length in octets of the layer, including the Layer Header record - /// - [XmlElement(Type = typeof(ushort), ElementName = "length")] - public ushort Length - { - get - { - return this._length; - } - - set - { - this._length = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._layerNumber); - dos.WriteUnsignedByte((byte)this._layerSpecificInformation); - dos.WriteUnsignedShort((ushort)this._length); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._layerNumber = dis.ReadUnsignedByte(); - this._layerSpecificInformation = dis.ReadUnsignedByte(); - this._length = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._layerNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._layerSpecificInformation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._length.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as LayerHeader; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(LayerHeader obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._layerNumber != obj._layerNumber) - { - ivarsEqual = false; - } - - if (this._layerSpecificInformation != obj._layerSpecificInformation) - { - ivarsEqual = false; - } - - if (this._length != obj._length) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._layerNumber.GetHashCode(); - result = GenerateHash(result) ^ this._layerSpecificInformation.GetHashCode(); - result = GenerateHash(result) ^ this._length.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/LinearObjectStatePdu.cs b/tests/OpenDisNet.Reference/Generated/LinearObjectStatePdu.cs deleted file mode 100644 index d73ebc9..0000000 --- a/tests/OpenDisNet.Reference/Generated/LinearObjectStatePdu.cs +++ /dev/null @@ -1,589 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// : Information abut the addition or modification of a synthecic enviroment object that is anchored to the terrain with a single point and has size or orientation. Section 7.10.5 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(SimulationAddress))] - [XmlInclude(typeof(ObjectType))] - [XmlInclude(typeof(LinearSegmentParameter))] - public partial class LinearObjectStatePdu : SyntheticEnvironmentFamilyPdu, IEquatable - { - /// - /// Object in synthetic environment - /// - private EntityID _objectID = new EntityID(); - - /// - /// Object with which this point object is associated - /// - private EntityID _referencedObjectID = new EntityID(); - - /// - /// unique update number of each state transition of an object - /// - private ushort _updateNumber; - - /// - /// force ID - /// - private byte _forceID; - - /// - /// number of linear segment parameters - /// - private byte _numberOfSegments; - - /// - /// requesterID - /// - private SimulationAddress _requesterID = new SimulationAddress(); - - /// - /// receiver ID - /// - private SimulationAddress _receivingID = new SimulationAddress(); - - /// - /// Object type - /// - private ObjectType _objectType = new ObjectType(); - - /// - /// Linear segment parameters - /// - private List _linearSegmentParameters = new List(); - - /// - /// Initializes a new instance of the class. - /// - public LinearObjectStatePdu() - { - PduType = (byte)44; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(LinearObjectStatePdu left, LinearObjectStatePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(LinearObjectStatePdu left, LinearObjectStatePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._objectID.GetMarshalledSize(); // this._objectID - marshalSize += this._referencedObjectID.GetMarshalledSize(); // this._referencedObjectID - marshalSize += 2; // this._updateNumber - marshalSize += 1; // this._forceID - marshalSize += 1; // this._numberOfSegments - marshalSize += this._requesterID.GetMarshalledSize(); // this._requesterID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += this._objectType.GetMarshalledSize(); // this._objectType - for (int idx = 0; idx < this._linearSegmentParameters.Count; idx++) - { - LinearSegmentParameter listElement = (LinearSegmentParameter)this._linearSegmentParameters[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Object in synthetic environment - /// - [XmlElement(Type = typeof(EntityID), ElementName = "objectID")] - public EntityID ObjectID - { - get - { - return this._objectID; - } - - set - { - this._objectID = value; - } - } - - /// - /// Gets or sets the Object with which this point object is associated - /// - [XmlElement(Type = typeof(EntityID), ElementName = "referencedObjectID")] - public EntityID ReferencedObjectID - { - get - { - return this._referencedObjectID; - } - - set - { - this._referencedObjectID = value; - } - } - - /// - /// Gets or sets the unique update number of each state transition of an object - /// - [XmlElement(Type = typeof(ushort), ElementName = "updateNumber")] - public ushort UpdateNumber - { - get - { - return this._updateNumber; - } - - set - { - this._updateNumber = value; - } - } - - /// - /// Gets or sets the force ID - /// - [XmlElement(Type = typeof(byte), ElementName = "forceID")] - public byte ForceID - { - get - { - return this._forceID; - } - - set - { - this._forceID = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfSegments method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfSegments")] - public byte NumberOfSegments - { - get - { - return this._numberOfSegments; - } - - set - { - this._numberOfSegments = value; - } - } - - /// - /// Gets or sets the requesterID - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "requesterID")] - public SimulationAddress RequesterID - { - get - { - return this._requesterID; - } - - set - { - this._requesterID = value; - } - } - - /// - /// Gets or sets the receiver ID - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "receivingID")] - public SimulationAddress ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the Object type - /// - [XmlElement(Type = typeof(ObjectType), ElementName = "objectType")] - public ObjectType ObjectType - { - get - { - return this._objectType; - } - - set - { - this._objectType = value; - } - } - - /// - /// Gets or sets the Linear segment parameters - /// - [XmlElement(ElementName = "linearSegmentParametersList", Type = typeof(List))] - public List LinearSegmentParameters - { - get - { - return this._linearSegmentParameters; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._objectID.Marshal(dos); - this._referencedObjectID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._updateNumber); - dos.WriteUnsignedByte((byte)this._forceID); - dos.WriteUnsignedByte((byte)this._linearSegmentParameters.Count); - this._requesterID.Marshal(dos); - this._receivingID.Marshal(dos); - this._objectType.Marshal(dos); - - for (int idx = 0; idx < this._linearSegmentParameters.Count; idx++) - { - LinearSegmentParameter aLinearSegmentParameter = (LinearSegmentParameter)this._linearSegmentParameters[idx]; - aLinearSegmentParameter.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._objectID.Unmarshal(dis); - this._referencedObjectID.Unmarshal(dis); - this._updateNumber = dis.ReadUnsignedShort(); - this._forceID = dis.ReadUnsignedByte(); - this._numberOfSegments = dis.ReadUnsignedByte(); - this._requesterID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._objectType.Unmarshal(dis); - for (int idx = 0; idx < this.NumberOfSegments; idx++) - { - LinearSegmentParameter anX = new LinearSegmentParameter(); - anX.Unmarshal(dis); - this._linearSegmentParameters.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._objectID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._referencedObjectID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._updateNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._forceID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._linearSegmentParameters.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._requesterID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._objectType.Reflection(sb); - sb.AppendLine(""); - for (int idx = 0; idx < this._linearSegmentParameters.Count; idx++) - { - sb.AppendLine(""); - LinearSegmentParameter aLinearSegmentParameter = (LinearSegmentParameter)this._linearSegmentParameters[idx]; - aLinearSegmentParameter.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as LinearObjectStatePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(LinearObjectStatePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._objectID.Equals(obj._objectID)) - { - ivarsEqual = false; - } - - if (!this._referencedObjectID.Equals(obj._referencedObjectID)) - { - ivarsEqual = false; - } - - if (this._updateNumber != obj._updateNumber) - { - ivarsEqual = false; - } - - if (this._forceID != obj._forceID) - { - ivarsEqual = false; - } - - if (this._numberOfSegments != obj._numberOfSegments) - { - ivarsEqual = false; - } - - if (!this._requesterID.Equals(obj._requesterID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (!this._objectType.Equals(obj._objectType)) - { - ivarsEqual = false; - } - - if (this._linearSegmentParameters.Count != obj._linearSegmentParameters.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._linearSegmentParameters.Count; idx++) - { - if (!this._linearSegmentParameters[idx].Equals(obj._linearSegmentParameters[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._objectID.GetHashCode(); - result = GenerateHash(result) ^ this._referencedObjectID.GetHashCode(); - result = GenerateHash(result) ^ this._updateNumber.GetHashCode(); - result = GenerateHash(result) ^ this._forceID.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfSegments.GetHashCode(); - result = GenerateHash(result) ^ this._requesterID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._objectType.GetHashCode(); - - if (this._linearSegmentParameters.Count > 0) - { - for (int idx = 0; idx < this._linearSegmentParameters.Count; idx++) - { - result = GenerateHash(result) ^ this._linearSegmentParameters[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/LinearSegmentParameter.cs b/tests/OpenDisNet.Reference/Generated/LinearSegmentParameter.cs deleted file mode 100644 index 7e037b5..0000000 --- a/tests/OpenDisNet.Reference/Generated/LinearSegmentParameter.cs +++ /dev/null @@ -1,571 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The specification of an individual segment of a linear segment synthetic environment object in a Linear Object State PDU Section 6.2.53 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(EulerAngles))] - public partial class LinearSegmentParameter - { - /// - /// the individual segment of the linear segment - /// - private byte _segmentNumber; - - /// - /// whether a modification has been made to the point object’s location or orientation - /// - private byte _segmentModification; - - /// - /// general dynamic appearance attributes of the segment. This record shall be defined as a 16-bit record of enumerations. The values defined for this record are included in Section 12 of SISO-REF-010. - /// - private ushort _generalSegmentAppearance; - - /// - /// This field shall specify specific dynamic appearance attributes of the segment. This record shall be defined as a 32-bit record of enumerations. - /// - private ushort _specificSegmentAppearance; - - /// - /// This field shall specify the location of the linear segment in the simulated world and shall be represented by a World Coordinates record - /// - private Vector3Double _segmentLocation = new Vector3Double(); - - /// - /// orientation of the linear segment about the segment location and shall be represented by a Euler Angles record - /// - private EulerAngles _segmentOrientation = new EulerAngles(); - - /// - /// length of the linear segment, in meters, extending in the positive X direction - /// - private ushort _segmentLength; - - /// - /// The total width of the linear segment, in meters, shall be specified by a 16-bit unsigned integer. One-half of the width shall extend in the positive Y direction, and one-half of the width shall extend in the negative Y direction. - /// - private ushort _segmentWidth; - - /// - /// The height of the linear segment, in meters, above ground shall be specified by a 16-bit unsigned integer. - /// - private ushort _segmentHeight; - - /// - /// The depth of the linear segment, in meters, below ground level - /// - private ushort _segmentDepth; - - /// - /// Initializes a new instance of the class. - /// - public LinearSegmentParameter() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(LinearSegmentParameter left, LinearSegmentParameter right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(LinearSegmentParameter left, LinearSegmentParameter right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._segmentNumber - marshalSize += 1; // this._segmentModification - marshalSize += 2; // this._generalSegmentAppearance - marshalSize += 2; // this._specificSegmentAppearance - marshalSize += this._segmentLocation.GetMarshalledSize(); // this._segmentLocation - marshalSize += this._segmentOrientation.GetMarshalledSize(); // this._segmentOrientation - marshalSize += 2; // this._segmentLength - marshalSize += 2; // this._segmentWidth - marshalSize += 2; // this._segmentHeight - marshalSize += 2; // this._segmentDepth - return marshalSize; - } - - /// - /// Gets or sets the the individual segment of the linear segment - /// - [XmlElement(Type = typeof(byte), ElementName = "segmentNumber")] - public byte SegmentNumber - { - get - { - return this._segmentNumber; - } - - set - { - this._segmentNumber = value; - } - } - - /// - /// Gets or sets the whether a modification has been made to the point object’s location or orientation - /// - [XmlElement(Type = typeof(byte), ElementName = "segmentModification")] - public byte SegmentModification - { - get - { - return this._segmentModification; - } - - set - { - this._segmentModification = value; - } - } - - /// - /// Gets or sets the general dynamic appearance attributes of the segment. This record shall be defined as a 16-bit record of enumerations. The values defined for this record are included in Section 12 of SISO-REF-010. - /// - [XmlElement(Type = typeof(ushort), ElementName = "generalSegmentAppearance")] - public ushort GeneralSegmentAppearance - { - get - { - return this._generalSegmentAppearance; - } - - set - { - this._generalSegmentAppearance = value; - } - } - - /// - /// Gets or sets the This field shall specify specific dynamic appearance attributes of the segment. This record shall be defined as a 32-bit record of enumerations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "specificSegmentAppearance")] - public ushort SpecificSegmentAppearance - { - get - { - return this._specificSegmentAppearance; - } - - set - { - this._specificSegmentAppearance = value; - } - } - - /// - /// Gets or sets the This field shall specify the location of the linear segment in the simulated world and shall be represented by a World Coordinates record - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "segmentLocation")] - public Vector3Double SegmentLocation - { - get - { - return this._segmentLocation; - } - - set - { - this._segmentLocation = value; - } - } - - /// - /// Gets or sets the orientation of the linear segment about the segment location and shall be represented by a Euler Angles record - /// - [XmlElement(Type = typeof(EulerAngles), ElementName = "segmentOrientation")] - public EulerAngles SegmentOrientation - { - get - { - return this._segmentOrientation; - } - - set - { - this._segmentOrientation = value; - } - } - - /// - /// Gets or sets the length of the linear segment, in meters, extending in the positive X direction - /// - [XmlElement(Type = typeof(ushort), ElementName = "segmentLength")] - public ushort SegmentLength - { - get - { - return this._segmentLength; - } - - set - { - this._segmentLength = value; - } - } - - /// - /// Gets or sets the The total width of the linear segment, in meters, shall be specified by a 16-bit unsigned integer. One-half of the width shall extend in the positive Y direction, and one-half of the width shall extend in the negative Y direction. - /// - [XmlElement(Type = typeof(ushort), ElementName = "segmentWidth")] - public ushort SegmentWidth - { - get - { - return this._segmentWidth; - } - - set - { - this._segmentWidth = value; - } - } - - /// - /// Gets or sets the The height of the linear segment, in meters, above ground shall be specified by a 16-bit unsigned integer. - /// - [XmlElement(Type = typeof(ushort), ElementName = "segmentHeight")] - public ushort SegmentHeight - { - get - { - return this._segmentHeight; - } - - set - { - this._segmentHeight = value; - } - } - - /// - /// Gets or sets the The depth of the linear segment, in meters, below ground level - /// - [XmlElement(Type = typeof(ushort), ElementName = "segmentDepth")] - public ushort SegmentDepth - { - get - { - return this._segmentDepth; - } - - set - { - this._segmentDepth = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._segmentNumber); - dos.WriteUnsignedByte((byte)this._segmentModification); - dos.WriteUnsignedShort((ushort)this._generalSegmentAppearance); - dos.WriteUnsignedShort((ushort)this._specificSegmentAppearance); - this._segmentLocation.Marshal(dos); - this._segmentOrientation.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._segmentLength); - dos.WriteUnsignedShort((ushort)this._segmentWidth); - dos.WriteUnsignedShort((ushort)this._segmentHeight); - dos.WriteUnsignedShort((ushort)this._segmentDepth); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._segmentNumber = dis.ReadUnsignedByte(); - this._segmentModification = dis.ReadUnsignedByte(); - this._generalSegmentAppearance = dis.ReadUnsignedShort(); - this._specificSegmentAppearance = dis.ReadUnsignedShort(); - this._segmentLocation.Unmarshal(dis); - this._segmentOrientation.Unmarshal(dis); - this._segmentLength = dis.ReadUnsignedShort(); - this._segmentWidth = dis.ReadUnsignedShort(); - this._segmentHeight = dis.ReadUnsignedShort(); - this._segmentDepth = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._segmentNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._segmentModification.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._generalSegmentAppearance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._specificSegmentAppearance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._segmentLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._segmentOrientation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._segmentLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._segmentWidth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._segmentHeight.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._segmentDepth.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as LinearSegmentParameter; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(LinearSegmentParameter obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._segmentNumber != obj._segmentNumber) - { - ivarsEqual = false; - } - - if (this._segmentModification != obj._segmentModification) - { - ivarsEqual = false; - } - - if (this._generalSegmentAppearance != obj._generalSegmentAppearance) - { - ivarsEqual = false; - } - - if (this._specificSegmentAppearance != obj._specificSegmentAppearance) - { - ivarsEqual = false; - } - - if (!this._segmentLocation.Equals(obj._segmentLocation)) - { - ivarsEqual = false; - } - - if (!this._segmentOrientation.Equals(obj._segmentOrientation)) - { - ivarsEqual = false; - } - - if (this._segmentLength != obj._segmentLength) - { - ivarsEqual = false; - } - - if (this._segmentWidth != obj._segmentWidth) - { - ivarsEqual = false; - } - - if (this._segmentHeight != obj._segmentHeight) - { - ivarsEqual = false; - } - - if (this._segmentDepth != obj._segmentDepth) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._segmentNumber.GetHashCode(); - result = GenerateHash(result) ^ this._segmentModification.GetHashCode(); - result = GenerateHash(result) ^ this._generalSegmentAppearance.GetHashCode(); - result = GenerateHash(result) ^ this._specificSegmentAppearance.GetHashCode(); - result = GenerateHash(result) ^ this._segmentLocation.GetHashCode(); - result = GenerateHash(result) ^ this._segmentOrientation.GetHashCode(); - result = GenerateHash(result) ^ this._segmentLength.GetHashCode(); - result = GenerateHash(result) ^ this._segmentWidth.GetHashCode(); - result = GenerateHash(result) ^ this._segmentHeight.GetHashCode(); - result = GenerateHash(result) ^ this._segmentDepth.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/LiveEntityIdentifier.cs b/tests/OpenDisNet.Reference/Generated/LiveEntityIdentifier.cs deleted file mode 100644 index 0e93889..0000000 --- a/tests/OpenDisNet.Reference/Generated/LiveEntityIdentifier.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of each entity in an event or exercise that is contained in a Live Entity PDU. Section 6.2.54 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(LiveSimulationAddress))] - public partial class LiveEntityIdentifier - { - /// - /// Live Simulation Address record (see 6.2.55) - /// - private LiveSimulationAddress _liveSimulationAddress = new LiveSimulationAddress(); - - /// - /// Live entity number - /// - private ushort _entityNumber; - - /// - /// Initializes a new instance of the class. - /// - public LiveEntityIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(LiveEntityIdentifier left, LiveEntityIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(LiveEntityIdentifier left, LiveEntityIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._liveSimulationAddress.GetMarshalledSize(); // this._liveSimulationAddress - marshalSize += 2; // this._entityNumber - return marshalSize; - } - - /// - /// Gets or sets the Live Simulation Address record (see 6.2.55) - /// - [XmlElement(Type = typeof(LiveSimulationAddress), ElementName = "liveSimulationAddress")] - public LiveSimulationAddress LiveSimulationAddress - { - get - { - return this._liveSimulationAddress; - } - - set - { - this._liveSimulationAddress = value; - } - } - - /// - /// Gets or sets the Live entity number - /// - [XmlElement(Type = typeof(ushort), ElementName = "entityNumber")] - public ushort EntityNumber - { - get - { - return this._entityNumber; - } - - set - { - this._entityNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._liveSimulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._entityNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._liveSimulationAddress.Unmarshal(dis); - this._entityNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._liveSimulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._entityNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as LiveEntityIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(LiveEntityIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._liveSimulationAddress.Equals(obj._liveSimulationAddress)) - { - ivarsEqual = false; - } - - if (this._entityNumber != obj._entityNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._liveSimulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._entityNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/LiveEntityPdu.cs b/tests/OpenDisNet.Reference/Generated/LiveEntityPdu.cs deleted file mode 100644 index 3affe6b..0000000 --- a/tests/OpenDisNet.Reference/Generated/LiveEntityPdu.cs +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The live entity PDUs have a header with some different field names, but the same length. Section 9.3.2 - /// - [Serializable] - [XmlRoot] - public partial class LiveEntityPdu : PduSuperclass, IEquatable - { - /// - /// Subprotocol used to decode the PDU. Section 13 of EBV. - /// - private ushort _subprotocolNumber; - - /// - /// zero-filled array of padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public LiveEntityPdu() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(LiveEntityPdu left, LiveEntityPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(LiveEntityPdu left, LiveEntityPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 2; // this._subprotocolNumber - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the Subprotocol used to decode the PDU. Section 13 of EBV. - /// - [XmlElement(Type = typeof(ushort), ElementName = "subprotocolNumber")] - public ushort SubprotocolNumber - { - get - { - return this._subprotocolNumber; - } - - set - { - this._subprotocolNumber = value; - } - } - - /// - /// Gets or sets the zero-filled array of padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._subprotocolNumber); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._subprotocolNumber = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._subprotocolNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as LiveEntityPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(LiveEntityPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._subprotocolNumber != obj._subprotocolNumber) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._subprotocolNumber.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/LiveSimulationAddress.cs b/tests/OpenDisNet.Reference/Generated/LiveSimulationAddress.cs deleted file mode 100644 index bde7892..0000000 --- a/tests/OpenDisNet.Reference/Generated/LiveSimulationAddress.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// A simulation's designation associated with all Live Entity IDs contained in Live Entity PDUs. Section 6.2.55 - /// - [Serializable] - [XmlRoot] - public partial class LiveSimulationAddress - { - /// - /// facility, installation, organizational unit or geographic location may have multiple sites associated with it. The Site Number is the first component of the Live Simulation Address, which defines a live simulation. - /// - private byte _liveSiteNumber; - - /// - /// An application associated with a live site is termed a live application. Each live application participating in an event - /// - private ushort _liveApplicationNumber; - - /// - /// Initializes a new instance of the class. - /// - public LiveSimulationAddress() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(LiveSimulationAddress left, LiveSimulationAddress right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(LiveSimulationAddress left, LiveSimulationAddress right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._liveSiteNumber - marshalSize += 2; // this._liveApplicationNumber - return marshalSize; - } - - /// - /// Gets or sets the facility, installation, organizational unit or geographic location may have multiple sites associated with it. The Site Number is the first component of the Live Simulation Address, which defines a live simulation. - /// - [XmlElement(Type = typeof(byte), ElementName = "liveSiteNumber")] - public byte LiveSiteNumber - { - get - { - return this._liveSiteNumber; - } - - set - { - this._liveSiteNumber = value; - } - } - - /// - /// Gets or sets the An application associated with a live site is termed a live application. Each live application participating in an event - /// - [XmlElement(Type = typeof(ushort), ElementName = "liveApplicationNumber")] - public ushort LiveApplicationNumber - { - get - { - return this._liveApplicationNumber; - } - - set - { - this._liveApplicationNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._liveSiteNumber); - dos.WriteUnsignedShort((ushort)this._liveApplicationNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._liveSiteNumber = dis.ReadUnsignedByte(); - this._liveApplicationNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._liveSiteNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._liveApplicationNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as LiveSimulationAddress; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(LiveSimulationAddress obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._liveSiteNumber != obj._liveSiteNumber) - { - ivarsEqual = false; - } - - if (this._liveApplicationNumber != obj._liveApplicationNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._liveSiteNumber.GetHashCode(); - result = GenerateHash(result) ^ this._liveApplicationNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/LogisticsFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/LogisticsFamilyPdu.cs deleted file mode 100644 index 08d35a9..0000000 --- a/tests/OpenDisNet.Reference/Generated/LogisticsFamilyPdu.cs +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Abstract superclass for logistics PDUs. Section 7.4 COMPLETE - /// - [Serializable] - [XmlRoot] - public partial class LogisticsFamilyPdu : Pdu, IEquatable - { - /// - /// Initializes a new instance of the class. - /// - public LogisticsFamilyPdu() - { - ProtocolFamily = (byte)3; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(LogisticsFamilyPdu left, LogisticsFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(LogisticsFamilyPdu left, LogisticsFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - return marshalSize; - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as LogisticsFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(LogisticsFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/MineEntityIdentifier.cs b/tests/OpenDisNet.Reference/Generated/MineEntityIdentifier.cs deleted file mode 100644 index ed07d91..0000000 --- a/tests/OpenDisNet.Reference/Generated/MineEntityIdentifier.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of a mine contained in the Minefield Data PDU. No espdus are issued for mine entities. Section 6.2.56 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class MineEntityIdentifier - { - /// - /// - /// - private SimulationAddress _simulationAddress = new SimulationAddress(); - - /// - /// - /// - private ushort _mineEntityNumber; - - /// - /// Initializes a new instance of the class. - /// - public MineEntityIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(MineEntityIdentifier left, MineEntityIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(MineEntityIdentifier left, MineEntityIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._mineEntityNumber - return marshalSize; - } - - /// - /// Gets or sets the - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "simulationAddress")] - public SimulationAddress SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - /// - /// Gets or sets the - /// - [XmlElement(Type = typeof(ushort), ElementName = "mineEntityNumber")] - public ushort MineEntityNumber - { - get - { - return this._mineEntityNumber; - } - - set - { - this._mineEntityNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._mineEntityNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._mineEntityNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._mineEntityNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as MineEntityIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(MineEntityIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._mineEntityNumber != obj._mineEntityNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._mineEntityNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/MinefieldFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/MinefieldFamilyPdu.cs deleted file mode 100644 index 222ae64..0000000 --- a/tests/OpenDisNet.Reference/Generated/MinefieldFamilyPdu.cs +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Abstract superclass for PDUs relating to minefields. Section 7.9 - /// - [Serializable] - [XmlRoot] - public partial class MinefieldFamilyPdu : Pdu, IEquatable - { - /// - /// Initializes a new instance of the class. - /// - public MinefieldFamilyPdu() - { - ProtocolFamily = (byte)8; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(MinefieldFamilyPdu left, MinefieldFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(MinefieldFamilyPdu left, MinefieldFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - return marshalSize; - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as MinefieldFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(MinefieldFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/MinefieldIdentifier.cs b/tests/OpenDisNet.Reference/Generated/MinefieldIdentifier.cs deleted file mode 100644 index 31a9856..0000000 --- a/tests/OpenDisNet.Reference/Generated/MinefieldIdentifier.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of a minefield Section 6.2.57 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class MinefieldIdentifier - { - /// - /// - /// - private SimulationAddress _simulationAddress = new SimulationAddress(); - - /// - /// - /// - private ushort _minefieldNumber; - - /// - /// Initializes a new instance of the class. - /// - public MinefieldIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(MinefieldIdentifier left, MinefieldIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(MinefieldIdentifier left, MinefieldIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._minefieldNumber - return marshalSize; - } - - /// - /// Gets or sets the - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "simulationAddress")] - public SimulationAddress SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - /// - /// Gets or sets the - /// - [XmlElement(Type = typeof(ushort), ElementName = "minefieldNumber")] - public ushort MinefieldNumber - { - get - { - return this._minefieldNumber; - } - - set - { - this._minefieldNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._minefieldNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._minefieldNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._minefieldNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as MinefieldIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(MinefieldIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._minefieldNumber != obj._minefieldNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._minefieldNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/MinefieldResponseNackPdu.cs b/tests/OpenDisNet.Reference/Generated/MinefieldResponseNackPdu.cs deleted file mode 100644 index 0a3d64e..0000000 --- a/tests/OpenDisNet.Reference/Generated/MinefieldResponseNackPdu.cs +++ /dev/null @@ -1,453 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// proivde the means to request a retransmit of a minefield data pdu. Section 7.9.5 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EightByteChunk))] - public partial class MinefieldResponseNackPdu : MinefieldFamilyPdu, IEquatable - { - /// - /// Minefield ID - /// - private EntityID _minefieldID = new EntityID(); - - /// - /// entity ID making the request - /// - private EntityID _requestingEntityID = new EntityID(); - - /// - /// request ID - /// - private byte _requestID; - - /// - /// how many pdus were missing - /// - private byte _numberOfMissingPdus; - - /// - /// PDU sequence numbers that were missing - /// - private List _missingPduSequenceNumbers = new List(); - - /// - /// Initializes a new instance of the class. - /// - public MinefieldResponseNackPdu() - { - PduType = (byte)40; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(MinefieldResponseNackPdu left, MinefieldResponseNackPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(MinefieldResponseNackPdu left, MinefieldResponseNackPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._minefieldID.GetMarshalledSize(); // this._minefieldID - marshalSize += this._requestingEntityID.GetMarshalledSize(); // this._requestingEntityID - marshalSize += 1; // this._requestID - marshalSize += 1; // this._numberOfMissingPdus - for (int idx = 0; idx < this._missingPduSequenceNumbers.Count; idx++) - { - EightByteChunk listElement = (EightByteChunk)this._missingPduSequenceNumbers[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Minefield ID - /// - [XmlElement(Type = typeof(EntityID), ElementName = "minefieldID")] - public EntityID MinefieldID - { - get - { - return this._minefieldID; - } - - set - { - this._minefieldID = value; - } - } - - /// - /// Gets or sets the entity ID making the request - /// - [XmlElement(Type = typeof(EntityID), ElementName = "requestingEntityID")] - public EntityID RequestingEntityID - { - get - { - return this._requestingEntityID; - } - - set - { - this._requestingEntityID = value; - } - } - - /// - /// Gets or sets the request ID - /// - [XmlElement(Type = typeof(byte), ElementName = "requestID")] - public byte RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfMissingPdus method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfMissingPdus")] - public byte NumberOfMissingPdus - { - get - { - return this._numberOfMissingPdus; - } - - set - { - this._numberOfMissingPdus = value; - } - } - - /// - /// Gets or sets the PDU sequence numbers that were missing - /// - [XmlElement(ElementName = "missingPduSequenceNumbersList", Type = typeof(List))] - public List MissingPduSequenceNumbers - { - get - { - return this._missingPduSequenceNumbers; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._minefieldID.Marshal(dos); - this._requestingEntityID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._requestID); - dos.WriteUnsignedByte((byte)this._missingPduSequenceNumbers.Count); - - for (int idx = 0; idx < this._missingPduSequenceNumbers.Count; idx++) - { - EightByteChunk aEightByteChunk = (EightByteChunk)this._missingPduSequenceNumbers[idx]; - aEightByteChunk.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._minefieldID.Unmarshal(dis); - this._requestingEntityID.Unmarshal(dis); - this._requestID = dis.ReadUnsignedByte(); - this._numberOfMissingPdus = dis.ReadUnsignedByte(); - for (int idx = 0; idx < this.NumberOfMissingPdus; idx++) - { - EightByteChunk anX = new EightByteChunk(); - anX.Unmarshal(dis); - this._missingPduSequenceNumbers.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._minefieldID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._requestingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._missingPduSequenceNumbers.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._missingPduSequenceNumbers.Count; idx++) - { - sb.AppendLine(""); - EightByteChunk aEightByteChunk = (EightByteChunk)this._missingPduSequenceNumbers[idx]; - aEightByteChunk.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as MinefieldResponseNackPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(MinefieldResponseNackPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._minefieldID.Equals(obj._minefieldID)) - { - ivarsEqual = false; - } - - if (!this._requestingEntityID.Equals(obj._requestingEntityID)) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._numberOfMissingPdus != obj._numberOfMissingPdus) - { - ivarsEqual = false; - } - - if (this._missingPduSequenceNumbers.Count != obj._missingPduSequenceNumbers.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._missingPduSequenceNumbers.Count; idx++) - { - if (!this._missingPduSequenceNumbers[idx].Equals(obj._missingPduSequenceNumbers[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._minefieldID.GetHashCode(); - result = GenerateHash(result) ^ this._requestingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfMissingPdus.GetHashCode(); - - if (this._missingPduSequenceNumbers.Count > 0) - { - for (int idx = 0; idx < this._missingPduSequenceNumbers.Count; idx++) - { - result = GenerateHash(result) ^ this._missingPduSequenceNumbers[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/MinefieldStatePdu.cs b/tests/OpenDisNet.Reference/Generated/MinefieldStatePdu.cs deleted file mode 100644 index 7ba480f..0000000 --- a/tests/OpenDisNet.Reference/Generated/MinefieldStatePdu.cs +++ /dev/null @@ -1,723 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// information about the complete minefield. The minefield presence, perimiter, etc. Section 7.9.2 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(MinefieldIdentifier))] - [XmlInclude(typeof(EntityType))] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(EulerAngles))] - [XmlInclude(typeof(Vector2Float))] - [XmlInclude(typeof(EntityType))] - public partial class MinefieldStatePdu : MinefieldFamilyPdu, IEquatable - { - /// - /// Minefield ID - /// - private MinefieldIdentifier _minefieldID = new MinefieldIdentifier(); - - /// - /// Minefield sequence - /// - private ushort _minefieldSequence; - - /// - /// force ID - /// - private byte _forceID; - - /// - /// Number of permieter points - /// - private byte _numberOfPerimeterPoints; - - /// - /// type of minefield - /// - private EntityType _minefieldType = new EntityType(); - - /// - /// how many mine types - /// - private ushort _numberOfMineTypes; - - /// - /// location of center of minefield in world coords - /// - private Vector3Double _minefieldLocation = new Vector3Double(); - - /// - /// orientation of minefield - /// - private EulerAngles _minefieldOrientation = new EulerAngles(); - - /// - /// appearance bitflags - /// - private ushort _appearance; - - /// - /// protocolMode. First two bits are the protocol mode, 14 bits reserved. - /// - private ushort _protocolMode; - - /// - /// perimeter points for the minefield - /// - private List _perimeterPoints = new List(); - - /// - /// Type of mines - /// - private List _mineType = new List(); - - /// - /// Initializes a new instance of the class. - /// - public MinefieldStatePdu() - { - PduType = (byte)37; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(MinefieldStatePdu left, MinefieldStatePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(MinefieldStatePdu left, MinefieldStatePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._minefieldID.GetMarshalledSize(); // this._minefieldID - marshalSize += 2; // this._minefieldSequence - marshalSize += 1; // this._forceID - marshalSize += 1; // this._numberOfPerimeterPoints - marshalSize += this._minefieldType.GetMarshalledSize(); // this._minefieldType - marshalSize += 2; // this._numberOfMineTypes - marshalSize += this._minefieldLocation.GetMarshalledSize(); // this._minefieldLocation - marshalSize += this._minefieldOrientation.GetMarshalledSize(); // this._minefieldOrientation - marshalSize += 2; // this._appearance - marshalSize += 2; // this._protocolMode - for (int idx = 0; idx < this._perimeterPoints.Count; idx++) - { - Vector2Float listElement = (Vector2Float)this._perimeterPoints[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._mineType.Count; idx++) - { - EntityType listElement = (EntityType)this._mineType[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Minefield ID - /// - [XmlElement(Type = typeof(MinefieldIdentifier), ElementName = "minefieldID")] - public MinefieldIdentifier MinefieldID - { - get - { - return this._minefieldID; - } - - set - { - this._minefieldID = value; - } - } - - /// - /// Gets or sets the Minefield sequence - /// - [XmlElement(Type = typeof(ushort), ElementName = "minefieldSequence")] - public ushort MinefieldSequence - { - get - { - return this._minefieldSequence; - } - - set - { - this._minefieldSequence = value; - } - } - - /// - /// Gets or sets the force ID - /// - [XmlElement(Type = typeof(byte), ElementName = "forceID")] - public byte ForceID - { - get - { - return this._forceID; - } - - set - { - this._forceID = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfPerimeterPoints method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfPerimeterPoints")] - public byte NumberOfPerimeterPoints - { - get - { - return this._numberOfPerimeterPoints; - } - - set - { - this._numberOfPerimeterPoints = value; - } - } - - /// - /// Gets or sets the type of minefield - /// - [XmlElement(Type = typeof(EntityType), ElementName = "minefieldType")] - public EntityType MinefieldType - { - get - { - return this._minefieldType; - } - - set - { - this._minefieldType = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfMineTypes method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfMineTypes")] - public ushort NumberOfMineTypes - { - get - { - return this._numberOfMineTypes; - } - - set - { - this._numberOfMineTypes = value; - } - } - - /// - /// Gets or sets the location of center of minefield in world coords - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "minefieldLocation")] - public Vector3Double MinefieldLocation - { - get - { - return this._minefieldLocation; - } - - set - { - this._minefieldLocation = value; - } - } - - /// - /// Gets or sets the orientation of minefield - /// - [XmlElement(Type = typeof(EulerAngles), ElementName = "minefieldOrientation")] - public EulerAngles MinefieldOrientation - { - get - { - return this._minefieldOrientation; - } - - set - { - this._minefieldOrientation = value; - } - } - - /// - /// Gets or sets the appearance bitflags - /// - [XmlElement(Type = typeof(ushort), ElementName = "appearance")] - public ushort Appearance - { - get - { - return this._appearance; - } - - set - { - this._appearance = value; - } - } - - /// - /// Gets or sets the protocolMode. First two bits are the protocol mode, 14 bits reserved. - /// - [XmlElement(Type = typeof(ushort), ElementName = "protocolMode")] - public ushort ProtocolMode - { - get - { - return this._protocolMode; - } - - set - { - this._protocolMode = value; - } - } - - /// - /// Gets or sets the perimeter points for the minefield - /// - [XmlElement(ElementName = "perimeterPointsList", Type = typeof(List))] - public List PerimeterPoints - { - get - { - return this._perimeterPoints; - } - } - - /// - /// Gets or sets the Type of mines - /// - [XmlElement(ElementName = "mineTypeList", Type = typeof(List))] - public List MineType - { - get - { - return this._mineType; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._minefieldID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._minefieldSequence); - dos.WriteUnsignedByte((byte)this._forceID); - dos.WriteUnsignedByte((byte)this._perimeterPoints.Count); - this._minefieldType.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._mineType.Count); - this._minefieldLocation.Marshal(dos); - this._minefieldOrientation.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._appearance); - dos.WriteUnsignedShort((ushort)this._protocolMode); - - for (int idx = 0; idx < this._perimeterPoints.Count; idx++) - { - Vector2Float aVector2Float = (Vector2Float)this._perimeterPoints[idx]; - aVector2Float.Marshal(dos); - } - - for (int idx = 0; idx < this._mineType.Count; idx++) - { - EntityType aEntityType = (EntityType)this._mineType[idx]; - aEntityType.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._minefieldID.Unmarshal(dis); - this._minefieldSequence = dis.ReadUnsignedShort(); - this._forceID = dis.ReadUnsignedByte(); - this._numberOfPerimeterPoints = dis.ReadUnsignedByte(); - this._minefieldType.Unmarshal(dis); - this._numberOfMineTypes = dis.ReadUnsignedShort(); - this._minefieldLocation.Unmarshal(dis); - this._minefieldOrientation.Unmarshal(dis); - this._appearance = dis.ReadUnsignedShort(); - this._protocolMode = dis.ReadUnsignedShort(); - for (int idx = 0; idx < this.NumberOfPerimeterPoints; idx++) - { - Vector2Float anX = new Vector2Float(); - anX.Unmarshal(dis); - this._perimeterPoints.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfMineTypes; idx++) - { - EntityType anX = new EntityType(); - anX.Unmarshal(dis); - this._mineType.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._minefieldID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._minefieldSequence.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._forceID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._perimeterPoints.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._minefieldType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._mineType.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._minefieldLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._minefieldOrientation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._appearance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._protocolMode.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._perimeterPoints.Count; idx++) - { - sb.AppendLine(""); - Vector2Float aVector2Float = (Vector2Float)this._perimeterPoints[idx]; - aVector2Float.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._mineType.Count; idx++) - { - sb.AppendLine(""); - EntityType aEntityType = (EntityType)this._mineType[idx]; - aEntityType.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as MinefieldStatePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(MinefieldStatePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._minefieldID.Equals(obj._minefieldID)) - { - ivarsEqual = false; - } - - if (this._minefieldSequence != obj._minefieldSequence) - { - ivarsEqual = false; - } - - if (this._forceID != obj._forceID) - { - ivarsEqual = false; - } - - if (this._numberOfPerimeterPoints != obj._numberOfPerimeterPoints) - { - ivarsEqual = false; - } - - if (!this._minefieldType.Equals(obj._minefieldType)) - { - ivarsEqual = false; - } - - if (this._numberOfMineTypes != obj._numberOfMineTypes) - { - ivarsEqual = false; - } - - if (!this._minefieldLocation.Equals(obj._minefieldLocation)) - { - ivarsEqual = false; - } - - if (!this._minefieldOrientation.Equals(obj._minefieldOrientation)) - { - ivarsEqual = false; - } - - if (this._appearance != obj._appearance) - { - ivarsEqual = false; - } - - if (this._protocolMode != obj._protocolMode) - { - ivarsEqual = false; - } - - if (this._perimeterPoints.Count != obj._perimeterPoints.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._perimeterPoints.Count; idx++) - { - if (!this._perimeterPoints[idx].Equals(obj._perimeterPoints[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._mineType.Count != obj._mineType.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._mineType.Count; idx++) - { - if (!this._mineType[idx].Equals(obj._mineType[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._minefieldID.GetHashCode(); - result = GenerateHash(result) ^ this._minefieldSequence.GetHashCode(); - result = GenerateHash(result) ^ this._forceID.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfPerimeterPoints.GetHashCode(); - result = GenerateHash(result) ^ this._minefieldType.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfMineTypes.GetHashCode(); - result = GenerateHash(result) ^ this._minefieldLocation.GetHashCode(); - result = GenerateHash(result) ^ this._minefieldOrientation.GetHashCode(); - result = GenerateHash(result) ^ this._appearance.GetHashCode(); - result = GenerateHash(result) ^ this._protocolMode.GetHashCode(); - - if (this._perimeterPoints.Count > 0) - { - for (int idx = 0; idx < this._perimeterPoints.Count; idx++) - { - result = GenerateHash(result) ^ this._perimeterPoints[idx].GetHashCode(); - } - } - - if (this._mineType.Count > 0) - { - for (int idx = 0; idx < this._mineType.Count; idx++) - { - result = GenerateHash(result) ^ this._mineType[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ModulationParameters.cs b/tests/OpenDisNet.Reference/Generated/ModulationParameters.cs deleted file mode 100644 index 1604180..0000000 --- a/tests/OpenDisNet.Reference/Generated/ModulationParameters.cs +++ /dev/null @@ -1,245 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Modulation parameters associated with a specific radio system. INCOMPLETE. 6.2.58 - /// - [Serializable] - [XmlRoot] - public partial class ModulationParameters - { - /// - /// Initializes a new instance of the class. - /// - public ModulationParameters() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ModulationParameters left, ModulationParameters right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ModulationParameters left, ModulationParameters right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - return marshalSize; - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ModulationParameters; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ModulationParameters obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ModulationType.cs b/tests/OpenDisNet.Reference/Generated/ModulationType.cs deleted file mode 100644 index c0357e3..0000000 --- a/tests/OpenDisNet.Reference/Generated/ModulationType.cs +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about the type of modulation used for radio transmission. 6.2.59 - /// - [Serializable] - [XmlRoot] - public partial class ModulationType - { - /// - /// This field shall indicate the spread spectrum technique or combination of spread spectrum techniques in use. Bt field. - /// - private ushort _spreadSpectrum; - - /// - /// the major classification of the modulation type. - /// - private ushort _majorModulation; - - /// - /// provide certain detailed information depending upon the major modulation type - /// - private ushort _detail; - - /// - /// the radio system associated with this Transmitter PDU and shall be used as the basis to interpret other fields whose values depend on a specific radio system. - /// - private ushort _radioSystem; - - /// - /// Initializes a new instance of the class. - /// - public ModulationType() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ModulationType left, ModulationType right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ModulationType left, ModulationType right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._spreadSpectrum - marshalSize += 2; // this._majorModulation - marshalSize += 2; // this._detail - marshalSize += 2; // this._radioSystem - return marshalSize; - } - - /// - /// Gets or sets the This field shall indicate the spread spectrum technique or combination of spread spectrum techniques in use. Bt field. - /// - [XmlElement(Type = typeof(ushort), ElementName = "spreadSpectrum")] - public ushort SpreadSpectrum - { - get - { - return this._spreadSpectrum; - } - - set - { - this._spreadSpectrum = value; - } - } - - /// - /// Gets or sets the the major classification of the modulation type. - /// - [XmlElement(Type = typeof(ushort), ElementName = "majorModulation")] - public ushort MajorModulation - { - get - { - return this._majorModulation; - } - - set - { - this._majorModulation = value; - } - } - - /// - /// Gets or sets the provide certain detailed information depending upon the major modulation type - /// - [XmlElement(Type = typeof(ushort), ElementName = "detail")] - public ushort Detail - { - get - { - return this._detail; - } - - set - { - this._detail = value; - } - } - - /// - /// Gets or sets the the radio system associated with this Transmitter PDU and shall be used as the basis to interpret other fields whose values depend on a specific radio system. - /// - [XmlElement(Type = typeof(ushort), ElementName = "radioSystem")] - public ushort RadioSystem - { - get - { - return this._radioSystem; - } - - set - { - this._radioSystem = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._spreadSpectrum); - dos.WriteUnsignedShort((ushort)this._majorModulation); - dos.WriteUnsignedShort((ushort)this._detail); - dos.WriteUnsignedShort((ushort)this._radioSystem); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._spreadSpectrum = dis.ReadUnsignedShort(); - this._majorModulation = dis.ReadUnsignedShort(); - this._detail = dis.ReadUnsignedShort(); - this._radioSystem = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._spreadSpectrum.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._majorModulation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._detail.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._radioSystem.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ModulationType; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ModulationType obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._spreadSpectrum != obj._spreadSpectrum) - { - ivarsEqual = false; - } - - if (this._majorModulation != obj._majorModulation) - { - ivarsEqual = false; - } - - if (this._detail != obj._detail) - { - ivarsEqual = false; - } - - if (this._radioSystem != obj._radioSystem) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._spreadSpectrum.GetHashCode(); - result = GenerateHash(result) ^ this._majorModulation.GetHashCode(); - result = GenerateHash(result) ^ this._detail.GetHashCode(); - result = GenerateHash(result) ^ this._radioSystem.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Munition.cs b/tests/OpenDisNet.Reference/Generated/Munition.cs deleted file mode 100644 index 329ed6c..0000000 --- a/tests/OpenDisNet.Reference/Generated/Munition.cs +++ /dev/null @@ -1,408 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// An entity's munition (e.g., bomb, missile) information shall be represented by one or more Munition records. For each type or location of munition, this record shall specify the type, location, quantity and status of munitions that an entity contains. Section 6.2.60 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class Munition - { - /// - /// This field shall identify the entity type of the munition. See section 6.2.30. - /// - private EntityType _munitionType = new EntityType(); - - /// - /// the station or launcher to which the munition is assigned. See Annex I - /// - private uint _station; - - /// - /// the quantity remaining of this munition. - /// - private ushort _quantity; - - /// - /// the status of the munition. It shall be represented by an 8-bit enumeration. - /// - private byte _munitionStatus; - - /// - /// padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public Munition() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Munition left, Munition right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Munition left, Munition right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._munitionType.GetMarshalledSize(); // this._munitionType - marshalSize += 4; // this._station - marshalSize += 2; // this._quantity - marshalSize += 1; // this._munitionStatus - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the This field shall identify the entity type of the munition. See section 6.2.30. - /// - [XmlElement(Type = typeof(EntityType), ElementName = "munitionType")] - public EntityType MunitionType - { - get - { - return this._munitionType; - } - - set - { - this._munitionType = value; - } - } - - /// - /// Gets or sets the the station or launcher to which the munition is assigned. See Annex I - /// - [XmlElement(Type = typeof(uint), ElementName = "station")] - public uint Station - { - get - { - return this._station; - } - - set - { - this._station = value; - } - } - - /// - /// Gets or sets the the quantity remaining of this munition. - /// - [XmlElement(Type = typeof(ushort), ElementName = "quantity")] - public ushort Quantity - { - get - { - return this._quantity; - } - - set - { - this._quantity = value; - } - } - - /// - /// Gets or sets the the status of the munition. It shall be represented by an 8-bit enumeration. - /// - [XmlElement(Type = typeof(byte), ElementName = "munitionStatus")] - public byte MunitionStatus - { - get - { - return this._munitionStatus; - } - - set - { - this._munitionStatus = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._munitionType.Marshal(dos); - dos.WriteUnsignedInt((uint)this._station); - dos.WriteUnsignedShort((ushort)this._quantity); - dos.WriteUnsignedByte((byte)this._munitionStatus); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._munitionType.Unmarshal(dis); - this._station = dis.ReadUnsignedInt(); - this._quantity = dis.ReadUnsignedShort(); - this._munitionStatus = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._munitionType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._station.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._quantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._munitionStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Munition; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Munition obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._munitionType.Equals(obj._munitionType)) - { - ivarsEqual = false; - } - - if (this._station != obj._station) - { - ivarsEqual = false; - } - - if (this._quantity != obj._quantity) - { - ivarsEqual = false; - } - - if (this._munitionStatus != obj._munitionStatus) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._munitionType.GetHashCode(); - result = GenerateHash(result) ^ this._station.GetHashCode(); - result = GenerateHash(result) ^ this._quantity.GetHashCode(); - result = GenerateHash(result) ^ this._munitionStatus.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/MunitionDescriptor.cs b/tests/OpenDisNet.Reference/Generated/MunitionDescriptor.cs deleted file mode 100644 index 6d4ba12..0000000 --- a/tests/OpenDisNet.Reference/Generated/MunitionDescriptor.cs +++ /dev/null @@ -1,408 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Represents the firing or detonation of a munition. Section 6.2.20.2 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class MunitionDescriptor - { - /// - /// What munition was used in the burst - /// - private EntityType _munitionType = new EntityType(); - - /// - /// type of warhead - /// - private ushort _warhead; - - /// - /// type of fuse used - /// - private ushort _fuse; - - /// - /// how many of the munition were fired - /// - private ushort _quantity; - - /// - /// rate at which the munition was fired - /// - private ushort _rate; - - /// - /// Initializes a new instance of the class. - /// - public MunitionDescriptor() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(MunitionDescriptor left, MunitionDescriptor right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(MunitionDescriptor left, MunitionDescriptor right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._munitionType.GetMarshalledSize(); // this._munitionType - marshalSize += 2; // this._warhead - marshalSize += 2; // this._fuse - marshalSize += 2; // this._quantity - marshalSize += 2; // this._rate - return marshalSize; - } - - /// - /// Gets or sets the What munition was used in the burst - /// - [XmlElement(Type = typeof(EntityType), ElementName = "munitionType")] - public EntityType MunitionType - { - get - { - return this._munitionType; - } - - set - { - this._munitionType = value; - } - } - - /// - /// Gets or sets the type of warhead - /// - [XmlElement(Type = typeof(ushort), ElementName = "warhead")] - public ushort Warhead - { - get - { - return this._warhead; - } - - set - { - this._warhead = value; - } - } - - /// - /// Gets or sets the type of fuse used - /// - [XmlElement(Type = typeof(ushort), ElementName = "fuse")] - public ushort Fuse - { - get - { - return this._fuse; - } - - set - { - this._fuse = value; - } - } - - /// - /// Gets or sets the how many of the munition were fired - /// - [XmlElement(Type = typeof(ushort), ElementName = "quantity")] - public ushort Quantity - { - get - { - return this._quantity; - } - - set - { - this._quantity = value; - } - } - - /// - /// Gets or sets the rate at which the munition was fired - /// - [XmlElement(Type = typeof(ushort), ElementName = "rate")] - public ushort Rate - { - get - { - return this._rate; - } - - set - { - this._rate = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._munitionType.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._warhead); - dos.WriteUnsignedShort((ushort)this._fuse); - dos.WriteUnsignedShort((ushort)this._quantity); - dos.WriteUnsignedShort((ushort)this._rate); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._munitionType.Unmarshal(dis); - this._warhead = dis.ReadUnsignedShort(); - this._fuse = dis.ReadUnsignedShort(); - this._quantity = dis.ReadUnsignedShort(); - this._rate = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._munitionType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._warhead.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuse.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._quantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._rate.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as MunitionDescriptor; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(MunitionDescriptor obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._munitionType.Equals(obj._munitionType)) - { - ivarsEqual = false; - } - - if (this._warhead != obj._warhead) - { - ivarsEqual = false; - } - - if (this._fuse != obj._fuse) - { - ivarsEqual = false; - } - - if (this._quantity != obj._quantity) - { - ivarsEqual = false; - } - - if (this._rate != obj._rate) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._munitionType.GetHashCode(); - result = GenerateHash(result) ^ this._warhead.GetHashCode(); - result = GenerateHash(result) ^ this._fuse.GetHashCode(); - result = GenerateHash(result) ^ this._quantity.GetHashCode(); - result = GenerateHash(result) ^ this._rate.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/MunitionReload.cs b/tests/OpenDisNet.Reference/Generated/MunitionReload.cs deleted file mode 100644 index e946bd3..0000000 --- a/tests/OpenDisNet.Reference/Generated/MunitionReload.cs +++ /dev/null @@ -1,440 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// indicate weapons (munitions) previously communicated via the Munition record. Section 6.2.61 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class MunitionReload - { - /// - /// This field shall identify the entity type of the munition. See section 6.2.30. - /// - private EntityType _munitionType = new EntityType(); - - /// - /// the station or launcher to which the munition is assigned. See Annex I - /// - private uint _station; - - /// - /// the standard quantity of this munition type normally loaded at this station/launcher if a station/launcher is specified. - /// - private ushort _standardQuantity; - - /// - /// the maximum quantity of this munition type that this station/launcher is capable of holding when a station/launcher is specified - /// - private ushort _maximumQuantity; - - /// - /// the station name within the host at which the part entity is located. - /// - private ushort _stationName; - - /// - /// the number of the particular wing station, cargo hold etc., at which the part is attached. - /// - private ushort _stationNumber; - - /// - /// Initializes a new instance of the class. - /// - public MunitionReload() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(MunitionReload left, MunitionReload right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(MunitionReload left, MunitionReload right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._munitionType.GetMarshalledSize(); // this._munitionType - marshalSize += 4; // this._station - marshalSize += 2; // this._standardQuantity - marshalSize += 2; // this._maximumQuantity - marshalSize += 2; // this._stationName - marshalSize += 2; // this._stationNumber - return marshalSize; - } - - /// - /// Gets or sets the This field shall identify the entity type of the munition. See section 6.2.30. - /// - [XmlElement(Type = typeof(EntityType), ElementName = "munitionType")] - public EntityType MunitionType - { - get - { - return this._munitionType; - } - - set - { - this._munitionType = value; - } - } - - /// - /// Gets or sets the the station or launcher to which the munition is assigned. See Annex I - /// - [XmlElement(Type = typeof(uint), ElementName = "station")] - public uint Station - { - get - { - return this._station; - } - - set - { - this._station = value; - } - } - - /// - /// Gets or sets the the standard quantity of this munition type normally loaded at this station/launcher if a station/launcher is specified. - /// - [XmlElement(Type = typeof(ushort), ElementName = "standardQuantity")] - public ushort StandardQuantity - { - get - { - return this._standardQuantity; - } - - set - { - this._standardQuantity = value; - } - } - - /// - /// Gets or sets the the maximum quantity of this munition type that this station/launcher is capable of holding when a station/launcher is specified - /// - [XmlElement(Type = typeof(ushort), ElementName = "maximumQuantity")] - public ushort MaximumQuantity - { - get - { - return this._maximumQuantity; - } - - set - { - this._maximumQuantity = value; - } - } - - /// - /// Gets or sets the the station name within the host at which the part entity is located. - /// - [XmlElement(Type = typeof(ushort), ElementName = "stationName")] - public ushort StationName - { - get - { - return this._stationName; - } - - set - { - this._stationName = value; - } - } - - /// - /// Gets or sets the the number of the particular wing station, cargo hold etc., at which the part is attached. - /// - [XmlElement(Type = typeof(ushort), ElementName = "stationNumber")] - public ushort StationNumber - { - get - { - return this._stationNumber; - } - - set - { - this._stationNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._munitionType.Marshal(dos); - dos.WriteUnsignedInt((uint)this._station); - dos.WriteUnsignedShort((ushort)this._standardQuantity); - dos.WriteUnsignedShort((ushort)this._maximumQuantity); - dos.WriteUnsignedShort((ushort)this._stationName); - dos.WriteUnsignedShort((ushort)this._stationNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._munitionType.Unmarshal(dis); - this._station = dis.ReadUnsignedInt(); - this._standardQuantity = dis.ReadUnsignedShort(); - this._maximumQuantity = dis.ReadUnsignedShort(); - this._stationName = dis.ReadUnsignedShort(); - this._stationNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._munitionType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._station.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._standardQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._maximumQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._stationName.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._stationNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as MunitionReload; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(MunitionReload obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._munitionType.Equals(obj._munitionType)) - { - ivarsEqual = false; - } - - if (this._station != obj._station) - { - ivarsEqual = false; - } - - if (this._standardQuantity != obj._standardQuantity) - { - ivarsEqual = false; - } - - if (this._maximumQuantity != obj._maximumQuantity) - { - ivarsEqual = false; - } - - if (this._stationName != obj._stationName) - { - ivarsEqual = false; - } - - if (this._stationNumber != obj._stationNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._munitionType.GetHashCode(); - result = GenerateHash(result) ^ this._station.GetHashCode(); - result = GenerateHash(result) ^ this._standardQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._maximumQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._stationName.GetHashCode(); - result = GenerateHash(result) ^ this._stationNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/NamedLocationIdentification.cs b/tests/OpenDisNet.Reference/Generated/NamedLocationIdentification.cs deleted file mode 100644 index 78f943b..0000000 --- a/tests/OpenDisNet.Reference/Generated/NamedLocationIdentification.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about the discrete positional relationship of the part entity with respect to the its host entity Section 6.2.62 - /// - [Serializable] - [XmlRoot] - public partial class NamedLocationIdentification - { - /// - /// the station name within the host at which the part entity is located. If the part entity is On Station, this field shall specify the representation of the part’s location data fields. This field shall be specified by a 16-bit enumeration - /// - private ushort _stationName; - - /// - /// the number of the particular wing station, cargo hold etc., at which the part is attached. - /// - private ushort _stationNumber; - - /// - /// Initializes a new instance of the class. - /// - public NamedLocationIdentification() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(NamedLocationIdentification left, NamedLocationIdentification right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(NamedLocationIdentification left, NamedLocationIdentification right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._stationName - marshalSize += 2; // this._stationNumber - return marshalSize; - } - - /// - /// Gets or sets the the station name within the host at which the part entity is located. If the part entity is On Station, this field shall specify the representation of the part’s location data fields. This field shall be specified by a 16-bit enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "stationName")] - public ushort StationName - { - get - { - return this._stationName; - } - - set - { - this._stationName = value; - } - } - - /// - /// Gets or sets the the number of the particular wing station, cargo hold etc., at which the part is attached. - /// - [XmlElement(Type = typeof(ushort), ElementName = "stationNumber")] - public ushort StationNumber - { - get - { - return this._stationNumber; - } - - set - { - this._stationNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._stationName); - dos.WriteUnsignedShort((ushort)this._stationNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._stationName = dis.ReadUnsignedShort(); - this._stationNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._stationName.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._stationNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as NamedLocationIdentification; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(NamedLocationIdentification obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._stationName != obj._stationName) - { - ivarsEqual = false; - } - - if (this._stationNumber != obj._stationNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._stationName.GetHashCode(); - result = GenerateHash(result) ^ this._stationNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ObjectIdentifier.cs b/tests/OpenDisNet.Reference/Generated/ObjectIdentifier.cs deleted file mode 100644 index 0bc1a50..0000000 --- a/tests/OpenDisNet.Reference/Generated/ObjectIdentifier.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of an environmental object. Section 6.2.63 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class ObjectIdentifier - { - /// - /// Simulation Address - /// - private SimulationAddress _simulationAddress = new SimulationAddress(); - - /// - /// - /// - private ushort _objectNumber; - - /// - /// Initializes a new instance of the class. - /// - public ObjectIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ObjectIdentifier left, ObjectIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ObjectIdentifier left, ObjectIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._objectNumber - return marshalSize; - } - - /// - /// Gets or sets the Simulation Address - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "simulationAddress")] - public SimulationAddress SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - /// - /// Gets or sets the - /// - [XmlElement(Type = typeof(ushort), ElementName = "objectNumber")] - public ushort ObjectNumber - { - get - { - return this._objectNumber; - } - - set - { - this._objectNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._objectNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._objectNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._objectNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ObjectIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ObjectIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._objectNumber != obj._objectNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._objectNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ObjectType.cs b/tests/OpenDisNet.Reference/Generated/ObjectType.cs deleted file mode 100644 index 037f713..0000000 --- a/tests/OpenDisNet.Reference/Generated/ObjectType.cs +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of an environmental object. Section 6.2.64 - /// - [Serializable] - [XmlRoot] - public partial class ObjectType - { - /// - /// Domain of entity (air, surface, subsurface, space, etc) - /// - private byte _domain; - - /// - /// country to which the design of the entity is attributed - /// - private byte _objectKind; - - /// - /// category of entity - /// - private byte _category; - - /// - /// subcategory of entity - /// - private byte _subcategory; - - /// - /// Initializes a new instance of the class. - /// - public ObjectType() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ObjectType left, ObjectType right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ObjectType left, ObjectType right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._domain - marshalSize += 1; // this._objectKind - marshalSize += 1; // this._category - marshalSize += 1; // this._subcategory - return marshalSize; - } - - /// - /// Gets or sets the Domain of entity (air, surface, subsurface, space, etc) - /// - [XmlElement(Type = typeof(byte), ElementName = "domain")] - public byte Domain - { - get - { - return this._domain; - } - - set - { - this._domain = value; - } - } - - /// - /// Gets or sets the country to which the design of the entity is attributed - /// - [XmlElement(Type = typeof(byte), ElementName = "objectKind")] - public byte ObjectKind - { - get - { - return this._objectKind; - } - - set - { - this._objectKind = value; - } - } - - /// - /// Gets or sets the category of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "category")] - public byte Category - { - get - { - return this._category; - } - - set - { - this._category = value; - } - } - - /// - /// Gets or sets the subcategory of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "subcategory")] - public byte Subcategory - { - get - { - return this._subcategory; - } - - set - { - this._subcategory = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._domain); - dos.WriteUnsignedByte((byte)this._objectKind); - dos.WriteUnsignedByte((byte)this._category); - dos.WriteUnsignedByte((byte)this._subcategory); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._domain = dis.ReadUnsignedByte(); - this._objectKind = dis.ReadUnsignedByte(); - this._category = dis.ReadUnsignedByte(); - this._subcategory = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._domain.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._objectKind.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._category.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._subcategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ObjectType; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ObjectType obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._domain != obj._domain) - { - ivarsEqual = false; - } - - if (this._objectKind != obj._objectKind) - { - ivarsEqual = false; - } - - if (this._category != obj._category) - { - ivarsEqual = false; - } - - if (this._subcategory != obj._subcategory) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._domain.GetHashCode(); - result = GenerateHash(result) ^ this._objectKind.GetHashCode(); - result = GenerateHash(result) ^ this._category.GetHashCode(); - result = GenerateHash(result) ^ this._subcategory.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/OneByteChunk.cs b/tests/OpenDisNet.Reference/Generated/OneByteChunk.cs deleted file mode 100644 index 6b45bd8..0000000 --- a/tests/OpenDisNet.Reference/Generated/OneByteChunk.cs +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// 8 bit piece of data - /// - [Serializable] - [XmlRoot] - public partial class OneByteChunk - { - /// - /// one byte of arbitrary data - /// - private byte[] _otherParameters = new byte[1]; - - /// - /// Initializes a new instance of the class. - /// - public OneByteChunk() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(OneByteChunk left, OneByteChunk right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(OneByteChunk left, OneByteChunk right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1 * 1; // _otherParameters - return marshalSize; - } - - /// - /// Gets or sets the one byte of arbitrary data - /// - [XmlArray(ElementName = "otherParameters")] - public byte[] OtherParameters - { - get - { - return this._otherParameters; - } - - set - { - this._otherParameters = value; - } -} - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - dos.WriteByte(this._otherParameters[idx]); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - this._otherParameters[idx] = dis.ReadByte(); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - sb.AppendLine("" + this._otherParameters[idx] + ""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as OneByteChunk; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(OneByteChunk obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (obj._otherParameters.Length != 1) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 1; idx++) - { - if (this._otherParameters[idx] != obj._otherParameters[idx]) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - - for (int idx = 0; idx < 1; idx++) - { - result = GenerateHash(result) ^ this._otherParameters[idx].GetHashCode(); - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/OwnershipStatus.cs b/tests/OpenDisNet.Reference/Generated/OwnershipStatus.cs deleted file mode 100644 index d14ac6c..0000000 --- a/tests/OpenDisNet.Reference/Generated/OwnershipStatus.cs +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// used to convey entity and conflict status information associated with transferring ownership of an entity. Section 6.2.65 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class OwnershipStatus - { - /// - /// EntityID - /// - private EntityID _entityId = new EntityID(); - - /// - /// The ownership and/or ownership conflict status of the entity represented by the Entity ID field. - /// - private byte _ownershipStatus; - - /// - /// padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public OwnershipStatus() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(OwnershipStatus left, OwnershipStatus right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(OwnershipStatus left, OwnershipStatus right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._entityId.GetMarshalledSize(); // this._entityId - marshalSize += 1; // this._ownershipStatus - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the EntityID - /// - [XmlElement(Type = typeof(EntityID), ElementName = "entityId")] - public EntityID EntityId - { - get - { - return this._entityId; - } - - set - { - this._entityId = value; - } - } - - /// - /// Gets or sets the The ownership and/or ownership conflict status of the entity represented by the Entity ID field. - /// - [XmlElement(Type = typeof(byte), ElementName = "ownershipStatus")] - public byte OwnershipStatus_ - { - get - { - return this._ownershipStatus; - } - - set - { - this._ownershipStatus = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._entityId.Marshal(dos); - dos.WriteUnsignedByte((byte)this._ownershipStatus); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._entityId.Unmarshal(dis); - this._ownershipStatus = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._entityId.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._ownershipStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as OwnershipStatus; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(OwnershipStatus obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._entityId.Equals(obj._entityId)) - { - ivarsEqual = false; - } - - if (this._ownershipStatus != obj._ownershipStatus) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._entityId.GetHashCode(); - result = GenerateHash(result) ^ this._ownershipStatus.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Pdu.cs b/tests/OpenDisNet.Reference/Generated/Pdu.cs deleted file mode 100644 index d6e238c..0000000 --- a/tests/OpenDisNet.Reference/Generated/Pdu.cs +++ /dev/null @@ -1,301 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Adds some fields to the the classic PDU - /// - [Serializable] - [XmlRoot] - public partial class Pdu : PduSuperclass, IEquatable - { - /// - /// PDU Status Record. Described in 6.2.67. This field is not present in earlier DIS versions - /// - private byte _pduStatus; - - /// - /// zero-filled array of padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public Pdu() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Pdu left, Pdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Pdu left, Pdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 1; // this._pduStatus - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the PDU Status Record. Described in 6.2.67. This field is not present in earlier DIS versions - /// - [XmlElement(Type = typeof(byte), ElementName = "pduStatus")] - public byte PduStatus - { - get - { - return this._pduStatus; - } - - set - { - this._pduStatus = value; - } - } - - /// - /// Gets or sets the zero-filled array of padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._pduStatus); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._pduStatus = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._pduStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Pdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Pdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._pduStatus != obj._pduStatus) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._pduStatus.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/PduContainer.cs b/tests/OpenDisNet.Reference/Generated/PduContainer.cs deleted file mode 100644 index 75a0ccc..0000000 --- a/tests/OpenDisNet.Reference/Generated/PduContainer.cs +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Used for XML compatability. A container that holds PDUs - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(Pdu))] - public partial class PduContainer - { - /// - /// Number of PDUs in the container list - /// - private int _numberOfPdus; - - /// - /// record sets - /// - private List _pdus = new List(); - - /// - /// Initializes a new instance of the class. - /// - public PduContainer() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(PduContainer left, PduContainer right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(PduContainer left, PduContainer right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._numberOfPdus - for (int idx = 0; idx < this._pdus.Count; idx++) - { - Pdu listElement = (Pdu)this._pdus[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfPdus method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(int), ElementName = "numberOfPdus")] - public int NumberOfPdus - { - get - { - return this._numberOfPdus; - } - - set - { - this._numberOfPdus = value; - } - } - - /// - /// Gets or sets the record sets - /// - [XmlElement(ElementName = "pdusList", Type = typeof(List))] - public List Pdus - { - get - { - return this._pdus; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteInt((int)this._pdus.Count); - - for (int idx = 0; idx < this._pdus.Count; idx++) - { - Pdu aPdu = (Pdu)this._pdus[idx]; - aPdu.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._numberOfPdus = dis.ReadInt(); - for (int idx = 0; idx < this.NumberOfPdus; idx++) - { - Pdu anX = new Pdu(); - anX.Unmarshal(dis); - this._pdus.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._pdus.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._pdus.Count; idx++) - { - sb.AppendLine(""); - Pdu aPdu = (Pdu)this._pdus[idx]; - aPdu.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as PduContainer; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(PduContainer obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._numberOfPdus != obj._numberOfPdus) - { - ivarsEqual = false; - } - - if (this._pdus.Count != obj._pdus.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._pdus.Count; idx++) - { - if (!this._pdus[idx].Equals(obj._pdus[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._numberOfPdus.GetHashCode(); - - if (this._pdus.Count > 0) - { - for (int idx = 0; idx < this._pdus.Count; idx++) - { - result = GenerateHash(result) ^ this._pdus[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/PduHeader.cs b/tests/OpenDisNet.Reference/Generated/PduHeader.cs deleted file mode 100644 index 11ee605..0000000 --- a/tests/OpenDisNet.Reference/Generated/PduHeader.cs +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Not used. The PDU Header Record is directly incoroporated into the PDU class. Here for completness only. Section 6.2.66 - /// - [Serializable] - [XmlRoot] - public partial class PduHeader - { - /// - /// The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2009. - /// - private byte _protocolVersion = 7; - - /// - /// Exercise ID - /// - private byte _exerciseID; - - /// - /// Type of pdu, unique for each PDU class - /// - private byte _pduType; - - /// - /// value that refers to the protocol family, eg SimulationManagement, etc - /// - private byte _protocolFamily; - - /// - /// Timestamp value - /// - private uint _timestamp; - - /// - /// Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word. - /// - private byte _pduLength; - - /// - /// PDU Status Record. Described in 6.2.67. This field is not present in earlier DIS versions - /// - private ushort _pduStatus; - - /// - /// zero filled array of padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public PduHeader() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(PduHeader left, PduHeader right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(PduHeader left, PduHeader right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._protocolVersion - marshalSize += 1; // this._exerciseID - marshalSize += 1; // this._pduType - marshalSize += 1; // this._protocolFamily - marshalSize += 4; // this._timestamp - marshalSize += 1; // this._pduLength - marshalSize += 2; // this._pduStatus - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2009. - /// - [XmlElement(Type = typeof(byte), ElementName = "protocolVersion")] - public byte ProtocolVersion - { - get - { - return this._protocolVersion; - } - - set - { - this._protocolVersion = value; - } - } - - /// - /// Gets or sets the Exercise ID - /// - [XmlElement(Type = typeof(byte), ElementName = "exerciseID")] - public byte ExerciseID - { - get - { - return this._exerciseID; - } - - set - { - this._exerciseID = value; - } - } - - /// - /// Gets or sets the Type of pdu, unique for each PDU class - /// - [XmlElement(Type = typeof(byte), ElementName = "pduType")] - public byte PduType - { - get - { - return this._pduType; - } - - set - { - this._pduType = value; - } - } - - /// - /// Gets or sets the value that refers to the protocol family, eg SimulationManagement, etc - /// - [XmlElement(Type = typeof(byte), ElementName = "protocolFamily")] - public byte ProtocolFamily - { - get - { - return this._protocolFamily; - } - - set - { - this._protocolFamily = value; - } - } - - /// - /// Gets or sets the Timestamp value - /// - [XmlElement(Type = typeof(uint), ElementName = "timestamp")] - public uint Timestamp - { - get - { - return this._timestamp; - } - - set - { - this._timestamp = value; - } - } - - /// - /// Gets or sets the Length, in bytes, of the PDU. Changed name from length to avoid use of Hibernate QL reserved word. - /// - [XmlElement(Type = typeof(byte), ElementName = "pduLength")] - public byte PduLength - { - get - { - return this._pduLength; - } - - set - { - this._pduLength = value; - } - } - - /// - /// Gets or sets the PDU Status Record. Described in 6.2.67. This field is not present in earlier DIS versions - /// - [XmlElement(Type = typeof(ushort), ElementName = "pduStatus")] - public ushort PduStatus - { - get - { - return this._pduStatus; - } - - set - { - this._pduStatus = value; - } - } - - /// - /// Gets or sets the zero filled array of padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._protocolVersion); - dos.WriteUnsignedByte((byte)this._exerciseID); - dos.WriteUnsignedByte((byte)this._pduType); - dos.WriteUnsignedByte((byte)this._protocolFamily); - dos.WriteUnsignedInt((uint)this._timestamp); - dos.WriteUnsignedByte((byte)this._pduLength); - dos.WriteUnsignedShort((ushort)this._pduStatus); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._protocolVersion = dis.ReadUnsignedByte(); - this._exerciseID = dis.ReadUnsignedByte(); - this._pduType = dis.ReadUnsignedByte(); - this._protocolFamily = dis.ReadUnsignedByte(); - this._timestamp = dis.ReadUnsignedInt(); - this._pduLength = dis.ReadUnsignedByte(); - this._pduStatus = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._protocolVersion.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._exerciseID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pduType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._protocolFamily.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._timestamp.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pduLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pduStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as PduHeader; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(PduHeader obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._protocolVersion != obj._protocolVersion) - { - ivarsEqual = false; - } - - if (this._exerciseID != obj._exerciseID) - { - ivarsEqual = false; - } - - if (this._pduType != obj._pduType) - { - ivarsEqual = false; - } - - if (this._protocolFamily != obj._protocolFamily) - { - ivarsEqual = false; - } - - if (this._timestamp != obj._timestamp) - { - ivarsEqual = false; - } - - if (this._pduLength != obj._pduLength) - { - ivarsEqual = false; - } - - if (this._pduStatus != obj._pduStatus) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._protocolVersion.GetHashCode(); - result = GenerateHash(result) ^ this._exerciseID.GetHashCode(); - result = GenerateHash(result) ^ this._pduType.GetHashCode(); - result = GenerateHash(result) ^ this._protocolFamily.GetHashCode(); - result = GenerateHash(result) ^ this._timestamp.GetHashCode(); - result = GenerateHash(result) ^ this._pduLength.GetHashCode(); - result = GenerateHash(result) ^ this._pduStatus.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/PduStatus.cs b/tests/OpenDisNet.Reference/Generated/PduStatus.cs deleted file mode 100644 index f028bca..0000000 --- a/tests/OpenDisNet.Reference/Generated/PduStatus.cs +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// PDU Status. These are a series of bit fields. Represented here as just a byte. Section 6.2.67 - /// - [Serializable] - [XmlRoot] - public partial class PduStatus - { - /// - /// Bit fields - /// - private byte _pduStatus; - - /// - /// Initializes a new instance of the class. - /// - public PduStatus() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(PduStatus left, PduStatus right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(PduStatus left, PduStatus right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._pduStatus - return marshalSize; - } - - /// - /// Gets or sets the Bit fields - /// - [XmlElement(Type = typeof(byte), ElementName = "pduStatus")] - public byte PduStatus_ - { - get - { - return this._pduStatus; - } - - set - { - this._pduStatus = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._pduStatus); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._pduStatus = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._pduStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as PduStatus; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(PduStatus obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._pduStatus != obj._pduStatus) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._pduStatus.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/PduSuperclass.cs b/tests/OpenDisNet.Reference/Generated/PduSuperclass.cs deleted file mode 100644 index ba223c8..0000000 --- a/tests/OpenDisNet.Reference/Generated/PduSuperclass.cs +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The superclass for all PDUs, including classic and Live Entity (LE) PDUs. This incorporates the PduHeader record, section 7.2.2 - /// - [Serializable] - [XmlRoot] - public partial class PduSuperclass - { - /// - /// The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2009. - /// - private byte _protocolVersion = 7; - - /// - /// Exercise ID - /// - private byte _exerciseID; - - /// - /// Type of pdu, unique for each PDU class - /// - private byte _pduType; - - /// - /// value that refers to the protocol family, eg SimulationManagement, et - /// - private byte _protocolFamily; - - /// - /// Timestamp value - /// - private uint _timestamp; - - /// - /// Length, in bytes, of the PDU - /// - private ushort _length; - - /// - /// Initializes a new instance of the class. - /// - public PduSuperclass() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(PduSuperclass left, PduSuperclass right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(PduSuperclass left, PduSuperclass right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._protocolVersion - marshalSize += 1; // this._exerciseID - marshalSize += 1; // this._pduType - marshalSize += 1; // this._protocolFamily - marshalSize += 4; // this._timestamp - marshalSize += 2; // this._length - return marshalSize; - } - - /// - /// Gets or sets the The version of the protocol. 5=DIS-1995, 6=DIS-1998, 7=DIS-2009. - /// - [XmlElement(Type = typeof(byte), ElementName = "protocolVersion")] - public byte ProtocolVersion - { - get - { - return this._protocolVersion; - } - - set - { - this._protocolVersion = value; - } - } - - /// - /// Gets or sets the Exercise ID - /// - [XmlElement(Type = typeof(byte), ElementName = "exerciseID")] - public byte ExerciseID - { - get - { - return this._exerciseID; - } - - set - { - this._exerciseID = value; - } - } - - /// - /// Gets or sets the Type of pdu, unique for each PDU class - /// - [XmlElement(Type = typeof(byte), ElementName = "pduType")] - public byte PduType - { - get - { - return this._pduType; - } - - set - { - this._pduType = value; - } - } - - /// - /// Gets or sets the value that refers to the protocol family, eg SimulationManagement, et - /// - [XmlElement(Type = typeof(byte), ElementName = "protocolFamily")] - public byte ProtocolFamily - { - get - { - return this._protocolFamily; - } - - set - { - this._protocolFamily = value; - } - } - - /// - /// Gets or sets the Timestamp value - /// - [XmlElement(Type = typeof(uint), ElementName = "timestamp")] - public uint Timestamp - { - get - { - return this._timestamp; - } - - set - { - this._timestamp = value; - } - } - - /// - /// Gets or sets the Length, in bytes, of the PDU - /// - [XmlElement(Type = typeof(ushort), ElementName = "length")] - public ushort Length - { - get - { - return this._length; - } - - set - { - this._length = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._protocolVersion); - dos.WriteUnsignedByte((byte)this._exerciseID); - dos.WriteUnsignedByte((byte)this._pduType); - dos.WriteUnsignedByte((byte)this._protocolFamily); - dos.WriteUnsignedInt((uint)this._timestamp); - dos.WriteUnsignedShort((ushort)this._length); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._protocolVersion = dis.ReadUnsignedByte(); - this._exerciseID = dis.ReadUnsignedByte(); - this._pduType = dis.ReadUnsignedByte(); - this._protocolFamily = dis.ReadUnsignedByte(); - this._timestamp = dis.ReadUnsignedInt(); - this._length = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._protocolVersion.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._exerciseID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pduType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._protocolFamily.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._timestamp.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._length.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as PduSuperclass; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(PduSuperclass obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._protocolVersion != obj._protocolVersion) - { - ivarsEqual = false; - } - - if (this._exerciseID != obj._exerciseID) - { - ivarsEqual = false; - } - - if (this._pduType != obj._pduType) - { - ivarsEqual = false; - } - - if (this._protocolFamily != obj._protocolFamily) - { - ivarsEqual = false; - } - - if (this._timestamp != obj._timestamp) - { - ivarsEqual = false; - } - - if (this._length != obj._length) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._protocolVersion.GetHashCode(); - result = GenerateHash(result) ^ this._exerciseID.GetHashCode(); - result = GenerateHash(result) ^ this._pduType.GetHashCode(); - result = GenerateHash(result) ^ this._protocolFamily.GetHashCode(); - result = GenerateHash(result) ^ this._timestamp.GetHashCode(); - result = GenerateHash(result) ^ this._length.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/PointObjectStatePdu.cs b/tests/OpenDisNet.Reference/Generated/PointObjectStatePdu.cs deleted file mode 100644 index 963ea88..0000000 --- a/tests/OpenDisNet.Reference/Generated/PointObjectStatePdu.cs +++ /dev/null @@ -1,652 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// : Inormation abut the addition or modification of a synthecic enviroment object that is anchored to the terrain with a single point. Section 7.10.4 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(ObjectType))] - [XmlInclude(typeof(Vector3Double))] - [XmlInclude(typeof(EulerAngles))] - [XmlInclude(typeof(SimulationAddress))] - public partial class PointObjectStatePdu : SyntheticEnvironmentFamilyPdu, IEquatable - { - /// - /// Object in synthetic environment - /// - private EntityID _objectID = new EntityID(); - - /// - /// Object with which this point object is associated - /// - private EntityID _referencedObjectID = new EntityID(); - - /// - /// unique update number of each state transition of an object - /// - private ushort _updateNumber; - - /// - /// force ID - /// - private byte _forceID; - - /// - /// modifications - /// - private byte _modifications; - - /// - /// Object type - /// - private ObjectType _objectType = new ObjectType(); - - /// - /// Object location - /// - private Vector3Double _objectLocation = new Vector3Double(); - - /// - /// Object orientation - /// - private EulerAngles _objectOrientation = new EulerAngles(); - - /// - /// Object apperance - /// - private double _objectAppearance; - - /// - /// requesterID - /// - private SimulationAddress _requesterID = new SimulationAddress(); - - /// - /// receiver ID - /// - private SimulationAddress _receivingID = new SimulationAddress(); - - /// - /// padding - /// - private uint _pad2; - - /// - /// Initializes a new instance of the class. - /// - public PointObjectStatePdu() - { - PduType = (byte)43; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(PointObjectStatePdu left, PointObjectStatePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(PointObjectStatePdu left, PointObjectStatePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._objectID.GetMarshalledSize(); // this._objectID - marshalSize += this._referencedObjectID.GetMarshalledSize(); // this._referencedObjectID - marshalSize += 2; // this._updateNumber - marshalSize += 1; // this._forceID - marshalSize += 1; // this._modifications - marshalSize += this._objectType.GetMarshalledSize(); // this._objectType - marshalSize += this._objectLocation.GetMarshalledSize(); // this._objectLocation - marshalSize += this._objectOrientation.GetMarshalledSize(); // this._objectOrientation - marshalSize += 8; // this._objectAppearance - marshalSize += this._requesterID.GetMarshalledSize(); // this._requesterID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += 4; // this._pad2 - return marshalSize; - } - - /// - /// Gets or sets the Object in synthetic environment - /// - [XmlElement(Type = typeof(EntityID), ElementName = "objectID")] - public EntityID ObjectID - { - get - { - return this._objectID; - } - - set - { - this._objectID = value; - } - } - - /// - /// Gets or sets the Object with which this point object is associated - /// - [XmlElement(Type = typeof(EntityID), ElementName = "referencedObjectID")] - public EntityID ReferencedObjectID - { - get - { - return this._referencedObjectID; - } - - set - { - this._referencedObjectID = value; - } - } - - /// - /// Gets or sets the unique update number of each state transition of an object - /// - [XmlElement(Type = typeof(ushort), ElementName = "updateNumber")] - public ushort UpdateNumber - { - get - { - return this._updateNumber; - } - - set - { - this._updateNumber = value; - } - } - - /// - /// Gets or sets the force ID - /// - [XmlElement(Type = typeof(byte), ElementName = "forceID")] - public byte ForceID - { - get - { - return this._forceID; - } - - set - { - this._forceID = value; - } - } - - /// - /// Gets or sets the modifications - /// - [XmlElement(Type = typeof(byte), ElementName = "modifications")] - public byte Modifications - { - get - { - return this._modifications; - } - - set - { - this._modifications = value; - } - } - - /// - /// Gets or sets the Object type - /// - [XmlElement(Type = typeof(ObjectType), ElementName = "objectType")] - public ObjectType ObjectType - { - get - { - return this._objectType; - } - - set - { - this._objectType = value; - } - } - - /// - /// Gets or sets the Object location - /// - [XmlElement(Type = typeof(Vector3Double), ElementName = "objectLocation")] - public Vector3Double ObjectLocation - { - get - { - return this._objectLocation; - } - - set - { - this._objectLocation = value; - } - } - - /// - /// Gets or sets the Object orientation - /// - [XmlElement(Type = typeof(EulerAngles), ElementName = "objectOrientation")] - public EulerAngles ObjectOrientation - { - get - { - return this._objectOrientation; - } - - set - { - this._objectOrientation = value; - } - } - - /// - /// Gets or sets the Object apperance - /// - [XmlElement(Type = typeof(double), ElementName = "objectAppearance")] - public double ObjectAppearance - { - get - { - return this._objectAppearance; - } - - set - { - this._objectAppearance = value; - } - } - - /// - /// Gets or sets the requesterID - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "requesterID")] - public SimulationAddress RequesterID - { - get - { - return this._requesterID; - } - - set - { - this._requesterID = value; - } - } - - /// - /// Gets or sets the receiver ID - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "receivingID")] - public SimulationAddress ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(uint), ElementName = "pad2")] - public uint Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._objectID.Marshal(dos); - this._referencedObjectID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._updateNumber); - dos.WriteUnsignedByte((byte)this._forceID); - dos.WriteUnsignedByte((byte)this._modifications); - this._objectType.Marshal(dos); - this._objectLocation.Marshal(dos); - this._objectOrientation.Marshal(dos); - dos.WriteDouble((double)this._objectAppearance); - this._requesterID.Marshal(dos); - this._receivingID.Marshal(dos); - dos.WriteUnsignedInt((uint)this._pad2); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._objectID.Unmarshal(dis); - this._referencedObjectID.Unmarshal(dis); - this._updateNumber = dis.ReadUnsignedShort(); - this._forceID = dis.ReadUnsignedByte(); - this._modifications = dis.ReadUnsignedByte(); - this._objectType.Unmarshal(dis); - this._objectLocation.Unmarshal(dis); - this._objectOrientation.Unmarshal(dis); - this._objectAppearance = dis.ReadDouble(); - this._requesterID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._pad2 = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._objectID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._referencedObjectID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._updateNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._forceID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._modifications.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._objectType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._objectLocation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._objectOrientation.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._objectAppearance.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._requesterID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as PointObjectStatePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(PointObjectStatePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._objectID.Equals(obj._objectID)) - { - ivarsEqual = false; - } - - if (!this._referencedObjectID.Equals(obj._referencedObjectID)) - { - ivarsEqual = false; - } - - if (this._updateNumber != obj._updateNumber) - { - ivarsEqual = false; - } - - if (this._forceID != obj._forceID) - { - ivarsEqual = false; - } - - if (this._modifications != obj._modifications) - { - ivarsEqual = false; - } - - if (!this._objectType.Equals(obj._objectType)) - { - ivarsEqual = false; - } - - if (!this._objectLocation.Equals(obj._objectLocation)) - { - ivarsEqual = false; - } - - if (!this._objectOrientation.Equals(obj._objectOrientation)) - { - ivarsEqual = false; - } - - if (this._objectAppearance != obj._objectAppearance) - { - ivarsEqual = false; - } - - if (!this._requesterID.Equals(obj._requesterID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._objectID.GetHashCode(); - result = GenerateHash(result) ^ this._referencedObjectID.GetHashCode(); - result = GenerateHash(result) ^ this._updateNumber.GetHashCode(); - result = GenerateHash(result) ^ this._forceID.GetHashCode(); - result = GenerateHash(result) ^ this._modifications.GetHashCode(); - result = GenerateHash(result) ^ this._objectType.GetHashCode(); - result = GenerateHash(result) ^ this._objectLocation.GetHashCode(); - result = GenerateHash(result) ^ this._objectOrientation.GetHashCode(); - result = GenerateHash(result) ^ this._objectAppearance.GetHashCode(); - result = GenerateHash(result) ^ this._requesterID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/PropulsionSystemData.cs b/tests/OpenDisNet.Reference/Generated/PropulsionSystemData.cs deleted file mode 100644 index b7360e5..0000000 --- a/tests/OpenDisNet.Reference/Generated/PropulsionSystemData.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// contains information describing the propulsion systems of the entity. This information shall be provided for each active propulsion system defined. Section 6.2.68 - /// - [Serializable] - [XmlRoot] - public partial class PropulsionSystemData - { - /// - /// powerSetting - /// - private float _powerSetting; - - /// - /// engine RPMs - /// - private float _engineRpm; - - /// - /// Initializes a new instance of the class. - /// - public PropulsionSystemData() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(PropulsionSystemData left, PropulsionSystemData right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(PropulsionSystemData left, PropulsionSystemData right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._powerSetting - marshalSize += 4; // this._engineRpm - return marshalSize; - } - - /// - /// Gets or sets the powerSetting - /// - [XmlElement(Type = typeof(float), ElementName = "powerSetting")] - public float PowerSetting - { - get - { - return this._powerSetting; - } - - set - { - this._powerSetting = value; - } - } - - /// - /// Gets or sets the engine RPMs - /// - [XmlElement(Type = typeof(float), ElementName = "engineRpm")] - public float EngineRpm - { - get - { - return this._engineRpm; - } - - set - { - this._engineRpm = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._powerSetting); - dos.WriteFloat((float)this._engineRpm); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._powerSetting = dis.ReadFloat(); - this._engineRpm = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._powerSetting.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._engineRpm.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as PropulsionSystemData; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(PropulsionSystemData obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._powerSetting != obj._powerSetting) - { - ivarsEqual = false; - } - - if (this._engineRpm != obj._engineRpm) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._powerSetting.GetHashCode(); - result = GenerateHash(result) ^ this._engineRpm.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RadioCommunicationsFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/RadioCommunicationsFamilyPdu.cs deleted file mode 100644 index ed02477..0000000 --- a/tests/OpenDisNet.Reference/Generated/RadioCommunicationsFamilyPdu.cs +++ /dev/null @@ -1,316 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Abstract superclass for radio communications PDUs. Section 7.7 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class RadioCommunicationsFamilyPdu : Pdu, IEquatable - { - /// - /// ID of the entitythat is the source of the communication - /// - private EntityID _entityId = new EntityID(); - - /// - /// particular radio within an entity - /// - private ushort _radioId; - - /// - /// Initializes a new instance of the class. - /// - public RadioCommunicationsFamilyPdu() - { - ProtocolFamily = (byte)4; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RadioCommunicationsFamilyPdu left, RadioCommunicationsFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RadioCommunicationsFamilyPdu left, RadioCommunicationsFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._entityId.GetMarshalledSize(); // this._entityId - marshalSize += 2; // this._radioId - return marshalSize; - } - - /// - /// Gets or sets the ID of the entitythat is the source of the communication - /// - [XmlElement(Type = typeof(EntityID), ElementName = "entityId")] - public EntityID EntityId - { - get - { - return this._entityId; - } - - set - { - this._entityId = value; - } - } - - /// - /// Gets or sets the particular radio within an entity - /// - [XmlElement(Type = typeof(ushort), ElementName = "radioId")] - public ushort RadioId - { - get - { - return this._radioId; - } - - set - { - this._radioId = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._entityId.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._radioId); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._entityId.Unmarshal(dis); - this._radioId = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._entityId.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._radioId.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RadioCommunicationsFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RadioCommunicationsFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._entityId.Equals(obj._entityId)) - { - ivarsEqual = false; - } - - if (this._radioId != obj._radioId) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._entityId.GetHashCode(); - result = GenerateHash(result) ^ this._radioId.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RadioIdentifier.cs b/tests/OpenDisNet.Reference/Generated/RadioIdentifier.cs deleted file mode 100644 index 1b543c9..0000000 --- a/tests/OpenDisNet.Reference/Generated/RadioIdentifier.cs +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of an attached or unattached radio in an event or exercise Section 6.2.69 - /// - [Serializable] - [XmlRoot] - public partial class RadioIdentifier - { - /// - /// site - /// - private ushort _siteNumber; - - /// - /// application number - /// - private ushort _applicationNumber; - - /// - /// reference number - /// - private ushort _referenceNumber; - - /// - /// Radio number - /// - private ushort _radioNumber; - - /// - /// Initializes a new instance of the class. - /// - public RadioIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RadioIdentifier left, RadioIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RadioIdentifier left, RadioIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._siteNumber - marshalSize += 2; // this._applicationNumber - marshalSize += 2; // this._referenceNumber - marshalSize += 2; // this._radioNumber - return marshalSize; - } - - /// - /// Gets or sets the site - /// - [XmlElement(Type = typeof(ushort), ElementName = "siteNumber")] - public ushort SiteNumber - { - get - { - return this._siteNumber; - } - - set - { - this._siteNumber = value; - } - } - - /// - /// Gets or sets the application number - /// - [XmlElement(Type = typeof(ushort), ElementName = "applicationNumber")] - public ushort ApplicationNumber - { - get - { - return this._applicationNumber; - } - - set - { - this._applicationNumber = value; - } - } - - /// - /// Gets or sets the reference number - /// - [XmlElement(Type = typeof(ushort), ElementName = "referenceNumber")] - public ushort ReferenceNumber - { - get - { - return this._referenceNumber; - } - - set - { - this._referenceNumber = value; - } - } - - /// - /// Gets or sets the Radio number - /// - [XmlElement(Type = typeof(ushort), ElementName = "radioNumber")] - public ushort RadioNumber - { - get - { - return this._radioNumber; - } - - set - { - this._radioNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._siteNumber); - dos.WriteUnsignedShort((ushort)this._applicationNumber); - dos.WriteUnsignedShort((ushort)this._referenceNumber); - dos.WriteUnsignedShort((ushort)this._radioNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._siteNumber = dis.ReadUnsignedShort(); - this._applicationNumber = dis.ReadUnsignedShort(); - this._referenceNumber = dis.ReadUnsignedShort(); - this._radioNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._siteNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._applicationNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._referenceNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._radioNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RadioIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RadioIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._siteNumber != obj._siteNumber) - { - ivarsEqual = false; - } - - if (this._applicationNumber != obj._applicationNumber) - { - ivarsEqual = false; - } - - if (this._referenceNumber != obj._referenceNumber) - { - ivarsEqual = false; - } - - if (this._radioNumber != obj._radioNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._siteNumber.GetHashCode(); - result = GenerateHash(result) ^ this._applicationNumber.GetHashCode(); - result = GenerateHash(result) ^ this._referenceNumber.GetHashCode(); - result = GenerateHash(result) ^ this._radioNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RadioType.cs b/tests/OpenDisNet.Reference/Generated/RadioType.cs deleted file mode 100644 index 77f87f1..0000000 --- a/tests/OpenDisNet.Reference/Generated/RadioType.cs +++ /dev/null @@ -1,457 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Identifies the type of radio. Section 6.2.70 - /// - [Serializable] - [XmlRoot] - public partial class RadioType - { - /// - /// Kind of entity - /// - private byte _entityKind; - - /// - /// Domain of entity (air, surface, subsurface, space, etc) - /// - private byte _domain; - - /// - /// country to which the design of the entity is attributed - /// - private ushort _country; - - /// - /// category of entity - /// - private byte _category; - - /// - /// specific info based on subcategory field - /// - private byte _subcategory; - - private byte _specific; - - private byte _extra; - - /// - /// Initializes a new instance of the class. - /// - public RadioType() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RadioType left, RadioType right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RadioType left, RadioType right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._entityKind - marshalSize += 1; // this._domain - marshalSize += 2; // this._country - marshalSize += 1; // this._category - marshalSize += 1; // this._subcategory - marshalSize += 1; // this._specific - marshalSize += 1; // this._extra - return marshalSize; - } - - /// - /// Gets or sets the Kind of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "entityKind")] - public byte EntityKind - { - get - { - return this._entityKind; - } - - set - { - this._entityKind = value; - } - } - - /// - /// Gets or sets the Domain of entity (air, surface, subsurface, space, etc) - /// - [XmlElement(Type = typeof(byte), ElementName = "domain")] - public byte Domain - { - get - { - return this._domain; - } - - set - { - this._domain = value; - } - } - - /// - /// Gets or sets the country to which the design of the entity is attributed - /// - [XmlElement(Type = typeof(ushort), ElementName = "country")] - public ushort Country - { - get - { - return this._country; - } - - set - { - this._country = value; - } - } - - /// - /// Gets or sets the category of entity - /// - [XmlElement(Type = typeof(byte), ElementName = "category")] - public byte Category - { - get - { - return this._category; - } - - set - { - this._category = value; - } - } - - /// - /// Gets or sets the specific info based on subcategory field - /// - [XmlElement(Type = typeof(byte), ElementName = "subcategory")] - public byte Subcategory - { - get - { - return this._subcategory; - } - - set - { - this._subcategory = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "specific")] - public byte Specific - { - get - { - return this._specific; - } - - set - { - this._specific = value; - } - } - - [XmlElement(Type = typeof(byte), ElementName = "extra")] - public byte Extra - { - get - { - return this._extra; - } - - set - { - this._extra = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._entityKind); - dos.WriteUnsignedByte((byte)this._domain); - dos.WriteUnsignedShort((ushort)this._country); - dos.WriteUnsignedByte((byte)this._category); - dos.WriteUnsignedByte((byte)this._subcategory); - dos.WriteUnsignedByte((byte)this._specific); - dos.WriteUnsignedByte((byte)this._extra); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._entityKind = dis.ReadUnsignedByte(); - this._domain = dis.ReadUnsignedByte(); - this._country = dis.ReadUnsignedShort(); - this._category = dis.ReadUnsignedByte(); - this._subcategory = dis.ReadUnsignedByte(); - this._specific = dis.ReadUnsignedByte(); - this._extra = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._entityKind.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._domain.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._country.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._category.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._subcategory.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._specific.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._extra.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RadioType; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RadioType obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._entityKind != obj._entityKind) - { - ivarsEqual = false; - } - - if (this._domain != obj._domain) - { - ivarsEqual = false; - } - - if (this._country != obj._country) - { - ivarsEqual = false; - } - - if (this._category != obj._category) - { - ivarsEqual = false; - } - - if (this._subcategory != obj._subcategory) - { - ivarsEqual = false; - } - - if (this._specific != obj._specific) - { - ivarsEqual = false; - } - - if (this._extra != obj._extra) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._entityKind.GetHashCode(); - result = GenerateHash(result) ^ this._domain.GetHashCode(); - result = GenerateHash(result) ^ this._country.GetHashCode(); - result = GenerateHash(result) ^ this._category.GetHashCode(); - result = GenerateHash(result) ^ this._subcategory.GetHashCode(); - result = GenerateHash(result) ^ this._specific.GetHashCode(); - result = GenerateHash(result) ^ this._extra.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ReceiverPdu.cs b/tests/OpenDisNet.Reference/Generated/ReceiverPdu.cs deleted file mode 100644 index 169879d..0000000 --- a/tests/OpenDisNet.Reference/Generated/ReceiverPdu.cs +++ /dev/null @@ -1,412 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Communication of a receiver state. Section 7.7.4 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class ReceiverPdu : RadioCommunicationsFamilyPdu, IEquatable - { - /// - /// encoding scheme used, and enumeration - /// - private ushort _receiverState; - - /// - /// padding - /// - private ushort _padding1; - - /// - /// received power - /// - private float _receivedPoser; - - /// - /// ID of transmitter - /// - private EntityID _transmitterEntityId = new EntityID(); - - /// - /// ID of transmitting radio - /// - private ushort _transmitterRadioId; - - /// - /// Initializes a new instance of the class. - /// - public ReceiverPdu() - { - PduType = (byte)27; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ReceiverPdu left, ReceiverPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ReceiverPdu left, ReceiverPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 2; // this._receiverState - marshalSize += 2; // this._padding1 - marshalSize += 4; // this._receivedPoser - marshalSize += this._transmitterEntityId.GetMarshalledSize(); // this._transmitterEntityId - marshalSize += 2; // this._transmitterRadioId - return marshalSize; - } - - /// - /// Gets or sets the encoding scheme used, and enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "receiverState")] - public ushort ReceiverState - { - get - { - return this._receiverState; - } - - set - { - this._receiverState = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding1")] - public ushort Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the received power - /// - [XmlElement(Type = typeof(float), ElementName = "receivedPoser")] - public float ReceivedPoser - { - get - { - return this._receivedPoser; - } - - set - { - this._receivedPoser = value; - } - } - - /// - /// Gets or sets the ID of transmitter - /// - [XmlElement(Type = typeof(EntityID), ElementName = "transmitterEntityId")] - public EntityID TransmitterEntityId - { - get - { - return this._transmitterEntityId; - } - - set - { - this._transmitterEntityId = value; - } - } - - /// - /// Gets or sets the ID of transmitting radio - /// - [XmlElement(Type = typeof(ushort), ElementName = "transmitterRadioId")] - public ushort TransmitterRadioId - { - get - { - return this._transmitterRadioId; - } - - set - { - this._transmitterRadioId = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._receiverState); - dos.WriteUnsignedShort((ushort)this._padding1); - dos.WriteFloat((float)this._receivedPoser); - this._transmitterEntityId.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._transmitterRadioId); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._receiverState = dis.ReadUnsignedShort(); - this._padding1 = dis.ReadUnsignedShort(); - this._receivedPoser = dis.ReadFloat(); - this._transmitterEntityId.Unmarshal(dis); - this._transmitterRadioId = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._receiverState.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._receivedPoser.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._transmitterEntityId.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._transmitterRadioId.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ReceiverPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ReceiverPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._receiverState != obj._receiverState) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._receivedPoser != obj._receivedPoser) - { - ivarsEqual = false; - } - - if (!this._transmitterEntityId.Equals(obj._transmitterEntityId)) - { - ivarsEqual = false; - } - - if (this._transmitterRadioId != obj._transmitterRadioId) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._receiverState.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._receivedPoser.GetHashCode(); - result = GenerateHash(result) ^ this._transmitterEntityId.GetHashCode(); - result = GenerateHash(result) ^ this._transmitterRadioId.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RecordQueryReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/RecordQueryReliablePdu.cs deleted file mode 100644 index 2406e53..0000000 --- a/tests/OpenDisNet.Reference/Generated/RecordQueryReliablePdu.cs +++ /dev/null @@ -1,544 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.13: A request for one or more records of data from an entity. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FourByteChunk))] - public partial class RecordQueryReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// request ID - /// - private uint _requestID; - - /// - /// level of reliability service used for this transaction - /// - private byte _requiredReliabilityService; - - /// - /// padding. The spec is unclear and contradictory here. - /// - private ushort _pad1; - - /// - /// padding - /// - private byte _pad2; - - /// - /// event type - /// - private ushort _eventType; - - /// - /// time - /// - private uint _time; - - /// - /// numberOfRecords - /// - private uint _numberOfRecords; - - /// - /// record IDs - /// - private List _recordIDs = new List(); - - /// - /// Initializes a new instance of the class. - /// - public RecordQueryReliablePdu() - { - PduType = (byte)63; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RecordQueryReliablePdu left, RecordQueryReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RecordQueryReliablePdu left, RecordQueryReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._requestID - marshalSize += 1; // this._requiredReliabilityService - marshalSize += 2; // this._pad1 - marshalSize += 1; // this._pad2 - marshalSize += 2; // this._eventType - marshalSize += 4; // this._time - marshalSize += 4; // this._numberOfRecords - for (int idx = 0; idx < this._recordIDs.Count; idx++) - { - FourByteChunk listElement = (FourByteChunk)this._recordIDs[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the level of reliability service used for this transaction - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliabilityService")] - public byte RequiredReliabilityService - { - get - { - return this._requiredReliabilityService; - } - - set - { - this._requiredReliabilityService = value; - } - } - - /// - /// Gets or sets the padding. The spec is unclear and contradictory here. - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad1")] - public ushort Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad2")] - public byte Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Gets or sets the event type - /// - [XmlElement(Type = typeof(ushort), ElementName = "eventType")] - public ushort EventType - { - get - { - return this._eventType; - } - - set - { - this._eventType = value; - } - } - - /// - /// Gets or sets the time - /// - [XmlElement(Type = typeof(uint), ElementName = "time")] - public uint Time - { - get - { - return this._time; - } - - set - { - this._time = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfRecords")] - public uint NumberOfRecords - { - get - { - return this._numberOfRecords; - } - - set - { - this._numberOfRecords = value; - } - } - - /// - /// Gets or sets the record IDs - /// - [XmlElement(ElementName = "recordIDsList", Type = typeof(List))] - public List RecordIDs - { - get - { - return this._recordIDs; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedByte((byte)this._requiredReliabilityService); - dos.WriteUnsignedShort((ushort)this._pad1); - dos.WriteUnsignedByte((byte)this._pad2); - dos.WriteUnsignedShort((ushort)this._eventType); - dos.WriteUnsignedInt((uint)this._time); - dos.WriteUnsignedInt((uint)this._recordIDs.Count); - - for (int idx = 0; idx < this._recordIDs.Count; idx++) - { - FourByteChunk aFourByteChunk = (FourByteChunk)this._recordIDs[idx]; - aFourByteChunk.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requestID = dis.ReadUnsignedInt(); - this._requiredReliabilityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedShort(); - this._pad2 = dis.ReadUnsignedByte(); - this._eventType = dis.ReadUnsignedShort(); - this._time = dis.ReadUnsignedInt(); - this._numberOfRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfRecords; idx++) - { - FourByteChunk anX = new FourByteChunk(); - anX.Unmarshal(dis); - this._recordIDs.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._eventType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - sb.AppendLine("" + this._recordIDs.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._recordIDs.Count; idx++) - { - sb.AppendLine(""); - FourByteChunk aFourByteChunk = (FourByteChunk)this._recordIDs[idx]; - aFourByteChunk.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RecordQueryReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RecordQueryReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._requiredReliabilityService != obj._requiredReliabilityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - if (this._eventType != obj._eventType) - { - ivarsEqual = false; - } - - if (this._time != obj._time) - { - ivarsEqual = false; - } - - if (this._numberOfRecords != obj._numberOfRecords) - { - ivarsEqual = false; - } - - if (this._recordIDs.Count != obj._recordIDs.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._recordIDs.Count; idx++) - { - if (!this._recordIDs[idx].Equals(obj._recordIDs[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._requiredReliabilityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - result = GenerateHash(result) ^ this._eventType.GetHashCode(); - result = GenerateHash(result) ^ this._time.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfRecords.GetHashCode(); - - if (this._recordIDs.Count > 0) - { - for (int idx = 0; idx < this._recordIDs.Count; idx++) - { - result = GenerateHash(result) ^ this._recordIDs[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RecordQuerySpecification.cs b/tests/OpenDisNet.Reference/Generated/RecordQuerySpecification.cs deleted file mode 100644 index 095e8b5..0000000 --- a/tests/OpenDisNet.Reference/Generated/RecordQuerySpecification.cs +++ /dev/null @@ -1,345 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The identification of the records being queried 6.2.71 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FourByteChunk))] - public partial class RecordQuerySpecification - { - private uint _numberOfRecords; - - /// - /// variable length list of 32 bit records - /// - private List _records = new List(); - - /// - /// Initializes a new instance of the class. - /// - public RecordQuerySpecification() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RecordQuerySpecification left, RecordQuerySpecification right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RecordQuerySpecification left, RecordQuerySpecification right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._numberOfRecords - for (int idx = 0; idx < this._records.Count; idx++) - { - FourByteChunk listElement = (FourByteChunk)this._records[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfRecords")] - public uint NumberOfRecords - { - get - { - return this._numberOfRecords; - } - - set - { - this._numberOfRecords = value; - } - } - - /// - /// Gets or sets the variable length list of 32 bit records - /// - [XmlElement(ElementName = "recordsList", Type = typeof(List))] - public List Records - { - get - { - return this._records; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._records.Count); - - for (int idx = 0; idx < this._records.Count; idx++) - { - FourByteChunk aFourByteChunk = (FourByteChunk)this._records[idx]; - aFourByteChunk.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._numberOfRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfRecords; idx++) - { - FourByteChunk anX = new FourByteChunk(); - anX.Unmarshal(dis); - this._records.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._records.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._records.Count; idx++) - { - sb.AppendLine(""); - FourByteChunk aFourByteChunk = (FourByteChunk)this._records[idx]; - aFourByteChunk.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RecordQuerySpecification; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RecordQuerySpecification obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._numberOfRecords != obj._numberOfRecords) - { - ivarsEqual = false; - } - - if (this._records.Count != obj._records.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._records.Count; idx++) - { - if (!this._records[idx].Equals(obj._records[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._numberOfRecords.GetHashCode(); - - if (this._records.Count > 0) - { - for (int idx = 0; idx < this._records.Count; idx++) - { - result = GenerateHash(result) ^ this._records[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RecordSpecification.cs b/tests/OpenDisNet.Reference/Generated/RecordSpecification.cs deleted file mode 100644 index b8404bc..0000000 --- a/tests/OpenDisNet.Reference/Generated/RecordSpecification.cs +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// This record shall specify the number of record sets contained in the Record Specification record and the record details. Section 6.2.72. - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(RecordSpecificationElement))] - public partial class RecordSpecification - { - /// - /// The number of record sets - /// - private uint _numberOfRecordSets; - - /// - /// variable length list record specifications. - /// - private List _recordSets = new List(); - - /// - /// Initializes a new instance of the class. - /// - public RecordSpecification() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RecordSpecification left, RecordSpecification right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RecordSpecification left, RecordSpecification right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._numberOfRecordSets - for (int idx = 0; idx < this._recordSets.Count; idx++) - { - RecordSpecificationElement listElement = (RecordSpecificationElement)this._recordSets[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfRecordSets method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfRecordSets")] - public uint NumberOfRecordSets - { - get - { - return this._numberOfRecordSets; - } - - set - { - this._numberOfRecordSets = value; - } - } - - /// - /// Gets or sets the variable length list record specifications. - /// - [XmlElement(ElementName = "recordSetsList", Type = typeof(List))] - public List RecordSets - { - get - { - return this._recordSets; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordSets.Count); - - for (int idx = 0; idx < this._recordSets.Count; idx++) - { - RecordSpecificationElement aRecordSpecificationElement = (RecordSpecificationElement)this._recordSets[idx]; - aRecordSpecificationElement.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._numberOfRecordSets = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfRecordSets; idx++) - { - RecordSpecificationElement anX = new RecordSpecificationElement(); - anX.Unmarshal(dis); - this._recordSets.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordSets.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._recordSets.Count; idx++) - { - sb.AppendLine(""); - RecordSpecificationElement aRecordSpecificationElement = (RecordSpecificationElement)this._recordSets[idx]; - aRecordSpecificationElement.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RecordSpecification; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RecordSpecification obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._numberOfRecordSets != obj._numberOfRecordSets) - { - ivarsEqual = false; - } - - if (this._recordSets.Count != obj._recordSets.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._recordSets.Count; idx++) - { - if (!this._recordSets[idx].Equals(obj._recordSets[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._numberOfRecordSets.GetHashCode(); - - if (this._recordSets.Count > 0) - { - for (int idx = 0; idx < this._recordSets.Count; idx++) - { - result = GenerateHash(result) ^ this._recordSets[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RecordSpecificationElement.cs b/tests/OpenDisNet.Reference/Generated/RecordSpecificationElement.cs deleted file mode 100644 index 67f348d..0000000 --- a/tests/OpenDisNet.Reference/Generated/RecordSpecificationElement.cs +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Synthetic record, made up from section 6.2.72. This is used to acheive a repeating variable list element. - /// - [Serializable] - [XmlRoot] - public partial class RecordSpecificationElement - { - /// - /// the data structure used to convey the parameter values of the record for each record. 32 bit enumeration. - /// - private uint _recordID; - - /// - /// the serial number of the first record in the block of records - /// - private uint _recordSetSerialNumber; - - /// - /// the length, in bits, of the record. Note, bits, not bytes. - /// - private ushort _recordLength; - - /// - /// the number of records included in the record set - /// - private ushort _recordCount; - - /// - /// the concatenated records of the format specified by the Record ID field. The length of this field is the Record Length multiplied by the Record Count, in units of bits. ^^^This is wrong--variable sized data records, bit values. THis MUST be patched after generation. - /// - private ushort _recordValues; - - /// - /// Padding of 0 to 31 unused bits as required for 32-bit alignment of the Record Set field. ^^^This is wrong--variable sized padding. MUST be patched post-code generation - /// - private byte _pad4; - - /// - /// Initializes a new instance of the class. - /// - public RecordSpecificationElement() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RecordSpecificationElement left, RecordSpecificationElement right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RecordSpecificationElement left, RecordSpecificationElement right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordID - marshalSize += 4; // this._recordSetSerialNumber - marshalSize += 2; // this._recordLength - marshalSize += 2; // this._recordCount - marshalSize += 2; // this._recordValues - marshalSize += 1; // this._pad4 - return marshalSize; - } - - /// - /// Gets or sets the the data structure used to convey the parameter values of the record for each record. 32 bit enumeration. - /// - [XmlElement(Type = typeof(uint), ElementName = "recordID")] - public uint RecordID - { - get - { - return this._recordID; - } - - set - { - this._recordID = value; - } - } - - /// - /// Gets or sets the the serial number of the first record in the block of records - /// - [XmlElement(Type = typeof(uint), ElementName = "recordSetSerialNumber")] - public uint RecordSetSerialNumber - { - get - { - return this._recordSetSerialNumber; - } - - set - { - this._recordSetSerialNumber = value; - } - } - - /// - /// Gets or sets the the length, in bits, of the record. Note, bits, not bytes. - /// - [XmlElement(Type = typeof(ushort), ElementName = "recordLength")] - public ushort RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - /// - /// Gets or sets the the number of records included in the record set - /// - [XmlElement(Type = typeof(ushort), ElementName = "recordCount")] - public ushort RecordCount - { - get - { - return this._recordCount; - } - - set - { - this._recordCount = value; - } - } - - /// - /// Gets or sets the the concatenated records of the format specified by the Record ID field. The length of this field is the Record Length multiplied by the Record Count, in units of bits. ^^^This is wrong--variable sized data records, bit values. THis MUST be patched after generation. - /// - [XmlElement(Type = typeof(ushort), ElementName = "recordValues")] - public ushort RecordValues - { - get - { - return this._recordValues; - } - - set - { - this._recordValues = value; - } - } - - /// - /// Gets or sets the Padding of 0 to 31 unused bits as required for 32-bit alignment of the Record Set field. ^^^This is wrong--variable sized padding. MUST be patched post-code generation - /// - [XmlElement(Type = typeof(byte), ElementName = "pad4")] - public byte Pad4 - { - get - { - return this._pad4; - } - - set - { - this._pad4 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordID); - dos.WriteUnsignedInt((uint)this._recordSetSerialNumber); - dos.WriteUnsignedShort((ushort)this._recordLength); - dos.WriteUnsignedShort((ushort)this._recordCount); - dos.WriteUnsignedShort((ushort)this._recordValues); - dos.WriteUnsignedByte((byte)this._pad4); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordID = dis.ReadUnsignedInt(); - this._recordSetSerialNumber = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedShort(); - this._recordCount = dis.ReadUnsignedShort(); - this._recordValues = dis.ReadUnsignedShort(); - this._pad4 = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordSetSerialNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordCount.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordValues.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad4.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RecordSpecificationElement; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RecordSpecificationElement obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordID != obj._recordID) - { - ivarsEqual = false; - } - - if (this._recordSetSerialNumber != obj._recordSetSerialNumber) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - if (this._recordCount != obj._recordCount) - { - ivarsEqual = false; - } - - if (this._recordValues != obj._recordValues) - { - ivarsEqual = false; - } - - if (this._pad4 != obj._pad4) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordID.GetHashCode(); - result = GenerateHash(result) ^ this._recordSetSerialNumber.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - result = GenerateHash(result) ^ this._recordCount.GetHashCode(); - result = GenerateHash(result) ^ this._recordValues.GetHashCode(); - result = GenerateHash(result) ^ this._pad4.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Relationship.cs b/tests/OpenDisNet.Reference/Generated/Relationship.cs deleted file mode 100644 index 025cc14..0000000 --- a/tests/OpenDisNet.Reference/Generated/Relationship.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The relationship of the part entity to its host entity. Section 6.2.73. - /// - [Serializable] - [XmlRoot] - public partial class Relationship - { - /// - /// the nature or purpose for joining of the part entity to the host entity and shall be represented by a 16-bit enumeration - /// - private ushort _nature; - - /// - /// the position of the part entity with respect to the host entity and shall be represented by a 16-bit enumeration - /// - private ushort _position; - - /// - /// Initializes a new instance of the class. - /// - public Relationship() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Relationship left, Relationship right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Relationship left, Relationship right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._nature - marshalSize += 2; // this._position - return marshalSize; - } - - /// - /// Gets or sets the the nature or purpose for joining of the part entity to the host entity and shall be represented by a 16-bit enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "nature")] - public ushort Nature - { - get - { - return this._nature; - } - - set - { - this._nature = value; - } - } - - /// - /// Gets or sets the the position of the part entity with respect to the host entity and shall be represented by a 16-bit enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "position")] - public ushort Position - { - get - { - return this._position; - } - - set - { - this._position = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._nature); - dos.WriteUnsignedShort((ushort)this._position); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._nature = dis.ReadUnsignedShort(); - this._position = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._nature.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._position.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Relationship; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Relationship obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._nature != obj._nature) - { - ivarsEqual = false; - } - - if (this._position != obj._position) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._nature.GetHashCode(); - result = GenerateHash(result) ^ this._position.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RemoveEntityPdu.cs b/tests/OpenDisNet.Reference/Generated/RemoveEntityPdu.cs deleted file mode 100644 index fa02d58..0000000 --- a/tests/OpenDisNet.Reference/Generated/RemoveEntityPdu.cs +++ /dev/null @@ -1,350 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.3 The removal of an entity from an exercise shall be communicated with a Remove Entity PDU. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class RemoveEntityPdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Identifier for originating entity(or simulation) - /// - private EntityID _originatingID = new EntityID(); - - /// - /// Identifier for the receiving entity(or simulation) - /// - private EntityID _receivingID = new EntityID(); - - /// - /// This field shall identify the specific and unique start/resume request being made by the SM - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public RemoveEntityPdu() - { - PduType = (byte)12; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RemoveEntityPdu left, RemoveEntityPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RemoveEntityPdu left, RemoveEntityPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingID.GetMarshalledSize(); // this._originatingID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the Identifier for originating entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingID")] - public EntityID OriginatingID - { - get - { - return this._originatingID; - } - - set - { - this._originatingID = value; - } - } - - /// - /// Gets or sets the Identifier for the receiving entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingID")] - public EntityID ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the This field shall identify the specific and unique start/resume request being made by the SM - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingID.Marshal(dos); - this._receivingID.Marshal(dos); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RemoveEntityPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RemoveEntityPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingID.Equals(obj._originatingID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RemoveEntityReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/RemoveEntityReliablePdu.cs deleted file mode 100644 index 836e9ff..0000000 --- a/tests/OpenDisNet.Reference/Generated/RemoveEntityReliablePdu.cs +++ /dev/null @@ -1,377 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.2: Removal of an entity , reliable. COMPLETE - /// - [Serializable] - [XmlRoot] - public partial class RemoveEntityReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// level of reliability service used for this transaction - /// - private byte _requiredReliabilityService; - - /// - /// padding - /// - private ushort _pad1; - - /// - /// padding - /// - private byte _pad2; - - /// - /// Request ID - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public RemoveEntityReliablePdu() - { - PduType = (byte)52; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RemoveEntityReliablePdu left, RemoveEntityReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RemoveEntityReliablePdu left, RemoveEntityReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 1; // this._requiredReliabilityService - marshalSize += 2; // this._pad1 - marshalSize += 1; // this._pad2 - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the level of reliability service used for this transaction - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliabilityService")] - public byte RequiredReliabilityService - { - get - { - return this._requiredReliabilityService; - } - - set - { - this._requiredReliabilityService = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad1")] - public ushort Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad2")] - public byte Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Gets or sets the Request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._requiredReliabilityService); - dos.WriteUnsignedShort((ushort)this._pad1); - dos.WriteUnsignedByte((byte)this._pad2); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requiredReliabilityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedShort(); - this._pad2 = dis.ReadUnsignedByte(); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RemoveEntityReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RemoveEntityReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requiredReliabilityService != obj._requiredReliabilityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requiredReliabilityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RepairCompletePdu.cs b/tests/OpenDisNet.Reference/Generated/RepairCompletePdu.cs deleted file mode 100644 index 59999d3..0000000 --- a/tests/OpenDisNet.Reference/Generated/RepairCompletePdu.cs +++ /dev/null @@ -1,382 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.4.6. Service Request PDU is received and repair is complete. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class RepairCompletePdu : LogisticsFamilyPdu, IEquatable - { - /// - /// Entity that is receiving service. See 6.2.28 - /// - private EntityID _receivingEntityID = new EntityID(); - - /// - /// Entity that is supplying. See 6.2.28 - /// - private EntityID _repairingEntityID = new EntityID(); - - /// - /// Enumeration for type of repair. See 6.2.74 - /// - private ushort _repair; - - /// - /// padding, number prevents conflict with superclass ivar name - /// - private short _padding4; - - /// - /// Initializes a new instance of the class. - /// - public RepairCompletePdu() - { - PduType = (byte)9; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RepairCompletePdu left, RepairCompletePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RepairCompletePdu left, RepairCompletePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._receivingEntityID.GetMarshalledSize(); // this._receivingEntityID - marshalSize += this._repairingEntityID.GetMarshalledSize(); // this._repairingEntityID - marshalSize += 2; // this._repair - marshalSize += 2; // this._padding4 - return marshalSize; - } - - /// - /// Gets or sets the Entity that is receiving service. See 6.2.28 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingEntityID")] - public EntityID ReceivingEntityID - { - get - { - return this._receivingEntityID; - } - - set - { - this._receivingEntityID = value; - } - } - - /// - /// Gets or sets the Entity that is supplying. See 6.2.28 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "repairingEntityID")] - public EntityID RepairingEntityID - { - get - { - return this._repairingEntityID; - } - - set - { - this._repairingEntityID = value; - } - } - - /// - /// Gets or sets the Enumeration for type of repair. See 6.2.74 - /// - [XmlElement(Type = typeof(ushort), ElementName = "repair")] - public ushort Repair - { - get - { - return this._repair; - } - - set - { - this._repair = value; - } - } - - /// - /// Gets or sets the padding, number prevents conflict with superclass ivar name - /// - [XmlElement(Type = typeof(short), ElementName = "padding4")] - public short Padding4 - { - get - { - return this._padding4; - } - - set - { - this._padding4 = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._receivingEntityID.Marshal(dos); - this._repairingEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._repair); - dos.WriteShort((short)this._padding4); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._receivingEntityID.Unmarshal(dis); - this._repairingEntityID.Unmarshal(dis); - this._repair = dis.ReadUnsignedShort(); - this._padding4 = dis.ReadShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._receivingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._repairingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._repair.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding4.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RepairCompletePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RepairCompletePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._receivingEntityID.Equals(obj._receivingEntityID)) - { - ivarsEqual = false; - } - - if (!this._repairingEntityID.Equals(obj._repairingEntityID)) - { - ivarsEqual = false; - } - - if (this._repair != obj._repair) - { - ivarsEqual = false; - } - - if (this._padding4 != obj._padding4) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._receivingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._repairingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._repair.GetHashCode(); - result = GenerateHash(result) ^ this._padding4.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/RepairResponsePdu.cs b/tests/OpenDisNet.Reference/Generated/RepairResponsePdu.cs deleted file mode 100644 index 3976fa1..0000000 --- a/tests/OpenDisNet.Reference/Generated/RepairResponsePdu.cs +++ /dev/null @@ -1,414 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.4.7. Sent after repair complete PDU. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class RepairResponsePdu : LogisticsFamilyPdu, IEquatable - { - /// - /// Entity that requested repairs. See 6.2.28 - /// - private EntityID _receivingEntityID = new EntityID(); - - /// - /// Entity that is repairing. See 6.2.28 - /// - private EntityID _repairingEntityID = new EntityID(); - - /// - /// Result of repair operation - /// - private byte _repairResult; - - /// - /// padding - /// - private short _padding1; - - /// - /// padding - /// - private byte _padding2; - - /// - /// Initializes a new instance of the class. - /// - public RepairResponsePdu() - { - PduType = (byte)10; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(RepairResponsePdu left, RepairResponsePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(RepairResponsePdu left, RepairResponsePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._receivingEntityID.GetMarshalledSize(); // this._receivingEntityID - marshalSize += this._repairingEntityID.GetMarshalledSize(); // this._repairingEntityID - marshalSize += 1; // this._repairResult - marshalSize += 2; // this._padding1 - marshalSize += 1; // this._padding2 - return marshalSize; - } - - /// - /// Gets or sets the Entity that requested repairs. See 6.2.28 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingEntityID")] - public EntityID ReceivingEntityID - { - get - { - return this._receivingEntityID; - } - - set - { - this._receivingEntityID = value; - } - } - - /// - /// Gets or sets the Entity that is repairing. See 6.2.28 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "repairingEntityID")] - public EntityID RepairingEntityID - { - get - { - return this._repairingEntityID; - } - - set - { - this._repairingEntityID = value; - } - } - - /// - /// Gets or sets the Result of repair operation - /// - [XmlElement(Type = typeof(byte), ElementName = "repairResult")] - public byte RepairResult - { - get - { - return this._repairResult; - } - - set - { - this._repairResult = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(short), ElementName = "padding1")] - public short Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding2")] - public byte Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._receivingEntityID.Marshal(dos); - this._repairingEntityID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._repairResult); - dos.WriteShort((short)this._padding1); - dos.WriteByte((byte)this._padding2); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._receivingEntityID.Unmarshal(dis); - this._repairingEntityID.Unmarshal(dis); - this._repairResult = dis.ReadUnsignedByte(); - this._padding1 = dis.ReadShort(); - this._padding2 = dis.ReadByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._receivingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._repairingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._repairResult.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as RepairResponsePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(RepairResponsePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._receivingEntityID.Equals(obj._receivingEntityID)) - { - ivarsEqual = false; - } - - if (!this._repairingEntityID.Equals(obj._repairingEntityID)) - { - ivarsEqual = false; - } - - if (this._repairResult != obj._repairResult) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._receivingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._repairingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._repairResult.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ResupplyOfferPdu.cs b/tests/OpenDisNet.Reference/Generated/ResupplyOfferPdu.cs deleted file mode 100644 index 52bc92d..0000000 --- a/tests/OpenDisNet.Reference/Generated/ResupplyOfferPdu.cs +++ /dev/null @@ -1,485 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information used to communicate the offer of supplies by a supplying entity to a receiving entity. Section 7.4.3 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(SupplyQuantity))] - public partial class ResupplyOfferPdu : LogisticsFamilyPdu, IEquatable - { - /// - /// Field identifies the Entity and respective Entity Record ID that is receiving service (see 6.2.28), Section 7.4.3 - /// - private EntityID _receivingEntityID = new EntityID(); - - /// - /// Identifies the Entity and respective Entity ID Record that is supplying (see 6.2.28), Section 7.4.3 - /// - private EntityID _supplyingEntityID = new EntityID(); - - /// - /// How many supplies types are being offered, Section 7.4.3 - /// - private byte _numberOfSupplyTypes; - - /// - /// padding - /// - private byte _padding1; - - /// - /// padding - /// - private short _padding2; - - /// - /// A Reord that Specifies the type of supply and the amount of that supply for each of the supply types in numberOfSupplyTypes (see 6.2.85), Section 7.4.3 - /// - private List _supplies = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ResupplyOfferPdu() - { - PduType = (byte)6; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ResupplyOfferPdu left, ResupplyOfferPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ResupplyOfferPdu left, ResupplyOfferPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._receivingEntityID.GetMarshalledSize(); // this._receivingEntityID - marshalSize += this._supplyingEntityID.GetMarshalledSize(); // this._supplyingEntityID - marshalSize += 1; // this._numberOfSupplyTypes - marshalSize += 1; // this._padding1 - marshalSize += 2; // this._padding2 - for (int idx = 0; idx < this._supplies.Count; idx++) - { - SupplyQuantity listElement = (SupplyQuantity)this._supplies[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Field identifies the Entity and respective Entity Record ID that is receiving service (see 6.2.28), Section 7.4.3 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingEntityID")] - public EntityID ReceivingEntityID - { - get - { - return this._receivingEntityID; - } - - set - { - this._receivingEntityID = value; - } - } - - /// - /// Gets or sets the Identifies the Entity and respective Entity ID Record that is supplying (see 6.2.28), Section 7.4.3 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "supplyingEntityID")] - public EntityID SupplyingEntityID - { - get - { - return this._supplyingEntityID; - } - - set - { - this._supplyingEntityID = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfSupplyTypes method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfSupplyTypes")] - public byte NumberOfSupplyTypes - { - get - { - return this._numberOfSupplyTypes; - } - - set - { - this._numberOfSupplyTypes = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding1")] - public byte Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(short), ElementName = "padding2")] - public short Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Gets or sets the A Reord that Specifies the type of supply and the amount of that supply for each of the supply types in numberOfSupplyTypes (see 6.2.85), Section 7.4.3 - /// - [XmlElement(ElementName = "suppliesList", Type = typeof(List))] - public List Supplies - { - get - { - return this._supplies; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._receivingEntityID.Marshal(dos); - this._supplyingEntityID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._supplies.Count); - dos.WriteByte((byte)this._padding1); - dos.WriteShort((short)this._padding2); - - for (int idx = 0; idx < this._supplies.Count; idx++) - { - SupplyQuantity aSupplyQuantity = (SupplyQuantity)this._supplies[idx]; - aSupplyQuantity.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._receivingEntityID.Unmarshal(dis); - this._supplyingEntityID.Unmarshal(dis); - this._numberOfSupplyTypes = dis.ReadUnsignedByte(); - this._padding1 = dis.ReadByte(); - this._padding2 = dis.ReadShort(); - for (int idx = 0; idx < this.NumberOfSupplyTypes; idx++) - { - SupplyQuantity anX = new SupplyQuantity(); - anX.Unmarshal(dis); - this._supplies.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._receivingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._supplyingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._supplies.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._supplies.Count; idx++) - { - sb.AppendLine(""); - SupplyQuantity aSupplyQuantity = (SupplyQuantity)this._supplies[idx]; - aSupplyQuantity.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ResupplyOfferPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ResupplyOfferPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._receivingEntityID.Equals(obj._receivingEntityID)) - { - ivarsEqual = false; - } - - if (!this._supplyingEntityID.Equals(obj._supplyingEntityID)) - { - ivarsEqual = false; - } - - if (this._numberOfSupplyTypes != obj._numberOfSupplyTypes) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._supplies.Count != obj._supplies.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._supplies.Count; idx++) - { - if (!this._supplies[idx].Equals(obj._supplies[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._receivingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._supplyingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfSupplyTypes.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - - if (this._supplies.Count > 0) - { - for (int idx = 0; idx < this._supplies.Count; idx++) - { - result = GenerateHash(result) ^ this._supplies[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ResupplyReceivedPdu.cs b/tests/OpenDisNet.Reference/Generated/ResupplyReceivedPdu.cs deleted file mode 100644 index db6d460..0000000 --- a/tests/OpenDisNet.Reference/Generated/ResupplyReceivedPdu.cs +++ /dev/null @@ -1,485 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.4.4. Receipt of supplies is communicated by issuing Resupply Received PDU. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(SupplyQuantity))] - public partial class ResupplyReceivedPdu : LogisticsFamilyPdu, IEquatable - { - /// - /// Entity that is receiving service. Shall be represented by Entity Identifier record (see 6.2.28) - /// - private EntityID _receivingEntityID = new EntityID(); - - /// - /// Entity that is supplying. Shall be represented by Entity Identifier record (see 6.2.28) - /// - private EntityID _supplyingEntityID = new EntityID(); - - /// - /// How many supplies are taken by receiving entity - /// - private byte _numberOfSupplyTypes; - - /// - /// padding - /// - private short _padding1; - - /// - /// padding - /// - private byte _padding2; - - /// - /// Type and amount of supplies for each specified supply type. See 6.2.85 for supply quantity record. - /// - private List _supplies = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ResupplyReceivedPdu() - { - PduType = (byte)7; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ResupplyReceivedPdu left, ResupplyReceivedPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ResupplyReceivedPdu left, ResupplyReceivedPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._receivingEntityID.GetMarshalledSize(); // this._receivingEntityID - marshalSize += this._supplyingEntityID.GetMarshalledSize(); // this._supplyingEntityID - marshalSize += 1; // this._numberOfSupplyTypes - marshalSize += 2; // this._padding1 - marshalSize += 1; // this._padding2 - for (int idx = 0; idx < this._supplies.Count; idx++) - { - SupplyQuantity listElement = (SupplyQuantity)this._supplies[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Entity that is receiving service. Shall be represented by Entity Identifier record (see 6.2.28) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingEntityID")] - public EntityID ReceivingEntityID - { - get - { - return this._receivingEntityID; - } - - set - { - this._receivingEntityID = value; - } - } - - /// - /// Gets or sets the Entity that is supplying. Shall be represented by Entity Identifier record (see 6.2.28) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "supplyingEntityID")] - public EntityID SupplyingEntityID - { - get - { - return this._supplyingEntityID; - } - - set - { - this._supplyingEntityID = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfSupplyTypes method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfSupplyTypes")] - public byte NumberOfSupplyTypes - { - get - { - return this._numberOfSupplyTypes; - } - - set - { - this._numberOfSupplyTypes = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(short), ElementName = "padding1")] - public short Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding2")] - public byte Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Gets or sets the Type and amount of supplies for each specified supply type. See 6.2.85 for supply quantity record. - /// - [XmlElement(ElementName = "suppliesList", Type = typeof(List))] - public List Supplies - { - get - { - return this._supplies; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._receivingEntityID.Marshal(dos); - this._supplyingEntityID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._supplies.Count); - dos.WriteShort((short)this._padding1); - dos.WriteByte((byte)this._padding2); - - for (int idx = 0; idx < this._supplies.Count; idx++) - { - SupplyQuantity aSupplyQuantity = (SupplyQuantity)this._supplies[idx]; - aSupplyQuantity.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._receivingEntityID.Unmarshal(dis); - this._supplyingEntityID.Unmarshal(dis); - this._numberOfSupplyTypes = dis.ReadUnsignedByte(); - this._padding1 = dis.ReadShort(); - this._padding2 = dis.ReadByte(); - for (int idx = 0; idx < this.NumberOfSupplyTypes; idx++) - { - SupplyQuantity anX = new SupplyQuantity(); - anX.Unmarshal(dis); - this._supplies.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._receivingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._supplyingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._supplies.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._supplies.Count; idx++) - { - sb.AppendLine(""); - SupplyQuantity aSupplyQuantity = (SupplyQuantity)this._supplies[idx]; - aSupplyQuantity.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ResupplyReceivedPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ResupplyReceivedPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._receivingEntityID.Equals(obj._receivingEntityID)) - { - ivarsEqual = false; - } - - if (!this._supplyingEntityID.Equals(obj._supplyingEntityID)) - { - ivarsEqual = false; - } - - if (this._numberOfSupplyTypes != obj._numberOfSupplyTypes) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._supplies.Count != obj._supplies.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._supplies.Count; idx++) - { - if (!this._supplies[idx].Equals(obj._supplies[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._receivingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._supplyingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfSupplyTypes.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - - if (this._supplies.Count > 0) - { - for (int idx = 0; idx < this._supplies.Count; idx++) - { - result = GenerateHash(result) ^ this._supplies[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SecondaryOperationalData.cs b/tests/OpenDisNet.Reference/Generated/SecondaryOperationalData.cs deleted file mode 100644 index 8c65209..0000000 --- a/tests/OpenDisNet.Reference/Generated/SecondaryOperationalData.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Additional operational data for an IFF emitting system and the number of IFF Fundamental Parameter Data records Section 6.2.76. - /// - [Serializable] - [XmlRoot] - public partial class SecondaryOperationalData - { - /// - /// additional operational characteristics of the IFF emitting system. Each 8-bit field will vary depending on the system type. - /// - private byte _operationalData1; - - /// - /// additional operational characteristics of the IFF emitting system. Each 8-bit field will vary depending on the system type. - /// - private byte _operationalData2; - - /// - /// the number of IFF Fundamental Parameter Data records that follow - /// - private ushort _numberOfIFFFundamentalParameterRecords; - - /// - /// Initializes a new instance of the class. - /// - public SecondaryOperationalData() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SecondaryOperationalData left, SecondaryOperationalData right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SecondaryOperationalData left, SecondaryOperationalData right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._operationalData1 - marshalSize += 1; // this._operationalData2 - marshalSize += 2; // this._numberOfIFFFundamentalParameterRecords - return marshalSize; - } - - /// - /// Gets or sets the additional operational characteristics of the IFF emitting system. Each 8-bit field will vary depending on the system type. - /// - [XmlElement(Type = typeof(byte), ElementName = "operationalData1")] - public byte OperationalData1 - { - get - { - return this._operationalData1; - } - - set - { - this._operationalData1 = value; - } - } - - /// - /// Gets or sets the additional operational characteristics of the IFF emitting system. Each 8-bit field will vary depending on the system type. - /// - [XmlElement(Type = typeof(byte), ElementName = "operationalData2")] - public byte OperationalData2 - { - get - { - return this._operationalData2; - } - - set - { - this._operationalData2 = value; - } - } - - /// - /// Gets or sets the the number of IFF Fundamental Parameter Data records that follow - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfIFFFundamentalParameterRecords")] - public ushort NumberOfIFFFundamentalParameterRecords - { - get - { - return this._numberOfIFFFundamentalParameterRecords; - } - - set - { - this._numberOfIFFFundamentalParameterRecords = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._operationalData1); - dos.WriteUnsignedByte((byte)this._operationalData2); - dos.WriteUnsignedShort((ushort)this._numberOfIFFFundamentalParameterRecords); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._operationalData1 = dis.ReadUnsignedByte(); - this._operationalData2 = dis.ReadUnsignedByte(); - this._numberOfIFFFundamentalParameterRecords = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._operationalData1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._operationalData2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._numberOfIFFFundamentalParameterRecords.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SecondaryOperationalData; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SecondaryOperationalData obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._operationalData1 != obj._operationalData1) - { - ivarsEqual = false; - } - - if (this._operationalData2 != obj._operationalData2) - { - ivarsEqual = false; - } - - if (this._numberOfIFFFundamentalParameterRecords != obj._numberOfIFFFundamentalParameterRecords) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._operationalData1.GetHashCode(); - result = GenerateHash(result) ^ this._operationalData2.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfIFFFundamentalParameterRecords.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SeesPdu.cs b/tests/OpenDisNet.Reference/Generated/SeesPdu.cs deleted file mode 100644 index 75bc0ff..0000000 --- a/tests/OpenDisNet.Reference/Generated/SeesPdu.cs +++ /dev/null @@ -1,586 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// SEES PDU, supplemental emissions entity state information. Section 7.6.6 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(PropulsionSystemData))] - [XmlInclude(typeof(VectoringNozzleSystem))] - public partial class SeesPdu : DistributedEmissionsFamilyPdu, IEquatable - { - /// - /// Originating entity ID - /// - private EntityID _orginatingEntityID = new EntityID(); - - /// - /// IR Signature representation index - /// - private ushort _infraredSignatureRepresentationIndex; - - /// - /// acoustic Signature representation index - /// - private ushort _acousticSignatureRepresentationIndex; - - /// - /// radar cross section representation index - /// - private ushort _radarCrossSectionSignatureRepresentationIndex; - - /// - /// how many propulsion systems - /// - private ushort _numberOfPropulsionSystems; - - /// - /// how many vectoring nozzle systems - /// - private ushort _numberOfVectoringNozzleSystems; - - /// - /// variable length list of propulsion system data - /// - private List _propulsionSystemData = new List(); - - /// - /// variable length list of vectoring system data - /// - private List _vectoringSystemData = new List(); - - /// - /// Initializes a new instance of the class. - /// - public SeesPdu() - { - PduType = (byte)30; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SeesPdu left, SeesPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SeesPdu left, SeesPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._orginatingEntityID.GetMarshalledSize(); // this._orginatingEntityID - marshalSize += 2; // this._infraredSignatureRepresentationIndex - marshalSize += 2; // this._acousticSignatureRepresentationIndex - marshalSize += 2; // this._radarCrossSectionSignatureRepresentationIndex - marshalSize += 2; // this._numberOfPropulsionSystems - marshalSize += 2; // this._numberOfVectoringNozzleSystems - for (int idx = 0; idx < this._propulsionSystemData.Count; idx++) - { - PropulsionSystemData listElement = (PropulsionSystemData)this._propulsionSystemData[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._vectoringSystemData.Count; idx++) - { - VectoringNozzleSystem listElement = (VectoringNozzleSystem)this._vectoringSystemData[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Originating entity ID - /// - [XmlElement(Type = typeof(EntityID), ElementName = "orginatingEntityID")] - public EntityID OrginatingEntityID - { - get - { - return this._orginatingEntityID; - } - - set - { - this._orginatingEntityID = value; - } - } - - /// - /// Gets or sets the IR Signature representation index - /// - [XmlElement(Type = typeof(ushort), ElementName = "infraredSignatureRepresentationIndex")] - public ushort InfraredSignatureRepresentationIndex - { - get - { - return this._infraredSignatureRepresentationIndex; - } - - set - { - this._infraredSignatureRepresentationIndex = value; - } - } - - /// - /// Gets or sets the acoustic Signature representation index - /// - [XmlElement(Type = typeof(ushort), ElementName = "acousticSignatureRepresentationIndex")] - public ushort AcousticSignatureRepresentationIndex - { - get - { - return this._acousticSignatureRepresentationIndex; - } - - set - { - this._acousticSignatureRepresentationIndex = value; - } - } - - /// - /// Gets or sets the radar cross section representation index - /// - [XmlElement(Type = typeof(ushort), ElementName = "radarCrossSectionSignatureRepresentationIndex")] - public ushort RadarCrossSectionSignatureRepresentationIndex - { - get - { - return this._radarCrossSectionSignatureRepresentationIndex; - } - - set - { - this._radarCrossSectionSignatureRepresentationIndex = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfPropulsionSystems method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfPropulsionSystems")] - public ushort NumberOfPropulsionSystems - { - get - { - return this._numberOfPropulsionSystems; - } - - set - { - this._numberOfPropulsionSystems = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVectoringNozzleSystems method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfVectoringNozzleSystems")] - public ushort NumberOfVectoringNozzleSystems - { - get - { - return this._numberOfVectoringNozzleSystems; - } - - set - { - this._numberOfVectoringNozzleSystems = value; - } - } - - /// - /// Gets or sets the variable length list of propulsion system data - /// - [XmlElement(ElementName = "propulsionSystemDataList", Type = typeof(List))] - public List PropulsionSystemData - { - get - { - return this._propulsionSystemData; - } - } - - /// - /// Gets or sets the variable length list of vectoring system data - /// - [XmlElement(ElementName = "vectoringSystemDataList", Type = typeof(List))] - public List VectoringSystemData - { - get - { - return this._vectoringSystemData; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._orginatingEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._infraredSignatureRepresentationIndex); - dos.WriteUnsignedShort((ushort)this._acousticSignatureRepresentationIndex); - dos.WriteUnsignedShort((ushort)this._radarCrossSectionSignatureRepresentationIndex); - dos.WriteUnsignedShort((ushort)this._propulsionSystemData.Count); - dos.WriteUnsignedShort((ushort)this._vectoringSystemData.Count); - - for (int idx = 0; idx < this._propulsionSystemData.Count; idx++) - { - PropulsionSystemData aPropulsionSystemData = (PropulsionSystemData)this._propulsionSystemData[idx]; - aPropulsionSystemData.Marshal(dos); - } - - for (int idx = 0; idx < this._vectoringSystemData.Count; idx++) - { - VectoringNozzleSystem aVectoringNozzleSystem = (VectoringNozzleSystem)this._vectoringSystemData[idx]; - aVectoringNozzleSystem.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._orginatingEntityID.Unmarshal(dis); - this._infraredSignatureRepresentationIndex = dis.ReadUnsignedShort(); - this._acousticSignatureRepresentationIndex = dis.ReadUnsignedShort(); - this._radarCrossSectionSignatureRepresentationIndex = dis.ReadUnsignedShort(); - this._numberOfPropulsionSystems = dis.ReadUnsignedShort(); - this._numberOfVectoringNozzleSystems = dis.ReadUnsignedShort(); - for (int idx = 0; idx < this.NumberOfPropulsionSystems; idx++) - { - PropulsionSystemData anX = new PropulsionSystemData(); - anX.Unmarshal(dis); - this._propulsionSystemData.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVectoringNozzleSystems; idx++) - { - VectoringNozzleSystem anX = new VectoringNozzleSystem(); - anX.Unmarshal(dis); - this._vectoringSystemData.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._orginatingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._infraredSignatureRepresentationIndex.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._acousticSignatureRepresentationIndex.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._radarCrossSectionSignatureRepresentationIndex.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._propulsionSystemData.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._vectoringSystemData.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._propulsionSystemData.Count; idx++) - { - sb.AppendLine(""); - PropulsionSystemData aPropulsionSystemData = (PropulsionSystemData)this._propulsionSystemData[idx]; - aPropulsionSystemData.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._vectoringSystemData.Count; idx++) - { - sb.AppendLine(""); - VectoringNozzleSystem aVectoringNozzleSystem = (VectoringNozzleSystem)this._vectoringSystemData[idx]; - aVectoringNozzleSystem.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SeesPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SeesPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._orginatingEntityID.Equals(obj._orginatingEntityID)) - { - ivarsEqual = false; - } - - if (this._infraredSignatureRepresentationIndex != obj._infraredSignatureRepresentationIndex) - { - ivarsEqual = false; - } - - if (this._acousticSignatureRepresentationIndex != obj._acousticSignatureRepresentationIndex) - { - ivarsEqual = false; - } - - if (this._radarCrossSectionSignatureRepresentationIndex != obj._radarCrossSectionSignatureRepresentationIndex) - { - ivarsEqual = false; - } - - if (this._numberOfPropulsionSystems != obj._numberOfPropulsionSystems) - { - ivarsEqual = false; - } - - if (this._numberOfVectoringNozzleSystems != obj._numberOfVectoringNozzleSystems) - { - ivarsEqual = false; - } - - if (this._propulsionSystemData.Count != obj._propulsionSystemData.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._propulsionSystemData.Count; idx++) - { - if (!this._propulsionSystemData[idx].Equals(obj._propulsionSystemData[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._vectoringSystemData.Count != obj._vectoringSystemData.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._vectoringSystemData.Count; idx++) - { - if (!this._vectoringSystemData[idx].Equals(obj._vectoringSystemData[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._orginatingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._infraredSignatureRepresentationIndex.GetHashCode(); - result = GenerateHash(result) ^ this._acousticSignatureRepresentationIndex.GetHashCode(); - result = GenerateHash(result) ^ this._radarCrossSectionSignatureRepresentationIndex.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfPropulsionSystems.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVectoringNozzleSystems.GetHashCode(); - - if (this._propulsionSystemData.Count > 0) - { - for (int idx = 0; idx < this._propulsionSystemData.Count; idx++) - { - result = GenerateHash(result) ^ this._propulsionSystemData[idx].GetHashCode(); - } - } - - if (this._vectoringSystemData.Count > 0) - { - for (int idx = 0; idx < this._vectoringSystemData.Count; idx++) - { - result = GenerateHash(result) ^ this._vectoringSystemData[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Sensor.cs b/tests/OpenDisNet.Reference/Generated/Sensor.cs deleted file mode 100644 index e6efef8..0000000 --- a/tests/OpenDisNet.Reference/Generated/Sensor.cs +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// An entity's sensor information. Section 6.2.77. - /// - [Serializable] - [XmlRoot] - public partial class Sensor - { - /// - /// the source of the Sensor Type field - /// - private byte _sensorTypeSource; - - /// - /// the on/off status of the sensor - /// - private byte _sensorOnOffStatus; - - /// - /// the sensor type and shall be represented by a 16-bit enumeration. - /// - private ushort _sensorType; - - /// - /// the station to which the sensor is assigned. A zero value shall indi- cate that this Sensor record is not associated with any particular station and represents the total quan- tity of this sensor for this entity. If this field is non-zero, it shall either reference an attached part or an articulated part - /// - private uint _station; - - /// - /// quantity of the sensor - /// - private ushort _quantity; - - /// - /// padding - /// - private ushort _padding; - - /// - /// Initializes a new instance of the class. - /// - public Sensor() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Sensor left, Sensor right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Sensor left, Sensor right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._sensorTypeSource - marshalSize += 1; // this._sensorOnOffStatus - marshalSize += 2; // this._sensorType - marshalSize += 4; // this._station - marshalSize += 2; // this._quantity - marshalSize += 2; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the the source of the Sensor Type field - /// - [XmlElement(Type = typeof(byte), ElementName = "sensorTypeSource")] - public byte SensorTypeSource - { - get - { - return this._sensorTypeSource; - } - - set - { - this._sensorTypeSource = value; - } - } - - /// - /// Gets or sets the the on/off status of the sensor - /// - [XmlElement(Type = typeof(byte), ElementName = "sensorOnOffStatus")] - public byte SensorOnOffStatus - { - get - { - return this._sensorOnOffStatus; - } - - set - { - this._sensorOnOffStatus = value; - } - } - - /// - /// Gets or sets the the sensor type and shall be represented by a 16-bit enumeration. - /// - [XmlElement(Type = typeof(ushort), ElementName = "sensorType")] - public ushort SensorType - { - get - { - return this._sensorType; - } - - set - { - this._sensorType = value; - } - } - - /// - /// Gets or sets the the station to which the sensor is assigned. A zero value shall indi- cate that this Sensor record is not associated with any particular station and represents the total quan- tity of this sensor for this entity. If this field is non-zero, it shall either reference an attached part or an articulated part - /// - [XmlElement(Type = typeof(uint), ElementName = "station")] - public uint Station - { - get - { - return this._station; - } - - set - { - this._station = value; - } - } - - /// - /// Gets or sets the quantity of the sensor - /// - [XmlElement(Type = typeof(ushort), ElementName = "quantity")] - public ushort Quantity - { - get - { - return this._quantity; - } - - set - { - this._quantity = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._sensorTypeSource); - dos.WriteUnsignedByte((byte)this._sensorOnOffStatus); - dos.WriteUnsignedShort((ushort)this._sensorType); - dos.WriteUnsignedInt((uint)this._station); - dos.WriteUnsignedShort((ushort)this._quantity); - dos.WriteUnsignedShort((ushort)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._sensorTypeSource = dis.ReadUnsignedByte(); - this._sensorOnOffStatus = dis.ReadUnsignedByte(); - this._sensorType = dis.ReadUnsignedShort(); - this._station = dis.ReadUnsignedInt(); - this._quantity = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._sensorTypeSource.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._sensorOnOffStatus.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._sensorType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._station.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._quantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Sensor; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Sensor obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._sensorTypeSource != obj._sensorTypeSource) - { - ivarsEqual = false; - } - - if (this._sensorOnOffStatus != obj._sensorOnOffStatus) - { - ivarsEqual = false; - } - - if (this._sensorType != obj._sensorType) - { - ivarsEqual = false; - } - - if (this._station != obj._station) - { - ivarsEqual = false; - } - - if (this._quantity != obj._quantity) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._sensorTypeSource.GetHashCode(); - result = GenerateHash(result) ^ this._sensorOnOffStatus.GetHashCode(); - result = GenerateHash(result) ^ this._sensorType.GetHashCode(); - result = GenerateHash(result) ^ this._station.GetHashCode(); - result = GenerateHash(result) ^ this._quantity.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SeparationVP.cs b/tests/OpenDisNet.Reference/Generated/SeparationVP.cs deleted file mode 100644 index 00a6a2f..0000000 --- a/tests/OpenDisNet.Reference/Generated/SeparationVP.cs +++ /dev/null @@ -1,472 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Physical separation of an entity from another entity. Section 6.2.93.6 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class SeparationVP - { - /// - /// the identification of the Variable Parameter record. Enumeration from EBV - /// - private byte _recordType = 4; - - /// - /// Reason for separation. EBV - /// - private byte _reasonForSeparation; - - /// - /// Whether the entity existed prior to separation EBV - /// - private byte _preEntityIndicator; - - /// - /// padding - /// - private byte _padding1; - - /// - /// ID of parent - /// - private EntityID _parentEntityID = new EntityID(); - - /// - /// padding - /// - private ushort _padding2; - - /// - /// Station separated from - /// - private uint _stationLocation; - - /// - /// Initializes a new instance of the class. - /// - public SeparationVP() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SeparationVP left, SeparationVP right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SeparationVP left, SeparationVP right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._recordType - marshalSize += 1; // this._reasonForSeparation - marshalSize += 1; // this._preEntityIndicator - marshalSize += 1; // this._padding1 - marshalSize += this._parentEntityID.GetMarshalledSize(); // this._parentEntityID - marshalSize += 2; // this._padding2 - marshalSize += 4; // this._stationLocation - return marshalSize; - } - - /// - /// Gets or sets the the identification of the Variable Parameter record. Enumeration from EBV - /// - [XmlElement(Type = typeof(byte), ElementName = "recordType")] - public byte RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the Reason for separation. EBV - /// - [XmlElement(Type = typeof(byte), ElementName = "reasonForSeparation")] - public byte ReasonForSeparation - { - get - { - return this._reasonForSeparation; - } - - set - { - this._reasonForSeparation = value; - } - } - - /// - /// Gets or sets the Whether the entity existed prior to separation EBV - /// - [XmlElement(Type = typeof(byte), ElementName = "preEntityIndicator")] - public byte PreEntityIndicator - { - get - { - return this._preEntityIndicator; - } - - set - { - this._preEntityIndicator = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding1")] - public byte Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the ID of parent - /// - [XmlElement(Type = typeof(EntityID), ElementName = "parentEntityID")] - public EntityID ParentEntityID - { - get - { - return this._parentEntityID; - } - - set - { - this._parentEntityID = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding2")] - public ushort Padding2 - { - get - { - return this._padding2; - } - - set - { - this._padding2 = value; - } - } - - /// - /// Gets or sets the Station separated from - /// - [XmlElement(Type = typeof(uint), ElementName = "stationLocation")] - public uint StationLocation - { - get - { - return this._stationLocation; - } - - set - { - this._stationLocation = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._recordType); - dos.WriteUnsignedByte((byte)this._reasonForSeparation); - dos.WriteUnsignedByte((byte)this._preEntityIndicator); - dos.WriteUnsignedByte((byte)this._padding1); - this._parentEntityID.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._padding2); - dos.WriteUnsignedInt((uint)this._stationLocation); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedByte(); - this._reasonForSeparation = dis.ReadUnsignedByte(); - this._preEntityIndicator = dis.ReadUnsignedByte(); - this._padding1 = dis.ReadUnsignedByte(); - this._parentEntityID.Unmarshal(dis); - this._padding2 = dis.ReadUnsignedShort(); - this._stationLocation = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._reasonForSeparation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._preEntityIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._parentEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._padding2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._stationLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SeparationVP; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SeparationVP obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._reasonForSeparation != obj._reasonForSeparation) - { - ivarsEqual = false; - } - - if (this._preEntityIndicator != obj._preEntityIndicator) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (!this._parentEntityID.Equals(obj._parentEntityID)) - { - ivarsEqual = false; - } - - if (this._padding2 != obj._padding2) - { - ivarsEqual = false; - } - - if (this._stationLocation != obj._stationLocation) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._reasonForSeparation.GetHashCode(); - result = GenerateHash(result) ^ this._preEntityIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._parentEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._padding2.GetHashCode(); - result = GenerateHash(result) ^ this._stationLocation.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/ServiceRequestPdu.cs b/tests/OpenDisNet.Reference/Generated/ServiceRequestPdu.cs deleted file mode 100644 index 3740c90..0000000 --- a/tests/OpenDisNet.Reference/Generated/ServiceRequestPdu.cs +++ /dev/null @@ -1,479 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Service Request PDU shall be used to communicate information associated with one entity requesting a service from another). Section 7.4.2 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(SupplyQuantity))] - public partial class ServiceRequestPdu : LogisticsFamilyPdu, IEquatable - { - /// - /// Entity that is requesting service (see 6.2.28), Section 7.4.2 - /// - private EntityID _requestingEntityID = new EntityID(); - - /// - /// Entity that is providing the service (see 6.2.28), Section 7.4.2 - /// - private EntityID _servicingEntityID = new EntityID(); - - /// - /// Type of service requested, Section 7.4.2 - /// - private byte _serviceTypeRequested; - - /// - /// How many requested, Section 7.4.2 - /// - private byte _numberOfSupplyTypes; - - /// - /// padding - /// - private short _serviceRequestPadding; - - private List _supplies = new List(); - - /// - /// Initializes a new instance of the class. - /// - public ServiceRequestPdu() - { - PduType = (byte)5; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(ServiceRequestPdu left, ServiceRequestPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(ServiceRequestPdu left, ServiceRequestPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._requestingEntityID.GetMarshalledSize(); // this._requestingEntityID - marshalSize += this._servicingEntityID.GetMarshalledSize(); // this._servicingEntityID - marshalSize += 1; // this._serviceTypeRequested - marshalSize += 1; // this._numberOfSupplyTypes - marshalSize += 2; // this._serviceRequestPadding - for (int idx = 0; idx < this._supplies.Count; idx++) - { - SupplyQuantity listElement = (SupplyQuantity)this._supplies[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the Entity that is requesting service (see 6.2.28), Section 7.4.2 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "requestingEntityID")] - public EntityID RequestingEntityID - { - get - { - return this._requestingEntityID; - } - - set - { - this._requestingEntityID = value; - } - } - - /// - /// Gets or sets the Entity that is providing the service (see 6.2.28), Section 7.4.2 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "servicingEntityID")] - public EntityID ServicingEntityID - { - get - { - return this._servicingEntityID; - } - - set - { - this._servicingEntityID = value; - } - } - - /// - /// Gets or sets the Type of service requested, Section 7.4.2 - /// - [XmlElement(Type = typeof(byte), ElementName = "serviceTypeRequested")] - public byte ServiceTypeRequested - { - get - { - return this._serviceTypeRequested; - } - - set - { - this._serviceTypeRequested = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfSupplyTypes method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfSupplyTypes")] - public byte NumberOfSupplyTypes - { - get - { - return this._numberOfSupplyTypes; - } - - set - { - this._numberOfSupplyTypes = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(short), ElementName = "serviceRequestPadding")] - public short ServiceRequestPadding - { - get - { - return this._serviceRequestPadding; - } - - set - { - this._serviceRequestPadding = value; - } - } - - [XmlElement(ElementName = "suppliesList", Type = typeof(List))] - public List Supplies - { - get - { - return this._supplies; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._requestingEntityID.Marshal(dos); - this._servicingEntityID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._serviceTypeRequested); - dos.WriteUnsignedByte((byte)this._supplies.Count); - dos.WriteShort((short)this._serviceRequestPadding); - - for (int idx = 0; idx < this._supplies.Count; idx++) - { - SupplyQuantity aSupplyQuantity = (SupplyQuantity)this._supplies[idx]; - aSupplyQuantity.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requestingEntityID.Unmarshal(dis); - this._servicingEntityID.Unmarshal(dis); - this._serviceTypeRequested = dis.ReadUnsignedByte(); - this._numberOfSupplyTypes = dis.ReadUnsignedByte(); - this._serviceRequestPadding = dis.ReadShort(); - for (int idx = 0; idx < this.NumberOfSupplyTypes; idx++) - { - SupplyQuantity anX = new SupplyQuantity(); - anX.Unmarshal(dis); - this._supplies.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._requestingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._servicingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._serviceTypeRequested.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._supplies.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._serviceRequestPadding.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._supplies.Count; idx++) - { - sb.AppendLine(""); - SupplyQuantity aSupplyQuantity = (SupplyQuantity)this._supplies[idx]; - aSupplyQuantity.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as ServiceRequestPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(ServiceRequestPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._requestingEntityID.Equals(obj._requestingEntityID)) - { - ivarsEqual = false; - } - - if (!this._servicingEntityID.Equals(obj._servicingEntityID)) - { - ivarsEqual = false; - } - - if (this._serviceTypeRequested != obj._serviceTypeRequested) - { - ivarsEqual = false; - } - - if (this._numberOfSupplyTypes != obj._numberOfSupplyTypes) - { - ivarsEqual = false; - } - - if (this._serviceRequestPadding != obj._serviceRequestPadding) - { - ivarsEqual = false; - } - - if (this._supplies.Count != obj._supplies.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._supplies.Count; idx++) - { - if (!this._supplies[idx].Equals(obj._supplies[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requestingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._servicingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._serviceTypeRequested.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfSupplyTypes.GetHashCode(); - result = GenerateHash(result) ^ this._serviceRequestPadding.GetHashCode(); - - if (this._supplies.Count > 0) - { - for (int idx = 0; idx < this._supplies.Count; idx++) - { - result = GenerateHash(result) ^ this._supplies[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SetDataPdu.cs b/tests/OpenDisNet.Reference/Generated/SetDataPdu.cs deleted file mode 100644 index 906bc69..0000000 --- a/tests/OpenDisNet.Reference/Generated/SetDataPdu.cs +++ /dev/null @@ -1,519 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.10. Change state information with the data contained in this. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class SetDataPdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// ID of request - /// - private uint _requestID; - - /// - /// padding - /// - private uint _padding1; - - /// - /// Number of fixed datum records - /// - private uint _numberOfFixedDatumRecords; - - /// - /// Number of variable datum records - /// - private uint _numberOfVariableDatumRecords; - - /// - /// variable length list of fixed datums - /// - private List _fixedDatums = new List(); - - /// - /// variable length list of variable length datums - /// - private List _variableDatums = new List(); - - /// - /// Initializes a new instance of the class. - /// - public SetDataPdu() - { - PduType = (byte)19; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SetDataPdu left, SetDataPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SetDataPdu left, SetDataPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 4; // this._requestID - marshalSize += 4; // this._padding1 - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatums[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the ID of request - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(uint), ElementName = "padding1")] - public uint Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the variable length list of fixed datums - /// - [XmlElement(ElementName = "fixedDatumsList", Type = typeof(List))] - public List FixedDatums - { - get - { - return this._fixedDatums; - } - } - - /// - /// Gets or sets the variable length list of variable length datums - /// - [XmlElement(ElementName = "variableDatumsList", Type = typeof(List))] - public List VariableDatums - { - get - { - return this._variableDatums; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._padding1); - dos.WriteUnsignedInt((uint)this._fixedDatums.Count); - dos.WriteUnsignedInt((uint)this._variableDatums.Count); - - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requestID = dis.ReadUnsignedInt(); - this._padding1 = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatums.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatums.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatums.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatums[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatums[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SetDataPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SetDataPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatums.Count != obj._fixedDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - if (!this._fixedDatums[idx].Equals(obj._fixedDatums[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatums.Count != obj._variableDatums.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - if (!this._variableDatums[idx].Equals(obj._variableDatums[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatums.Count > 0) - { - for (int idx = 0; idx < this._fixedDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatums[idx].GetHashCode(); - } - } - - if (this._variableDatums.Count > 0) - { - for (int idx = 0; idx < this._variableDatums.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatums[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SetDataReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/SetDataReliablePdu.cs deleted file mode 100644 index af94644..0000000 --- a/tests/OpenDisNet.Reference/Generated/SetDataReliablePdu.cs +++ /dev/null @@ -1,583 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.9: initializing or chaning internal state information, reliable. Needs manual intervention to fix padding on variable datums. UNFINISHED - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(FixedDatum))] - [XmlInclude(typeof(VariableDatum))] - public partial class SetDataReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// level of reliability service used for this transaction - /// - private byte _requiredReliabilityService; - - /// - /// padding - /// - private ushort _pad1; - - /// - /// padding - /// - private byte _pad2; - - /// - /// Request ID - /// - private uint _requestID; - - /// - /// Fixed datum record count - /// - private uint _numberOfFixedDatumRecords; - - /// - /// variable datum record count - /// - private uint _numberOfVariableDatumRecords; - - /// - /// Fixed datum records - /// - private List _fixedDatumRecords = new List(); - - /// - /// Variable datum records - /// - private List _variableDatumRecords = new List(); - - /// - /// Initializes a new instance of the class. - /// - public SetDataReliablePdu() - { - PduType = (byte)59; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SetDataReliablePdu left, SetDataReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SetDataReliablePdu left, SetDataReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += 1; // this._requiredReliabilityService - marshalSize += 2; // this._pad1 - marshalSize += 1; // this._pad2 - marshalSize += 4; // this._requestID - marshalSize += 4; // this._numberOfFixedDatumRecords - marshalSize += 4; // this._numberOfVariableDatumRecords - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum listElement = (FixedDatum)this._fixedDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum listElement = (VariableDatum)this._variableDatumRecords[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the level of reliability service used for this transaction - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliabilityService")] - public byte RequiredReliabilityService - { - get - { - return this._requiredReliabilityService; - } - - set - { - this._requiredReliabilityService = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad1")] - public ushort Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad2")] - public byte Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Gets or sets the Request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfFixedDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfFixedDatumRecords")] - public uint NumberOfFixedDatumRecords - { - get - { - return this._numberOfFixedDatumRecords; - } - - set - { - this._numberOfFixedDatumRecords = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfVariableDatumRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(uint), ElementName = "numberOfVariableDatumRecords")] - public uint NumberOfVariableDatumRecords - { - get - { - return this._numberOfVariableDatumRecords; - } - - set - { - this._numberOfVariableDatumRecords = value; - } - } - - /// - /// Gets or sets the Fixed datum records - /// - [XmlElement(ElementName = "fixedDatumRecordsList", Type = typeof(List))] - public List FixedDatumRecords - { - get - { - return this._fixedDatumRecords; - } - } - - /// - /// Gets or sets the Variable datum records - /// - [XmlElement(ElementName = "variableDatumRecordsList", Type = typeof(List))] - public List VariableDatumRecords - { - get - { - return this._variableDatumRecords; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._requiredReliabilityService); - dos.WriteUnsignedShort((ushort)this._pad1); - dos.WriteUnsignedByte((byte)this._pad2); - dos.WriteUnsignedInt((uint)this._requestID); - dos.WriteUnsignedInt((uint)this._fixedDatumRecords.Count); - dos.WriteUnsignedInt((uint)this._variableDatumRecords.Count); - - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Marshal(dos); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._requiredReliabilityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedShort(); - this._pad2 = dis.ReadUnsignedByte(); - this._requestID = dis.ReadUnsignedInt(); - this._numberOfFixedDatumRecords = dis.ReadUnsignedInt(); - this._numberOfVariableDatumRecords = dis.ReadUnsignedInt(); - for (int idx = 0; idx < this.NumberOfFixedDatumRecords; idx++) - { - FixedDatum anX = new FixedDatum(); - anX.Unmarshal(dis); - this._fixedDatumRecords.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfVariableDatumRecords; idx++) - { - VariableDatum anX = new VariableDatum(); - anX.Unmarshal(dis); - this._variableDatumRecords.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine("" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fixedDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumRecords.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - sb.AppendLine(""); - FixedDatum aFixedDatum = (FixedDatum)this._fixedDatumRecords[idx]; - aFixedDatum.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - sb.AppendLine(""); - VariableDatum aVariableDatum = (VariableDatum)this._variableDatumRecords[idx]; - aVariableDatum.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SetDataReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SetDataReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (this._requiredReliabilityService != obj._requiredReliabilityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - if (this._numberOfFixedDatumRecords != obj._numberOfFixedDatumRecords) - { - ivarsEqual = false; - } - - if (this._numberOfVariableDatumRecords != obj._numberOfVariableDatumRecords) - { - ivarsEqual = false; - } - - if (this._fixedDatumRecords.Count != obj._fixedDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - if (!this._fixedDatumRecords[idx].Equals(obj._fixedDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._variableDatumRecords.Count != obj._variableDatumRecords.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - if (!this._variableDatumRecords[idx].Equals(obj._variableDatumRecords[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._requiredReliabilityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfFixedDatumRecords.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfVariableDatumRecords.GetHashCode(); - - if (this._fixedDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._fixedDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._fixedDatumRecords[idx].GetHashCode(); - } - } - - if (this._variableDatumRecords.Count > 0) - { - for (int idx = 0; idx < this._variableDatumRecords.Count; idx++) - { - result = GenerateHash(result) ^ this._variableDatumRecords[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SimulationAddress.cs b/tests/OpenDisNet.Reference/Generated/SimulationAddress.cs deleted file mode 100644 index d63c7e4..0000000 --- a/tests/OpenDisNet.Reference/Generated/SimulationAddress.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// A Simulation Address record shall consist of the Site Identification number and the Application Identification number. Section 6.2.79 - /// - [Serializable] - [XmlRoot] - public partial class SimulationAddress - { - /// - /// A site is defined as a facility, installation, organizational unit or a geographic location that has one or more simulation applications capable of participating in a distributed event. - /// - private ushort _site; - - /// - /// An application is defined as a software program that is used to generate and process distributed simulation data including live, virtual and constructive data. - /// - private ushort _application; - - /// - /// Initializes a new instance of the class. - /// - public SimulationAddress() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SimulationAddress left, SimulationAddress right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SimulationAddress left, SimulationAddress right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._site - marshalSize += 2; // this._application - return marshalSize; - } - - /// - /// Gets or sets the A site is defined as a facility, installation, organizational unit or a geographic location that has one or more simulation applications capable of participating in a distributed event. - /// - [XmlElement(Type = typeof(ushort), ElementName = "site")] - public ushort Site - { - get - { - return this._site; - } - - set - { - this._site = value; - } - } - - /// - /// Gets or sets the An application is defined as a software program that is used to generate and process distributed simulation data including live, virtual and constructive data. - /// - [XmlElement(Type = typeof(ushort), ElementName = "application")] - public ushort Application - { - get - { - return this._application; - } - - set - { - this._application = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._site); - dos.WriteUnsignedShort((ushort)this._application); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._site = dis.ReadUnsignedShort(); - this._application = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._site.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._application.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SimulationAddress; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SimulationAddress obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._site != obj._site) - { - ivarsEqual = false; - } - - if (this._application != obj._application) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._site.GetHashCode(); - result = GenerateHash(result) ^ this._application.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SimulationIdentifier.cs b/tests/OpenDisNet.Reference/Generated/SimulationIdentifier.cs deleted file mode 100644 index c43cb1a..0000000 --- a/tests/OpenDisNet.Reference/Generated/SimulationIdentifier.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of a simulation when using the 48-bit identifier format shall be specified by the Sim- ulation Identifier record. The reason that the 48-bit format is required in addition to the 32-bit simulation address format that actually identifies a specific simulation is because some 48-bit identifier fields in PDUs may contain either an Object Identifier, such as an Entity ID, or a Simulation Identifier. Section 6.2.80 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class SimulationIdentifier - { - /// - /// Simulation address - /// - private SimulationAddress _simulationAddress = new SimulationAddress(); - - /// - /// This field shall be set to zero as there is no reference number associated with a Simulation Identifier. - /// - private ushort _referenceNumber; - - /// - /// Initializes a new instance of the class. - /// - public SimulationIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SimulationIdentifier left, SimulationIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SimulationIdentifier left, SimulationIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._referenceNumber - return marshalSize; - } - - /// - /// Gets or sets the Simulation address - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "simulationAddress")] - public SimulationAddress SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - /// - /// Gets or sets the This field shall be set to zero as there is no reference number associated with a Simulation Identifier. - /// - [XmlElement(Type = typeof(ushort), ElementName = "referenceNumber")] - public ushort ReferenceNumber - { - get - { - return this._referenceNumber; - } - - set - { - this._referenceNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._referenceNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._referenceNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._referenceNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SimulationIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SimulationIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._referenceNumber != obj._referenceNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._referenceNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SimulationManagementFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/SimulationManagementFamilyPdu.cs deleted file mode 100644 index 81b653d..0000000 --- a/tests/OpenDisNet.Reference/Generated/SimulationManagementFamilyPdu.cs +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5 Abstract superclass for PDUs relating to the simulation itself. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class SimulationManagementFamilyPdu : Pdu, IEquatable - { - /// - /// Entity that is sending message - /// - private EntityID _originatingEntityID = new EntityID(); - - /// - /// Entity that is intended to receive message - /// - private EntityID _receivingEntityID = new EntityID(); - - /// - /// Initializes a new instance of the class. - /// - public SimulationManagementFamilyPdu() - { - ProtocolFamily = (byte)5; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SimulationManagementFamilyPdu left, SimulationManagementFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SimulationManagementFamilyPdu left, SimulationManagementFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingEntityID.GetMarshalledSize(); // this._originatingEntityID - marshalSize += this._receivingEntityID.GetMarshalledSize(); // this._receivingEntityID - return marshalSize; - } - - /// - /// Gets or sets the Entity that is sending message - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingEntityID")] - public EntityID OriginatingEntityID - { - get - { - return this._originatingEntityID; - } - - set - { - this._originatingEntityID = value; - } - } - - /// - /// Gets or sets the Entity that is intended to receive message - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingEntityID")] - public EntityID ReceivingEntityID - { - get - { - return this._receivingEntityID; - } - - set - { - this._receivingEntityID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingEntityID.Marshal(dos); - this._receivingEntityID.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingEntityID.Unmarshal(dis); - this._receivingEntityID.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SimulationManagementFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SimulationManagementFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingEntityID.Equals(obj._originatingEntityID)) - { - ivarsEqual = false; - } - - if (!this._receivingEntityID.Equals(obj._receivingEntityID)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingEntityID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SimulationManagementPduHeader.cs b/tests/OpenDisNet.Reference/Generated/SimulationManagementPduHeader.cs deleted file mode 100644 index 863e4f3..0000000 --- a/tests/OpenDisNet.Reference/Generated/SimulationManagementPduHeader.cs +++ /dev/null @@ -1,349 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// First part of a simulation management (SIMAN) PDU and SIMAN-Reliability (SIMAN-R) PDU. Sectionn 6.2.81 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(PduHeader))] - [XmlInclude(typeof(EntityID))] - public partial class SimulationManagementPduHeader - { - /// - /// Conventional PDU header - /// - private PduHeader _pduHeader = new PduHeader(); - - /// - /// IDs the simulation or entity, etiehr a simulation or an entity. Either 6.2.80 or 6.2.28 - /// - private EntityID _originatingID = new EntityID(); - - /// - /// simulation, all simulations, a special ID, or an entity. See 5.6.5 and 5.12.4 - /// - private EntityID _recevingID = new EntityID(); - - /// - /// Initializes a new instance of the class. - /// - public SimulationManagementPduHeader() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SimulationManagementPduHeader left, SimulationManagementPduHeader right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SimulationManagementPduHeader left, SimulationManagementPduHeader right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._pduHeader.GetMarshalledSize(); // this._pduHeader - marshalSize += this._originatingID.GetMarshalledSize(); // this._originatingID - marshalSize += this._recevingID.GetMarshalledSize(); // this._recevingID - return marshalSize; - } - - /// - /// Gets or sets the Conventional PDU header - /// - [XmlElement(Type = typeof(PduHeader), ElementName = "pduHeader")] - public PduHeader PduHeader - { - get - { - return this._pduHeader; - } - - set - { - this._pduHeader = value; - } - } - - /// - /// Gets or sets the IDs the simulation or entity, etiehr a simulation or an entity. Either 6.2.80 or 6.2.28 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingID")] - public EntityID OriginatingID - { - get - { - return this._originatingID; - } - - set - { - this._originatingID = value; - } - } - - /// - /// Gets or sets the simulation, all simulations, a special ID, or an entity. See 5.6.5 and 5.12.4 - /// - [XmlElement(Type = typeof(EntityID), ElementName = "recevingID")] - public EntityID RecevingID - { - get - { - return this._recevingID; - } - - set - { - this._recevingID = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._pduHeader.Marshal(dos); - this._originatingID.Marshal(dos); - this._recevingID.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._pduHeader.Unmarshal(dis); - this._originatingID.Unmarshal(dis); - this._recevingID.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._pduHeader.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._originatingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._recevingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SimulationManagementPduHeader; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SimulationManagementPduHeader obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._pduHeader.Equals(obj._pduHeader)) - { - ivarsEqual = false; - } - - if (!this._originatingID.Equals(obj._originatingID)) - { - ivarsEqual = false; - } - - if (!this._recevingID.Equals(obj._recevingID)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._pduHeader.GetHashCode(); - result = GenerateHash(result) ^ this._originatingID.GetHashCode(); - result = GenerateHash(result) ^ this._recevingID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SimulationManagementWithReliabilityFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/SimulationManagementWithReliabilityFamilyPdu.cs deleted file mode 100644 index f21b6d3..0000000 --- a/tests/OpenDisNet.Reference/Generated/SimulationManagementWithReliabilityFamilyPdu.cs +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12: Abstract superclass for reliable simulation management PDUs - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class SimulationManagementWithReliabilityFamilyPdu : Pdu, IEquatable - { - /// - /// Object originatig the request - /// - private EntityID _originatingEntityID = new EntityID(); - - /// - /// Object with which this point object is associated - /// - private EntityID _receivingEntityID = new EntityID(); - - /// - /// Initializes a new instance of the class. - /// - public SimulationManagementWithReliabilityFamilyPdu() - { - ProtocolFamily = (byte)10; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SimulationManagementWithReliabilityFamilyPdu left, SimulationManagementWithReliabilityFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SimulationManagementWithReliabilityFamilyPdu left, SimulationManagementWithReliabilityFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingEntityID.GetMarshalledSize(); // this._originatingEntityID - marshalSize += this._receivingEntityID.GetMarshalledSize(); // this._receivingEntityID - return marshalSize; - } - - /// - /// Gets or sets the Object originatig the request - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingEntityID")] - public EntityID OriginatingEntityID - { - get - { - return this._originatingEntityID; - } - - set - { - this._originatingEntityID = value; - } - } - - /// - /// Gets or sets the Object with which this point object is associated - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingEntityID")] - public EntityID ReceivingEntityID - { - get - { - return this._receivingEntityID; - } - - set - { - this._receivingEntityID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingEntityID.Marshal(dos); - this._receivingEntityID.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingEntityID.Unmarshal(dis); - this._receivingEntityID.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SimulationManagementWithReliabilityFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SimulationManagementWithReliabilityFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingEntityID.Equals(obj._originatingEntityID)) - { - ivarsEqual = false; - } - - if (!this._receivingEntityID.Equals(obj._receivingEntityID)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingEntityID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/StandardVariableSpecification.cs b/tests/OpenDisNet.Reference/Generated/StandardVariableSpecification.cs deleted file mode 100644 index 831a909..0000000 --- a/tests/OpenDisNet.Reference/Generated/StandardVariableSpecification.cs +++ /dev/null @@ -1,348 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Does not work, and causes failure in anything it is embedded in. Section 6.2.82 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationManagementPduHeader))] - public partial class StandardVariableSpecification - { - /// - /// Number of static variable records - /// - private ushort _numberOfStandardVariableRecords; - - /// - /// variable length list of standard variables, The class type and length here are WRONG and will cause the incorrect serialization of any class in whihc it is embedded. - /// - private List _standardVariables = new List(); - - /// - /// Initializes a new instance of the class. - /// - public StandardVariableSpecification() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(StandardVariableSpecification left, StandardVariableSpecification right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(StandardVariableSpecification left, StandardVariableSpecification right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._numberOfStandardVariableRecords - for (int idx = 0; idx < this._standardVariables.Count; idx++) - { - SimulationManagementPduHeader listElement = (SimulationManagementPduHeader)this._standardVariables[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfStandardVariableRecords method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(ushort), ElementName = "numberOfStandardVariableRecords")] - public ushort NumberOfStandardVariableRecords - { - get - { - return this._numberOfStandardVariableRecords; - } - - set - { - this._numberOfStandardVariableRecords = value; - } - } - - /// - /// Gets or sets the variable length list of standard variables, The class type and length here are WRONG and will cause the incorrect serialization of any class in whihc it is embedded. - /// - [XmlElement(ElementName = "standardVariablesList", Type = typeof(List))] - public List StandardVariables - { - get - { - return this._standardVariables; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._standardVariables.Count); - - for (int idx = 0; idx < this._standardVariables.Count; idx++) - { - SimulationManagementPduHeader aSimulationManagementPduHeader = (SimulationManagementPduHeader)this._standardVariables[idx]; - aSimulationManagementPduHeader.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._numberOfStandardVariableRecords = dis.ReadUnsignedShort(); - for (int idx = 0; idx < this.NumberOfStandardVariableRecords; idx++) - { - SimulationManagementPduHeader anX = new SimulationManagementPduHeader(); - anX.Unmarshal(dis); - this._standardVariables.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._standardVariables.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._standardVariables.Count; idx++) - { - sb.AppendLine(""); - SimulationManagementPduHeader aSimulationManagementPduHeader = (SimulationManagementPduHeader)this._standardVariables[idx]; - aSimulationManagementPduHeader.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as StandardVariableSpecification; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(StandardVariableSpecification obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._numberOfStandardVariableRecords != obj._numberOfStandardVariableRecords) - { - ivarsEqual = false; - } - - if (this._standardVariables.Count != obj._standardVariables.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._standardVariables.Count; idx++) - { - if (!this._standardVariables[idx].Equals(obj._standardVariables[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._numberOfStandardVariableRecords.GetHashCode(); - - if (this._standardVariables.Count > 0) - { - for (int idx = 0; idx < this._standardVariables.Count; idx++) - { - result = GenerateHash(result) ^ this._standardVariables[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/StartResumePdu.cs b/tests/OpenDisNet.Reference/Generated/StartResumePdu.cs deleted file mode 100644 index 988dd1e..0000000 --- a/tests/OpenDisNet.Reference/Generated/StartResumePdu.cs +++ /dev/null @@ -1,419 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.4. Start or resume an exercise. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(ClockTime))] - public partial class StartResumePdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Identifier for originating entity(or simulation) - /// - private EntityID _originatingID = new EntityID(); - - /// - /// Identifier for the receiving entity(or simulation) - /// - private EntityID _receivingID = new EntityID(); - - /// - /// This field shall specify the real-world time (UTC) at which the entity is to start/resume in the exercise. This information shall be used by the participating simulation applications to start/resume an exercise synchronously. This field shall be represented by a Clock Time record (see 6.2.16). - /// - private ClockTime _realWorldTime = new ClockTime(); - - /// - /// The reference time within a simulation exercise. This time is established ahead of time by simulation management and is common to all participants in a particular exercise. Simulation time may be either Absolute Time or Relative Time. This field shall be represented by a Clock Time record (see 6.2.16) - /// - private ClockTime _simulationTime = new ClockTime(); - - /// - /// Identifier for the specific and unique start/resume request - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public StartResumePdu() - { - PduType = (byte)13; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(StartResumePdu left, StartResumePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(StartResumePdu left, StartResumePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingID.GetMarshalledSize(); // this._originatingID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += this._realWorldTime.GetMarshalledSize(); // this._realWorldTime - marshalSize += this._simulationTime.GetMarshalledSize(); // this._simulationTime - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the Identifier for originating entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingID")] - public EntityID OriginatingID - { - get - { - return this._originatingID; - } - - set - { - this._originatingID = value; - } - } - - /// - /// Gets or sets the Identifier for the receiving entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingID")] - public EntityID ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the This field shall specify the real-world time (UTC) at which the entity is to start/resume in the exercise. This information shall be used by the participating simulation applications to start/resume an exercise synchronously. This field shall be represented by a Clock Time record (see 6.2.16). - /// - [XmlElement(Type = typeof(ClockTime), ElementName = "realWorldTime")] - public ClockTime RealWorldTime - { - get - { - return this._realWorldTime; - } - - set - { - this._realWorldTime = value; - } - } - - /// - /// Gets or sets the The reference time within a simulation exercise. This time is established ahead of time by simulation management and is common to all participants in a particular exercise. Simulation time may be either Absolute Time or Relative Time. This field shall be represented by a Clock Time record (see 6.2.16) - /// - [XmlElement(Type = typeof(ClockTime), ElementName = "simulationTime")] - public ClockTime SimulationTime - { - get - { - return this._simulationTime; - } - - set - { - this._simulationTime = value; - } - } - - /// - /// Gets or sets the Identifier for the specific and unique start/resume request - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingID.Marshal(dos); - this._receivingID.Marshal(dos); - this._realWorldTime.Marshal(dos); - this._simulationTime.Marshal(dos); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._realWorldTime.Unmarshal(dis); - this._simulationTime.Unmarshal(dis); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._realWorldTime.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._simulationTime.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as StartResumePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(StartResumePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingID.Equals(obj._originatingID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (!this._realWorldTime.Equals(obj._realWorldTime)) - { - ivarsEqual = false; - } - - if (!this._simulationTime.Equals(obj._simulationTime)) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._realWorldTime.GetHashCode(); - result = GenerateHash(result) ^ this._simulationTime.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/StartResumeReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/StartResumeReliablePdu.cs deleted file mode 100644 index 9f1cdb3..0000000 --- a/tests/OpenDisNet.Reference/Generated/StartResumeReliablePdu.cs +++ /dev/null @@ -1,446 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.3: Start resume simulation, relaible. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(ClockTime))] - public partial class StartResumeReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// time in real world for this operation to happen - /// - private ClockTime _realWorldTime = new ClockTime(); - - /// - /// time in simulation for the simulation to resume - /// - private ClockTime _simulationTime = new ClockTime(); - - /// - /// level of reliability service used for this transaction - /// - private byte _requiredReliabilityService; - - /// - /// padding - /// - private ushort _pad1; - - /// - /// padding - /// - private byte _pad2; - - /// - /// Request ID - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public StartResumeReliablePdu() - { - PduType = (byte)53; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(StartResumeReliablePdu left, StartResumeReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(StartResumeReliablePdu left, StartResumeReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._realWorldTime.GetMarshalledSize(); // this._realWorldTime - marshalSize += this._simulationTime.GetMarshalledSize(); // this._simulationTime - marshalSize += 1; // this._requiredReliabilityService - marshalSize += 2; // this._pad1 - marshalSize += 1; // this._pad2 - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the time in real world for this operation to happen - /// - [XmlElement(Type = typeof(ClockTime), ElementName = "realWorldTime")] - public ClockTime RealWorldTime - { - get - { - return this._realWorldTime; - } - - set - { - this._realWorldTime = value; - } - } - - /// - /// Gets or sets the time in simulation for the simulation to resume - /// - [XmlElement(Type = typeof(ClockTime), ElementName = "simulationTime")] - public ClockTime SimulationTime - { - get - { - return this._simulationTime; - } - - set - { - this._simulationTime = value; - } - } - - /// - /// Gets or sets the level of reliability service used for this transaction - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliabilityService")] - public byte RequiredReliabilityService - { - get - { - return this._requiredReliabilityService; - } - - set - { - this._requiredReliabilityService = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "pad1")] - public ushort Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad2")] - public byte Pad2 - { - get - { - return this._pad2; - } - - set - { - this._pad2 = value; - } - } - - /// - /// Gets or sets the Request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._realWorldTime.Marshal(dos); - this._simulationTime.Marshal(dos); - dos.WriteUnsignedByte((byte)this._requiredReliabilityService); - dos.WriteUnsignedShort((ushort)this._pad1); - dos.WriteUnsignedByte((byte)this._pad2); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._realWorldTime.Unmarshal(dis); - this._simulationTime.Unmarshal(dis); - this._requiredReliabilityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedShort(); - this._pad2 = dis.ReadUnsignedByte(); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._realWorldTime.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._simulationTime.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._requiredReliabilityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as StartResumeReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(StartResumeReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._realWorldTime.Equals(obj._realWorldTime)) - { - ivarsEqual = false; - } - - if (!this._simulationTime.Equals(obj._simulationTime)) - { - ivarsEqual = false; - } - - if (this._requiredReliabilityService != obj._requiredReliabilityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._pad2 != obj._pad2) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._realWorldTime.GetHashCode(); - result = GenerateHash(result) ^ this._simulationTime.GetHashCode(); - result = GenerateHash(result) ^ this._requiredReliabilityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._pad2.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/StopFreezePdu.cs b/tests/OpenDisNet.Reference/Generated/StopFreezePdu.cs deleted file mode 100644 index c779db0..0000000 --- a/tests/OpenDisNet.Reference/Generated/StopFreezePdu.cs +++ /dev/null @@ -1,481 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 7.5.5. Stop or freeze an enity (or exercise). COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(ClockTime))] - public partial class StopFreezePdu : SimulationManagementFamilyPdu, IEquatable - { - /// - /// Identifier for originating entity(or simulation) - /// - private EntityID _originatingID = new EntityID(); - - /// - /// Identifier for the receiving entity(or simulation) - /// - private EntityID _receivingID = new EntityID(); - - /// - /// real-world(UTC) time at which the entity shall stop or freeze in the exercise - /// - private ClockTime _realWorldTime = new ClockTime(); - - /// - /// Reason the simulation was stopped or frozen (see section 7 of SISO-REF-010) represented by an 8-bit enumeration - /// - private byte _reason; - - /// - /// Internal behavior of the entity(or simulation) and its appearance while frozen to the other participants - /// - private byte _frozenBehavior; - - /// - /// padding - /// - private short _padding1; - - /// - /// Request ID that is unique - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public StopFreezePdu() - { - PduType = (byte)14; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(StopFreezePdu left, StopFreezePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(StopFreezePdu left, StopFreezePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._originatingID.GetMarshalledSize(); // this._originatingID - marshalSize += this._receivingID.GetMarshalledSize(); // this._receivingID - marshalSize += this._realWorldTime.GetMarshalledSize(); // this._realWorldTime - marshalSize += 1; // this._reason - marshalSize += 1; // this._frozenBehavior - marshalSize += 2; // this._padding1 - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the Identifier for originating entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "originatingID")] - public EntityID OriginatingID - { - get - { - return this._originatingID; - } - - set - { - this._originatingID = value; - } - } - - /// - /// Gets or sets the Identifier for the receiving entity(or simulation) - /// - [XmlElement(Type = typeof(EntityID), ElementName = "receivingID")] - public EntityID ReceivingID - { - get - { - return this._receivingID; - } - - set - { - this._receivingID = value; - } - } - - /// - /// Gets or sets the real-world(UTC) time at which the entity shall stop or freeze in the exercise - /// - [XmlElement(Type = typeof(ClockTime), ElementName = "realWorldTime")] - public ClockTime RealWorldTime - { - get - { - return this._realWorldTime; - } - - set - { - this._realWorldTime = value; - } - } - - /// - /// Gets or sets the Reason the simulation was stopped or frozen (see section 7 of SISO-REF-010) represented by an 8-bit enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "reason")] - public byte Reason - { - get - { - return this._reason; - } - - set - { - this._reason = value; - } - } - - /// - /// Gets or sets the Internal behavior of the entity(or simulation) and its appearance while frozen to the other participants - /// - [XmlElement(Type = typeof(byte), ElementName = "frozenBehavior")] - public byte FrozenBehavior - { - get - { - return this._frozenBehavior; - } - - set - { - this._frozenBehavior = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(short), ElementName = "padding1")] - public short Padding1 - { - get - { - return this._padding1; - } - - set - { - this._padding1 = value; - } - } - - /// - /// Gets or sets the Request ID that is unique - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._originatingID.Marshal(dos); - this._receivingID.Marshal(dos); - this._realWorldTime.Marshal(dos); - dos.WriteUnsignedByte((byte)this._reason); - dos.WriteUnsignedByte((byte)this._frozenBehavior); - dos.WriteShort((short)this._padding1); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._originatingID.Unmarshal(dis); - this._receivingID.Unmarshal(dis); - this._realWorldTime.Unmarshal(dis); - this._reason = dis.ReadUnsignedByte(); - this._frozenBehavior = dis.ReadUnsignedByte(); - this._padding1 = dis.ReadShort(); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._originatingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._receivingID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._realWorldTime.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._reason.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._frozenBehavior.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as StopFreezePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(StopFreezePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._originatingID.Equals(obj._originatingID)) - { - ivarsEqual = false; - } - - if (!this._receivingID.Equals(obj._receivingID)) - { - ivarsEqual = false; - } - - if (!this._realWorldTime.Equals(obj._realWorldTime)) - { - ivarsEqual = false; - } - - if (this._reason != obj._reason) - { - ivarsEqual = false; - } - - if (this._frozenBehavior != obj._frozenBehavior) - { - ivarsEqual = false; - } - - if (this._padding1 != obj._padding1) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._originatingID.GetHashCode(); - result = GenerateHash(result) ^ this._receivingID.GetHashCode(); - result = GenerateHash(result) ^ this._realWorldTime.GetHashCode(); - result = GenerateHash(result) ^ this._reason.GetHashCode(); - result = GenerateHash(result) ^ this._frozenBehavior.GetHashCode(); - result = GenerateHash(result) ^ this._padding1.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/StopFreezeReliablePdu.cs b/tests/OpenDisNet.Reference/Generated/StopFreezeReliablePdu.cs deleted file mode 100644 index c3b7535..0000000 --- a/tests/OpenDisNet.Reference/Generated/StopFreezeReliablePdu.cs +++ /dev/null @@ -1,444 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.12.4: Stop freeze simulation, relaible. COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(ClockTime))] - public partial class StopFreezeReliablePdu : SimulationManagementWithReliabilityFamilyPdu, IEquatable - { - /// - /// time in real world for this operation to happen - /// - private ClockTime _realWorldTime = new ClockTime(); - - /// - /// Reason for stopping/freezing simulation - /// - private byte _reason; - - /// - /// internal behvior of the simulation while frozen - /// - private byte _frozenBehavior; - - /// - /// reliablity level - /// - private byte _requiredReliablityService; - - /// - /// padding - /// - private byte _pad1; - - /// - /// Request ID - /// - private uint _requestID; - - /// - /// Initializes a new instance of the class. - /// - public StopFreezeReliablePdu() - { - PduType = (byte)54; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(StopFreezeReliablePdu left, StopFreezeReliablePdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(StopFreezeReliablePdu left, StopFreezeReliablePdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._realWorldTime.GetMarshalledSize(); // this._realWorldTime - marshalSize += 1; // this._reason - marshalSize += 1; // this._frozenBehavior - marshalSize += 1; // this._requiredReliablityService - marshalSize += 1; // this._pad1 - marshalSize += 4; // this._requestID - return marshalSize; - } - - /// - /// Gets or sets the time in real world for this operation to happen - /// - [XmlElement(Type = typeof(ClockTime), ElementName = "realWorldTime")] - public ClockTime RealWorldTime - { - get - { - return this._realWorldTime; - } - - set - { - this._realWorldTime = value; - } - } - - /// - /// Gets or sets the Reason for stopping/freezing simulation - /// - [XmlElement(Type = typeof(byte), ElementName = "reason")] - public byte Reason - { - get - { - return this._reason; - } - - set - { - this._reason = value; - } - } - - /// - /// Gets or sets the internal behvior of the simulation while frozen - /// - [XmlElement(Type = typeof(byte), ElementName = "frozenBehavior")] - public byte FrozenBehavior - { - get - { - return this._frozenBehavior; - } - - set - { - this._frozenBehavior = value; - } - } - - /// - /// Gets or sets the reliablity level - /// - [XmlElement(Type = typeof(byte), ElementName = "requiredReliablityService")] - public byte RequiredReliablityService - { - get - { - return this._requiredReliablityService; - } - - set - { - this._requiredReliablityService = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad1")] - public byte Pad1 - { - get - { - return this._pad1; - } - - set - { - this._pad1 = value; - } - } - - /// - /// Gets or sets the Request ID - /// - [XmlElement(Type = typeof(uint), ElementName = "requestID")] - public uint RequestID - { - get - { - return this._requestID; - } - - set - { - this._requestID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._realWorldTime.Marshal(dos); - dos.WriteUnsignedByte((byte)this._reason); - dos.WriteUnsignedByte((byte)this._frozenBehavior); - dos.WriteUnsignedByte((byte)this._requiredReliablityService); - dos.WriteUnsignedByte((byte)this._pad1); - dos.WriteUnsignedInt((uint)this._requestID); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._realWorldTime.Unmarshal(dis); - this._reason = dis.ReadUnsignedByte(); - this._frozenBehavior = dis.ReadUnsignedByte(); - this._requiredReliablityService = dis.ReadUnsignedByte(); - this._pad1 = dis.ReadUnsignedByte(); - this._requestID = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._realWorldTime.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._reason.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._frozenBehavior.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requiredReliablityService.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._requestID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as StopFreezeReliablePdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(StopFreezeReliablePdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._realWorldTime.Equals(obj._realWorldTime)) - { - ivarsEqual = false; - } - - if (this._reason != obj._reason) - { - ivarsEqual = false; - } - - if (this._frozenBehavior != obj._frozenBehavior) - { - ivarsEqual = false; - } - - if (this._requiredReliablityService != obj._requiredReliablityService) - { - ivarsEqual = false; - } - - if (this._pad1 != obj._pad1) - { - ivarsEqual = false; - } - - if (this._requestID != obj._requestID) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._realWorldTime.GetHashCode(); - result = GenerateHash(result) ^ this._reason.GetHashCode(); - result = GenerateHash(result) ^ this._frozenBehavior.GetHashCode(); - result = GenerateHash(result) ^ this._requiredReliablityService.GetHashCode(); - result = GenerateHash(result) ^ this._pad1.GetHashCode(); - result = GenerateHash(result) ^ this._requestID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/StorageFuel.cs b/tests/OpenDisNet.Reference/Generated/StorageFuel.cs deleted file mode 100644 index 2f24cd2..0000000 --- a/tests/OpenDisNet.Reference/Generated/StorageFuel.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about an entity's engine fuel. Section 6.2.83. - /// - [Serializable] - [XmlRoot] - public partial class StorageFuel - { - /// - /// Fuel quantity, units specified by next field - /// - private uint _fuelQuantity; - - /// - /// Units in which the fuel is measured - /// - private byte _fuelMeasurementUnits; - - /// - /// Type of fuel - /// - private byte _fuelType; - - /// - /// Location of fuel as related to entity. See section 14 of EBV document - /// - private byte _fuelLocation; - - /// - /// padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public StorageFuel() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(StorageFuel left, StorageFuel right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(StorageFuel left, StorageFuel right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._fuelQuantity - marshalSize += 1; // this._fuelMeasurementUnits - marshalSize += 1; // this._fuelType - marshalSize += 1; // this._fuelLocation - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the Fuel quantity, units specified by next field - /// - [XmlElement(Type = typeof(uint), ElementName = "fuelQuantity")] - public uint FuelQuantity - { - get - { - return this._fuelQuantity; - } - - set - { - this._fuelQuantity = value; - } - } - - /// - /// Gets or sets the Units in which the fuel is measured - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelMeasurementUnits")] - public byte FuelMeasurementUnits - { - get - { - return this._fuelMeasurementUnits; - } - - set - { - this._fuelMeasurementUnits = value; - } - } - - /// - /// Gets or sets the Type of fuel - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelType")] - public byte FuelType - { - get - { - return this._fuelType; - } - - set - { - this._fuelType = value; - } - } - - /// - /// Gets or sets the Location of fuel as related to entity. See section 14 of EBV document - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelLocation")] - public byte FuelLocation - { - get - { - return this._fuelLocation; - } - - set - { - this._fuelLocation = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._fuelQuantity); - dos.WriteUnsignedByte((byte)this._fuelMeasurementUnits); - dos.WriteUnsignedByte((byte)this._fuelType); - dos.WriteUnsignedByte((byte)this._fuelLocation); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._fuelQuantity = dis.ReadUnsignedInt(); - this._fuelMeasurementUnits = dis.ReadUnsignedByte(); - this._fuelType = dis.ReadUnsignedByte(); - this._fuelLocation = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._fuelQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelMeasurementUnits.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as StorageFuel; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(StorageFuel obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._fuelQuantity != obj._fuelQuantity) - { - ivarsEqual = false; - } - - if (this._fuelMeasurementUnits != obj._fuelMeasurementUnits) - { - ivarsEqual = false; - } - - if (this._fuelType != obj._fuelType) - { - ivarsEqual = false; - } - - if (this._fuelLocation != obj._fuelLocation) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._fuelQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._fuelMeasurementUnits.GetHashCode(); - result = GenerateHash(result) ^ this._fuelType.GetHashCode(); - result = GenerateHash(result) ^ this._fuelLocation.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/StorageFuelReload.cs b/tests/OpenDisNet.Reference/Generated/StorageFuelReload.cs deleted file mode 100644 index 1f94c9f..0000000 --- a/tests/OpenDisNet.Reference/Generated/StorageFuelReload.cs +++ /dev/null @@ -1,501 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// For each type or location of Storage Fuel, this record shall specify the type, location, fuel measure- ment units, reload quantity and maximum quantity for storage fuel either for the whole entity or a specific storage fuel location (tank). Section 6.2.84. - /// - [Serializable] - [XmlRoot] - public partial class StorageFuelReload - { - /// - /// the standard quantity of this fuel type normally loaded at this station/launcher if a station/launcher is specified. If the Station/Launcher field is set to zero, then this is the total quantity of this fuel type that would be present in a standard reload of all appli- cable stations/launchers associated with this entity. - /// - private uint _standardQuantity; - - /// - /// the maximum quantity of this fuel type that this sta- tion/launcher is capable of holding when a station/launcher is specified. This would be the value used when a maximum reload was desired to be set for this station/launcher. If the Station/launcher field is set to zero, then this is the maximum quantity of this fuel type that would be present on this entity at all stations/launchers that can accept this fuel type. - /// - private uint _maximumQuantity; - - /// - /// the seconds normally required to reload the standard quantity of this fuel type at this specific station/launcher. When the Station/Launcher field is set to zero, this shall be the time it takes to perform a standard quantity reload of this fuel type at all applicable stations/launchers for this entity. - /// - private byte _standardQuantityReloadTime; - - /// - /// the seconds normally required to reload the maximum possible quantity of this fuel type at this station/launcher. When the Station/Launcher field is set to zero, this shall be the time it takes to perform a maximum quantity load/reload of this fuel type at all applicable stations/launchers for this entity. - /// - private byte _maximumQuantityReloadTime; - - /// - /// the fuel measurement units. Enumeration - /// - private byte _fuelMeasurementUnits; - - /// - /// Fuel type. Enumeration - /// - private byte _fuelType; - - /// - /// Location of fuel as related to entity. See section 14 of EBV document - /// - private byte _fuelLocation; - - /// - /// padding - /// - private byte _padding; - - /// - /// Initializes a new instance of the class. - /// - public StorageFuelReload() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(StorageFuelReload left, StorageFuelReload right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(StorageFuelReload left, StorageFuelReload right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._standardQuantity - marshalSize += 4; // this._maximumQuantity - marshalSize += 1; // this._standardQuantityReloadTime - marshalSize += 1; // this._maximumQuantityReloadTime - marshalSize += 1; // this._fuelMeasurementUnits - marshalSize += 1; // this._fuelType - marshalSize += 1; // this._fuelLocation - marshalSize += 1; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the the standard quantity of this fuel type normally loaded at this station/launcher if a station/launcher is specified. If the Station/Launcher field is set to zero, then this is the total quantity of this fuel type that would be present in a standard reload of all appli- cable stations/launchers associated with this entity. - /// - [XmlElement(Type = typeof(uint), ElementName = "standardQuantity")] - public uint StandardQuantity - { - get - { - return this._standardQuantity; - } - - set - { - this._standardQuantity = value; - } - } - - /// - /// Gets or sets the the maximum quantity of this fuel type that this sta- tion/launcher is capable of holding when a station/launcher is specified. This would be the value used when a maximum reload was desired to be set for this station/launcher. If the Station/launcher field is set to zero, then this is the maximum quantity of this fuel type that would be present on this entity at all stations/launchers that can accept this fuel type. - /// - [XmlElement(Type = typeof(uint), ElementName = "maximumQuantity")] - public uint MaximumQuantity - { - get - { - return this._maximumQuantity; - } - - set - { - this._maximumQuantity = value; - } - } - - /// - /// Gets or sets the the seconds normally required to reload the standard quantity of this fuel type at this specific station/launcher. When the Station/Launcher field is set to zero, this shall be the time it takes to perform a standard quantity reload of this fuel type at all applicable stations/launchers for this entity. - /// - [XmlElement(Type = typeof(byte), ElementName = "standardQuantityReloadTime")] - public byte StandardQuantityReloadTime - { - get - { - return this._standardQuantityReloadTime; - } - - set - { - this._standardQuantityReloadTime = value; - } - } - - /// - /// Gets or sets the the seconds normally required to reload the maximum possible quantity of this fuel type at this station/launcher. When the Station/Launcher field is set to zero, this shall be the time it takes to perform a maximum quantity load/reload of this fuel type at all applicable stations/launchers for this entity. - /// - [XmlElement(Type = typeof(byte), ElementName = "maximumQuantityReloadTime")] - public byte MaximumQuantityReloadTime - { - get - { - return this._maximumQuantityReloadTime; - } - - set - { - this._maximumQuantityReloadTime = value; - } - } - - /// - /// Gets or sets the the fuel measurement units. Enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelMeasurementUnits")] - public byte FuelMeasurementUnits - { - get - { - return this._fuelMeasurementUnits; - } - - set - { - this._fuelMeasurementUnits = value; - } - } - - /// - /// Gets or sets the Fuel type. Enumeration - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelType")] - public byte FuelType - { - get - { - return this._fuelType; - } - - set - { - this._fuelType = value; - } - } - - /// - /// Gets or sets the Location of fuel as related to entity. See section 14 of EBV document - /// - [XmlElement(Type = typeof(byte), ElementName = "fuelLocation")] - public byte FuelLocation - { - get - { - return this._fuelLocation; - } - - set - { - this._fuelLocation = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "padding")] - public byte Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._standardQuantity); - dos.WriteUnsignedInt((uint)this._maximumQuantity); - dos.WriteUnsignedByte((byte)this._standardQuantityReloadTime); - dos.WriteUnsignedByte((byte)this._maximumQuantityReloadTime); - dos.WriteUnsignedByte((byte)this._fuelMeasurementUnits); - dos.WriteUnsignedByte((byte)this._fuelType); - dos.WriteUnsignedByte((byte)this._fuelLocation); - dos.WriteUnsignedByte((byte)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._standardQuantity = dis.ReadUnsignedInt(); - this._maximumQuantity = dis.ReadUnsignedInt(); - this._standardQuantityReloadTime = dis.ReadUnsignedByte(); - this._maximumQuantityReloadTime = dis.ReadUnsignedByte(); - this._fuelMeasurementUnits = dis.ReadUnsignedByte(); - this._fuelType = dis.ReadUnsignedByte(); - this._fuelLocation = dis.ReadUnsignedByte(); - this._padding = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._standardQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._maximumQuantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._standardQuantityReloadTime.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._maximumQuantityReloadTime.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelMeasurementUnits.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._fuelLocation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as StorageFuelReload; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(StorageFuelReload obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._standardQuantity != obj._standardQuantity) - { - ivarsEqual = false; - } - - if (this._maximumQuantity != obj._maximumQuantity) - { - ivarsEqual = false; - } - - if (this._standardQuantityReloadTime != obj._standardQuantityReloadTime) - { - ivarsEqual = false; - } - - if (this._maximumQuantityReloadTime != obj._maximumQuantityReloadTime) - { - ivarsEqual = false; - } - - if (this._fuelMeasurementUnits != obj._fuelMeasurementUnits) - { - ivarsEqual = false; - } - - if (this._fuelType != obj._fuelType) - { - ivarsEqual = false; - } - - if (this._fuelLocation != obj._fuelLocation) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._standardQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._maximumQuantity.GetHashCode(); - result = GenerateHash(result) ^ this._standardQuantityReloadTime.GetHashCode(); - result = GenerateHash(result) ^ this._maximumQuantityReloadTime.GetHashCode(); - result = GenerateHash(result) ^ this._fuelMeasurementUnits.GetHashCode(); - result = GenerateHash(result) ^ this._fuelType.GetHashCode(); - result = GenerateHash(result) ^ this._fuelLocation.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SupplyQuantity.cs b/tests/OpenDisNet.Reference/Generated/SupplyQuantity.cs deleted file mode 100644 index 5d564b5..0000000 --- a/tests/OpenDisNet.Reference/Generated/SupplyQuantity.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// A supply, and the amount of that supply. Section 6.2.85 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityType))] - public partial class SupplyQuantity - { - /// - /// Type of supply - /// - private EntityType _supplyType = new EntityType(); - - /// - /// the number of units of a supply type. - /// - private float _quantity; - - /// - /// Initializes a new instance of the class. - /// - public SupplyQuantity() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SupplyQuantity left, SupplyQuantity right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SupplyQuantity left, SupplyQuantity right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._supplyType.GetMarshalledSize(); // this._supplyType - marshalSize += 4; // this._quantity - return marshalSize; - } - - /// - /// Gets or sets the Type of supply - /// - [XmlElement(Type = typeof(EntityType), ElementName = "supplyType")] - public EntityType SupplyType - { - get - { - return this._supplyType; - } - - set - { - this._supplyType = value; - } - } - - /// - /// Gets or sets the the number of units of a supply type. - /// - [XmlElement(Type = typeof(float), ElementName = "quantity")] - public float Quantity - { - get - { - return this._quantity; - } - - set - { - this._quantity = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._supplyType.Marshal(dos); - dos.WriteFloat((float)this._quantity); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._supplyType.Unmarshal(dis); - this._quantity = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._supplyType.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._quantity.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SupplyQuantity; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SupplyQuantity obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._supplyType.Equals(obj._supplyType)) - { - ivarsEqual = false; - } - - if (this._quantity != obj._quantity) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._supplyType.GetHashCode(); - result = GenerateHash(result) ^ this._quantity.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SyntheticEnvironmentFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/SyntheticEnvironmentFamilyPdu.cs deleted file mode 100644 index b9c288d..0000000 --- a/tests/OpenDisNet.Reference/Generated/SyntheticEnvironmentFamilyPdu.cs +++ /dev/null @@ -1,248 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Section 5.3.11: Abstract superclass for synthetic environment PDUs - /// - [Serializable] - [XmlRoot] - public partial class SyntheticEnvironmentFamilyPdu : Pdu, IEquatable - { - /// - /// Initializes a new instance of the class. - /// - public SyntheticEnvironmentFamilyPdu() - { - ProtocolFamily = (byte)9; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SyntheticEnvironmentFamilyPdu left, SyntheticEnvironmentFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SyntheticEnvironmentFamilyPdu left, SyntheticEnvironmentFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - return marshalSize; - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SyntheticEnvironmentFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SyntheticEnvironmentFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/SystemIdentifier.cs b/tests/OpenDisNet.Reference/Generated/SystemIdentifier.cs deleted file mode 100644 index db1c2a6..0000000 --- a/tests/OpenDisNet.Reference/Generated/SystemIdentifier.cs +++ /dev/null @@ -1,376 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The ID of the IFF emitting system. NOT COMPLETE. Section 6.2.86 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(ChangeOptions))] - public partial class SystemIdentifier - { - /// - /// general type of emitting system, an enumeration - /// - private ushort _systemType; - - /// - /// named type of system, an enumeration - /// - private ushort _systemName; - - /// - /// mode of operation for the system, an enumeration - /// - private ushort _systemMode; - - /// - /// status of this PDU, see section 6.2.15 - /// - private ChangeOptions _changeOptions = new ChangeOptions(); - - /// - /// Initializes a new instance of the class. - /// - public SystemIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(SystemIdentifier left, SystemIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(SystemIdentifier left, SystemIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._systemType - marshalSize += 2; // this._systemName - marshalSize += 2; // this._systemMode - marshalSize += this._changeOptions.GetMarshalledSize(); // this._changeOptions - return marshalSize; - } - - /// - /// Gets or sets the general type of emitting system, an enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "systemType")] - public ushort SystemType - { - get - { - return this._systemType; - } - - set - { - this._systemType = value; - } - } - - /// - /// Gets or sets the named type of system, an enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "systemName")] - public ushort SystemName - { - get - { - return this._systemName; - } - - set - { - this._systemName = value; - } - } - - /// - /// Gets or sets the mode of operation for the system, an enumeration - /// - [XmlElement(Type = typeof(ushort), ElementName = "systemMode")] - public ushort SystemMode - { - get - { - return this._systemMode; - } - - set - { - this._systemMode = value; - } - } - - /// - /// Gets or sets the status of this PDU, see section 6.2.15 - /// - [XmlElement(Type = typeof(ChangeOptions), ElementName = "changeOptions")] - public ChangeOptions ChangeOptions - { - get - { - return this._changeOptions; - } - - set - { - this._changeOptions = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._systemType); - dos.WriteUnsignedShort((ushort)this._systemName); - dos.WriteUnsignedShort((ushort)this._systemMode); - this._changeOptions.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._systemType = dis.ReadUnsignedShort(); - this._systemName = dis.ReadUnsignedShort(); - this._systemMode = dis.ReadUnsignedShort(); - this._changeOptions.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._systemType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._systemName.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._systemMode.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - this._changeOptions.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as SystemIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(SystemIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._systemType != obj._systemType) - { - ivarsEqual = false; - } - - if (this._systemName != obj._systemName) - { - ivarsEqual = false; - } - - if (this._systemMode != obj._systemMode) - { - ivarsEqual = false; - } - - if (!this._changeOptions.Equals(obj._changeOptions)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._systemType.GetHashCode(); - result = GenerateHash(result) ^ this._systemName.GetHashCode(); - result = GenerateHash(result) ^ this._systemMode.GetHashCode(); - result = GenerateHash(result) ^ this._changeOptions.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/TotalRecordSets.cs b/tests/OpenDisNet.Reference/Generated/TotalRecordSets.cs deleted file mode 100644 index a7d9d4f..0000000 --- a/tests/OpenDisNet.Reference/Generated/TotalRecordSets.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Total number of record sets contained in a logical set of one or more PDUs. Used to transfer ownership, etc Section 6.2.88 - /// - [Serializable] - [XmlRoot] - public partial class TotalRecordSets - { - /// - /// Total number of record sets - /// - private ushort _totalRecordSets; - - /// - /// padding - /// - private ushort _padding; - - /// - /// Initializes a new instance of the class. - /// - public TotalRecordSets() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(TotalRecordSets left, TotalRecordSets right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(TotalRecordSets left, TotalRecordSets right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._totalRecordSets - marshalSize += 2; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the Total number of record sets - /// - [XmlElement(Type = typeof(ushort), ElementName = "totalRecordSets")] - public ushort TotalRecordSets_ - { - get - { - return this._totalRecordSets; - } - - set - { - this._totalRecordSets = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(ushort), ElementName = "padding")] - public ushort Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._totalRecordSets); - dos.WriteUnsignedShort((ushort)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._totalRecordSets = dis.ReadUnsignedShort(); - this._padding = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._totalRecordSets.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as TotalRecordSets; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(TotalRecordSets obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._totalRecordSets != obj._totalRecordSets) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._totalRecordSets.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/TrackJamData.cs b/tests/OpenDisNet.Reference/Generated/TrackJamData.cs deleted file mode 100644 index da7cf75..0000000 --- a/tests/OpenDisNet.Reference/Generated/TrackJamData.cs +++ /dev/null @@ -1,344 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Track-Jam data Section 6.2.89 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class TrackJamData - { - /// - /// the entity tracked or illumated, or an emitter beam targeted with jamming - /// - private EntityID _entityID = new EntityID(); - - /// - /// Emitter system associated with the entity - /// - private byte _emitterNumber; - - /// - /// Beam associated with the entity - /// - private byte _beamNumber; - - /// - /// Initializes a new instance of the class. - /// - public TrackJamData() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(TrackJamData left, TrackJamData right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(TrackJamData left, TrackJamData right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._entityID.GetMarshalledSize(); // this._entityID - marshalSize += 1; // this._emitterNumber - marshalSize += 1; // this._beamNumber - return marshalSize; - } - - /// - /// Gets or sets the the entity tracked or illumated, or an emitter beam targeted with jamming - /// - [XmlElement(Type = typeof(EntityID), ElementName = "entityID")] - public EntityID EntityID - { - get - { - return this._entityID; - } - - set - { - this._entityID = value; - } - } - - /// - /// Gets or sets the Emitter system associated with the entity - /// - [XmlElement(Type = typeof(byte), ElementName = "emitterNumber")] - public byte EmitterNumber - { - get - { - return this._emitterNumber; - } - - set - { - this._emitterNumber = value; - } - } - - /// - /// Gets or sets the Beam associated with the entity - /// - [XmlElement(Type = typeof(byte), ElementName = "beamNumber")] - public byte BeamNumber - { - get - { - return this._beamNumber; - } - - set - { - this._beamNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._entityID.Marshal(dos); - dos.WriteUnsignedByte((byte)this._emitterNumber); - dos.WriteUnsignedByte((byte)this._beamNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._entityID.Unmarshal(dis); - this._emitterNumber = dis.ReadUnsignedByte(); - this._beamNumber = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._entityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._emitterNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as TrackJamData; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(TrackJamData obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._entityID.Equals(obj._entityID)) - { - ivarsEqual = false; - } - - if (this._emitterNumber != obj._emitterNumber) - { - ivarsEqual = false; - } - - if (this._beamNumber != obj._beamNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._entityID.GetHashCode(); - result = GenerateHash(result) ^ this._emitterNumber.GetHashCode(); - result = GenerateHash(result) ^ this._beamNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/TwoByteChunk.cs b/tests/OpenDisNet.Reference/Generated/TwoByteChunk.cs deleted file mode 100644 index a92f68a..0000000 --- a/tests/OpenDisNet.Reference/Generated/TwoByteChunk.cs +++ /dev/null @@ -1,303 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// 16 bit piece of data - /// - [Serializable] - [XmlRoot] - public partial class TwoByteChunk - { - /// - /// two bytes of arbitrary data - /// - private byte[] _otherParameters = new byte[2]; - - /// - /// Initializes a new instance of the class. - /// - public TwoByteChunk() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(TwoByteChunk left, TwoByteChunk right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(TwoByteChunk left, TwoByteChunk right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2 * 1; // _otherParameters - return marshalSize; - } - - /// - /// Gets or sets the two bytes of arbitrary data - /// - [XmlArray(ElementName = "otherParameters")] - public byte[] OtherParameters - { - get - { - return this._otherParameters; - } - - set - { - this._otherParameters = value; - } -} - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - dos.WriteByte(this._otherParameters[idx]); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - this._otherParameters[idx] = dis.ReadByte(); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - for (int idx = 0; idx < this._otherParameters.Length; idx++) - { - sb.AppendLine("" + this._otherParameters[idx] + ""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as TwoByteChunk; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(TwoByteChunk obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (obj._otherParameters.Length != 2) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < 2; idx++) - { - if (this._otherParameters[idx] != obj._otherParameters[idx]) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - - for (int idx = 0; idx < 2; idx++) - { - result = GenerateHash(result) ^ this._otherParameters[idx].GetHashCode(); - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/UAFundamentalParameter.cs b/tests/OpenDisNet.Reference/Generated/UAFundamentalParameter.cs deleted file mode 100644 index f70d8c4..0000000 --- a/tests/OpenDisNet.Reference/Generated/UAFundamentalParameter.cs +++ /dev/null @@ -1,437 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Regeneration parameters for active emission systems that are variable throughout a scenario. Section 6.2.90 - /// - [Serializable] - [XmlRoot] - public partial class UAFundamentalParameter - { - /// - /// Which database record shall be used. An enumeration from EBV document - /// - private ushort _activeEmissionParameterIndex; - - /// - /// The type of scan pattern, If not used, zero. An enumeration from EBV document - /// - private ushort _scanPattern; - - /// - /// center azimuth bearing of th emain beam. In radians. - /// - private float _beamCenterAzimuthHorizontal; - - /// - /// Horizontal beamwidth of th emain beam Meastued at the 3dB down point of peak radiated power. In radians. - /// - private float _azimuthalBeamwidthHorizontal; - - /// - /// center of the d/e angle of th emain beam relative to the stablised de angle of the target. In radians. - /// - private float _beamCenterDepressionElevation; - - /// - /// vertical beamwidth of the main beam. Meastured at the 3dB down point of peak radiated power. In radians. - /// - private float _beamwidthDownElevation; - - /// - /// Initializes a new instance of the class. - /// - public UAFundamentalParameter() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(UAFundamentalParameter left, UAFundamentalParameter right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(UAFundamentalParameter left, UAFundamentalParameter right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 2; // this._activeEmissionParameterIndex - marshalSize += 2; // this._scanPattern - marshalSize += 4; // this._beamCenterAzimuthHorizontal - marshalSize += 4; // this._azimuthalBeamwidthHorizontal - marshalSize += 4; // this._beamCenterDepressionElevation - marshalSize += 4; // this._beamwidthDownElevation - return marshalSize; - } - - /// - /// Gets or sets the Which database record shall be used. An enumeration from EBV document - /// - [XmlElement(Type = typeof(ushort), ElementName = "activeEmissionParameterIndex")] - public ushort ActiveEmissionParameterIndex - { - get - { - return this._activeEmissionParameterIndex; - } - - set - { - this._activeEmissionParameterIndex = value; - } - } - - /// - /// Gets or sets the The type of scan pattern, If not used, zero. An enumeration from EBV document - /// - [XmlElement(Type = typeof(ushort), ElementName = "scanPattern")] - public ushort ScanPattern - { - get - { - return this._scanPattern; - } - - set - { - this._scanPattern = value; - } - } - - /// - /// Gets or sets the center azimuth bearing of th emain beam. In radians. - /// - [XmlElement(Type = typeof(float), ElementName = "beamCenterAzimuthHorizontal")] - public float BeamCenterAzimuthHorizontal - { - get - { - return this._beamCenterAzimuthHorizontal; - } - - set - { - this._beamCenterAzimuthHorizontal = value; - } - } - - /// - /// Gets or sets the Horizontal beamwidth of th emain beam Meastued at the 3dB down point of peak radiated power. In radians. - /// - [XmlElement(Type = typeof(float), ElementName = "azimuthalBeamwidthHorizontal")] - public float AzimuthalBeamwidthHorizontal - { - get - { - return this._azimuthalBeamwidthHorizontal; - } - - set - { - this._azimuthalBeamwidthHorizontal = value; - } - } - - /// - /// Gets or sets the center of the d/e angle of th emain beam relative to the stablised de angle of the target. In radians. - /// - [XmlElement(Type = typeof(float), ElementName = "beamCenterDepressionElevation")] - public float BeamCenterDepressionElevation - { - get - { - return this._beamCenterDepressionElevation; - } - - set - { - this._beamCenterDepressionElevation = value; - } - } - - /// - /// Gets or sets the vertical beamwidth of the main beam. Meastured at the 3dB down point of peak radiated power. In radians. - /// - [XmlElement(Type = typeof(float), ElementName = "beamwidthDownElevation")] - public float BeamwidthDownElevation - { - get - { - return this._beamwidthDownElevation; - } - - set - { - this._beamwidthDownElevation = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedShort((ushort)this._activeEmissionParameterIndex); - dos.WriteUnsignedShort((ushort)this._scanPattern); - dos.WriteFloat((float)this._beamCenterAzimuthHorizontal); - dos.WriteFloat((float)this._azimuthalBeamwidthHorizontal); - dos.WriteFloat((float)this._beamCenterDepressionElevation); - dos.WriteFloat((float)this._beamwidthDownElevation); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._activeEmissionParameterIndex = dis.ReadUnsignedShort(); - this._scanPattern = dis.ReadUnsignedShort(); - this._beamCenterAzimuthHorizontal = dis.ReadFloat(); - this._azimuthalBeamwidthHorizontal = dis.ReadFloat(); - this._beamCenterDepressionElevation = dis.ReadFloat(); - this._beamwidthDownElevation = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._activeEmissionParameterIndex.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._scanPattern.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamCenterAzimuthHorizontal.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._azimuthalBeamwidthHorizontal.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamCenterDepressionElevation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._beamwidthDownElevation.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as UAFundamentalParameter; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(UAFundamentalParameter obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._activeEmissionParameterIndex != obj._activeEmissionParameterIndex) - { - ivarsEqual = false; - } - - if (this._scanPattern != obj._scanPattern) - { - ivarsEqual = false; - } - - if (this._beamCenterAzimuthHorizontal != obj._beamCenterAzimuthHorizontal) - { - ivarsEqual = false; - } - - if (this._azimuthalBeamwidthHorizontal != obj._azimuthalBeamwidthHorizontal) - { - ivarsEqual = false; - } - - if (this._beamCenterDepressionElevation != obj._beamCenterDepressionElevation) - { - ivarsEqual = false; - } - - if (this._beamwidthDownElevation != obj._beamwidthDownElevation) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._activeEmissionParameterIndex.GetHashCode(); - result = GenerateHash(result) ^ this._scanPattern.GetHashCode(); - result = GenerateHash(result) ^ this._beamCenterAzimuthHorizontal.GetHashCode(); - result = GenerateHash(result) ^ this._azimuthalBeamwidthHorizontal.GetHashCode(); - result = GenerateHash(result) ^ this._beamCenterDepressionElevation.GetHashCode(); - result = GenerateHash(result) ^ this._beamwidthDownElevation.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/UaPdu.cs b/tests/OpenDisNet.Reference/Generated/UaPdu.cs deleted file mode 100644 index 95784b1..0000000 --- a/tests/OpenDisNet.Reference/Generated/UaPdu.cs +++ /dev/null @@ -1,756 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Information about underwater acoustic emmissions. This requires manual cleanup. The beam data records should ALL be a the finish, rather than attached to each emitter system. Section 7.6.4. UNFINISHED - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - [XmlInclude(typeof(EventIdentifier))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(Vector3Float))] - [XmlInclude(typeof(Vector3Float))] - public partial class UaPdu : DistributedEmissionsFamilyPdu, IEquatable - { - /// - /// ID of the entity that is the source of the emission - /// - private EntityID _emittingEntityID = new EntityID(); - - /// - /// ID of event - /// - private EventIdentifier _eventID = new EventIdentifier(); - - /// - /// This field shall be used to indicate whether the data in the UA PDU represent a state update or data that have changed since issuance of the last UA PDU - /// - private byte _stateChangeIndicator; - - /// - /// padding - /// - private byte _pad; - - /// - /// This field indicates which database record (or file) shall be used in the definition of passive signature (unintentional) emissions of the entity. The indicated database record (or file) shall define all noise generated as a function of propulsion plant configurations and associated auxiliaries. - /// - private ushort _passiveParameterIndex; - - /// - /// This field shall specify the entity propulsion plant configuration. This field is used to determine the passive signature characteristics of an entity. - /// - private byte _propulsionPlantConfiguration; - - /// - /// This field shall represent the number of shafts on a platform - /// - private byte _numberOfShafts; - - /// - /// This field shall indicate the number of APAs described in the current UA PDU - /// - private byte _numberOfAPAs; - - /// - /// This field shall specify the number of UA emitter systems being described in the current UA PDU - /// - private byte _numberOfUAEmitterSystems; - - /// - /// shaft RPM values. THIS IS WRONG. It has the wrong class in the list. - /// - private List _shaftRPMs = new List(); - - /// - /// apaData. THIS IS WRONG. It has the worng class in the list. - /// - private List _apaData = new List(); - - /// - /// THIS IS WRONG. It has the wrong class in the list. - /// - private List _emitterSystems = new List(); - - /// - /// Initializes a new instance of the class. - /// - public UaPdu() - { - PduType = (byte)29; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(UaPdu left, UaPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(UaPdu left, UaPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._emittingEntityID.GetMarshalledSize(); // this._emittingEntityID - marshalSize += this._eventID.GetMarshalledSize(); // this._eventID - marshalSize += 1; // this._stateChangeIndicator - marshalSize += 1; // this._pad - marshalSize += 2; // this._passiveParameterIndex - marshalSize += 1; // this._propulsionPlantConfiguration - marshalSize += 1; // this._numberOfShafts - marshalSize += 1; // this._numberOfAPAs - marshalSize += 1; // this._numberOfUAEmitterSystems - for (int idx = 0; idx < this._shaftRPMs.Count; idx++) - { - Vector3Float listElement = (Vector3Float)this._shaftRPMs[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._apaData.Count; idx++) - { - Vector3Float listElement = (Vector3Float)this._apaData[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - for (int idx = 0; idx < this._emitterSystems.Count; idx++) - { - Vector3Float listElement = (Vector3Float)this._emitterSystems[idx]; - marshalSize += listElement.GetMarshalledSize(); - } - - return marshalSize; - } - - /// - /// Gets or sets the ID of the entity that is the source of the emission - /// - [XmlElement(Type = typeof(EntityID), ElementName = "emittingEntityID")] - public EntityID EmittingEntityID - { - get - { - return this._emittingEntityID; - } - - set - { - this._emittingEntityID = value; - } - } - - /// - /// Gets or sets the ID of event - /// - [XmlElement(Type = typeof(EventIdentifier), ElementName = "eventID")] - public EventIdentifier EventID - { - get - { - return this._eventID; - } - - set - { - this._eventID = value; - } - } - - /// - /// Gets or sets the This field shall be used to indicate whether the data in the UA PDU represent a state update or data that have changed since issuance of the last UA PDU - /// - [XmlElement(Type = typeof(byte), ElementName = "stateChangeIndicator")] - public byte StateChangeIndicator - { - get - { - return this._stateChangeIndicator; - } - - set - { - this._stateChangeIndicator = value; - } - } - - /// - /// Gets or sets the padding - /// - [XmlElement(Type = typeof(byte), ElementName = "pad")] - public byte Pad - { - get - { - return this._pad; - } - - set - { - this._pad = value; - } - } - - /// - /// Gets or sets the This field indicates which database record (or file) shall be used in the definition of passive signature (unintentional) emissions of the entity. The indicated database record (or file) shall define all noise generated as a function of propulsion plant configurations and associated auxiliaries. - /// - [XmlElement(Type = typeof(ushort), ElementName = "passiveParameterIndex")] - public ushort PassiveParameterIndex - { - get - { - return this._passiveParameterIndex; - } - - set - { - this._passiveParameterIndex = value; - } - } - - /// - /// Gets or sets the This field shall specify the entity propulsion plant configuration. This field is used to determine the passive signature characteristics of an entity. - /// - [XmlElement(Type = typeof(byte), ElementName = "propulsionPlantConfiguration")] - public byte PropulsionPlantConfiguration - { - get - { - return this._propulsionPlantConfiguration; - } - - set - { - this._propulsionPlantConfiguration = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfShafts method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfShafts")] - public byte NumberOfShafts - { - get - { - return this._numberOfShafts; - } - - set - { - this._numberOfShafts = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfAPAs method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfAPAs")] - public byte NumberOfAPAs - { - get - { - return this._numberOfAPAs; - } - - set - { - this._numberOfAPAs = value; - } - } - - /// - /// Note that setting this value will not change the marshalled value. The list whose length this describes is used for that purpose. - /// The getnumberOfUAEmitterSystems method will also be based on the actual list length rather than this value. - /// The method is simply here for completeness and should not be used for any computations. - /// - [XmlElement(Type = typeof(byte), ElementName = "numberOfUAEmitterSystems")] - public byte NumberOfUAEmitterSystems - { - get - { - return this._numberOfUAEmitterSystems; - } - - set - { - this._numberOfUAEmitterSystems = value; - } - } - - /// - /// Gets or sets the shaft RPM values. THIS IS WRONG. It has the wrong class in the list. - /// - [XmlElement(ElementName = "shaftRPMsList", Type = typeof(List))] - public List ShaftRPMs - { - get - { - return this._shaftRPMs; - } - } - - /// - /// Gets or sets the apaData. THIS IS WRONG. It has the worng class in the list. - /// - [XmlElement(ElementName = "apaDataList", Type = typeof(List))] - public List ApaData - { - get - { - return this._apaData; - } - } - - /// - /// Gets or sets the THIS IS WRONG. It has the wrong class in the list. - /// - [XmlElement(ElementName = "emitterSystemsList", Type = typeof(List))] - public List EmitterSystems - { - get - { - return this._emitterSystems; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public override void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._emittingEntityID.Marshal(dos); - this._eventID.Marshal(dos); - dos.WriteByte((byte)this._stateChangeIndicator); - dos.WriteByte((byte)this._pad); - dos.WriteUnsignedShort((ushort)this._passiveParameterIndex); - dos.WriteUnsignedByte((byte)this._propulsionPlantConfiguration); - dos.WriteUnsignedByte((byte)this._shaftRPMs.Count); - dos.WriteUnsignedByte((byte)this._apaData.Count); - dos.WriteUnsignedByte((byte)this._emitterSystems.Count); - - for (int idx = 0; idx < this._shaftRPMs.Count; idx++) - { - Vector3Float aVector3Float = (Vector3Float)this._shaftRPMs[idx]; - aVector3Float.Marshal(dos); - } - - for (int idx = 0; idx < this._apaData.Count; idx++) - { - Vector3Float aVector3Float = (Vector3Float)this._apaData[idx]; - aVector3Float.Marshal(dos); - } - - for (int idx = 0; idx < this._emitterSystems.Count; idx++) - { - Vector3Float aVector3Float = (Vector3Float)this._emitterSystems[idx]; - aVector3Float.Marshal(dos); - } - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._emittingEntityID.Unmarshal(dis); - this._eventID.Unmarshal(dis); - this._stateChangeIndicator = dis.ReadByte(); - this._pad = dis.ReadByte(); - this._passiveParameterIndex = dis.ReadUnsignedShort(); - this._propulsionPlantConfiguration = dis.ReadUnsignedByte(); - this._numberOfShafts = dis.ReadUnsignedByte(); - this._numberOfAPAs = dis.ReadUnsignedByte(); - this._numberOfUAEmitterSystems = dis.ReadUnsignedByte(); - for (int idx = 0; idx < this.NumberOfShafts; idx++) - { - Vector3Float anX = new Vector3Float(); - anX.Unmarshal(dis); - this._shaftRPMs.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfAPAs; idx++) - { - Vector3Float anX = new Vector3Float(); - anX.Unmarshal(dis); - this._apaData.Add(anX); - }; - - for (int idx = 0; idx < this.NumberOfUAEmitterSystems; idx++) - { - Vector3Float anX = new Vector3Float(); - anX.Unmarshal(dis); - this._emitterSystems.Add(anX); - }; - - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._emittingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._eventID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._stateChangeIndicator.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._pad.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._passiveParameterIndex.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._propulsionPlantConfiguration.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._shaftRPMs.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._apaData.Count.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._emitterSystems.Count.ToString(CultureInfo.InvariantCulture) + ""); - for (int idx = 0; idx < this._shaftRPMs.Count; idx++) - { - sb.AppendLine(""); - Vector3Float aVector3Float = (Vector3Float)this._shaftRPMs[idx]; - aVector3Float.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._apaData.Count; idx++) - { - sb.AppendLine(""); - Vector3Float aVector3Float = (Vector3Float)this._apaData[idx]; - aVector3Float.Reflection(sb); - sb.AppendLine(""); - } - - for (int idx = 0; idx < this._emitterSystems.Count; idx++) - { - sb.AppendLine(""); - Vector3Float aVector3Float = (Vector3Float)this._emitterSystems[idx]; - aVector3Float.Reflection(sb); - sb.AppendLine(""); - } - - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as UaPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(UaPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._emittingEntityID.Equals(obj._emittingEntityID)) - { - ivarsEqual = false; - } - - if (!this._eventID.Equals(obj._eventID)) - { - ivarsEqual = false; - } - - if (this._stateChangeIndicator != obj._stateChangeIndicator) - { - ivarsEqual = false; - } - - if (this._pad != obj._pad) - { - ivarsEqual = false; - } - - if (this._passiveParameterIndex != obj._passiveParameterIndex) - { - ivarsEqual = false; - } - - if (this._propulsionPlantConfiguration != obj._propulsionPlantConfiguration) - { - ivarsEqual = false; - } - - if (this._numberOfShafts != obj._numberOfShafts) - { - ivarsEqual = false; - } - - if (this._numberOfAPAs != obj._numberOfAPAs) - { - ivarsEqual = false; - } - - if (this._numberOfUAEmitterSystems != obj._numberOfUAEmitterSystems) - { - ivarsEqual = false; - } - - if (this._shaftRPMs.Count != obj._shaftRPMs.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._shaftRPMs.Count; idx++) - { - if (!this._shaftRPMs[idx].Equals(obj._shaftRPMs[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._apaData.Count != obj._apaData.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._apaData.Count; idx++) - { - if (!this._apaData[idx].Equals(obj._apaData[idx])) - { - ivarsEqual = false; - } - } - } - - if (this._emitterSystems.Count != obj._emitterSystems.Count) - { - ivarsEqual = false; - } - - if (ivarsEqual) - { - for (int idx = 0; idx < this._emitterSystems.Count; idx++) - { - if (!this._emitterSystems[idx].Equals(obj._emitterSystems[idx])) - { - ivarsEqual = false; - } - } - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._emittingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._eventID.GetHashCode(); - result = GenerateHash(result) ^ this._stateChangeIndicator.GetHashCode(); - result = GenerateHash(result) ^ this._pad.GetHashCode(); - result = GenerateHash(result) ^ this._passiveParameterIndex.GetHashCode(); - result = GenerateHash(result) ^ this._propulsionPlantConfiguration.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfShafts.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfAPAs.GetHashCode(); - result = GenerateHash(result) ^ this._numberOfUAEmitterSystems.GetHashCode(); - - if (this._shaftRPMs.Count > 0) - { - for (int idx = 0; idx < this._shaftRPMs.Count; idx++) - { - result = GenerateHash(result) ^ this._shaftRPMs[idx].GetHashCode(); - } - } - - if (this._apaData.Count > 0) - { - for (int idx = 0; idx < this._apaData.Count; idx++) - { - result = GenerateHash(result) ^ this._apaData[idx].GetHashCode(); - } - } - - if (this._emitterSystems.Count > 0) - { - for (int idx = 0; idx < this._emitterSystems.Count; idx++) - { - result = GenerateHash(result) ^ this._emitterSystems[idx].GetHashCode(); - } - } - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/UnattachedIdentifier.cs b/tests/OpenDisNet.Reference/Generated/UnattachedIdentifier.cs deleted file mode 100644 index 7c6c000..0000000 --- a/tests/OpenDisNet.Reference/Generated/UnattachedIdentifier.cs +++ /dev/null @@ -1,312 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// The unique designation of one or more unattached radios in an event or exercise Section 6.2.91 - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(SimulationAddress))] - public partial class UnattachedIdentifier - { - /// - /// See 6.2.79 - /// - private SimulationAddress _simulationAddress = new SimulationAddress(); - - /// - /// Reference number - /// - private ushort _referenceNumber; - - /// - /// Initializes a new instance of the class. - /// - public UnattachedIdentifier() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(UnattachedIdentifier left, UnattachedIdentifier right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(UnattachedIdentifier left, UnattachedIdentifier right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += this._simulationAddress.GetMarshalledSize(); // this._simulationAddress - marshalSize += 2; // this._referenceNumber - return marshalSize; - } - - /// - /// Gets or sets the See 6.2.79 - /// - [XmlElement(Type = typeof(SimulationAddress), ElementName = "simulationAddress")] - public SimulationAddress SimulationAddress - { - get - { - return this._simulationAddress; - } - - set - { - this._simulationAddress = value; - } - } - - /// - /// Gets or sets the Reference number - /// - [XmlElement(Type = typeof(ushort), ElementName = "referenceNumber")] - public ushort ReferenceNumber - { - get - { - return this._referenceNumber; - } - - set - { - this._referenceNumber = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - this._simulationAddress.Marshal(dos); - dos.WriteUnsignedShort((ushort)this._referenceNumber); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._simulationAddress.Unmarshal(dis); - this._referenceNumber = dis.ReadUnsignedShort(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine(""); - this._simulationAddress.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine("" + this._referenceNumber.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as UnattachedIdentifier; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(UnattachedIdentifier obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (!this._simulationAddress.Equals(obj._simulationAddress)) - { - ivarsEqual = false; - } - - if (this._referenceNumber != obj._referenceNumber) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._simulationAddress.GetHashCode(); - result = GenerateHash(result) ^ this._referenceNumber.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/UnsignedDISInteger.cs b/tests/OpenDisNet.Reference/Generated/UnsignedDISInteger.cs deleted file mode 100644 index a09f68f..0000000 --- a/tests/OpenDisNet.Reference/Generated/UnsignedDISInteger.cs +++ /dev/null @@ -1,277 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// container class not in specification - /// - [Serializable] - [XmlRoot] - public partial class UnsignedDISInteger - { - /// - /// unsigned integer - /// - private uint _val; - - /// - /// Initializes a new instance of the class. - /// - public UnsignedDISInteger() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(UnsignedDISInteger left, UnsignedDISInteger right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(UnsignedDISInteger left, UnsignedDISInteger right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._val - return marshalSize; - } - - /// - /// Gets or sets the unsigned integer - /// - [XmlElement(Type = typeof(uint), ElementName = "val")] - public uint Val - { - get - { - return this._val; - } - - set - { - this._val = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._val); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._val = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._val.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as UnsignedDISInteger; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(UnsignedDISInteger obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._val != obj._val) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._val.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/VariableDatum.cs b/tests/OpenDisNet.Reference/Generated/VariableDatum.cs deleted file mode 100644 index 0b26932..0000000 --- a/tests/OpenDisNet.Reference/Generated/VariableDatum.cs +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// the variable datum type, the datum length, and the value for that variable datum type. NOT COMPLETE. Section 6.2.92 - /// - [Serializable] - [XmlRoot] - public partial class VariableDatum - { - /// - /// Type of variable datum to be transmitted. 32 bit enumeration defined in EBV - /// - private uint _variableDatumID; - - /// - /// Length, in bits, of the variable datum. - /// - private uint _variableDatumLength; - - /// - /// Variable datum. This can be any number of bits long, depending on the datum. - /// - private uint _variableDatumBits; - - /// - /// padding to put the record on a 64 bit boundary - /// - private uint _padding; - - /// - /// Initializes a new instance of the class. - /// - public VariableDatum() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(VariableDatum left, VariableDatum right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(VariableDatum left, VariableDatum right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._variableDatumID - marshalSize += 4; // this._variableDatumLength - marshalSize += 4; // this._variableDatumBits - marshalSize += 4; // this._padding - return marshalSize; - } - - /// - /// Gets or sets the Type of variable datum to be transmitted. 32 bit enumeration defined in EBV - /// - [XmlElement(Type = typeof(uint), ElementName = "variableDatumID")] - public uint VariableDatumID - { - get - { - return this._variableDatumID; - } - - set - { - this._variableDatumID = value; - } - } - - /// - /// Gets or sets the Length, in bits, of the variable datum. - /// - [XmlElement(Type = typeof(uint), ElementName = "variableDatumLength")] - public uint VariableDatumLength - { - get - { - return this._variableDatumLength; - } - - set - { - this._variableDatumLength = value; - } - } - - /// - /// Gets or sets the Variable datum. This can be any number of bits long, depending on the datum. - /// - [XmlElement(Type = typeof(uint), ElementName = "variableDatumBits")] - public uint VariableDatumBits - { - get - { - return this._variableDatumBits; - } - - set - { - this._variableDatumBits = value; - } - } - - /// - /// Gets or sets the padding to put the record on a 64 bit boundary - /// - [XmlElement(Type = typeof(uint), ElementName = "padding")] - public uint Padding - { - get - { - return this._padding; - } - - set - { - this._padding = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._variableDatumID); - dos.WriteUnsignedInt((uint)this._variableDatumLength); - dos.WriteUnsignedInt((uint)this._variableDatumBits); - dos.WriteUnsignedInt((uint)this._padding); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._variableDatumID = dis.ReadUnsignedInt(); - this._variableDatumLength = dis.ReadUnsignedInt(); - this._variableDatumBits = dis.ReadUnsignedInt(); - this._padding = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._variableDatumID.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableDatumBits.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._padding.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as VariableDatum; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(VariableDatum obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._variableDatumID != obj._variableDatumID) - { - ivarsEqual = false; - } - - if (this._variableDatumLength != obj._variableDatumLength) - { - ivarsEqual = false; - } - - if (this._variableDatumBits != obj._variableDatumBits) - { - ivarsEqual = false; - } - - if (this._padding != obj._padding) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._variableDatumID.GetHashCode(); - result = GenerateHash(result) ^ this._variableDatumLength.GetHashCode(); - result = GenerateHash(result) ^ this._variableDatumBits.GetHashCode(); - result = GenerateHash(result) ^ this._padding.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/VariableParameter.cs b/tests/OpenDisNet.Reference/Generated/VariableParameter.cs deleted file mode 100644 index b589e23..0000000 --- a/tests/OpenDisNet.Reference/Generated/VariableParameter.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// specification of additional information associated with an entity or detonation, not otherwise accounted for in a PDU 6.2.93.1 - /// - [Serializable] - [XmlRoot] - public partial class VariableParameter - { - /// - /// the identification of the Variable Parameter record. Enumeration from EBV - /// - private byte _recordType; - - /// - /// Variable parameter data fields. Two doubles minus one byte - /// - private double _variableParameterFields1; - - /// - /// Variable parameter data fields. - /// - private uint _variableParameterFields2; - - /// - /// Variable parameter data fields. - /// - private ushort _variableParameterFields3; - - /// - /// Variable parameter data fields. - /// - private byte _variableParameterFields4; - - /// - /// Initializes a new instance of the class. - /// - public VariableParameter() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(VariableParameter left, VariableParameter right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(VariableParameter left, VariableParameter right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 1; // this._recordType - marshalSize += 8; // this._variableParameterFields1 - marshalSize += 4; // this._variableParameterFields2 - marshalSize += 2; // this._variableParameterFields3 - marshalSize += 1; // this._variableParameterFields4 - return marshalSize; - } - - /// - /// Gets or sets the the identification of the Variable Parameter record. Enumeration from EBV - /// - [XmlElement(Type = typeof(byte), ElementName = "recordType")] - public byte RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the Variable parameter data fields. Two doubles minus one byte - /// - [XmlElement(Type = typeof(double), ElementName = "variableParameterFields1")] - public double VariableParameterFields1 - { - get - { - return this._variableParameterFields1; - } - - set - { - this._variableParameterFields1 = value; - } - } - - /// - /// Gets or sets the Variable parameter data fields. - /// - [XmlElement(Type = typeof(uint), ElementName = "variableParameterFields2")] - public uint VariableParameterFields2 - { - get - { - return this._variableParameterFields2; - } - - set - { - this._variableParameterFields2 = value; - } - } - - /// - /// Gets or sets the Variable parameter data fields. - /// - [XmlElement(Type = typeof(ushort), ElementName = "variableParameterFields3")] - public ushort VariableParameterFields3 - { - get - { - return this._variableParameterFields3; - } - - set - { - this._variableParameterFields3 = value; - } - } - - /// - /// Gets or sets the Variable parameter data fields. - /// - [XmlElement(Type = typeof(byte), ElementName = "variableParameterFields4")] - public byte VariableParameterFields4 - { - get - { - return this._variableParameterFields4; - } - - set - { - this._variableParameterFields4 = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedByte((byte)this._recordType); - dos.WriteDouble((double)this._variableParameterFields1); - dos.WriteUnsignedInt((uint)this._variableParameterFields2); - dos.WriteUnsignedShort((ushort)this._variableParameterFields3); - dos.WriteUnsignedByte((byte)this._variableParameterFields4); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedByte(); - this._variableParameterFields1 = dis.ReadDouble(); - this._variableParameterFields2 = dis.ReadUnsignedInt(); - this._variableParameterFields3 = dis.ReadUnsignedShort(); - this._variableParameterFields4 = dis.ReadUnsignedByte(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableParameterFields1.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableParameterFields2.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableParameterFields3.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._variableParameterFields4.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as VariableParameter; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(VariableParameter obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._variableParameterFields1 != obj._variableParameterFields1) - { - ivarsEqual = false; - } - - if (this._variableParameterFields2 != obj._variableParameterFields2) - { - ivarsEqual = false; - } - - if (this._variableParameterFields3 != obj._variableParameterFields3) - { - ivarsEqual = false; - } - - if (this._variableParameterFields4 != obj._variableParameterFields4) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._variableParameterFields1.GetHashCode(); - result = GenerateHash(result) ^ this._variableParameterFields2.GetHashCode(); - result = GenerateHash(result) ^ this._variableParameterFields3.GetHashCode(); - result = GenerateHash(result) ^ this._variableParameterFields4.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/VariableTransmitterParameters.cs b/tests/OpenDisNet.Reference/Generated/VariableTransmitterParameters.cs deleted file mode 100644 index 26f8411..0000000 --- a/tests/OpenDisNet.Reference/Generated/VariableTransmitterParameters.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Relates to radios. NOT COMPLETE. Section 6.2.94 - /// - [Serializable] - [XmlRoot] - public partial class VariableTransmitterParameters - { - /// - /// Type of VTP. Enumeration from EBV - /// - private uint _recordType = 4; - - /// - /// Length, in bytes - /// - private uint _recordLength = 4; - - /// - /// Initializes a new instance of the class. - /// - public VariableTransmitterParameters() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(VariableTransmitterParameters left, VariableTransmitterParameters right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(VariableTransmitterParameters left, VariableTransmitterParameters right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._recordType - marshalSize += 4; // this._recordLength - return marshalSize; - } - - /// - /// Gets or sets the Type of VTP. Enumeration from EBV - /// - [XmlElement(Type = typeof(uint), ElementName = "recordType")] - public uint RecordType - { - get - { - return this._recordType; - } - - set - { - this._recordType = value; - } - } - - /// - /// Gets or sets the Length, in bytes - /// - [XmlElement(Type = typeof(uint), ElementName = "recordLength")] - public uint RecordLength - { - get - { - return this._recordLength; - } - - set - { - this._recordLength = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteUnsignedInt((uint)this._recordType); - dos.WriteUnsignedInt((uint)this._recordLength); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._recordType = dis.ReadUnsignedInt(); - this._recordLength = dis.ReadUnsignedInt(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._recordType.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._recordLength.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as VariableTransmitterParameters; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(VariableTransmitterParameters obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._recordType != obj._recordType) - { - ivarsEqual = false; - } - - if (this._recordLength != obj._recordLength) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._recordType.GetHashCode(); - result = GenerateHash(result) ^ this._recordLength.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Vector2Float.cs b/tests/OpenDisNet.Reference/Generated/Vector2Float.cs deleted file mode 100644 index 2184d38..0000000 --- a/tests/OpenDisNet.Reference/Generated/Vector2Float.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Two floating point values, x, y - /// - [Serializable] - [XmlRoot] - public partial class Vector2Float - { - /// - /// X value - /// - private float _x; - - /// - /// y Value - /// - private float _y; - - /// - /// Initializes a new instance of the class. - /// - public Vector2Float() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Vector2Float left, Vector2Float right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Vector2Float left, Vector2Float right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._x - marshalSize += 4; // this._y - return marshalSize; - } - - /// - /// Gets or sets the X value - /// - [XmlElement(Type = typeof(float), ElementName = "x")] - public float X - { - get - { - return this._x; - } - - set - { - this._x = value; - } - } - - /// - /// Gets or sets the y Value - /// - [XmlElement(Type = typeof(float), ElementName = "y")] - public float Y - { - get - { - return this._y; - } - - set - { - this._y = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._x); - dos.WriteFloat((float)this._y); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._x = dis.ReadFloat(); - this._y = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._x.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._y.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Vector2Float; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Vector2Float obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._x != obj._x) - { - ivarsEqual = false; - } - - if (this._y != obj._y) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._x.GetHashCode(); - result = GenerateHash(result) ^ this._y.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Vector3Double.cs b/tests/OpenDisNet.Reference/Generated/Vector3Double.cs deleted file mode 100644 index 8784efa..0000000 --- a/tests/OpenDisNet.Reference/Generated/Vector3Double.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Three double precision floating point values, x, y, and z. Used for world coordinates Section 6.2.97. - /// - [Serializable] - [XmlRoot] - public partial class Vector3Double - { - /// - /// X value - /// - private double _x; - - /// - /// y Value - /// - private double _y; - - /// - /// Z value - /// - private double _z; - - /// - /// Initializes a new instance of the class. - /// - public Vector3Double() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Vector3Double left, Vector3Double right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Vector3Double left, Vector3Double right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 8; // this._x - marshalSize += 8; // this._y - marshalSize += 8; // this._z - return marshalSize; - } - - /// - /// Gets or sets the X value - /// - [XmlElement(Type = typeof(double), ElementName = "x")] - public double X - { - get - { - return this._x; - } - - set - { - this._x = value; - } - } - - /// - /// Gets or sets the y Value - /// - [XmlElement(Type = typeof(double), ElementName = "y")] - public double Y - { - get - { - return this._y; - } - - set - { - this._y = value; - } - } - - /// - /// Gets or sets the Z value - /// - [XmlElement(Type = typeof(double), ElementName = "z")] - public double Z - { - get - { - return this._z; - } - - set - { - this._z = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteDouble((double)this._x); - dos.WriteDouble((double)this._y); - dos.WriteDouble((double)this._z); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._x = dis.ReadDouble(); - this._y = dis.ReadDouble(); - this._z = dis.ReadDouble(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._x.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._y.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._z.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Vector3Double; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Vector3Double obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._x != obj._x) - { - ivarsEqual = false; - } - - if (this._y != obj._y) - { - ivarsEqual = false; - } - - if (this._z != obj._z) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._x.GetHashCode(); - result = GenerateHash(result) ^ this._y.GetHashCode(); - result = GenerateHash(result) ^ this._z.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/Vector3Float.cs b/tests/OpenDisNet.Reference/Generated/Vector3Float.cs deleted file mode 100644 index 82689bc..0000000 --- a/tests/OpenDisNet.Reference/Generated/Vector3Float.cs +++ /dev/null @@ -1,341 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Three floating point values, x, y, and z. Section 6.2.95 - /// - [Serializable] - [XmlRoot] - public partial class Vector3Float - { - /// - /// X value - /// - private float _x; - - /// - /// y Value - /// - private float _y; - - /// - /// Z value - /// - private float _z; - - /// - /// Initializes a new instance of the class. - /// - public Vector3Float() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(Vector3Float left, Vector3Float right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(Vector3Float left, Vector3Float right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._x - marshalSize += 4; // this._y - marshalSize += 4; // this._z - return marshalSize; - } - - /// - /// Gets or sets the X value - /// - [XmlElement(Type = typeof(float), ElementName = "x")] - public float X - { - get - { - return this._x; - } - - set - { - this._x = value; - } - } - - /// - /// Gets or sets the y Value - /// - [XmlElement(Type = typeof(float), ElementName = "y")] - public float Y - { - get - { - return this._y; - } - - set - { - this._y = value; - } - } - - /// - /// Gets or sets the Z value - /// - [XmlElement(Type = typeof(float), ElementName = "z")] - public float Z - { - get - { - return this._z; - } - - set - { - this._z = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._x); - dos.WriteFloat((float)this._y); - dos.WriteFloat((float)this._z); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._x = dis.ReadFloat(); - this._y = dis.ReadFloat(); - this._z = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._x.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._y.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._z.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as Vector3Float; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(Vector3Float obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._x != obj._x) - { - ivarsEqual = false; - } - - if (this._y != obj._y) - { - ivarsEqual = false; - } - - if (this._z != obj._z) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._x.GetHashCode(); - result = GenerateHash(result) ^ this._y.GetHashCode(); - result = GenerateHash(result) ^ this._z.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/VectoringNozzleSystem.cs b/tests/OpenDisNet.Reference/Generated/VectoringNozzleSystem.cs deleted file mode 100644 index 5bd7e4d..0000000 --- a/tests/OpenDisNet.Reference/Generated/VectoringNozzleSystem.cs +++ /dev/null @@ -1,309 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// Operational data for describing the vectoring nozzle systems Section 6.2.96 - /// - [Serializable] - [XmlRoot] - public partial class VectoringNozzleSystem - { - /// - /// In degrees - /// - private float _horizontalDeflectionAngle; - - /// - /// In degrees - /// - private float _verticalDeflectionAngle; - - /// - /// Initializes a new instance of the class. - /// - public VectoringNozzleSystem() - { - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(VectoringNozzleSystem left, VectoringNozzleSystem right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(VectoringNozzleSystem left, VectoringNozzleSystem right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public virtual int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize += 4; // this._horizontalDeflectionAngle - marshalSize += 4; // this._verticalDeflectionAngle - return marshalSize; - } - - /// - /// Gets or sets the In degrees - /// - [XmlElement(Type = typeof(float), ElementName = "horizontalDeflectionAngle")] - public float HorizontalDeflectionAngle - { - get - { - return this._horizontalDeflectionAngle; - } - - set - { - this._horizontalDeflectionAngle = value; - } - } - - /// - /// Gets or sets the In degrees - /// - [XmlElement(Type = typeof(float), ElementName = "verticalDeflectionAngle")] - public float VerticalDeflectionAngle - { - get - { - return this._verticalDeflectionAngle; - } - - set - { - this._verticalDeflectionAngle = value; - } - } - - /// - /// Occurs when exception when processing PDU is caught. - /// - public event Action Exception; - - /// - /// Called when exception occurs (raises the event). - /// - /// The exception. - protected void OnException(Exception e) - { - if (this.Exception != null) - { - this.Exception(e); - } - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Marshal(DataOutputStream dos) - { - if (dos != null) - { - try - { - dos.WriteFloat((float)this._horizontalDeflectionAngle); - dos.WriteFloat((float)this._verticalDeflectionAngle); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Unmarshal(DataInputStream dis) - { - if (dis != null) - { - try - { - this._horizontalDeflectionAngle = dis.ReadFloat(); - this._verticalDeflectionAngle = dis.ReadFloat(); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public virtual void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - try - { - sb.AppendLine("" + this._horizontalDeflectionAngle.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine("" + this._verticalDeflectionAngle.ToString(CultureInfo.InvariantCulture) + ""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as VectoringNozzleSystem; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(VectoringNozzleSystem obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - if (this._horizontalDeflectionAngle != obj._horizontalDeflectionAngle) - { - ivarsEqual = false; - } - - if (this._verticalDeflectionAngle != obj._verticalDeflectionAngle) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ this._horizontalDeflectionAngle.GetHashCode(); - result = GenerateHash(result) ^ this._verticalDeflectionAngle.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/Generated/WarfareFamilyPdu.cs b/tests/OpenDisNet.Reference/Generated/WarfareFamilyPdu.cs deleted file mode 100644 index 86a8974..0000000 --- a/tests/OpenDisNet.Reference/Generated/WarfareFamilyPdu.cs +++ /dev/null @@ -1,318 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author: DMcG -// Modified for use with C#: -// - Peter Smith (Naval Air Warfare Center - Training Systems Division) -// - Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using System.Diagnostics; -using System.Xml.Serialization; -using DISnet.DataStreamUtilities; - -namespace DISnet -{ - /// - /// abstract superclass for fire and detonation pdus that have shared information. Section 7.3 COMPLETE - /// - [Serializable] - [XmlRoot] - [XmlInclude(typeof(EntityID))] - public partial class WarfareFamilyPdu : Pdu, IEquatable - { - /// - /// ID of the entity that shot - /// - private EntityID _firingEntityID = new EntityID(); - - /// - /// ID of the entity that is being shot at - /// - private EntityID _targetEntityID = new EntityID(); - - /// - /// Initializes a new instance of the class. - /// - public WarfareFamilyPdu() - { - ProtocolFamily = (byte)2; - } - - /// - /// Implements the operator !=. - /// - /// The left operand. - /// The right operand. - /// - /// true if operands are not equal; otherwise, false. - /// - public static bool operator !=(WarfareFamilyPdu left, WarfareFamilyPdu right) - { - return !(left == right); - } - - /// - /// Implements the operator ==. - /// - /// The left operand. - /// The right operand. - /// - /// true if both operands are equal; otherwise, false. - /// - public static bool operator ==(WarfareFamilyPdu left, WarfareFamilyPdu right) - { - if (object.ReferenceEquals(left, right)) - { - return true; - } - - if (((object)left == null) || ((object)right == null)) - { - return false; - } - - return left.Equals(right); - } - - public override int GetMarshalledSize() - { - int marshalSize = 0; - - marshalSize = base.GetMarshalledSize(); - marshalSize += this._firingEntityID.GetMarshalledSize(); // this._firingEntityID - marshalSize += this._targetEntityID.GetMarshalledSize(); // this._targetEntityID - return marshalSize; - } - - /// - /// Gets or sets the ID of the entity that shot - /// - [XmlElement(Type = typeof(EntityID), ElementName = "firingEntityID")] - public EntityID FiringEntityID - { - get - { - return this._firingEntityID; - } - - set - { - this._firingEntityID = value; - } - } - - /// - /// Gets or sets the ID of the entity that is being shot at - /// - [XmlElement(Type = typeof(EntityID), ElementName = "targetEntityID")] - public EntityID TargetEntityID - { - get - { - return this._targetEntityID; - } - - set - { - this._targetEntityID = value; - } - } - - /// - /// Automatically sets the length of the marshalled data, then calls the marshal method. - /// - /// The DataOutputStream instance to which the PDU is marshaled. - public virtual void MarshalAutoLengthSet(DataOutputStream dos) - { - // Set the length prior to marshalling data - this.Length = (ushort)this.GetMarshalledSize(); - this.Marshal(dos); - } - - /// - /// Marshal the data to the DataOutputStream. Note: Length needs to be set before calling this method - /// - /// The DataOutputStream instance to which the PDU is marshaled. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Marshal(DataOutputStream dos) - { - base.Marshal(dos); - if (dos != null) - { - try - { - this._firingEntityID.Marshal(dos); - this._targetEntityID.Marshal(dos); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Unmarshal(DataInputStream dis) - { - base.Unmarshal(dis); - - if (dis != null) - { - try - { - this._firingEntityID.Unmarshal(dis); - this._targetEntityID.Unmarshal(dis); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - } - - /// - /// This allows for a quick display of PDU data. The current format is unacceptable and only used for debugging. - /// This will be modified in the future to provide a better display. Usage: - /// pdu.GetType().InvokeMember("Reflection", System.Reflection.BindingFlags.InvokeMethod, null, pdu, new object[] { sb }); - /// where pdu is an object representing a single pdu and sb is a StringBuilder. - /// Note: The supplied Utilities folder contains a method called 'DecodePDU' in the PDUProcessor Class that provides this functionality - /// - /// The StringBuilder instance to which the PDU is written to. - [SuppressMessage("Microsoft.Design", "CA1031:DoNotCatchGeneralExceptionTypes", Justification = "Due to ignoring errors.")] - public override void Reflection(StringBuilder sb) - { - sb.AppendLine(""); - base.Reflection(sb); - try - { - sb.AppendLine(""); - this._firingEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - this._targetEntityID.Reflection(sb); - sb.AppendLine(""); - sb.AppendLine(""); - } - catch (Exception e) - { -#if DEBUG - Trace.WriteLine(e); - Trace.Flush(); -#endif - this.OnException(e); - } - } - - /// - /// Determines whether the specified is equal to this instance. - /// - /// The to compare with this instance. - /// - /// true if the specified is equal to this instance; otherwise, false. - /// - public override bool Equals(object obj) - { - return this == obj as WarfareFamilyPdu; - } - - /// - /// Compares for reference AND value equality. - /// - /// The object to compare with this instance. - /// - /// true if both operands are equal; otherwise, false. - /// - public bool Equals(WarfareFamilyPdu obj) - { - bool ivarsEqual = true; - - if (obj.GetType() != this.GetType()) - { - return false; - } - - ivarsEqual = base.Equals(obj); - - if (!this._firingEntityID.Equals(obj._firingEntityID)) - { - ivarsEqual = false; - } - - if (!this._targetEntityID.Equals(obj._targetEntityID)) - { - ivarsEqual = false; - } - - return ivarsEqual; - } - - /// - /// HashCode Helper - /// - /// The hash value. - /// The new hash value. - private static int GenerateHash(int hash) - { - hash = hash << (5 + hash); - return hash; - } - - /// - /// Gets the hash code. - /// - /// The hash code. - public override int GetHashCode() - { - int result = 0; - - result = GenerateHash(result) ^ base.GetHashCode(); - - result = GenerateHash(result) ^ this._firingEntityID.GetHashCode(); - result = GenerateHash(result) ^ this._targetEntityID.GetHashCode(); - - return result; - } - } -} diff --git a/tests/OpenDisNet.Reference/GlobalUsings.cs b/tests/OpenDisNet.Reference/GlobalUsings.cs deleted file mode 100644 index d717d0e..0000000 --- a/tests/OpenDisNet.Reference/GlobalUsings.cs +++ /dev/null @@ -1,2 +0,0 @@ -global using System.Diagnostics.CodeAnalysis; -global using System.Globalization; diff --git a/tests/OpenDisNet.Reference/LICENSE b/tests/OpenDisNet.Reference/LICENSE deleted file mode 100644 index 1b5b23f..0000000 --- a/tests/OpenDisNet.Reference/LICENSE +++ /dev/null @@ -1,25 +0,0 @@ -BSD 2-Clause License - -Copyright (c) 2016, Open DIS -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -* Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -* Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/tests/OpenDisNet.Reference/OpenDisNet.Reference.csproj b/tests/OpenDisNet.Reference/OpenDisNet.Reference.csproj deleted file mode 100644 index e7dcc1a..0000000 --- a/tests/OpenDisNet.Reference/OpenDisNet.Reference.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net10.0 - enable - disable - false - $(NoWarn);CS1591;CS0618 - - - - - - - - diff --git a/tests/OpenDisNet.Reference/Utilities/ChunkConverters.cs b/tests/OpenDisNet.Reference/Utilities/ChunkConverters.cs deleted file mode 100644 index 7152a0a..0000000 --- a/tests/OpenDisNet.Reference/Utilities/ChunkConverters.cs +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author Peter Smith (Naval Air Warfare Center - Training Systems Division) 01/23/2009 -// Modified by Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.Collections.Generic; -using System.Text; -using OpenDis.Dis1998; - -namespace DISnet.DataStreamUtilities -{ - /// - /// Chunk Convertor for DIS 1998 (note: same methods could be reused with 1995). - /// - public static class DIS1998ChunkConverter - { - #region�Methods�(9)�� - - /// - /// Method to convert a byte Array into Eigh tByte Chunks - /// - /// Byte array that contains data to convert - /// List containing EightByteChunks - public static List ArrayToEightByteChunks(Array data) - { - //If no data exists return null - if (data.Length == 0) - { - return null; - } - - // Used to get the length of the data - var byteChunkData = new EightByteChunk(); - int lengthByteChunkData = byteChunkData.OtherParameters.Length; - - // Calculate the size if not on the byte boundary then all 1 to make it so - int maxSize = Convert.ToInt32(Math.Ceiling(data.Length / (double)lengthByteChunkData)); //PES09182009 Modified so it would also work on Mobile - - // Create buffer to hold the data passed in from the array - byte[] chunkBuffer = new byte[maxSize * lengthByteChunkData]; - - // Copy data to the buffer created above - Buffer.BlockCopy(data, 0, chunkBuffer, 0, data.Length); - - var byteChunkList = new List(); - - // Iterate over the buffer and grab the appropriate number of bytes, store into the List - for (int i = 0; i < maxSize; i++) - { - byteChunkData = new EightByteChunk(); - Buffer.BlockCopy(chunkBuffer, i * lengthByteChunkData, byteChunkData.OtherParameters, 0, lengthByteChunkData); - - byteChunkList.Add(byteChunkData); - } - - return byteChunkList; - } - - /// - /// Method to convert a byte Array into Four tByte Chunks - /// - /// Byte array that contains data to convert - /// List containing FourByteChunks - public static List ArrayToFourByteChunks(Array data) - { - if (data.Length == 0) - { - return null; - } - - var byteChunkData = new FourByteChunk(); - int lengthByteChunkData = byteChunkData.OtherParameters.Length; - - // PES09182009 Modified so it would also work on Mobile - int maxSize = Convert.ToInt32(Math.Ceiling(data.Length / (double)lengthByteChunkData)); - - byte[] chunkBuffer = new byte[maxSize * lengthByteChunkData]; - Buffer.BlockCopy(data, 0, chunkBuffer, 0, data.Length); - - var byteChunkList = new List(); - - for (int i = 0; i < maxSize; i++) - { - byteChunkData = new FourByteChunk(); - Buffer.BlockCopy(chunkBuffer, i * lengthByteChunkData, byteChunkData.OtherParameters, 0, lengthByteChunkData); - - byteChunkList.Add(byteChunkData); - } - - return byteChunkList; - } - - /// - /// Method to convert a byte Array into Two tByte Chunks - /// - /// Byte array that contains data to convert - /// List containing TwoByteChunks - public static List ArrayToTwoByteChunks(Array data) - { - if (data.Length == 0) - { - return null; - } - - var byteChunkData = new TwoByteChunk(); - int lengthByteChunkData = byteChunkData.OtherParameters.Length; - - // PES09182009 Modified so it would also work on Mobile - int maxSize = Convert.ToInt32(Math.Ceiling(data.Length / (double)lengthByteChunkData)); - - byte[] chunkBuffer = new byte[maxSize * lengthByteChunkData]; - Buffer.BlockCopy(data, 0, chunkBuffer, 0, data.Length); - - var byteChunkList = new List(); - - for (int i = 0; i < maxSize; i++) - { - byteChunkData = new TwoByteChunk(); - Buffer.BlockCopy(chunkBuffer, i * lengthByteChunkData, byteChunkData.OtherParameters, 0, lengthByteChunkData); - - byteChunkList.Add(byteChunkData); - } - - return byteChunkList; - } - - /// - /// Method to convert Eight Byte Chunks into an Array - /// - /// List that holds the EightByteChunks - /// Byte array - public static Array EightByteChunksToArray(List chunkList) - { - var byteChunkData = new EightByteChunk(); - int lengthByteChunkData = byteChunkData.OtherParameters.Length; - - //Data passed in does not exist. - if (chunkList.Count == 0) - { - return null; - } - - // Create the appropriate sized buffer for this type - byte[] chunkBuffer = new byte[chunkList.Count * lengthByteChunkData]; - - // Go through each item and append to the buffer - for (int i = 0; i < chunkList.Count; i++) - { - Buffer.BlockCopy(chunkList[i].OtherParameters, 0, chunkBuffer, i * lengthByteChunkData, lengthByteChunkData); - } - - return chunkBuffer; - } - - /// - /// Method to convert Four Byte Chunks into an Array - /// - /// List that holds the FourByteChunks - /// Byte array - public static Array FourByteChunksToArray(List chunkList) - { - var byteChunkData = new FourByteChunk(); - int lengthByteChunkData = byteChunkData.OtherParameters.Length; - - // Data passed in does not exist. - if (chunkList.Count == 0) - { - return null; - } - - byte[] chunkBuffer = new byte[chunkList.Count * lengthByteChunkData]; - - for (int i = 0; i < chunkList.Count; i++) - { - Buffer.BlockCopy(chunkList[i].OtherParameters, 0, chunkBuffer, i * lengthByteChunkData, lengthByteChunkData); - } - - return chunkBuffer; - } - - /// - /// Method to convert a string into Eight Byte Chunks into an Array. This method was provided as a means to transport - /// 'other' - /// types of data via a PDU that uses variable or fixed Datum. - /// - /// String data to convert - /// List of EightByteChunk data - public static List StringToEightByteChunks(string data) - { - // If data does not exist return null - if (data.Length == 0) - { - return null; - } - - // Using standard ascii encoding - var encoding = new ASCIIEncoding(); - - // Convert string into bytes - Array dataArray = encoding.GetBytes(data); - - return ArrayToEightByteChunks(dataArray); - } - - /// - /// Method to convert a string into Four Byte Chunks into an Array. This method was provided as a means to transport - /// 'other' - /// types of data via a PDU that uses variable or fixed Datum. - /// - /// String data to convert - /// List of FourByteChunk data - public static List StringToFourByteChunks(string data) - { - if (data.Length == 0) - { - return null; - } - - var encoding = new ASCIIEncoding(); - Array dataArray = encoding.GetBytes(data); - - return ArrayToFourByteChunks(dataArray); - } - - /// - /// Method to convert a string into Two Byte Chunks into an Array. This method was provided as a means to transport - /// 'other' - /// types of data via a PDU that uses variable or fixed Datum. - /// - /// String data to convert - /// List of TwoByteChunk data - public static List StringToTwoByteChunks(string data) - { - if (data.Length == 0) - { - return null; - } - - var encoding = new ASCIIEncoding(); - Array dataArray = encoding.GetBytes(data); - - return ArrayToTwoByteChunks(dataArray); - } - - /// - /// Method to convert Two Byte Chunks into an Array - /// - /// List that holds the TwoByteChunks - /// Byte array - public static Array TwoByteChunksToArray(List chunkList) - { - var byteChunkData = new TwoByteChunk(); - int lengthByteChunkData = byteChunkData.OtherParameters.Length; - - // Data passed in does not exist. - if (chunkList.Count == 0) - { - return null; - } - - byte[] chunkBuffer = new byte[chunkList.Count * lengthByteChunkData]; - - for (int i = 0; i < chunkList.Count; i++) - { - Buffer.BlockCopy(chunkList[i].OtherParameters, 0, chunkBuffer, i * lengthByteChunkData, lengthByteChunkData); - } - - return chunkBuffer; - } - - #endregion�Methods� - } - - ///// - ///// Class originally created to provide chunk data using reflection. The method below does work, however I could not find a way to - ///// use reflection going from an Array to the appropriate chunk type data (eg. EightByteChunk). - ///// - ///// Type of Chunk data (eg. EightByteChunk) - //public class ChunkConvertersUsingReflection where T : class - //{ - // public Array ByteChunksToArrayUsingReflection(List chunkList) - // { - // T[] bufferArray = new T[chunkList.Count]; - // //Requires knowledge of the Property of the class. In the Chunk classes each one contains the 'OtherParameters' property. Note that - // //data has to exist within this otherwise an error will occur. Try catch could be implemented. - // byte[] otherParameter = (byte[])chunkList[0].GetType().GetProperty("OtherParameters", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Default).GetValue(chunkList[0], null); - // byte[] chunkBuffer = new byte[chunkList.Count * otherParameter.Length]; - // for (int i = 0; i < bufferArray.Length; i++) - // { - // //Get the underlining data - // byte[] data = (byte[])chunkList[i].GetType().GetProperty("OtherParameters", System.Reflection.BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public | BindingFlags.Default).GetValue(chunkList[i], null); - // Buffer.BlockCopy(data, 0, chunkBuffer, i * otherParameter.Length, otherParameter.Length); - // } - // return chunkBuffer; - // } - //} -} \ No newline at end of file diff --git a/tests/OpenDisNet.Reference/Utilities/Conversion.cs b/tests/OpenDisNet.Reference/Utilities/Conversion.cs deleted file mode 100644 index 0596322..0000000 --- a/tests/OpenDisNet.Reference/Utilities/Conversion.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author Peter Smith (Naval Air Warfare Center - Training Systems Division) 01/23/2009 -// Modified by Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -namespace DISnet.DataStreamUtilities -{ - public static class Conversion - { - #region�Fields�(2)� - - /// - /// The mask that will leave only the type metric from an - /// integer representing the Articulation Parameter's parameter type. - /// This mask is based on the IEEE Std 1278.1-1995 - /// - public const int ARTICULATION_PARAMETER_TYPE_METRIC_MASK = 0x001F; - - /// - /// The number of bits used to store the type metric value - /// within the Articulation Parameter's parameter type value. - /// This mask is based on the IEEE Std 1278.1-1995 - /// - public const byte ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS = 5; - - #endregion�Fields� - - #region�Methods�(3)� - - /// - /// Extracts the data for the type class value stored within the parameter type value. - /// This an inverse to the function . - /// - /// The value storing the type metric and type class values. - /// The type class value, with ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS bits precision. - public static int GetArticulationTypeClass(int parametertype) => - // wipe off the typemetric bits and return the typeclass bits - parametertype >> ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS; - - /// - /// Extracts the data for the type metric value stored within the parameter type value. - /// This an inverse to the function . - /// - /// The value storing the type metric and type class values. - /// The type metric value, with ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS bits precision. - public static int GetArticulationTypeMetric(int parametertype) => - // wipe off the typeclass bits and return the typemetric bits - parametertype & ARTICULATION_PARAMETER_TYPE_METRIC_MASK; - - /// - /// Make the value needed for the ArticulationParameter's Parameter Type. - /// - /// The enumeration for the articulated part. - /// This must have less precision than ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS. - /// The enumeration for the motion description. - /// This must have less precision than 32 - ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS. - /// The value to be used as the Parameter Type, with 32 bits precision. - public static uint MakeArticulationParameterType(uint typeclass, uint typemetric) - { - // enforce a ceiling on typemetric - typemetric &= ARTICULATION_PARAMETER_TYPE_METRIC_MASK; - - // shift the typeclass bits to the left by the precision amount of typemetric - // and then add the typemetric bits - return (typeclass << ARTICULATION_PARAMETER_TYPE_METRIC_NUMBER_OF_BITS) - + typemetric; - } - - #endregion�Methods� - } -} diff --git a/tests/OpenDisNet.Reference/Utilities/DataInputStream.cs b/tests/OpenDisNet.Reference/Utilities/DataInputStream.cs deleted file mode 100644 index 69b42ca..0000000 --- a/tests/OpenDisNet.Reference/Utilities/DataInputStream.cs +++ /dev/null @@ -1,302 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author Peter Smith (Naval Air Warfare Center - Training Systems Division) 01/23/2009 -// Modified by Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; - -namespace DISnet.DataStreamUtilities -{ - /// - /// Class used to read in PDU Bytes via the DataStream class - /// - public class DataInputStream - { - #region�Fields�(1)� - - private readonly DataStream pduDataStream; - - #endregion�Fields� - - #region�Constructors�(2)� - - /// - /// Initializes a new instance of the class with - /// Endian set to Little. - /// - public DataInputStream() - : this(Endian.Little) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The endian. - public DataInputStream(Endian endian) - { - pduDataStream = new DataStream { StreamCounter = 0 }; - Endian = endian; - } - - /// - /// Initializes a new instance of the class. - /// - /// byte array - /// type of endian - public DataInputStream(byte[] ds, Endian endian) - : this(endian) - { - pduDataStream.StreamByteArray = ds; - pduDataStream.Endian = endian; - } - - #endregion�Constructors� - - #region�Properties�(1)� - - ///// - ///// Used to convert an array of bytes to a MemoryStream - ///// - ///// byte array - ///// MemoryStream - ////private MemoryStream ConvertBytesMemoryStream(byte[] data) - ////{ - //// MemoryStream ms = new MemoryStream(); - - //// ms.Write(data, 0, data.Length); - - //// return ms; - ////} - - /// - /// Gets or sets the endian value currently being used to process PDU data - /// - public Endian Endian - { - get => pduDataStream.Endian; - - set => pduDataStream.Endian = value; - } - - #endregion�Properties� - - #region�Methods�(11)� - - /// - /// Reads from DataStream's byte array a byte - /// - /// byte value - public byte ReadByte() - { - byte returnedData = pduDataStream.StreamByteArray[pduDataStream.StreamCounter]; - pduDataStream.StreamCounter++; - return returnedData; - } - - /// - /// Reads from DataStream's byte array a byte - /// - /// byte value - public byte[] ReadByteArray(int length) - { - byte[] returnedData = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, length); - - pduDataStream.StreamCounter += length; - return returnedData; - } - - /// - /// Reads from DataStream's byte array a double value - /// - /// double value - public double ReadDouble() - { - const int size = sizeof(double); - byte[] temp = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, size); - - if (Endian == Endian.Big) - { - Array.Reverse(temp); - } - - double returnedData = BitConverter.ToDouble(temp, 0); - pduDataStream.StreamCounter += size; - return returnedData; - } - - /// - /// Reads from DataStream's byte array a float value - /// - /// float value - public float ReadFloat() - { - const int size = sizeof(float); - byte[] temp = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, size); - - if (Endian == Endian.Big) - { - Array.Reverse(temp); - } - - float returnedData = BitConverter.ToSingle(temp, 0); - pduDataStream.StreamCounter += size; - return returnedData; - } - - /// - /// Reads from DataStream's byte array an int value - /// - /// int value - public int ReadInt() - { - const int size = sizeof(int); - byte[] temp = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, size); - - if (Endian == Endian.Big) - { - Array.Reverse(temp); - } - - int returnedData = BitConverter.ToInt32(temp, 0); - pduDataStream.StreamCounter += size; - return returnedData; - } - - /// - /// Reads from DataStream's byte array a long - /// - /// long value - public long ReadLong() - { - const int size = sizeof(long); - byte[] temp = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, size); - - if (Endian == Endian.Big) - { - Array.Reverse(temp); - } - - long returnedData = BitConverter.ToInt64(temp, 0); - pduDataStream.StreamCounter += size; - return returnedData; - } - - /// - /// Reads from DataStream's byte array a short value - /// - /// short value - public short ReadShort() - { - const int size = sizeof(short); - byte[] temp = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, size); - - if (Endian == Endian.Big) - { - Array.Reverse(temp); - } - - short returnedData = BitConverter.ToInt16(temp, 0); - pduDataStream.StreamCounter += size; - return returnedData; - } - - /// - /// Reads from DataStream's byte array a byte - /// - /// byte value - public byte ReadUnsignedByte() => ReadByte(); - - /// - /// Reads from DataStream's byte array a unsigned int - /// - /// unsigned int value - public uint ReadUnsignedInt() - { - const int size = sizeof(uint); - byte[] temp = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, size); - - if (Endian == Endian.Big) - { - Array.Reverse(temp); - } - - uint returnedData = BitConverter.ToUInt32(temp, 0); - - pduDataStream.StreamCounter += size; - return returnedData; - } - - /// - /// Reads from DataStream's byte array a unsigned long - /// - /// ulong value - public ulong ReadUnsignedLong() - { - const int size = sizeof(ulong); - byte[] temp = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, size); - - if (Endian == Endian.Big) - { - Array.Reverse(temp); - } - - ulong returnedData = BitConverter.ToUInt64(temp, 0); - pduDataStream.StreamCounter += size; - return returnedData; - } - - /// - /// Reads from DataStream's byte array a unsigned short - /// - /// unsigned short value - public ushort ReadUnsignedShort() - { - const int size = sizeof(ushort); - byte[] temp = DataStream.ReturnByteArray(pduDataStream.StreamByteArray, pduDataStream.StreamCounter, size); - - if (Endian == Endian.Big) - { - Array.Reverse(temp); - } - - ushort returnedData = BitConverter.ToUInt16(temp, 0); - pduDataStream.StreamCounter += size; - return returnedData; - } - - #endregion�Methods� - } -} diff --git a/tests/OpenDisNet.Reference/Utilities/DataOutputStream.cs b/tests/OpenDisNet.Reference/Utilities/DataOutputStream.cs deleted file mode 100644 index 19f742d..0000000 --- a/tests/OpenDisNet.Reference/Utilities/DataOutputStream.cs +++ /dev/null @@ -1,288 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author Peter Smith (Naval Air Warfare Center - Training Systems Division) 01/23/2009 -// Modified by Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; - -namespace DISnet.DataStreamUtilities -{ - /// - /// Class used to export PDU information from a DataStream - /// - public class DataOutputStream - { - #region�Fields�(1)� - - #endregion�Fields� - - #region�Constructors�(2)� - - /// - /// Initializes a new instance of the DataOutputStream class from an - /// existing DataStream and sets Endian type to use. - /// - /// The data stream. - /// The endian to be used. - public DataOutputStream(DataStream ds, Endian endian) - { - DS = ds; - Endian = endian; - } - - /// - /// Initializes a new instance of the DataOutputStream class and - /// with Endian set to Little. - /// - public DataOutputStream() - : this(Endian.Little) - { - } - - /// - /// Initializes a new instance of the DataOutputStream class and - /// sets the Endian to use. - /// - /// The endian to be used. - public DataOutputStream(Endian endian) - { - DS = new DataStream(); - Endian = endian; - } - - #endregion�Constructors� - - #region�Properties�(2)� - - /// - /// Gets the underlining DataStream - /// - public DataStream DS { get; } - - /// - /// Gets or sets the Endian type - /// - public Endian Endian - { - get => DS.Endian; - - set => DS.Endian = value; - } - - #endregion�Properties� - - #region�Methods�(15)� - - /// - /// Converts the DataStream to a byte array - /// - /// byte array - public byte[] ConvertToBytes() => DS.ConvertToBytes(); - - /// - /// Write a byte value to the DataStream - /// - /// byte - public void WriteByte(byte data) => WriteData(data); - - /// - /// Write a byte array value to the DataStream - /// - /// byte - public void WriteByte(byte[] data) => WriteData(data); - - /// - /// Write a double value to the DataStream - /// - /// double - public void WriteDouble(double data) - { - byte[] serializedData = BitConverter.GetBytes(data); - - if (Endian == Endian.Big) - { - Array.Reverse(serializedData); - } - - WriteData(serializedData); - } - - /// - /// Write a float value to the DataStream - /// - /// float - public void WriteFloat(float data) - { - byte[] serializedData = BitConverter.GetBytes(data); - - if (Endian == Endian.Big) - { - Array.Reverse(serializedData); - } - - WriteData(serializedData); - } - - /// - /// Write a int value to the DataStream - /// - /// int32 - public void WriteInt(int data) - { - byte[] serializedData = BitConverter.GetBytes(data); - - if (Endian == Endian.Big) - { - Array.Reverse(serializedData); - } - - WriteData(serializedData); - } - - /// - /// Write a long value to the DataStream - /// - /// long - public void WriteLong(long data) - { - byte[] serializedData = BitConverter.GetBytes(data); - - if (Endian == Endian.Big) - { - Array.Reverse(serializedData); - } - - WriteData(serializedData); - } - - /// - /// Write a short value to the DataStream - /// - /// short value - public void WriteShort(short data) - { - byte[] serializedData = BitConverter.GetBytes(data); - - if (Endian == Endian.Big) - { - Array.Reverse(serializedData); - } - - WriteData(serializedData); - } - - /// - /// Write a byte value to the DataStream - /// - /// byte - public void WriteUnsignedByte(byte data) => WriteData(data); - - /// - /// Write a byte array value to the DataStream - /// - /// byte - public void WriteUnsignedByte(byte[] data) => WriteData(data); - - /// - /// Write a unsigned int value to the DataStream - /// - /// unsigned int - public void WriteUnsignedInt(uint data) - { - byte[] serializedData = BitConverter.GetBytes(data); - - if (Endian == Endian.Big) - { - Array.Reverse(serializedData); - } - - WriteData(serializedData); - } - - /// - /// Write a unsigned long value to the DataStream - /// - /// long - public void WriteUnsignedLong(ulong data) - { - byte[] serializedData = BitConverter.GetBytes(data); - - if (Endian == Endian.Big) - { - Array.Reverse(serializedData); - } - - WriteData(serializedData); - } - - /// - /// Write a unsigned short value to the DataStream - /// - /// unsigned short - public void WriteUnsignedShort(ushort data) - { - byte[] serializedData = BitConverter.GetBytes(data); - - if (Endian == Endian.Big) - { - Array.Reverse(serializedData); - } - - WriteData(serializedData); - } - - /// - /// Base method to write a byte value to the DataStream - /// - /// byte - private void WriteData(byte data) - { - DS.Append(data); - DS.StreamCounter += 1; - } - - /// - /// Base method to write an array of bytes to the DataStream - /// - /// byte array - private void WriteData(byte[] data) - { - DS.Append(data); - DS.StreamCounter += data.Length; - } - - #endregion�Methods� - } -} diff --git a/tests/OpenDisNet.Reference/Utilities/DataStream.cs b/tests/OpenDisNet.Reference/Utilities/DataStream.cs deleted file mode 100644 index 1606337..0000000 --- a/tests/OpenDisNet.Reference/Utilities/DataStream.cs +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright (c) 1995-2009 held by the author(s). All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the names of the Naval Postgraduate School (NPS) -// Modeling Virtual Environments and Simulation (MOVES) Institute -// (http://www.nps.edu and http://www.MovesInstitute.org) -// nor the names of its contributors may be used to endorse or -// promote products derived from this software without specific -// prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// AS IS AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -// COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -// INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, -// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN -// ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Copyright (c) 2008, MOVES Institute, Naval Postgraduate School. All -// rights reserved. This work is licensed under the BSD open source license, -// available at https://www.movesinstitute.org/licenses/bsd.html -// -// Author Peter Smith (Naval Air Warfare Center - Training Systems Division) 01/23/2009 -// Modified by Zvonko Bostjancic (Blubit d.o.o. - zvonko.bostjancic@blubit.si) - -using System; -using System.IO; - -namespace DISnet.DataStreamUtilities -{ - /// - /// Base class for storing PDU information - /// - public class DataStream : IDisposable - { -#region�Fields�(1)� - - #endregion�Fields� - - #region�Constructors�(1)� - - /// - /// Initializes a new instance of the DataStream class. - /// This will store all PDU information for either an InputStream or OutputStream. - /// - public DataStream() - { - // Test the machine to determine to see what it supports. - Endian = BitConverter.IsLittleEndian ? Endian.Little : Endian.Big; - - // create a new MemoryStream - Stream = new MemoryStream(); - } - - #endregion�Constructors� - - #region�Properties�(4)� - - /// - /// Gets or sets the endian type - /// - public Endian Endian { get; set; } - - /// - /// Gets or sets the MemoryStream that will be used to hold the PDU data. - /// - public MemoryStream Stream - { - get; - set; - } - - /// - /// Gets or sets the location to store a byte representation of the PDU. - /// - public byte[] StreamByteArray - { - get; - set; - } - - /// - /// Gets or sets the counter used to keep track of where pointer is for the stream. - /// - public int StreamCounter - { - get; - set; - } - - #endregion�Properties� - - #region�Methods�(6)� - - /// - /// Appends the byte array data to the MemoryStream - /// - /// byte array - public void Append(byte[] data) - { - Stream.Seek(Stream.Length, SeekOrigin.Begin); - Stream.Write(data, 0, data.Length); - } - - /// - /// Appends a single byte to the MemoryStream - /// - /// - public void Append(byte data) - { - Stream.Seek(Stream.Length, SeekOrigin.Begin); - Stream.WriteByte(data); - } - - /// - /// Re-Initializes the MemoryStream and streamCounter back to zero - /// - public void Clear() - { - StreamCounter = 0; - Stream = new MemoryStream(); - } - - /// - /// Convert a MemoryStream to a byte array - /// - /// byte array - public byte[] ConvertToBytes() => ReturnByteArray(Stream.GetBuffer(), 0, (int)Stream.Length); - - public void Dispose() - { - if (Stream != null) - { - try - { - Stream.Close(); - Stream.Dispose(); - } - catch - { - } - } - } - - /// - /// Returns a portion of a byte array for Endian conversion - /// - /// source bytearray - /// A 32-bit integer that represents the start index at which the conversion should begin - /// A 32-bit integer that represents the size of the value type - /// A byte array that will hold the byte representation of the value - public static byte[] ReturnByteArray(byte[] byteStream, int startIndex, int sizeOfData) - { - byte[] temp = new byte[sizeOfData]; - Array.Copy(byteStream, startIndex, temp, 0, sizeOfData); - - return temp; - } - - #endregion�Methods� - } -} diff --git a/tests/OpenDisNet.Reference/Utilities/Endian.cs b/tests/OpenDisNet.Reference/Utilities/Endian.cs deleted file mode 100644 index 597273f..0000000 --- a/tests/OpenDisNet.Reference/Utilities/Endian.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace DISnet.DataStreamUtilities; - -public enum Endian -{ - Little, - Big, -} diff --git a/tests/OpenDisNet.Reference/packages.lock.json b/tests/OpenDisNet.Reference/packages.lock.json deleted file mode 100644 index 4a91a8c..0000000 --- a/tests/OpenDisNet.Reference/packages.lock.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "version": 1, - "dependencies": { - "net10.0": {} - } -} \ No newline at end of file diff --git a/tests/OpenDisNet.Tests/Conformance/Audit/v1.0.1.json b/tests/OpenDisNet.Tests/Conformance/Audit/v1.0.1.json new file mode 100644 index 0000000..55a63de --- /dev/null +++ b/tests/OpenDisNet.Tests/Conformance/Audit/v1.0.1.json @@ -0,0 +1,40 @@ +{ + "auditVersion": "1.0.1", + "wireStandard": "IEEE Std 1278.1-2012 (DIS v7)", + "enumerationStandard": "SISO-REF-010-2025 v36", + "pduTypeCount": 72, + "concreteWireClassCount": 233, + "families": [ + { "value": 1, "count": 5, "types": [1, 4, 66, 67, 72] }, + { "value": 2, "count": 4, "types": [2, 3, 68, 69] }, + { "value": 3, "count": 6, "types": [5, 6, 7, 8, 9, 10] }, + { "value": 4, "count": 5, "types": [25, 26, 27, 31, 32] }, + { "value": 5, "count": 12, "types": [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22] }, + { "value": 6, "count": 5, "types": [23, 24, 28, 29, 30] }, + { "value": 7, "count": 4, "types": [33, 34, 35, 36] }, + { "value": 8, "count": 4, "types": [37, 38, 39, 40] }, + { "value": 9, "count": 5, "types": [41, 42, 43, 44, 45] }, + { "value": 10, "count": 15, "types": [51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65] }, + { "value": 11, "count": 5, "types": [46, 47, 48, 49, 50] }, + { "value": 13, "count": 2, "types": [70, 71] } + ], + "artifacts": [ + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/DIS_7_2012.xml", "sha256": "e1d89b7def1e2a76dbb277f3415a108c283ce94284648fd48eabb80080df0d9b" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/DistributedEmissionsFamilyPdus.xml", "sha256": "74207698837591da1f327f9b954f8ae7cde3dd1f5141d38f65262258b1eea66f" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/EntityInformationFamilyPdus.xml", "sha256": "bb68e679a86f9533202b5d8f68db667220b8f0f6e53ab0b0e02aa3cb121a4c82" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/EntityManagementFamilyPdus.xml", "sha256": "4404a634a648c95da3100b64489b8f8b08840b9fdeb56c297fe821df10ac4379" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/InformationOperationsFamilyPdus.xml", "sha256": "3348d7132d77138449e0c1a91545957fd6ed985d1bc5e426efc9c1732cb20e8a" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/LiveEntityFamilyPdus.xml", "sha256": "6dd57d0ae5ccf48cf09b0b936f116f590f85d0bf53688e243c94789433638d25" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/LogisticsFamilyPdus.xml", "sha256": "8e69464a7b421e8a048973d59b94736e95c71b623de9a250257c09179ca2a713" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/MinefieldFamilyPdus.xml", "sha256": "05a10725e81deb9572c67ca79ef3d2a0e6be38baac3c4bf3fc6640f611e19401" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/RadioCommunicationsFamilyPdus.xml", "sha256": "1e74bec4817d95695bb75831e191b75335b802874a52b296d3df9056630ac351" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/SimulationManagementFamilyPdus.xml", "sha256": "030d36634978c3e44434e360a61860386b43230e43b6f20751947ac00bfc44a3" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/SimulationManagementWithReliabilityFamilyPdus.xml", "sha256": "dbb32b2d541f715064397fc78e75b59a0be20b8b4a6a12150330c1fcd30bfdf1" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/SyntheticEnvironmentFamilyPdus.xml", "sha256": "5cac3fe21fa3fa8deb281e23ddebca164f4fcd22cf7b69928e2bf8c786908ee2" }, + { "path": "tools/OpenDisNet.Generator/Schemas/DIS7/WarfareFamilyPdus.xml", "sha256": "518506834ce8a054994358a0bce4a773e3eabadce6a8465f009d91d3585bcd38" }, + { "path": "tools/OpenDisNet.Generator/Schemas/SISO/referenced-types-v36.json", "sha256": "a845598c022fd38b79000ac434f039772a6a679979f7f8dd618261c833330089" }, + { "path": "tests/OpenDisNet.Tests/Conformance/Vectors/opendis7-java-default.json", "sha256": "1caf4b724f17358de22012faf55377ff21d215fbc2395ef32b8cdef07ec221a6" }, + { "path": "tests/OpenDisNet.Tests/Conformance/Vectors/opendis7-java-populated.json", "sha256": "6558f75e153194618e3a3b77c737a48cbbc849e5c27e478e42dc81219e78b792" }, + { "path": "src/OpenDisNet/PublicAPI.Shipped.txt", "sha256": "d7325bf2bf1e3fcb50dc152050f6f0275f6e147fa6eb085e1c0c51779a251ba6" } + ] +} diff --git a/tests/OpenDisNet.Tests/Conformance/ConformanceAuditTests.cs b/tests/OpenDisNet.Tests/Conformance/ConformanceAuditTests.cs index cc3ade4..f3c2cdc 100644 --- a/tests/OpenDisNet.Tests/Conformance/ConformanceAuditTests.cs +++ b/tests/OpenDisNet.Tests/Conformance/ConformanceAuditTests.cs @@ -19,7 +19,7 @@ public void AuditedInputsHaveNotChanged() string root = FindRepositoryRoot(); AuditManifest manifest = ReadManifest(root); - Assert.Equal("1.0", manifest.AuditVersion); + Assert.Equal("1.0.1", manifest.AuditVersion); Assert.Equal(72, manifest.PduTypeCount); Assert.Equal(233, manifest.ConcreteWireClassCount); Assert.Equal(17, manifest.Artifacts.Length); @@ -58,9 +58,9 @@ public void AuditAccountsForEveryStandardPduAndFamily() private static AuditManifest ReadManifest(string root) { - string path = Path.Combine(root, "tests", "OpenDisNet.Tests", "Conformance", "Audit", "v1.0.json"); + string path = Path.Combine(root, "tests", "OpenDisNet.Tests", "Conformance", "Audit", "v1.0.1.json"); return JsonSerializer.Deserialize(File.ReadAllText(path), JsonOptions) - ?? throw new InvalidDataException("The 1.0 conformance audit manifest is empty."); + ?? throw new InvalidDataException("The 1.0.1 conformance audit manifest is empty."); } private static string FindRepositoryRoot() diff --git a/tests/OpenDisNet.Tests/Conformance/OpenDisReferenceTests.cs b/tests/OpenDisNet.Tests/Conformance/OpenDisReferenceTests.cs deleted file mode 100644 index 22b95b8..0000000 --- a/tests/OpenDisNet.Tests/Conformance/OpenDisReferenceTests.cs +++ /dev/null @@ -1,31 +0,0 @@ -using DISnet.DataStreamUtilities; -using OpenDisNet.Pdus; -using OpenDisNet.Protocol; -using ReferenceFirePdu = DISnet.FirePdu; - -namespace OpenDisNet.Tests.Conformance; - -public sealed class OpenDisReferenceTests -{ - [Fact] - public void FirePduBytesAreAcceptedByIndependentReferenceImplementation() - { - var expected = (FirePdu)PduFactory.Create(PduType.Fire, exerciseId: 7); - expected.Timestamp = 123; - expected.FiringEntityId = new EntityId(1, 2, 3); - expected.TargetEntityId = new EntityId(4, 5, 6); - expected.FireMissionIndex = 13; - expected.Range = 20; - - byte[] bytes = DisSerializer.Serialize(expected); - var reference = new ReferenceFirePdu(); - reference.Unmarshal(new DataInputStream(bytes, Endian.Big)); - - Assert.Equal((byte)7, reference.ProtocolVersion); - Assert.Equal((ushort)96, reference.Length); - Assert.Equal((ushort)1, reference.FiringEntityID.SimulationAddress.Site); - Assert.Equal((ushort)6, reference.TargetEntityID.EntityNumber); - Assert.Equal((uint)13, reference.FireMissionIndex); - Assert.Equal(20F, reference.Range); - } -} diff --git a/tests/OpenDisNet.Tests/OpenDisNet.Tests.csproj b/tests/OpenDisNet.Tests/OpenDisNet.Tests.csproj index a5870e9..e9d739d 100644 --- a/tests/OpenDisNet.Tests/OpenDisNet.Tests.csproj +++ b/tests/OpenDisNet.Tests/OpenDisNet.Tests.csproj @@ -20,7 +20,6 @@ - diff --git a/tools/OpenDisNet.Generator/Schemas/DIS7/DIS_7_2012.xml b/tools/OpenDisNet.Generator/Schemas/DIS7/DIS_7_2012.xml index 6d2ba86..b3ec7e9 100644 --- a/tools/OpenDisNet.Generator/Schemas/DIS7/DIS_7_2012.xml +++ b/tools/OpenDisNet.Generator/Schemas/DIS7/DIS_7_2012.xml @@ -332,7 +332,7 @@ dB and RPM)"/> - + diff --git a/tools/OpenDisNet.Generator/Schemas/DIS7/DistributedEmissionsFamilyPdus.xml b/tools/OpenDisNet.Generator/Schemas/DIS7/DistributedEmissionsFamilyPdus.xml index a7d8631..346bf53 100644 --- a/tools/OpenDisNet.Generator/Schemas/DIS7/DistributedEmissionsFamilyPdus.xml +++ b/tools/OpenDisNet.Generator/Schemas/DIS7/DistributedEmissionsFamilyPdus.xml @@ -248,7 +248,7 @@ - + @@ -466,7 +466,7 @@ This field defines the active emission parameter index, beam scan pattern, - + @@ -760,4 +760,4 @@ This field defines the active emission parameter index, beam scan pattern, - \ No newline at end of file +