Beispiel #1
0
 public object InstanceSystemObject(TyonHydrater hydrater)
 {
     return(hydrater.HydrateValue(
                GetTyonType().GetSystemType(hydrater),
                GetTyonValue()
                ) ?? GetTyonType().InstanceSystemObject(hydrater));
 }
Beispiel #2
0
        public void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
        {
            Type log_type           = GetLogSystemType(hydrater);
            Variable_IndexedLog log = Variable_IndexedLog.New(log_type);

            if (variable.GetContents() != null)
            {
                int index = 0;
                foreach (object old_element in variable.GetContents().Convert <IEnumerable>())
                {
                    log.CreateStrongInstance(index++).SetContents(old_element);
                }
            }

            GetTyonValueList().IfNotNull(l => l.PushToLogVariable(log, hydrater));

            hydrater.DeferProcess(delegate() {
                List <object> values = log.GetValues()
                                       .Truncate(GetNumberTyonValues())
                                       .ToList();

                Type final_type = IsExplicitlyTyped().ConvertBool(
                    () => log_type,
                    () => values.Convert(v => v.GetTypeEX()).GetCommonAncestor()
                    );

                variable.SetContents(values.ToArrayOfType(final_type));
            });
        }
Beispiel #3
0
        public Type GetLogSystemType(TyonHydrater hydrater)
        {
            if (IsExplicitlyTyped())
            {
                return(GetTyonType().GetSystemType(hydrater));
            }

            return(typeof(object));
        }
Beispiel #4
0
        public void PushToSystemObject(object obj, TyonHydrater hydrater)
        {
            Variable variable;

            if (hydrater.TryGetDesignatedVariable(obj.GetType(), GetId(), out variable))
            {
                GetTyonValue().PushToVariable(variable.CreateStrongInstance(obj), hydrater);
            }
            else
            {
                hydrater.LogMissingField(obj.GetType(), GetId());
            }
        }
Beispiel #5
0
        public void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
        {
            if (AllowsHotloading() && variable.GetVariableType().IsTypicalReferenceType())
            {
                object current_value = variable.GetContents();

                if (current_value != null)
                {
                    if (GetSystemType(hydrater) == current_value.GetType())
                    {
                        PushToSystemObject(current_value, hydrater);
                        return;
                    }
                }
            }

            variable.SetContents(InstanceSystemObject(hydrater));
        }
Beispiel #6
0
        public object InstanceSystemObject(TyonHydrater hydrater)
        {
            object system_object = null;

            if (GetTyonValueList() != null)
            {
                Variable_IndexedLog log = Variable_IndexedLog.New(typeof(object));

                GetTyonValueList().PushToLogVariable(log, hydrater);

                system_object = GetTyonType().InstanceSystemObject(hydrater, log.GetValues().ToArray());
            }
            else
            {
                system_object = GetTyonType().InstanceSystemObject(hydrater);
            }

            return(system_object.ChainIfNotNull(o => PushToSystemObject(o, hydrater)));
        }
Beispiel #7
0
 public abstract void PushToVariable(VariableInstance variable, TyonHydrater hydrater);
Beispiel #8
0
 public override object InstanceSystemObject(TyonHydrater hydrater, object[] arguments)
 {
     return(null);
 }
Beispiel #9
0
 public void PushToLogVariable(Variable variable, TyonHydrater hydrater)
 {
     GetTyonValues().ProcessWithIndex((i, v) => v.PushToVariable(variable.CreateStrongInstance(i), hydrater));
 }
Beispiel #10
0
 public override object InstanceSystemObject(TyonHydrater hydrater, object[] arguments)
 {
     return(GetSystemType(hydrater).IfNotNull(t => t.CreateInstance(arguments)));
 }
Beispiel #11
0
 public object InstanceSystemObject(TyonHydrater hydrater)
 {
     return(InstanceSystemObject(hydrater, Empty.Array <object>()));
 }
Beispiel #12
0
 public override void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
 {
     variable.SetContents(GetTyonType().GetSystemType(hydrater));
 }
Beispiel #13
0
 public void PushToSystemObject(object obj, TyonHydrater hydrater)
 {
     hydrater.RegisterInternalAddress(obj, GetTyonAddress());
     GetTyonVariables().Process(v => v.PushToSystemObject(obj, hydrater));
 }
Beispiel #14
0
 public Type GetSystemType(TyonHydrater hydrater)
 {
     return(GetTyonType().GetSystemType(hydrater));
 }
Beispiel #15
0
 public override void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
 {
     variable.SetContents(hydrater.ResolveExternalAddress(GetTyonAddress()));
 }
Beispiel #16
0
 public void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
 {
     variable.SetContents(InstanceSystemObject(hydrater));
 }
Beispiel #17
0
 public override void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
 {
     GetTyonArray().PushToVariable(variable, hydrater);
 }
Beispiel #18
0
 public override void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
 {
     hydrater.DeferProcess(delegate() {
         variable.SetContents(hydrater.ResolveInternalAddress(GetTyonAddress()));
     });
 }
Beispiel #19
0
 public override void PushToVariable(VariableInstance variable, TyonHydrater hydrater)
 {
     variable.SetContents(GetInt());
 }
Beispiel #20
0
 public abstract object InstanceSystemObject(TyonHydrater hydrater, object[] arguments);