public bool Equals(WString other) { if (WrappedValue == null) { return(other.WrappedValue == null ? true : false); } return(WrappedValue.Equals(other.WrappedValue)); }
public int CompareTo(WString other) { if (WrappedValue == null) { return(other == null ? 0 : -1); } return(WrappedValue.CompareTo(other.WrappedValue)); }
public ITypeFacade GetElementType(IObjectFacade objectFacade) { if (IsCollection) { var introspectableSpecification = WrappedValue.GetFacet <ITypeOfFacet>().GetValueSpec(((ObjectFacade)objectFacade).WrappedNakedObject, framework.MetamodelManager.Metamodel); var elementSpec = framework.MetamodelManager.GetSpecification(introspectableSpecification); return(new TypeFacade(elementSpec, FrameworkFacade, framework)); } return(null); }
private static void SetProperty_Generic <T>(Dictionary <String, WrappedValue <T> > collection, String symName, T value) { WrappedValue <T> val = null; if (!collection.TryGetValue(symName, out val)) { throw new ApplicationException("No such property"); } val.Value = value; }
public Task SendCommand(ServerCommand command) { // Store where the message originated from command.ServerId = _serverIdManager.ServerId; // Wrap the value so buses that need to serialize can call ToString() var wrappedValue = new WrappedValue(command, _serializer); // Send the command to the all servers return _messageBus.Send(_serverIdManager.ServerId, ServerSignal, wrappedValue); }
public Task SendCommand(ServerCommand command) { // Store where the message originated from command.ServerId = _serverIdManager.ServerId; // Wrap the value so buses that need to serialize can call ToString() var wrappedValue = new WrappedValue(command, _serializer); // Send the command to the all servers return(_messageBus.Send(_serverIdManager.ServerId, ServerSignal, wrappedValue)); }
private void HandleServerCommands(IList <Message> messages) { foreach (var message in messages) { // Only handle server commands if (ServerSignal.Equals(message.SignalKey)) { // Uwrap the command and raise the event var command = WrappedValue.Unwrap <ServerCommand>(message.Value, _serializer); OnCommand(command); } } }
private bool DecryptIf(Dictionary <string, object> currenttree, string key, dynamic value, TypeConverter converter) { var didSomething = false; if (ShouldTryDecryption(value, converter)) { // TODO properly some try-catch-all error handling to prevent nasty blowups. Nothing fancy. var wrap = new WrappedValue((string)value); var unwrappedValue = this.encrypt.UnwrapAndDecrypt(wrap); currenttree[key] = unwrappedValue; didSomething = true; } return(didSomething); }
public void HappyPath() { byte[] key = new byte[16], iv = new byte[16], value = new byte[16]; SecureRandom random = new SecureRandom(); random.NextBytes(key); random.NextBytes(iv); random.NextBytes(value); var wrappedString = new WrappedValue { EncryptedAESKey = key, IV = iv, EncryptedValue = value }.ToString(); Assert.StartsWith("ENC[", wrappedString); var wrap = new WrappedValue(wrappedString); Assert.Equal(key, wrap.EncryptedAESKey); Assert.Equal(iv, wrap.IV); Assert.Equal(value, wrap.EncryptedValue); }
public void HappyPath_EncryptAndThenDecrypt(string value) { var e = new Encrypt { PublicKey = publicKey, PrivateKey = privateKey }; WrappedValue wrapped = e.EncryptAndWrap(value); Assert.NotNull(wrapped); Assert.NotNull(wrapped.EncryptedAESKey); Assert.NotNull(wrapped.IV); Assert.NotNull(wrapped.EncryptedValue); string wrapHexed = wrapped.ToString(); Assert.NotNull(wrapHexed); Assert.NotEqual(string.Empty, wrapHexed); WrappedValue unhexedWrap = null; try { unhexedWrap = new WrappedValue(wrapHexed); } catch { // no-op } Assert.NotNull(unhexedWrap); Assert.Equal(wrapped.EncryptedValue, unhexedWrap.EncryptedValue); string decryptedValue = e.UnwrapAndDecrypt(unhexedWrap); Assert.NotNull(decryptedValue); Assert.Equal(value, decryptedValue); }
public int CompareTo(WUInt32 other) { return(WrappedValue.CompareTo(other.WrappedValue)); }
public bool Equals(uint other) { return(WrappedValue.Equals(other)); }
public int CompareTo(uint other) { return(WrappedValue.CompareTo(other)); }
public int CompareTo(WTimeSpan other) { return(WrappedValue.CompareTo(other.WrappedValue)); }
public int CompareTo(WDecimal other) { return(WrappedValue.CompareTo(other.WrappedValue)); }
public override string ToString() { return(WrappedValue.ToString()); }
public bool Equals(WDateTime other) { return(WrappedValue.Equals(other.WrappedValue)); }
public bool IsOfType(ITypeFacade otherSpec) { return(WrappedValue.IsOfType(((TypeFacade)otherSpec).WrappedValue)); }
public bool Equals(WGuid other) { return(WrappedValue.Equals(other.WrappedValue)); }
public int CompareTo(WGuid other) { return(WrappedValue.CompareTo(other.WrappedValue)); }
public bool Equals(double other) { return(WrappedValue.Equals(other)); }
public bool Equals(long other) { return(WrappedValue.Equals(other)); }
public bool Equals(WTimeSpan other) { return(WrappedValue.Equals(other.WrappedValue)); }
public bool Equals(WUInt32 other) { return(WrappedValue.Equals(other.WrappedValue)); }
public int CompareTo(WDateTime other) { return(WrappedValue.CompareTo(other.WrappedValue)); }
protected void RegisterObject(String symName, WrappedValue <Material> obj) { _materials[symName] = obj; }
private Task SendMessage(string key, object value) { var wrappedValue = new WrappedValue(value, _serializer); return _messageBus.Send(_connectionId, key, wrappedValue).Catch(); }
protected void RegisterObject(String symName, WrappedValue <double> obj) { _doubles[symName] = obj; }
public override int GetHashCode() { return(WrappedValue.GetHashCode()); }
public override string ToString() { return(WrappedValue?.ToString() ?? ""); }
public bool Equals(WDecimal other) { return(WrappedValue.Equals(other.WrappedValue)); }
public override int GetHashCode() { return(WrappedValue != null ? WrappedValue.GetHashCode() : 0); }