Esempio n. 1
0
 public MaterialGap(
     LocalKey key = null,
     float size   = 16.0f) : base(key: key)
 {
     D.assert(key != null);
     this.size = size;
 }
Esempio n. 2
0
 public MaterialSlice(
     LocalKey key = null,
     Widget child = null) : base(key: key)
 {
     D.assert(key != null);
     D.assert(child != null);
     this.child = child;
 }
Esempio n. 3
0
 public _TableElementRow(
     LocalKey key            = null,
     List <Element> children = null
     )
 {
     this.key      = key;
     this.children = children;
 }
Esempio n. 4
0
 public TableRow(
     LocalKey key           = null,
     Decoration decoration  = null,
     List <Widget> children = null
     )
 {
     this.key        = key;
     this.decoration = decoration;
     this.children   = children;
 }
Esempio n. 5
0
 public DataRow(
     LocalKey key  = null,
     bool selected = false,
     ValueChanged <bool> onSelectChanged = null,
     List <DataCell> cells = null
     )
 {
     D.assert(cells != null);
     this.key             = key;
     this.selected        = selected;
     this.onSelectChanged = onSelectChanged;
     this.cells           = cells;
 }
        public Temporary AcquireTemporary(Type type, bool isRef = false)
        {
            Contracts.CheckValue(type, nameof(type));
            Contracts.Check(Il != null, "Cannot access IL for a method that has already been created");

            if (_tempDisposer == null)
            {
                _tempDisposer = ReleaseLocal;
            }

            LocalKey            key = new LocalKey(type, isRef);
            List <LocalBuilder> locals;

            if (_locals != null && _locals.TryGetValue(key, out locals) && locals.Count > 0)
            {
                var temp = locals[locals.Count - 1];
                locals.RemoveAt(locals.Count - 1);
                return(new Temporary(_tempDisposer, temp, key.IsRef));
            }
            return(new Temporary(_tempDisposer, Il.DeclareLocal(key.Type), key.IsRef));
        }
        /// <summary>
        /// Called by the Temporary struct's Dispose method, through the _tempDisposer delegate.
        /// </summary>
        private void ReleaseLocal(LocalBuilder localBuilder, bool isRef)
        {
            Contracts.AssertValue(localBuilder);

            LocalKey key = new LocalKey(localBuilder.LocalType, isRef);

            List <LocalBuilder> locals;

            if (_locals == null)
            {
                _locals = new Dictionary <LocalKey, List <LocalBuilder> >();
            }
            else if (_locals.TryGetValue(key, out locals))
            {
                Contracts.Assert(!locals.Contains(localBuilder));
                locals.Add(localBuilder);
                return;
            }

            locals = new List <LocalBuilder>(4);
            _locals.Add(key, locals);
            locals.Add(localBuilder);
        }
Esempio n. 8
0
 public _MergeableMaterialSliceKey(LocalKey value) : base()
 {
     this.value = value;
 }
Esempio n. 9
0
 public MergeableMaterialItem(
     LocalKey key)
 {
     D.assert(key != null);
     this.key = key;
 }
Esempio n. 10
0
 public CallbackAction(LocalKey intentKey = null, OnInvokeCallback onInvoke = null) : base(intentKey: intentKey)
 {
     D.assert(onInvoke != null);
     this.onInvoke = onInvoke;
 }
Esempio n. 11
0
 public UiWidgetAction(LocalKey intentKey)
 {
     D.assert(intentKey != null);
     this.intentKey = intentKey;
 }
Esempio n. 12
0
        protected override void OnTempestMessage(MessageEventArgs e)
        {
            switch (e.Message.MessageType)
            {
            case (ushort)TempestMessageType.AcknowledgeConnect:
            {
                var msg = (AcknowledgeConnectMessage)e.Message;

                this.serializer.Protocols = this.serializer.Protocols.Intersect(msg.EnabledProtocols);
                ConnectionId = msg.ConnectionId;

                this.remoteEncryption = new RSACrypto();
                this.remoteEncryption.ImportKey((RSAAsymmetricKey)msg.PublicEncryptionKey);

                var encryption = new AesManaged {
                    KeySize = 256
                };
                encryption.GenerateKey();

                BufferValueWriter authKeyWriter = new BufferValueWriter(new byte[1600]);
                LocalKey.Serialize(this.serializer.SerializationContext, authKeyWriter, this.remoteEncryption);

                SendAsync(new FinalConnectMessage
                    {
                        AESKey = this.remoteEncryption.Encrypt(encryption.Key),
                        PublicAuthenticationKeyType = LocalKey.GetType(),
                        PublicAuthenticationKey     = authKeyWriter.ToArray()
                    });

                this.serializer.AES  = encryption;
                this.serializer.HMAC = new HMACSHA256(encryption.Key);

                break;
            }

            case (ushort)TempestMessageType.Connected:
            {
                var msg = (ConnectedMessage)e.Message;

                ConnectionId = msg.ConnectionId;

                this.formallyConnected = true;

                Timer t = Interlocked.Exchange(ref this.connectTimer, null);
                if (t != null)
                {
                    t.Dispose();
                }

                var tcs = Interlocked.Exchange(ref this.connectTcs, null);
                if (tcs != null)
                {
                    if (tcs.TrySetResult(new ClientConnectionResult(ConnectionResult.Success, RemoteKey)))
                    {
                        OnConnected();
                    }
                }

                break;
            }

            default:
                base.OnTempestMessage(e);
                break;
            }
        }
Esempio n. 13
0
 public void Set(LocalKey key, TValue value) => Dictionary.Set(key, value);
Esempio n. 14
0
 public TValue Get(LocalKey key) => Dictionary.Get(key);
Esempio n. 15
0
 public override string ToString()
 {
     return(Enum.GetName(LocalKey.GetType(), LocalKey));
 }
Esempio n. 16
0
 public Intent(LocalKey key) : base()
 {
     D.assert(key != null);
     this.key = key;
 }
Esempio n. 17
0
 public _RequestFocusActionBase(LocalKey name) : base(name)
 {
 }
Esempio n. 18
0
 public App()
 {
     LocalKey.Init();
 }