コード例 #1
0
 public object InstanceSystemObject(TyonHydrater hydrater)
 {
     return(hydrater.HydrateValue(
                GetTyonType().GetSystemType(hydrater),
                GetTyonValue()
                ) ?? GetTyonType().InstanceSystemObject(hydrater));
 }
コード例 #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));
            });
        }
コード例 #3
0
        public Type GetLogSystemType(TyonHydrater hydrater)
        {
            if (IsExplicitlyTyped())
            {
                return(GetTyonType().GetSystemType(hydrater));
            }

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