public static void Postfix(ProtobufSerializer.GameObjectData goData, UniqueIdentifier uid)
 {
     if (blacklistedHandPlacedClassIds.Contains(goData.ClassId) && Multiplayer.Main != null && Multiplayer.Main.IsMultiplayer())
     {
         UnityEngine.Object.Destroy(uid.gameObject);
     }
 }
 static void Postfix(UniqueIdentifier __instance)
 {
     if (__instance is PrefabIdentifier && DebrisPatcher.isValidPrefab(__instance.ClassId))
     {
         track(__instance.gameObject);
     }
 }
Example #3
0
        internal static Message CreateGetMessage(UniqueIdentifier id, IEnumerable <string> attributes, CultureInfo locale)
        {
            Get op = null;

            if (attributes != null && attributes.Any())
            {
                op             = new Get();
                op.Dialect     = Namespaces.RMIdentityAttributeType;
                op.Expressions = MessageComposer.AddMandatoryAttributes(attributes, locale).ToArray();
            }

            Message message;

            if (op == null)
            {
                message = Message.CreateMessage(MessageVersion.Default, Namespaces.Get);
            }
            else
            {
                message = Message.CreateMessage(MessageVersion.Default, Namespaces.Get, new SerializerBodyWriter(op));
                message.AddHeader(Namespaces.IdMDirectoryAccess, HeaderConstants.IdentityManagementOperation, null, true);
            }

            if (locale != null)
            {
                message.AddHeader(AttributeNames.Locale, locale);
            }

            message.AddHeader(HeaderConstants.ResourceReferenceProperty, id.ToString());

            return(message);
        }
        public void AValidId_HasPredefined_Sizes()
        {
            var ex1 = Assert.Throws <InvalidCastException>(() =>
            {
                // Length: 39
                new UniqueIdentifier("010101010101010101010101010101010101010");
            });

            var ex2 = Assert.Throws <InvalidCastException>(() =>
            {
                // Length: 129
                new UniqueIdentifier("010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010101010");
            });

            var ok32  = new UniqueIdentifier("00000000000000000000000000000000");
            var ok40  = new UniqueIdentifier("0000000000000000000000000000000000000000");
            var ok64  = new UniqueIdentifier("0000000000000000000000000000000000000000111111111111111111111111");
            var ok96  = new UniqueIdentifier("000000000000000000000000000000000000000011111111111111110000000000000000000000000000000000000000");
            var ok128 = new UniqueIdentifier("00000000000000000000000000000000000000001111111111111111111111111111111111111111000000000000000000000000000000000000000011111111");

            Assert.Equal("The string could not be converted to a valid UniqueIdentifier", ex1.Message);
            Assert.Equal("The string could not be converted to a valid UniqueIdentifier", ex2.Message);
            Assert.NotNull(ok32);
            Assert.NotNull(ok40);
            Assert.NotNull(ok64);
            Assert.NotNull(ok96);
            Assert.NotNull(ok128);
        }
Example #5
0
        public static DICOMFileType GetFileType(DICOMObject d)
        {
            IDICOMElement el = d.FindFirst(TagHelper.SOPCLASS_UID.CompleteID);

            if (el != null)
            {
                UniqueIdentifier ui = el as UniqueIdentifier;
                switch (ui.Data)
                {
                case "1.2.840.10008.5.1.4.1.1.481.1": return(DICOMFileType.RT_IMAGE);

                case "1.2.840.10008.5.1.4.1.1.2": return(DICOMFileType.CT_IMAGE);

                case "1.2.840.10008.5.1.4.1.1.4": return(DICOMFileType.MRI_IMAGE);

                case "1.2.840.10008.5.1.4.1.1.77.1.5.2": return(DICOMFileType.PET_IMAGE);

                case "1.2.840.10008.5.1.4.1.1.481.5": return(DICOMFileType.RT_PLAN);

                case "1.2.840.10008.5.1.4.1.1.481.3": return(DICOMFileType.RT_STRUCT);

                case "1.2.840.10008.5.1.4.1.1.481.2": return(DICOMFileType.RT_DOSE);

                default: return(DICOMFileType.OTHER);
                }
            }
            return(DICOMFileType.OTHER);
        }
Example #6
0
        internal AnalogInput(NeuronGroup neuronGroup, int number, ushort registerNumber, NeuronSpiConnector spiConnector)
        {
            _registerNumber  = registerNumber;
            UniqueIdentifyer = new UniqueIdentifier(neuronGroup, NeuronResource.AnalogInput, number);

            var value = spiConnector.GetSingleRegisterValue(neuronGroup, 1021);

            if (value == null)
            {
                throw new Exception("failure while getting Voffset from registers");
            }


            var vRef = spiConnector.GetSingleRegisterValue(neuronGroup, 1009);

            var vRefInt = spiConnector.GetSingleRegisterValue(neuronGroup, 5);

            var aI1Vdev   = spiConnector.GetSingleRegisterValue(neuronGroup, 1025);
            var ai1Offset = spiConnector.GetSingleRegisterValue(neuronGroup, 1026);

            if (vRefInt == null || vRef == null || aI1Vdev == null || ai1Offset == null)
            {
                throw new Exception("failure while getting the calibration values from the Registers!");
            }

            _aI1Vdev   = BitConverter.ToInt16(BitConverter.GetBytes(aI1Vdev.Value), 0);
            _ai1Offset = BitConverter.ToInt16(BitConverter.GetBytes(ai1Offset.Value), 0);
            _vRealInt  = 3.3 * ((double)vRef / (double)vRefInt);
        }
Example #7
0
        public bool SetUp(DvtkData.Dimse.DicomMessage dicomMessage)
        {
            DvtkData.Dimse.DimseCommand command = dicomMessage.CommandField;
            System.String sopClassUid           = System.String.Empty;

            // To be fixed - why is the SOP Class UID not always filled in?
            // RB: TODO
            if (command == DvtkData.Dimse.DimseCommand.CSTORERQ)
            {
                sopClassUid = "1.2.840.10008.5.1.4.1.1.7";
            }

            DvtkData.Dimse.Attribute attribute = dicomMessage.CommandSet.GetAttribute(DvtkData.Dimse.Tag.AFFECTED_SOP_CLASS_UID);
            if (attribute == null)
            {
                attribute = dicomMessage.CommandSet.GetAttribute(DvtkData.Dimse.Tag.REQUESTED_SOP_CLASS_UID);
            }
            if ((attribute != null) &&
                (attribute.Length != 0))
            {
                UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                sopClassUid = uniqueIdentifier.Values[0];
            }

            // Try to initialise a template
            _template = new DicomComparisonTemplate();
            bool setUpDone = _template.Initialize(command, sopClassUid);

            return(setUpDone);
        }
Example #8
0
        public INodeDescriptor GetINodeDescriptor()
        {
            UniqueIdentifier ui = new UniqueIdentifier();

            ui.Update(false, NodeID, true);
            return(InstanceWrapper.GetINodeDescriptor(ui, NodeClass));
        }
Example #9
0
 internal Student(UniqueIdentifier regNumber, PlainText name)
 {
     Contract.Requires(regNumber != null, "The registration numebr cannot be null !");
     Contract.Requires(name != null, "The student name cannot be null !");
     RegistrationNumber = regNumber;
     Name = name;
 }
Example #10
0
        /// <summary>
        /// Gets the unique identifier.
        /// </summary>
        /// <param name="ui">The instance of <see cref="UniqueIdentifier"/> that represents an unique identifier.</param>
        /// <returns>
        ///     <c>true</c> if it is not top level element; <c>false</c> otherwise if it is top level element
        /// </returns>
        internal override bool GetUniqueIdentifier(UniqueIdentifier ui)
        {
            bool intermediate = base.GetUniqueIdentifier(ui);

            ui.Update(intermediate, ModelEntity.Wrapper.SymbolicName.XmlQualifiedName, false);
            return(true);
        }
Example #11
0
        public IEnumerable <TestCase> GenerateTestCases(
            MethodPair methods,
            ParameterListPair parameters,
            UniqueIdentifier uniqueIdentifier)
        {
            var testCases       = ImmutableList.CreateBuilder <TestCase>();
            var asyncParameters = methods.AsyncMethod.GetParameters();

            for (var i = 0; i < asyncParameters.Length; i++)
            {
                if (asyncParameters[i].ParameterType == typeof(CancellationToken))
                {
                    // Check if the type is annotated as nullable
                    testCases.Add(new CanceledTestCase(
                                      methods.AsyncMethod,
                                      asyncParameters[i],
                                      new ParameterList(parameters.AsyncParameters.Parameters.SetItem(
                                                            i,
                                                            Parameter.Default(parameters.AsyncParameters.Parameters[i].Name !, async(writer, variableName) =>
                    {
                        await writer.WriteLineAsync($"            using var { variableName }Source = new CancellationTokenSource();").ConfigureAwait(false);
                        await writer.WriteLineAsync($"            var { variableName } = { variableName }Source.Token;").ConfigureAwait(false);
                        await writer.WriteLineAsync($"            { variableName }Source.Cancel();").ConfigureAwait(false);
                    }))),
                                      _knownNamespaces,
                                      _optionsResolver,
                                      uniqueIdentifier));
                }
            }

            return(testCases.ToImmutable());
        }
 void reattachBeaconAfterLoad()
 {
     if (UniqueIdentifier.TryGetIdentifier(_beaconID, out UniqueIdentifier beacon))
     {
         setBeaconAttached(beacon.GetComponent <Beacon>(), true);
     }
 }
 private static void ThrowOnDeleteBuiltInResource(UniqueIdentifier id)
 {
     if (MessageComposer.builtInResources.Contains(id))
     {
         throw new InvalidOperationException($"A request to delete a built-in resource has been stopped by the client library. Resource: {id}");
     }
 }
Example #14
0
        private Dictionary <string, string> ProcessingDelete(UniqueIdentifier id, ObserverObjectSetting objectSetting)
        {
            Dictionary <string, string> filesDeleted = new Dictionary <string, string>();

            WriteDebug("Retrieve delete " + id.Value);

            var obj = observedObjects.Where(o => o.ObjectID == id).FirstOrDefault();

            if (obj == null)
            {
                WriteVerbose("Target is not observed. Delete Request will be skipped.");
                return(filesDeleted);
            }

            ObjectSetting converterSetting = GetObjectSetting(obj, RMConverterSetting);

            foreach (string s in Converter.GetSerializedFiles(
                         obj,
                         converterSetting,
                         RMObserverSetting.ExportDirectory,
                         objectSetting.AttributeSeparations))
            {
                if (File.Exists(s))
                {
                    File.Delete(s);
                    filesDeleted.Add(s, "Deleted");
                }
            }

            observedObjects.Remove(obj);
            return(filesDeleted);
        }
Example #15
0
        private static bool SpawnedWithoutServersPermission(ProtobufSerializer.GameObjectData goData, GameObject gameObject)
        {
            if (!HAND_PLACED_ITEMS_ONLY_SPAWNABLE_BY_SERVER.Contains(goData.ClassId))
            {
                // If these items are not in the blacklist then the server is fine with it being spawned.
                return(false);
            }

            NitroxEntity serverEntity = gameObject.GetComponent <NitroxEntity>();

            if (serverEntity)
            {
                // if we have a NitroxEntity then the server is aware of this entity.
                return(false);
            }

            UniqueIdentifier identifier = gameObject.GetComponent <UniqueIdentifier>();
            Entities         entities   = NitroxServiceLocator.LocateService <Entities>();

            if (identifier != null && entities.WasSpawnedByServer(identifier.Id))
            {
                // Looks like this ran through the main entity spawning code - the server knows about it.
                return(true);
            }

            // We've exhausted all mechanisms of entity detection - this doesn't appear to be an entity that the server is aware of.
            return(true);
        }
Example #16
0
    public override object Load(object[] data, object instance)
    {
        if (instance != null)
        {
            return(instance);
        }
#if US_LOGGING
        if (!((bool)data [1]))
        {
            Radical.Log("[[Disabled, will not be set]]");
        }
        Radical.Log("GameObject: {0}", data [0]);
#endif
        if (data.Length > 3)
        {
            var asset = SaveGameManager.Instance.GetAsset((SaveGameManager.AssetReference)data[3]) as GameObject;
            return(asset);
        }
        return(instance ?? new UnitySerializer.DeferredSetter((d) => {
            return UniqueIdentifier.GetByName((string)data [0]);
        })
        {
            enabled = (bool)data [1]
        });
    }
Example #17
0
 internal DigitalInput(int numberOfInputOnGroup, NeuronGroup neuronGroup, ushort registerNumber, ushort bitInRegister)
 {
     _registerNumber  = registerNumber;
     _bitInRegister   = bitInRegister;
     UniqueIdentifyer = new UniqueIdentifier(neuronGroup, NeuronResource.DigitalInput, numberOfInputOnGroup);
     _currentValue    = OnOffValue.Unknown;
 }
        protected override void ProcessRecord()
        {
            UniqueIdentifier uniqueID = this.ID as UniqueIdentifier;

            if (uniqueID != null)
            {
                this.WriteObject(new RmaObject(RmcWrapper.Client.CreateResourceTemplateForUpdate(this.ObjectType, uniqueID)));
                return;
            }

            string stringID = this.ID as string;

            if (stringID != null)
            {
                uniqueID = new UniqueIdentifier(stringID);
                this.WriteObject(new RmaObject(RmcWrapper.Client.CreateResourceTemplateForUpdate(this.ObjectType, uniqueID)));
                return;
            }

            Guid?guidID = this.ID as Guid?;

            if (guidID != null)
            {
                uniqueID = new UniqueIdentifier(guidID.Value);
                this.WriteObject(new RmaObject(RmcWrapper.Client.CreateResourceTemplateForUpdate(this.ObjectType, uniqueID)));
                return;
            }
        }
 public static void Postfix(ProtobufSerializer.GameObjectData goData, UniqueIdentifier uid)
 {
     if (Multiplayer.Active && SerializationHelper.BLOCK_HAND_PLACED_DESERIALIZATION && SpawnedWithoutServersPermission(goData, uid.gameObject) && uid.gameObject.name != "CellRoot(Clone)")
     {
         Object.Destroy(uid.gameObject);
     }
 }
Example #20
0
        internal AnalogOutput(NeuronGroup neuronGroup, int number, ushort registerNumber, NeuronSpiConnector spiConnector, DriverLogger logger)
        {
            _registerNumber = registerNumber;
            _logger         = logger;
            _logger.LogInstantiating(this);
            _neuronGroup  = neuronGroup;
            _spiConnector = spiConnector;

            UniqueIdentifyer = new UniqueIdentifier(neuronGroup, NeuronResource.AnalogOutput, number);

            var vOffset = _spiConnector.GetSingleRegisterValue(neuronGroup, 1021);
            var vDef    = _spiConnector.GetSingleRegisterValue(neuronGroup, 1020);
            var vRef    = _spiConnector.GetSingleRegisterValue(neuronGroup, 1009);
            var vRefInt = _spiConnector.GetSingleRegisterValue(neuronGroup, 5);

            if (vRefInt == null || vRef == null || vOffset == null || vDef == null)
            {
                throw new Exception("failure while getting the calibration Values from the Registers!");
            }

            _vOffset = BitConverter.ToInt16(BitConverter.GetBytes(vOffset.Value), 0);
            _vDev    = BitConverter.ToInt16(BitConverter.GetBytes(vDef.Value), 0);

            _vRealInt = 3.3 * ((double)vRef / (double)vRefInt);
        }
        public ResourceObject Get(UniqueIdentifier id, IEnumerable <string> attributes, CultureInfo locale)
        {
            if (id == null)
            {
                throw new ArgumentNullException("id");
            }

            bool partialResponse = attributes != null;

            GetResponse r = new GetResponse();

            using (Message message = MessageComposer.CreateGetMessage(id, attributes, locale))
            {
                using (Message responseMessage = this.Invoke((c) => c.Get(message)))
                {
                    responseMessage.ThrowOnFault();

                    if (partialResponse)
                    {
                        GetResponse response = responseMessage.DeserializeMessageWithPayload <GetResponse>();
                        return(new ResourceObject(response.Results.OfType <XmlElement>(), this.client, locale));
                    }
                    else
                    {
                        XmlDictionaryReader fullObject = responseMessage.GetReaderAtBodyContents();
                        return(new ResourceObject(fullObject, this.client, locale));
                    }
                }
            }
        }
Example #22
0
        private List <ObserverRequest> GetObserverRequestFromCompositeRequest(ResourceObject request)
        {
            List <ObserverRequest> observerRequests = new List <ObserverRequest>();
            ResourceObject         compositeRequest = RmcWrapper.Client.GetResource(request.ObjectID);

            string parameterXMLString = String.Format("<RequestParameters>{0}</RequestParameters>", compositeRequest.Attributes["RequestParameter"].StringValue);

            XElement requestParameters = XElement.Parse(parameterXMLString);

            foreach (var requestParameter in requestParameters.Elements())
            {
                var objectID   = new UniqueIdentifier(requestParameter.Element("Target").Value);
                var objectType = observedObjects.Where(o => o.ObjectID == objectID).FirstOrDefault();

                if (objectType != null)
                {
                    observerRequests.Add(
                        new ObserverRequest(
                            objectID,
                            objectType.ObjectTypeName,
                            requestParameter.Element("Operation").Value));
                }
                else
                {
                    WriteVerbose("msidmCompositeType RequestParameter is skipped. Could not find Target in observed objects.");
                }
            }
            return(observerRequests);
        }
Example #23
0
        public void Approve(UniqueIdentifier workflowInstance, UniqueIdentifier approvalRequest, bool approve, string reason = null)
        {
            if (workflowInstance == null)
            {
                throw new ArgumentNullException(nameof(workflowInstance));
            }

            if (approvalRequest == null)
            {
                throw new ArgumentNullException(nameof(approvalRequest));
            }

            ApprovalResponse response = new ApprovalResponse
            {
                Decision = approve ? ResourceFactoryClient.ApprovedText : ResourceFactoryClient.RejectedText,
                Reason   = reason,
                Approval = approvalRequest.ToString()
            };


            using (Message message = MessageComposer.CreateApprovalMessage(workflowInstance, response))
            {
                using (Message responseMessage = this.Invoke((c) => c.Create(message)))
                {
                    responseMessage.ThrowOnFault();
                }
            }
        }
Example #24
0
    public override IEnumerable <object> Save(Component target)
    {
        SaveGameManager.AssetReference assetId = SaveGameManager.Instance.GetAssetId(target);
        if (assetId.index != -1)
        {
            return(new object[]
            {
                null,
                true,
                target.GetType().FullName,
                assetId
            });
        }
        int num = target.gameObject.GetComponents(target.GetType()).FindIndex((Component c) => c == target);

        if (UniqueIdentifier.GetByName(target.gameObject.GetId()) != null)
        {
            return(new object[]
            {
                target.gameObject.GetId(),
                true,
                target.GetType().FullName,
                string.Empty,
                num
            });
        }
        return(new object[]
        {
            target.gameObject.GetId(),
            false,
            target.GetType().FullName,
            string.Empty,
            num
        });
    }
Example #25
0
        public void Create(ResourceObject resource)
        {
            if (resource == null)
            {
                throw new ArgumentNullException(nameof(resource));
            }

            try
            {
                using (Message message = MessageComposer.CreateCreateMessage(resource))
                {
                    using (Message responseMessage = this.Invoke((c) => c.Create(message)))
                    {
                        responseMessage.ThrowOnFault();

                        ResourceCreatedType response = responseMessage.DeserializeMessageWithPayload <ResourceCreatedType>();
                        UniqueIdentifier    id       = new UniqueIdentifier(response.EndpointReference.ReferenceProperties.ResourceReferenceProperty.Text);
                        resource.CompleteCreateOperation(id);
                    }
                }
            }
            catch (FaultException <RepresentationFailures> e)
            {
                throw InvalidRepresentationException.GetException(e.Detail);
            }
        }
Example #26
0
        /// <summary>
        /// Initialize the DicomComparator
        /// </summary>
        /// <param name="dicomMessage"></param>
        /// <returns></returns>
        /// <returns>bool - true = template initialized, false template not initialized</returns>
        public bool Initialize(DvtkData.Dimse.DicomMessage dicomMessage)
        {
            DvtkData.Dimse.DimseCommand command = dicomMessage.CommandField;
            System.String sopClassUid           = System.String.Empty;

            DvtkData.Dimse.Attribute attribute = dicomMessage.CommandSet.GetAttribute(DvtkData.Dimse.Tag.AFFECTED_SOP_CLASS_UID);
            if (attribute == null)
            {
                attribute = dicomMessage.CommandSet.GetAttribute(DvtkData.Dimse.Tag.REQUESTED_SOP_CLASS_UID);
            }
            if ((attribute != null) &&
                (attribute.Length != 0))
            {
                UniqueIdentifier uniqueIdentifier = (UniqueIdentifier)attribute.DicomValue;
                sopClassUid = uniqueIdentifier.Values[0];
            }

            // Try to initialise a template
            _template = new DicomComparisonTemplate();
            bool initialized = _template.Initialize(command, sopClassUid);

            if (initialized == true)
            {
                // Load the template with the corresponding attribute values
                initialized = LoadTemplate(dicomMessage.DataSet);
            }

            return(initialized);
        }
 /// <summary>
 /// Gets the unique identifier.
 /// </summary>
 /// <param name="ui">The instance of <see cref="UniqueIdentifier"/> that represents an unique identifier.</param>
 /// <returns>
 ///     <c>true</c> if it is not top level element; <c>false</c> otherwise if it is top level element
 /// </returns>
 internal override bool GetUniqueIdentifier(UniqueIdentifier ui)
 {
     if (!base.GetUniqueIdentifier(ui))
     {
         ui.Update(false, ModelEntity.Wrapper.SymbolicName.XmlQualifiedName, true);
     }
     return(true);
 }
        public void TestSVRemoveUniqueIdentifierWithInitialValue()
        {
            UniqueIdentifier testValue     = new UniqueIdentifier("e945055f-96e7-431b-902f-e1ebd52d9253");
            UniqueIdentifier initialValue  = new UniqueIdentifier("e945055f-96e7-431b-902f-e1ebd52d9253");
            UniqueIdentifier expectedValue = null;

            this.ExecuteSVTestRemove(AttributeType.Reference, initialValue, testValue, expectedValue, ModeType.Modify);
        }
        public void TestSVSetUniqueIdentifierWithInitialValue()
        {
            UniqueIdentifier testValue     = new UniqueIdentifier("e945055f-96e7-431b-902f-e1ebd52d9253");
            UniqueIdentifier initialValue  = new UniqueIdentifier("ba69ce24-3bac-48bb-8f0d-b82932716913");
            UniqueIdentifier expectedValue = new UniqueIdentifier("e945055f-96e7-431b-902f-e1ebd52d9253");

            this.ExecuteSVTestSet(AttributeType.Reference, initialValue, testValue, expectedValue, ModeType.Modify);
        }
Example #30
0
        public static string GetPrivateKey(string productName)
        {
            string actual = UniqueIdentifier.GetIdentifier() + productName;

            string actualEncrypted = StringUtilities.Crypt(actual, License.PassPhrase, true);

            return(StringUtilities.EncodeToBase64(actualEncrypted));
        }
Example #31
0
        private static DICOMElement CreateVRObject(string vr, Constants.EncodeType encType, byte[] data, Tag t, bool isLittleEndian, bool isIndefinite)
        {
            switch (vr)
            {
                case "CS":
                    CodeString cs = new CodeString();
                    cs.ByteData = data;
                    cs.EncodeType = encType;
                    cs.IsLittleEndian = isLittleEndian;
                    cs.Tag = t;
                    return cs;

                case "SH":
                    ShortString sh = new ShortString();
                    sh.ByteData = data;
                    sh.EncodeType = encType;
                    sh.IsLittleEndian = isLittleEndian;
                    sh.Tag = t;
                    return sh;

                case "LO":
                    LongString lo = new LongString();
                    lo.ByteData = data;
                    lo.EncodeType = encType;
                    lo.IsLittleEndian = isLittleEndian;
                    lo.Tag = t;
                    return lo;

                case "ST":
                    ShortText st = new ShortText();
                    st.ByteData = data;
                    st.EncodeType = encType;
                    st.IsLittleEndian = isLittleEndian;
                    st.Tag = t;
                    return st;

                case "LT":
                    LongText lt = new LongText();
                    lt.ByteData = data;
                    lt.EncodeType = encType;
                    lt.IsLittleEndian = isLittleEndian;
                    lt.Tag = t;
                    return lt;

                case "UT":
                    UnlimitedText ut = new UnlimitedText();
                    ut.ByteData = data;
                    ut.EncodeType = encType;
                    ut.IsLittleEndian = isLittleEndian;
                    ut.Tag = t;
                    return ut;

                case "AE":
                    ApplicationEntity ae = new ApplicationEntity();
                    ae.ByteData = data;
                    ae.EncodeType = encType;
                    ae.IsLittleEndian = isLittleEndian;
                    ae.Tag = t;
                    return ae;

                case "PN":
                    PersonsName pn = new PersonsName();
                    pn.ByteData = data;
                    pn.EncodeType = encType;
                    pn.IsLittleEndian = isLittleEndian;
                    pn.Tag = t;
                    return pn;

                case "UI":
                    UniqueIdentifier ui = new UniqueIdentifier();
                    ui.ByteData = data;
                    ui.EncodeType = encType;
                    ui.IsLittleEndian = isLittleEndian;
                    ui.Tag = t;
                    return ui;

                case "DA":
                    DateVR da = new DateVR();
                    da.ByteData = data;
                    da.EncodeType = encType;
                    da.IsLittleEndian = isLittleEndian;
                    da.Tag = t;
                    return da;

                case "TM":
                    TimeVR tm = new TimeVR();
                    tm.ByteData = data;
                    tm.EncodeType = encType;
                    tm.IsLittleEndian = isLittleEndian;
                    tm.Tag = t;
                    return tm;

                case "DT":
                    DateTimeVR dt = new DateTimeVR();
                    dt.ByteData = data;
                    dt.EncodeType = encType;
                    dt.IsLittleEndian = isLittleEndian;
                    dt.Tag = t;
                    return dt;

                case "AS":
                    AgeString aSt = new AgeString();
                    aSt.ByteData = data;
                    aSt.EncodeType = encType;
                    aSt.IsLittleEndian = isLittleEndian;
                    aSt.Tag = t;
                    return aSt;

                case "IS":
                    IntegerString iSt = new IntegerString();
                    iSt.ByteData = data;
                    iSt.EncodeType = encType;
                    iSt.IsLittleEndian = isLittleEndian;
                    iSt.Tag = t;
                    return iSt;

                case "DS":
                    DecimalString ds = new DecimalString();
                    ds.ByteData = data;
                    ds.EncodeType = encType;
                    ds.IsLittleEndian = isLittleEndian;
                    ds.Tag = t;
                    return ds;

                case "SS":
                    SignedShort ss = new SignedShort();
                    ss.ByteData = data;
                    ss.EncodeType = encType;
                    ss.IsLittleEndian = isLittleEndian;
                    ss.Tag = t;
                    return ss;

                case "US":
                    UnsignedShort us = new UnsignedShort();
                    us.ByteData = data;
                    us.EncodeType = encType;
                    us.IsLittleEndian = isLittleEndian;
                    us.Tag = t;
                    return us;

                case "SL":
                    SignedLong sl = new SignedLong();
                    sl.ByteData = data;
                    sl.EncodeType = encType;
                    sl.IsLittleEndian = isLittleEndian;
                    sl.Tag = t;
                    return sl;

                case "UL":
                    UnsignedLong ul = new UnsignedLong();
                    ul.ByteData = data;
                    ul.EncodeType = encType;
                    ul.IsLittleEndian = isLittleEndian;
                    ul.Tag = t;
                    return ul;

                case "AT":
                    AttributeTag at = new AttributeTag();
                    at.ByteData = data;
                    at.EncodeType = encType;
                    at.IsLittleEndian = isLittleEndian;
                    at.Tag = t;
                    return at;

                case "FL":
                    FloatingPointSingle fl = new FloatingPointSingle();
                    fl.ByteData = data;
                    fl.EncodeType = encType;
                    fl.IsLittleEndian = isLittleEndian;
                    fl.Tag = t;
                    return fl;

                case "FD":
                    FloatingPointDouble fd = new FloatingPointDouble();
                    fd.ByteData = data;
                    fd.EncodeType = encType;
                    fd.IsLittleEndian = isLittleEndian;
                    fd.Tag = t;
                    return fd;

                case "OB":
                    if (t.Id == TagHelper.PIXEL_DATA)
                    {
                        PixelData fd1 = new PixelData(data, encType, isLittleEndian, "OB", isIndefinite);
                        fd1.Format = isIndefinite ? FrameDataFormat.ENCAPSULATED : FrameDataFormat.NATIVE;
                        fd1.EncodeType = encType;
                        fd1.IsLittleEndian = isLittleEndian;
                        fd1.Tag = t;
                        return fd1;
                    }
                    else
                    {
                        OtherByteString ob = new OtherByteString();
                        ob.ByteData = data;
                        ob.EncodeType = encType;
                        ob.IsLittleEndian = isLittleEndian;
                        ob.Tag = t;
                        return ob;
                    }
                case "OW":
                    if (t.Id == TagHelper.PIXEL_DATA)
                    {
                        PixelData fd2 = new PixelData(data, encType, isLittleEndian, "OW", isIndefinite);
                        fd2.Format = isIndefinite ? FrameDataFormat.ENCAPSULATED : FrameDataFormat.NATIVE;
                        fd2.EncodeType = encType;
                        fd2.IsLittleEndian = isLittleEndian;
                        fd2.Tag = t;
                        return fd2;
                    }
                    else
                    {
                        OtherWordString ow = new OtherWordString();
                        ow.ByteData = data;
                        ow.EncodeType = encType;
                        ow.IsLittleEndian = isLittleEndian;
                        ow.Tag = t;
                        return ow;
                    }

                case "OF":
                    OtherFloatString of = new OtherFloatString();
                    of.ByteData = data;
                    of.EncodeType = encType;
                    of.IsLittleEndian = isLittleEndian;
                    of.Tag = t;
                    return of;

                case "SQ":
                    Sequence s = new Sequence();
                    s.ByteData = data;
                    s.EncodeType = encType;
                    s.IsLittleEndian = isLittleEndian;
                    s.Tag = t;
                    s.ReadChildren();
                    return s;

                default:
                    //Case for unknown VR
                    DICOMElement dOb = new DICOMElement();
                    dOb.ByteData = data;
                    dOb.EncodeType = encType;
                    dOb.IsLittleEndian = isLittleEndian;
                    dOb.Tag = t;
                    return dOb;
            }
        }