Inheritance: MonoBehaviour
        static void Main(string[] args)
        {
            Person myp = new Person();
            myp.Age = 38;

            Console.Write(myp.Age);

            //This constructs the object.
            //Looks like anon class in Java.
            Construct cDo = new Construct()
            {
                Name = "Jason",
                JobCode = 8675309
            };

            Console.WriteLine("Enter one - three");
            //Convert a String read from the user input to an INT.
            int result = int.Parse(Console.ReadLine());

            switch (result)
            {
                case 1:
                    Console.WriteLine("You entered:{0} ", result);
                    break;
                case 3:
                    Console.WriteLine("You entered:{0} ", result);
                    break;
                case 2:
                    Console.WriteLine("You entered:{0} ", result);
                    break;
                default:
                    break;
            }
        }
示例#2
0
文件: EmailBLL.cs 项目: ucdavis/PTF
        public static void Billing(Construct construct)
        {
            var deligate = new BeginInvoiceRequestDelegate(BeginInvoiceRequest);
            var callback = new AsyncCallback(EndInvoiceRequest);

            deligate.BeginInvoke(construct, callback, null);
        }
        /// <summary>Visits a constructor invocation.</summary>
        /// <param name="cons">Construction.</param>
        /// <returns>Resulting expression to visit.</returns>
        public override void VisitConstruct(Construct cons)
        {
            CheckMethod(
                ConstructAsInstanceInitializer(cons),
                x =>
                    x.DeclaringType.FullName.StartsWith("Microsoft.OData.Service.DataServiceException") &&
                    !HasParameterType(x, "System.Int32"),
                methodUnderCheck.FullName);

            base.VisitConstruct(cons);
        }
示例#4
0
文件: EmailBLL.cs 项目: ucdavis/PTF
        public static void ConstructComplete(Construct construct)
        {
            MailMessage message = new MailMessage();
            message.From = new MailAddress(fromEmail);                              // add in all the to emails
            if (adminEmails.Count() > 0) foreach (var a in adminEmails) { message.To.Add(a); }     // add in all from from emails
            message.Body = EmailText.STR_OrderCompleted + "<br/>Construct Code:" + construct.ConstructCode;
            message.Subject = "PTF Order Completed.";
            message.IsBodyHtml = true;

            SmtpClient client = new SmtpClient();
            client.Send(message);
        }
    internal void CreateMonthly(Construct wts_, Technicals.ProductBase[] products_)
    {
      List<DateTime> dates = new List<DateTime>();
      List<double> vals = new List<double>();

      int countOfZerosThisMonth = 0;
      int numberOfRebalsThisMomth = 0;

      int currentMonth = 0;
      int currentYear = 0;

      for (int i = 0; i < wts_.Dates.Count; ++i)
      {
        if (wts_.Dates[i].Year != currentYear || wts_.Dates[i].Month != currentMonth)
        {
          if (currentMonth != 0)
          {
            dates.Add(new DateTime(currentYear, currentMonth, 1));
            vals.Add(Convert.ToDouble(countOfZerosThisMonth) / Convert.ToDouble(numberOfRebalsThisMomth));
          }

          countOfZerosThisMonth = 0;
          numberOfRebalsThisMomth = 0;
        }

        double[] weightsThisRebal = wts_.GetValues(wts_.Dates[i]);

        for(int y=0;y<weightsThisRebal.Length;++y)
          if (weightsThisRebal[y] == 0.0 && products_[y].IsValid(wts_.Dates[i]))
            ++countOfZerosThisMonth;

        ++numberOfRebalsThisMomth;

        currentMonth = wts_.Dates[i].Month;
        currentYear = wts_.Dates[i].Year;
      }

      dates.Add(new DateTime(currentYear, currentMonth, 1));
      vals.Add(Convert.ToDouble(countOfZerosThisMonth) / Convert.ToDouble(numberOfRebalsThisMomth));

      foreach (DateTime date in dates)
        dt.Columns.Add(date.ToString("MMM yy"), typeof(double));

      DataRow row = dt.NewRow();

      for (int i = 0; i < vals.Count; ++i)
        row[i] = vals[i];

      dt.Rows.Add(row);

      Chart.DataSource = dt;
    }
示例#6
0
 public override Expression VisitConstruct(Construct cons) {
   MemberBinding mb = cons.Constructor as MemberBinding;
   if (mb != null) {
     mb.TargetObject = this.VisitExpression(mb.TargetObject);
   }
   cons.Operands = this.VisitExpressionList(cons.Operands);
   this.composers.Clear();
   if (mb != null) {
     this.composers.Add(this.GetComposer(mb.TargetObject));
   }
   this.GetComposers(this.composers, cons.Operands);
   return (Expression) this.Compose(cons, this.composers);
 }
        public override void VisitConstruct(Construct construct)
        {
            var memberBinding = construct.Constructor as MemberBinding;

            if (memberBinding != null
                && memberBinding.BoundMember.Name.Name == ".ctor"
                && memberBinding.BoundMember.DeclaringType.IsTask())
            {
                Problems.Add(new Problem(GetResolution(), construct.UniqueKey.ToString()));
            }

            base.VisitConstruct(construct);
        }
示例#8
0
        public void Load()
        {
            string gamePicturePath = Path.Combine(_scenarioPath, "Picture");
            string gameDataPath = Path.Combine(_scenarioPath, "Data");

            // 地形タイプ情報の読み込み
            var landformInfos = LoadInfo();

            // 各チップ画像の取得
            var landImages = WarGlobal.BmpManager.GetSurfaces(
                Path.Combine(gamePicturePath, "BMAPCHAR.BMP"), WarGlobal.ChipSize);

            var objectImages = WarGlobal.BmpManager.GetSurfaces(
                Path.Combine(gamePicturePath, "BMAPOBJ.BMP"), WarGlobal.ChipSize,
                path => BitmapUtil.Load(path, Color.Black));

            // 地形チップの生成
            var landforms = new Landform[landImages.Count];
            // 地形タイプの読み込み
            using (var reader = new StreamReader(Path.Combine(gameDataPath, "TikeiType"), WarGlobal.Encoding))
            {
                var sc = new Scanner(reader);
                for (int i = 0; i < landforms.Length; i++)
                {
                    int id = sc.NextInt32(NumberStyles.HexNumber);
                    landforms[i] = new Landform(landImages[i], landformInfos[id + 1]);
                }
            }
            WarGlobal.Landforms = landforms;

            // オブジェクトチップの生成
            var constructs = new Construct[objectImages.Count + 2];
            // 0番目は移動不可, 1番目はnull
            for (int i = 2; i < objectImages.Count; i++)
            {
                int id;
                if (i > EndWall)
                    id = 18;
                else if (i > EndCity)
                    id = 17;
                else
                    id = 16;
                constructs[i] = new Construct(objectImages[i - 1], landformInfos[id + 1]);
            }
            // 移動不可オブジェクトの生成
            constructs[0] = new Construct(null, landformInfos[0]);

            WarGlobal.Constructs = constructs;
        }
    internal void CreateWeekly(Construct wts_, Technicals.ProductBase[] products_)
    {
      int lastDay = (int)DayOfWeek.Sunday;
      int countThisWeek = 0;
      List<DateTime> dates = new List<DateTime>();
      List<int> values = new List<int>();
      DateTime firsInWeek = wts_.Dates[0];

      for (int i = 0; i < wts_.Dates.Count; ++i)
      {
        DateTime rebalDate = wts_.Dates[i];

        int dayIndex = (int)rebalDate.DayOfWeek;

        if (dayIndex > lastDay)
        {
          ++countThisWeek;
          lastDay = dayIndex;
        }
        else
        {
          dates.Add(firsInWeek);
          values.Add(countThisWeek);
          countThisWeek = 1;
          firsInWeek = rebalDate;
          lastDay = dayIndex;
        }
      }

      // last one won't have been added to the list
      dates.Add(firsInWeek);
      values.Add(countThisWeek);

      foreach (DateTime date in dates)
        dt.Columns.Add(date.ToString("MMM yy"), typeof(double));

      DataRow row = dt.NewRow();

      for (int i = 0; i < values.Count; ++i)
        row[i] = values[i];

      dt.Rows.Add(row);

      Chart.DataSource = dt;
    }
示例#10
0
        /// <summary>Visits a constructor invocation.</summary>
        /// <param name="cons">Construction.</param>
        /// <returns>Resulting expression to visit.</returns>
        public override void VisitConstruct(Construct cons)
        {
            InstanceInitializer init = ConstructAsInstanceInitializer(cons);

            if (init != null)
            {
                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeTypeReference" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReferenceOptions"),
                    methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeTypeReferenceExpression" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeParameterDeclaration" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeMemberField" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeArrayCreateExpression" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);
                
                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeCastExpression" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);

                CheckMethod(init,
                    x => x.DeclaringType.FullName == "System.CodeDom.CodeObjectCreateExpression" &&
                        !HasParameterType(x, "System.CodeDom.CodeTypeReference"),
                        methodUnderCheck.FullName);
            }

            base.VisitConstruct(cons);
        }
示例#11
0
        /// <summary>Visits a constructor invocation.</summary>
        /// <param name="cons">Construction.</param>
        /// <returns>Resulting expression to visit.</returns>
        public override void VisitConstruct(Construct cons)
        {
            CheckMethod(
                ConstructAsInstanceInitializer(cons),
                x =>
                    x.Template != null &&
                    x.Template.FullName == "System.Collections.Generic.HashSet`1.#ctor" &&
                    !HasParameterType(x, "System.Collections.Generic.IEqualityComparer`1"),
                methodUnderCheck.FullName);

            CheckMethod(
                ConstructAsInstanceInitializer(cons),
                x =>
                    x.Template != null &&
                    x.Template.FullName == "System.Collections.Generic.Dictionary`2.#ctor" &&
                    !HasParameterType(x, "System.Collections.Generic.IEqualityComparer`1"),
                methodUnderCheck.FullName);

            base.VisitConstruct(cons);
        }
示例#12
0
文件: test.cs 项目: christophevg/ADL
    public static void Main(String[] Args)
    {
        Construct root = new Construct();

        root.setType( "rootConstruct" );

        root.setName( "rootName" );

        root.addAnnotation( "rootAnnotation1" );
        root.addAnnotation( "rootAnnotation2" );

        root.addSuper( "rootSuper1" );
        root.addSuper( "rootSuper2" );

        root.addModifier( new Modifier( "rootSwitchModifier" ) );
        root.addModifier( new Modifier( "rootStringModifier", "abc" ) );
        root.addModifier( new Modifier( "rootIntegerModifier", 123 ) );
        root.addModifier( new Modifier( "rootBooleanModifier", false ) );

        Construct child = new Construct();

        child.setType( "childConstruct" );

        child.setName( "childName" );

        child.addAnnotation( "childAnnotation1" );
        child.addAnnotation( "childAnnotation2" );

        child.addSuper( "childSuper1" );
        child.addSuper( "childSuper2" );

        child.addModifier( new Modifier( "childSwitchModifier" ) );
        child.addModifier( new Modifier( "childStringModifier", "abc" ) );
        child.addModifier( new Modifier( "childIntegerModifier", 123 ) );
        child.addModifier( new Modifier( "childBooleanModifier", false ) );

        root.addChild(child);

        Console.WriteLine( root );
    }
示例#13
0
文件: EmailBLL.cs 项目: ucdavis/PTF
        public static void BeginInvoiceRequest(Construct construct)
        {
            var reportName = "/PTF/Invoice";

            var parameters = new Dictionary<string, string>();
            parameters.Add("ConstructCode", construct.ConstructCode);

            var invoice = Get(reportName, parameters);
            var memoryStream = new MemoryStream(invoice);

            //var message = new MailMessage(fromEmail, billingEmail);
            var message = new MailMessage();
            message.From = new MailAddress(fromEmail);
            if (billingEmails.Count() > 0) foreach (var a in billingEmails) { message.To.Add(a); }
            if (adminEmails.Count() > 0) foreach( var a in adminEmails) {message.To.Add(a);}
            message.Attachments.Add(new Attachment(memoryStream, string.Format("{0}_{1}.pdf", construct.Order.ID, construct.ConstructCode)));
            message.Body = EmailText.STR_Billing;
            message.Subject = "PTF Order Ready for Billing";
            message.IsBodyHtml = true;

            SmtpClient client = new SmtpClient();
            client.Send(message);
        }
示例#14
0
 internal ActivityExampleStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
 {
     new EventSource(this, "ActivityEventSource");
 }
示例#15
0
 protected virtual Expression CoerceFromTypeUnion(Expression source, TypeUnion sourceType, TypeNode targetType, bool explicitCoercion, TypeNode originalTargetType, TypeViewer typeViewer){
   if (source == null || sourceType == null || targetType == null) return null;
   if (targetType == SystemTypes.Object) return this.CoerceTypeUnionToObject(source, typeViewer);
   int cErrors = (this.Errors != null) ? this.Errors.Count : 0;
   if (explicitCoercion){
     Method coercion = this.UserDefinedExplicitCoercionMethod(source, sourceType, targetType, false, originalTargetType, typeViewer);
     if (coercion != null && coercion.ReturnType == targetType && coercion.Parameters != null && coercion.Parameters[0] != null &&
       this.ImplicitCoercionFromTo(sourceType, coercion.Parameters[0].Type, typeViewer))
       return this.ImplicitCoercion(new MethodCall(new MemberBinding(null, coercion), new ExpressionList(source), NodeType.Call, coercion.ReturnType),
         targetType, typeViewer);
   }
   Method getTag = TypeViewer.GetTypeView(typeViewer, sourceType).GetMethod(StandardIds.GetTag);
   if (getTag == null) return null;
   Method getValue = TypeViewer.GetTypeView(typeViewer, sourceType).GetMethod(StandardIds.GetValue);
   if (getValue == null) return null;
   Local src = new Local(sourceType);
   Local srcOb = new Local(SystemTypes.Object, source.SourceContext);
   Local tgt = new Local(targetType);
   Expression callGetTag = new MethodCall(new MemberBinding(new UnaryExpression(src, NodeType.AddressOf), getTag), null);
   Expression callGetValue = new MethodCall(new MemberBinding(new UnaryExpression(src, NodeType.AddressOf), getValue), null);
   TypeNodeList types = sourceType.Types;
   int n = types == null ? 0 : types.Count;
   Block endOfSwitch = new Block();
   StatementList statements = new StatementList(5+n);
   statements.Add(new AssignmentStatement(src, source));
   statements.Add(new AssignmentStatement(srcOb, callGetValue));
   BlockList cases = new BlockList(n);
   statements.Add(new SwitchInstruction(callGetTag, cases));
   bool hadCoercion = false;
   Block eb = new Block(new StatementList(1));
   Construct c = new Construct(new MemberBinding(null, SystemTypes.InvalidCastException.GetConstructor()), null, SystemTypes.InvalidCastException);
   eb.Statements.Add(new Throw(c));
   for (int i = 0; i < n; i++){
     TypeNode t = types[i];
     if (t == null) continue;
     if (!explicitCoercion && !this.ImplicitCoercionFromTo(t, targetType, typeViewer)) return null;
     Expression expr = this.ExplicitCoercion(srcOb, t, typeViewer);
     if (expr == null) return null;
     expr = this.ExplicitCoercion(expr, targetType, typeViewer);
     if (expr == null) {
       cases.Add(eb);
       statements.Add(eb);
     }
     else {
       Block b = new Block(new StatementList(2));
       hadCoercion = true;
       expr.SourceContext = srcOb.SourceContext;
       b.Statements.Add(new AssignmentStatement(tgt, expr));
       b.Statements.Add(new Branch(null, endOfSwitch));
       cases.Add(b);
       statements.Add(b);
     }
   }
   if (this.Errors != null) {
     for (int ie = cErrors, ne = this.Errors.Count; ie < ne; ie++) {
       this.Errors[ie] = null;
     }
   }
   if (!hadCoercion) return null;
   statements.Add(endOfSwitch);
   statements.Add(new ExpressionStatement(tgt));
   return new BlockExpression(new Block(statements));
   //TODO: wrap this in a CoerceTypeUnion node so that source code can be reconstructed easily
 }
示例#16
0
        /// <summary>Visits a constructor invocation.</summary>
        /// <param name="cons">Construction.</param>
        /// <returns>Resulting expression to visit.</returns>
        public override void VisitConstruct(Construct cons)
        {
            if (cons != null)
            {
                MemberBinding constructorBinding = cons.Constructor as MemberBinding;
                if (constructorBinding != null)
                {
                    Method method = constructorBinding.BoundMember as Method; // More likely: InstanceInitializer;
                    this.CheckMethodUsage(method);
                }
            }

            base.VisitConstruct(cons);
        }
示例#17
0
 public AwsCdkDmsHandler(Construct scope, string applicationName, string environmentName, string region) : base(scope, applicationName, environmentName, region)
 {
 }
        public DeveloperToolsStack(Construct parent, string id) : base(parent, id)
        {
            var cdkRepository = new Repository(this, "CDKRepository", new RepositoryProps
            {
                RepositoryName = Amazon.CDK.Aws.ACCOUNT_ID + "-MythicalMysfitsService-Repository-CDK"
            });

            var webRepository = new Repository(this, "WebRepository", new RepositoryProps
            {
                RepositoryName = Amazon.CDK.Aws.ACCOUNT_ID + "-MythicalMysfitsService-Repository-Web"
            });

            this.apiRepository = new Amazon.CDK.AWS.CodeCommit.Repository(this, "APIRepository", new RepositoryProps
            {
                RepositoryName = Amazon.CDK.Aws.ACCOUNT_ID + "-MythicalMysfitsService-Repository-API"
            });

            this.lambdaRepository = new Amazon.CDK.AWS.CodeCommit.Repository(this, "LambdaRepository",
                                                                             new RepositoryProps
            {
                RepositoryName = Amazon.CDK.Aws.ACCOUNT_ID + "-MythicalMysfitsService-Repository-Lambda"
            });

            new CfnOutput(this, "CDKRepositoryCloneUrlHttp", new CfnOutputProps()
            {
                Description = "CDK Repository CloneUrl HTTP",
                Value       = cdkRepository.RepositoryCloneUrlHttp
            });
            new CfnOutput(this, "CDKRepositoryCloneUrlSsh", new CfnOutputProps()
            {
                Description = "CDK Repository CloneUrl SSH",
                Value       = cdkRepository.RepositoryCloneUrlHttp
            });

            new CfnOutput(this, "WebRepositoryCloneUrlHttp", new CfnOutputProps()
            {
                Description = "Web Repository CloneUrl HTTP",
                Value       = webRepository.RepositoryCloneUrlHttp
            });
            new CfnOutput(this, "WebRepositoryCloneUrlSsh", new CfnOutputProps()
            {
                Description = "Web Repository CloneUrl SSH",
                Value       = webRepository.RepositoryCloneUrlSsh
            });

            new CfnOutput(this, "APIRepositoryCloneUrlHttp", new CfnOutputProps()
            {
                Description = "API Repository CloneUrl HTTP",
                Value       = apiRepository.RepositoryCloneUrlHttp
            });
            new CfnOutput(this, "APIRepositoryCloneUrlSsh", new CfnOutputProps()
            {
                Description = "API Repository CloneUrl HTTP",
                Value       = apiRepository.RepositoryCloneUrlSsh
            });

            new CfnOutput(this, "lambdaRepositoryCloneUrlHttp", new CfnOutputProps()
            {
                Description = "Lambda Repository CloneUrl HTTP",
                Value       = lambdaRepository.RepositoryCloneUrlHttp
            });
            new CfnOutput(this, "lambdaRepositoryCloneUrlSsh", new CfnOutputProps()
            {
                Description = "Lambda Repository CloneUrl HTTP",
                Value       = lambdaRepository.RepositoryCloneUrlSsh
            });
        }
示例#19
0
        public static void report(Node node, int shift)
        {
            if (node == null)
            {
                indent(shift);
                Console.WriteLine("NULL ENTITY");
                return;
            }

            switch (node.NodeType)
            {
            case NodeType.AliasDefinition:
            {
                AliasDefinition alias = node as AliasDefinition;
                indent(shift);
                Console.WriteLine("using {0} = {1};", alias.Alias.Name, alias.AliasedUri.Name);
                break;
            }

            case NodeType.CompilationUnit:
            case NodeType.CompilationUnitSnippet:
            {
                CompilationUnit cu = node as CompilationUnit;

                for (int i = 0, n = cu.Nodes.Length; i < n; i++)
                {
                    report(cu.Nodes[i], 0);
                }
                break;
            }

            case NodeType.Namespace:
            {
                Namespace ns = node as Namespace;

                if (ns.UsedNamespaces != null && ns.UsedNamespaces.Length != 0)
                {
                    indent(shift);
                    Console.WriteLine("using ");
                    for (int i = 0, n = ns.UsedNamespaces.Length; i < n; i++)
                    {
                        Console.Write("{0}", ns.UsedNamespaces[i].Namespace.Name);
                        if (i < n - 1)
                        {
                            Console.Write(", ");
                        }
                    }
                    Console.WriteLine();
                }

                indent(shift);
                Console.WriteLine("namespace {0}", ns.FullNameId.Name);

                indent(shift);
                Console.WriteLine("{");

                if (ns.AliasDefinitions != null && ns.AliasDefinitions.Length != 0)
                {
                    for (int i = 0, n = ns.AliasDefinitions.Length; i < n; i++)
                    {
                        report(ns.AliasDefinitions[i], shift + ind);
                    }
                }

                if (ns.NestedNamespaces != null && ns.NestedNamespaces.Length != 0)
                {
                    for (int i = 0, n = ns.NestedNamespaces.Length; i < n; i++)
                    {
                        report(ns.NestedNamespaces[i], shift + ind);
                    }
                }

                if (ns.Types != null && ns.Types.Length != 0)
                {
                    for (int i = 0, n = ns.Types.Length; i < n; i++)
                    {
                        report(ns.Types[i], shift + ind);
                    }
                }

                indent(shift);
                Console.WriteLine("}");

                break;
            }

            case NodeType.Class:
            {
                Class cls = node as Class;

                if (cls == SystemTypes.Object)
                {
                    Console.Write(cls.Name);
                    break;
                }

                indent(shift);

                if (cls.IsAbstract)
                {
                    Console.Write("abstract ");
                }
                if (cls.IsPrivate)
                {
                    Console.Write("private ");
                }
                else if (cls.IsPublic)
                {
                    Console.Write("public ");
                }
                else
                {
                    Console.Write("internal ");                             // ??????????????
                }
                if (cls.IsSealed)
                {
                    Console.Write("sealed ");
                }

                Console.Write("class ");
                if (cls.DeclaringType != null)
                {
                    Console.Write("{0}::", cls.DeclaringType.Name.Name);
                }
                Console.Write("{0}", cls.Name != null?cls.Name.Name:"<NONAME>");

                if (cls.BaseClass != null)
                {
                    Console.Write(" : {0}", cls.BaseClass.Name.Name);
                }

                if (cls.Interfaces != null && cls.Interfaces.Length != 0)
                {
                    if (cls.BaseClass != null)
                    {
                        Console.Write(",");
                    }
                    else
                    {
                        Console.Write(" :");
                    }

                    for (int i = 0, n = cls.Interfaces.Length; i < n; i++)
                    {
                        Interface interfac = cls.Interfaces[i];
                        if (interfac != null)
                        {
                            Console.Write(" {0}", interfac.Name.Name);
                        }
                        if (i < n - 1)
                        {
                            Console.Write(",");
                        }
                    }
                }
                Console.WriteLine();

                indent(shift);
                Console.WriteLine("{");

                if (cls.Members != null && cls.Members.Length != 0)
                {
                    for (int i = 0, n = cls.Members.Length; i < n; i++)
                    {
                        Member member = cls.Members[i];

                        if (member == null)
                        {
                            indent(shift + ind);
                            Console.WriteLine("<UNRESOLVED MEMBER>");
                            continue;
                        }
                        report(member, shift + ind);
                    }
                }
                indent(shift);
                Console.WriteLine("}");

                break;
            }

            case NodeType.Struct:
            {
                Struct struc = node as Struct;

                indent(shift);

                if (struc.IsAbstract)
                {
                    Console.Write("abstract ");
                }
                if (struc.IsPrivate)
                {
                    Console.Write("private ");
                }
                else if (struc.IsPublic)
                {
                    Console.Write("public ");
                }
                else
                {
                    Console.Write("internal ");                               // ??????????????
                }
                if (struc.IsSealed)
                {
                    Console.Write("sealed ");
                }

                Console.Write("struct ");
                if (struc.DeclaringType != null)
                {
                    Console.Write("{0}::", struc.DeclaringType.Name.Name);
                }
                Console.Write("{0}", struc.Name != null?struc.Name.Name:"<NONAME>");

                if (struc.Interfaces != null && struc.Interfaces.Length != 0)
                {
                    Console.Write(" :");
                    for (int i = 0, n = struc.Interfaces.Length; i < n; i++)
                    {
                        Interface interfac = struc.Interfaces[i];
                        if (interfac != null)
                        {
                            Console.Write(" {0}", interfac.Name.Name);
                        }
                        if (i < n - 1)
                        {
                            Console.Write(",");
                        }
                    }
                }
                Console.WriteLine();

                indent(shift);
                Console.WriteLine("{");

                if (struc.Members != null && struc.Members.Length != 0)
                {
                    for (int i = 0, n = struc.Members.Length; i < n; i++)
                    {
                        Member member = struc.Members[i];

                        if (member == null)
                        {
                            indent(shift + ind);
                            Console.WriteLine("<UNRESOLVED MEMBER>");
                            continue;
                        }
                        report(member, shift + ind);
                    }
                }
                indent(shift);
                Console.WriteLine("}");
                break;
            }

            case NodeType.EnumNode:
            {
                EnumNode enume = node as EnumNode;

                indent(shift);
                if (enume.Name != null && enume.Name.Name != null)
                {
                    Console.Write("enum {0} = ", enume.Name.Name);
                }
                else
                {
                    Console.Write("enum <NONAME> = ");
                }
                Console.Write("{");

                for (int i = 0, n = enume.Members.Length; i < n; i++)
                {
                    Field enumerator = (Field)enume.Members[i];
                    Console.Write("{0}", enumerator.Name.Name);
                    if (enumerator.DefaultValue != null)
                    {
                        Console.Write(" = {0}", enumerator.DefaultValue.ToString());
                    }
                    if (i < n - 1)
                    {
                        Console.Write(", ");
                    }
                }
                Console.WriteLine("};");

                break;
            }

            case NodeType.Interface:
            {
                Interface interfac = node as Interface;

                indent(shift);

                if (interfac.IsAbstract)
                {
                    Console.Write("abstract ");
                }
                if (interfac.IsPrivate)
                {
                    Console.Write("private ");
                }
                else if (interfac.IsPublic)
                {
                    Console.Write("public ");
                }
                else
                {
                    Console.Write("internal ");                                // ???????????
                }
                Console.WriteLine("interface {0}", interfac.Name.Name);
                indent(shift);
                Console.WriteLine("{");

                if (interfac.Members != null && interfac.Members.Length != 0)
                {
                    for (int i = 0, n = interfac.Members.Length; i < n; i++)
                    {
                        Member member = interfac.Members[i];

                        if (member == null)
                        {
                            indent(shift + ind);
                            Console.WriteLine("<UNRESOLVED MEMBER>");
                            continue;
                        }
                        report(member, shift + ind);
                    }
                }
                indent(shift);
                Console.WriteLine("}");

                break;
            }

            case NodeType.Method:
            case NodeType.InstanceInitializer:
            {
                Method method = node as Method;

                indent(shift);

                if (method.IsAbstract)
                {
                    Console.Write("abstract ");
                }
                if (method.IsPublic)
                {
                    Console.Write("public ");
                }
                if (method.IsStatic)
                {
                    Console.Write("static ");
                }
                if (method.IsVirtual)
                {
                    Console.Write("virtual ");
                }
                if (method.IsPrivate)
                {
                    Console.Write("private ");
                }
                if (method.OverriddenMethod != null)
                {
                    Console.Write("override ");
                }

                if (method.ReturnType != null && method.ReturnType.Name != null)
                {
                    Console.Write("{0} ", method.ReturnType.Name.Name);
                }
                if (method.Name != null)
                {
                    if (method.ImplementedInterfaceMethods != null && method.ImplementedInterfaceMethods.Length != 0)
                    {
                        Method interf = method.ImplementedInterfaceMethods[0];
                        if (interf != null)
                        {
                            string name = interf.DeclaringType.Name.Name;
                            Console.Write("{0}.", name);
                        }
                    }
                    Console.Write("{0}", method.Name.Name);
                }
                Console.Write(" (");

                if (method.Parameters != null && method.Parameters.Length != 0)
                {
                    for (int i = 0, n = method.Parameters.Length; i < n; i++)
                    {
                        Parameter par = method.Parameters[i];
                        if (par == null)
                        {
                            continue;
                        }
                        if ((par.Flags & ParameterFlags.In) != 0)
                        {
                            Console.Write("in ");
                        }
                        if ((par.Flags & ParameterFlags.Out) != 0)
                        {
                            Console.Write("out ");
                        }

                        if (par.Type != null && par.Type.Name != null)
                        {
                            Console.Write("{0}", par.Type.Name.Name);
                        }
                        else
                        {
                            report(par.Type, 0);
                        }
                        Console.Write(" {0}", par.Name.Name);
                        if (i < n - 1)
                        {
                            Console.Write(", ");
                        }
                    }
                }
                Console.Write(" )");

                // method body
                if (method.Body != null)
                {
                    Console.WriteLine();
                    report(method.Body, shift);
                }
                else
                {
                    Console.WriteLine(";");
                }
                break;
            }

            case NodeType.DelegateNode:
            {
                DelegateNode dn = node as DelegateNode;

                indent(shift);
                Console.Write("delegate ");

                if (dn.ReturnType != null && dn.ReturnType.Name != null)
                {
                    Console.Write("{0} ", dn.ReturnType.Name.Name);
                }
                if (dn.Name != null)
                {
                    Console.Write("{0}", dn.Name.Name);
                }
                Console.Write(" (");

                if (dn.Parameters != null && dn.Parameters.Length != 0)
                {
                    for (int i = 0, n = dn.Parameters.Length; i < n; i++)
                    {
                        Parameter par = dn.Parameters[i];
                        if (par == null)
                        {
                            continue;
                        }
                        if ((par.Flags & ParameterFlags.In) != 0)
                        {
                            Console.Write("in ");
                        }
                        if ((par.Flags & ParameterFlags.Out) != 0)
                        {
                            Console.Write("out ");
                        }

                        if (par.Type != null && par.Type.Name != null)
                        {
                            Console.Write("{0}", par.Type.Name.Name);
                        }
                        else
                        {
                            report(par.Type, 0);
                        }
                        Console.Write(" {0}", par.Name.Name);
                        if (i < n - 1)
                        {
                            Console.Write(", ");
                        }
                    }
                }
                Console.WriteLine(" );");
                break;
            }

            case NodeType.StaticInitializer:
            {
                StaticInitializer si = node as StaticInitializer;

                indent(shift);

                Console.WriteLine("static {0} ( )", si.Name.Name);

                // body
                if (si.Body != null)
                {
                    report(si.Body, shift);
                }
                else
                {
                    Console.WriteLine("NO BODY");
                }
                break;
            }

            case NodeType.FieldInitializerBlock:
            {
                FieldInitializerBlock initializers = node as FieldInitializerBlock;

                indent(shift);
                if (initializers.IsStatic)
                {
                    Console.Write("static ");
                }
                Console.WriteLine("init {");
                for (int i = 0, n = initializers.Statements.Length; i < n; i++)
                {
                    report(initializers.Statements[i], shift + ind);
                }
                indent(shift);
                Console.WriteLine("}");
                break;
            }

            case NodeType.Base:
            {
                Console.Write("base");
                break;
            }

            case NodeType.Field:
            {
                Field field = node as Field;

                indent(shift);

                if (field.IsPrivate)
                {
                    Console.Write("private ");
                }
                else if (field.IsPublic)
                {
                    Console.Write("public ");
                }

                if (field.IsStatic)
                {
                    Console.Write("static ");
                }
                if (field.IsInitOnly)
                {
                    Console.Write("readonly ");
                }

                if (field.Type != null)
                {
                    if (field.Type.Name != null)
                    {
                        Console.Write("{0}", field.Type.Name.Name);
                    }
                    else
                    {
                        report(field.Type, 0);
                    }
                }
                Console.Write(" {0}", field.Name.Name);

                if (field.Initializer != null)
                {
                    Console.Write(" = ");
                    report(field.Initializer, 0);
                }
                Console.WriteLine(";");

                break;
            }

            case NodeType.VariableDeclaration:
            {
                VariableDeclaration variable = node as VariableDeclaration;

                indent(shift);
                if (variable.Type != null && variable.Type.Name != null)
                {
                    Console.Write("{0}", variable.Type.Name.Name);
                }
                else
                {
                    report(variable.Type, 0);
                }

                Console.Write(" {0}", variable.Name.Name);

                if (variable.Initializer != null)
                {
                    Console.Write(" = ");
                    report(variable.Initializer, 0);
                }
                Console.WriteLine(";");

                break;
            }

            case NodeType.LocalDeclarationsStatement:
            {
                LocalDeclarationsStatement stmt = node as LocalDeclarationsStatement;

                indent(shift);

                TypeNode type = stmt.Type;
                if (type != null && type.Name != null)
                {
                    Console.Write("{0}", type.Name.Name);
                }
                else
                {
                    report(type, 0);
                }
                Console.Write(" ");

                LocalDeclarationList list = stmt.Declarations;
                for (int i = 0, n = list.Length; i < n; i++)
                {
                    LocalDeclaration local = list[i];
                    Console.Write("{0}", local.Name.Name);
                    if (local.InitialValue != null)
                    {
                        Console.Write(" = ");
                        report(local.InitialValue, 0);
                    }
                    if (i < n - 1)
                    {
                        Console.Write(", ");
                    }
                }
                Console.WriteLine(";");
                break;
            }

            case NodeType.Property:
            {
                Property property = node as Property;

                indent(shift);

                if (property.IsPrivate)
                {
                    Console.Write("private ");
                }
                else if (property.IsPublic)
                {
                    Console.Write("public ");
                }

                if (property.IsStatic)
                {
                    Console.Write("static ");
                }

                if (property != null)
                {
                    if (property.Type != null && property.Type.Name != null)
                    {
                        Console.Write("{0} ", property.Type.Name.Name);
                    }

                    if (property.ImplementedTypes != null)
                    {
                        TypeNode typ = property.ImplementedTypes[0];
                        Console.Write("{0}.", typ.Name.Name);
                    }
                    if (property.Name != null)
                    {
                        Console.WriteLine("{0}", property.Name.Name);
                    }
                }
                indent(shift);
                Console.WriteLine("{");

                if (property.Getter != null)
                {
                    report(property.Getter, shift + ind);
                }
                if (property.Setter != null)
                {
                    report(property.Setter, shift + ind);
                }

                indent(shift);
                Console.WriteLine("}");

                break;
            }

            case NodeType.Lock:
            {
                Lock _lock = node as Lock;

                indent(shift);
                Console.Write("lock(");
                report(_lock.Guard, shift);
                Console.WriteLine(")");
                report(_lock.Body, shift + ind);
                indent(shift);
                Console.WriteLine("}");

                break;
            }

            case NodeType.Block:
            {
                Block block = node as Block;
                if (block == null || block.Statements == null)
                {
                    break;
                }
                indent(shift);
                Console.WriteLine("{");

                for (int i = 0, n = block.Statements.Length; i < n; i++)
                {
                    report(block.Statements[i], shift + ind);
                    Console.WriteLine();
                }
                indent(shift);
                Console.WriteLine("}");

                break;
            }

            case NodeType.MemberBinding:
            {
                MemberBinding mb = node as MemberBinding;
                if (mb.TargetObject != null)
                {
                    report(mb.TargetObject, 0);
                }
                else if (mb.BoundMember != null && mb.BoundMember.DeclaringType != null)
                {
                    Console.Write(mb.BoundMember.DeclaringType.Name);
                }
                Console.Write(".");
                if (mb.BoundMember.Name != null)
                {
                    Console.Write(mb.BoundMember.Name.Name);
                }
                else
                {
                    report(mb.BoundMember, 0);
                }
                break;
            }

            case NodeType.AssignmentStatement:
            {
                AssignmentStatement assignment = node as AssignmentStatement;

                indent(shift);

                report(assignment.Target, 0);
                switch (assignment.Operator)
                {
                case NodeType.Nop: Console.Write(" = "); break;

                case NodeType.Add: Console.Write(" += "); break;

                case NodeType.Add_Ovf: Console.Write(" += "); break;

                case NodeType.Add_Ovf_Un: Console.Write(" += "); break;

                case NodeType.Sub: Console.Write(" -= "); break;

                case NodeType.Sub_Ovf: Console.Write(" -= "); break;

                case NodeType.Sub_Ovf_Un: Console.Write(" -= "); break;

                case NodeType.Mul: Console.Write(" *= "); break;

                case NodeType.Mul_Ovf: Console.Write(" *= "); break;

                case NodeType.Mul_Ovf_Un: Console.Write(" *= "); break;
                }
                report(assignment.Source, 0);
                Console.Write(";");
                break;
            }

            case NodeType.ExpressionStatement:
            {
                ExpressionStatement exprStatement = node as ExpressionStatement;

                indent(shift);

                report(exprStatement.Expression, 0);
                Console.Write(";");
                break;
            }

            case NodeType.Return:
            {
                Return return_stmt = node as Return;

                indent(shift);
                Console.Write("return");
                if (return_stmt.Expression != null)
                {
                    Console.Write(" ");
                    report(return_stmt.Expression, 0);
                }
                Console.Write(";");

                break;
            }

            case NodeType.Branch:
            {
                Branch branch = node as Branch;

                indent(shift);
                Console.WriteLine("break; (???)");

                break;
            }

            case NodeType.For:
            {
                For for_stmt = node as For;

                indent(shift);
                Console.Write("for ( ");
                for (int i = 0, n = for_stmt.Initializer.Length; i < n; i++)
                {
                    report(for_stmt.Initializer[i], 0);
                }
                report(for_stmt.Condition, 0);
                Console.Write("; ");
                for (int i = 0, n = for_stmt.Incrementer.Length; i < n; i++)
                {
                    report(for_stmt.Incrementer[i], 0);
                }
                Console.WriteLine(")");

                indent(shift);
                Console.WriteLine("{");
                report(for_stmt.Body, shift + ind);
                indent(shift);
                Console.WriteLine("}");

                break;
            }

            case NodeType.While:
            {
                While while_loop = node as While;

                indent(shift);
                Console.Write("while ( ");
                report(while_loop.Condition, 0);
                Console.WriteLine(" )");

                report(while_loop.Body, shift);

                break;
            }

            case NodeType.DoWhile:
            {
                DoWhile repeat = node as DoWhile;

                indent(shift);
                Console.WriteLine("do");
                report(repeat.Body, shift);

                indent(shift);
                Console.Write("while (");
                report(repeat.Condition, 0);
                Console.WriteLine(" );");

                break;
            }

            case NodeType.If:
            {
                If if_stmt = node as If;

                indent(shift);
                Console.Write("if ( ");
                report(if_stmt.Condition, 0);
                Console.WriteLine(" )");

                report(if_stmt.TrueBlock, shift);

                if (if_stmt.FalseBlock == null ||
                    if_stmt.FalseBlock.Statements == null ||
                    if_stmt.FalseBlock.Statements.Length == 0)
                {
                    break;
                }

                indent(shift);
                Console.WriteLine("else");
                report(if_stmt.FalseBlock, shift);

                break;
            }

            case NodeType.Switch:
            {
                Switch swtch = node as Switch;

                indent(shift);
                Console.Write("switch ( ");
                report(swtch.Expression, 0);
                Console.WriteLine(" )");

                indent(shift);
                Console.WriteLine("{");

                for (int i = 0, n = swtch.Cases.Length; i < n; i++)
                {
                    indent(shift + ind);
                    if (swtch.Cases[i].Label != null)
                    {
                        Console.Write("case ");
                        report(swtch.Cases[i].Label, 0);
                        Console.WriteLine(":");
                    }
                    else
                    {
                        Console.WriteLine("default:");
                    }
                    report(swtch.Cases[i].Body, shift + ind);
                }
                indent(shift);
                Console.WriteLine("}");

                break;
            }

            case NodeType.Throw:
            {
                Throw thro = node as Throw;

                indent(shift);
                Console.Write("throw (");
                report(thro.Expression, 0);
                Console.Write(");");
                break;
            }

            case NodeType.Exit:
            {
                indent(shift);
                Console.WriteLine("exit;");
                break;
            }

            case NodeType.Continue:
            {
                indent(shift);
                Console.WriteLine("continue;");
                break;
            }

            case NodeType.Try:
            {
                Try trys = node as Try;

                indent(shift);
                Console.WriteLine("try {");
                report(trys.TryBlock, shift + ind);
                indent(shift);
                Console.WriteLine("}");
                if (trys.Catchers != null)
                {
                    for (int i = 0, n = trys.Catchers.Length; i < n; i++)
                    {
                        indent(shift);
                        if (trys.Catchers[i].Type != null)
                        {
                            Console.Write("catch ( {0} ", trys.Catchers[i].Type.FullName);
                        }
                        else
                        {
                            Console.Write("catch ( ");
                        }
                        if (trys.Catchers[i].Variable != null)
                        {
                            report(trys.Catchers[i].Variable, 0);
                        }
                        Console.WriteLine(" ) {");
                        report(trys.Catchers[i].Block, shift + ind);
                        indent(shift);
                        Console.WriteLine("}");
                    }
                }
                if (trys.Finally != null && trys.Finally.Block != null)
                {
                    indent(shift);
                    Console.WriteLine("finally");
                    report(trys.Finally.Block, shift);
                }
                break;
            }

            case NodeType.BlockExpression:
            {
                BlockExpression be = node as BlockExpression;

                Console.WriteLine("(");
                StatementList sl = be.Block.Statements;
                for (int i = 0, n = sl.Length; i < n; i++)
                {
                    report(sl[i], shift + ind);
                }
                indent(shift);
                Console.Write(")");
                break;
            }

            case NodeType.ArrayTypeExpression:
            {
                ArrayTypeExpression array = node as ArrayTypeExpression;

                indent(shift);

                if (array.ElementType != null &&
                    array.ElementType.Name != null &&
                    array.ElementType.Name.Name != null)
                {
                    Console.Write(array.ElementType.Name.Name);
                }
                else
                {
                    report(array.ElementType, 0);
                }

                Console.Write("[");
                for (int i = 0, n = array.Rank; i < n; i++)
                {
                    if (array.Sizes != null)
                    {
                        Console.Write(array.Sizes[i]);
                    }
                    if (i < n - 1)
                    {
                        Console.Write(",");
                    }
                }
                Console.Write("]");

                break;
            }

            case NodeType.Construct:
            {
                Construct construct = node as Construct;

                indent(shift);
                Console.Write("new ");
                report(construct.Constructor, 0);
                Console.Write("(");
                if (construct.Operands != null)
                {
                    for (int i = 0, n = construct.Operands.Length; i < n; i++)
                    {
                        report(construct.Operands[i], 0);
                        if (i < n - 1)
                        {
                            Console.Write(",");
                        }
                    }
                }
                Console.Write(")");
                break;
            }

            case NodeType.ConstructArray:
            {
                ConstructArray initializer = node as ConstructArray;

                Console.Write("new ");

                if (initializer.ElementType != null &&
                    initializer.ElementType.Name != null &&
                    initializer.ElementType.Name.Name != null)
                {
                    Console.Write(initializer.ElementType.Name.Name);
                }
                else
                {
                    report(initializer.ElementType, 0);
                }

                Console.Write("[");
                for (int i = 0, n = initializer.Operands.Length; i < n; i++)
                {
                    report(initializer.Operands[i], 0);
                    if (i < n - 1)
                    {
                        Console.Write(",");
                    }
                }
                Console.Write("]");

                break;
            }

            case NodeType.ConstructDelegate:
            {
                ConstructDelegate cd = node as ConstructDelegate;

                // Console.Write("new {0}({1})",cd.DelegateType.Name.Name,cd.MethodName.Name);
                Console.Write("new {0}(", cd.DelegateType.Name.Name);
                report(cd.TargetObject, 0);
                Console.Write(".{0})", cd.MethodName.Name);
                // cd.Type;
                break;
            }

            default:
            {
                if (node is ZonnonCompilation)
                {
                    ZonnonCompilation zc = node as ZonnonCompilation;
                    report(zc.CompilationUnits[0], shift);
                }
                // Expression?

                else if (node is MethodCall)
                {
                    MethodCall call = node as MethodCall;

                    report(call.Callee, 0);
                    Console.Write("(");

                    if (call.Operands != null && call.Operands.Length != 0)
                    {
                        for (int i = 0, n = call.Operands.Length; i < n; i++)
                        {
                            report(call.Operands[i], 0);
                            if (i < n - 1)
                            {
                                Console.Write(",");
                            }
                        }
                    }

                    Console.Write(")");
                }
                else if (node is Variable)
                {
                    Variable variable = node as Variable;
                    Console.Write("{0}", variable.Name.Name);
                }
                else if (node is Identifier)
                {
                    Identifier identifier = node as Identifier;
                    Console.Write("{0}", identifier.Name);
                }
                else if (node is QualifiedIdentifier)
                {
                    QualifiedIdentifier qualid = node as QualifiedIdentifier;
                    report(qualid.Qualifier, 0);
                    Console.Write(".{0}", qualid.Identifier == null?"<UNRESOLVED>":qualid.Identifier.Name);
                }
                else if (node is Literal)
                {
                    Literal literal = node as Literal;
                    if (literal.Value == null)
                    {
                        Console.Write("null");
                    }
                    else
                    {
                        if (literal.Value is string)
                        {
                            Console.Write("\"");
                        }
                        else if (literal.Value is char)
                        {
                            Console.Write("'");
                        }
                        Console.Write("{0}", literal.Value.ToString());
                        if (literal.Value is string)
                        {
                            Console.Write("\"");
                        }
                        else if (literal.Value is char)
                        {
                            Console.Write("'");
                        }
                    }
                }
                else if (node is Indexer)
                {
                    Indexer indexer = node as Indexer;
                    report(indexer.Object, 0);
                    Console.Write("[");
                    for (int i = 0, n = indexer.Operands.Length; i < n; i++)
                    {
                        report(indexer.Operands[i], 0);
                        if (i < n - 1)
                        {
                            Console.Write(",");
                        }
                    }
                    Console.Write("]");
                }
                else if (node is UnaryExpression)
                {
                    UnaryExpression unexpr = node as UnaryExpression;

                    bool add_pars = unexpr.Operand is BinaryExpression ||
                                    unexpr.Operand is UnaryExpression;

                    switch (unexpr.NodeType)
                    {
                    case NodeType.Add: Console.Write("+");  break;

                    case NodeType.Sub: Console.Write("-");  break;

                    case NodeType.Neg: Console.Write("-");  break;

                    case NodeType.Not: Console.Write("~");  break;

                    case NodeType.UnaryPlus: Console.Write("+"); break;

                    case NodeType.LogicalNot: Console.Write("!"); break;

                    case NodeType.Conv_U2: Console.Write("(UInt16)"); break;

                    case NodeType.RefAddress: Console.Write("ref "); break;

                    case NodeType.Ckfinite: Console.Write("(Ckfinite)"); break;

                    default:           Console.Write("???");  break;
                    }

                    if (add_pars)
                    {
                        Console.Write("(");
                    }
                    report(unexpr.Operand, 0);
                    if (add_pars)
                    {
                        Console.Write(")");
                    }
                }
                else if (node is BinaryExpression)
                {
                    BinaryExpression binexpr = node as BinaryExpression;

                    bool add_pars = binexpr.Operand1 is BinaryExpression ||
                                    binexpr.Operand1 is UnaryExpression;

                    if (binexpr.NodeType == NodeType.Castclass)
                    {
                        Console.Write("(");
                        report(binexpr.Operand2, 0);
                        Console.Write(")");

                        if (add_pars)
                        {
                            Console.Write("(");
                        }
                        report(binexpr.Operand1, 0);
                        if (add_pars)
                        {
                            Console.Write(")");
                        }
                        break;
                    }

                    if (add_pars)
                    {
                        Console.Write("(");
                    }
                    report(binexpr.Operand1, 0);
                    if (add_pars)
                    {
                        Console.Write(")");
                    }

                    switch (binexpr.NodeType)
                    {
                    case NodeType.Add: Console.Write(" + "); break;

                    case NodeType.Add_Ovf: Console.Write(" + "); break;

                    case NodeType.Add_Ovf_Un: Console.Write(" + "); break;

                    case NodeType.Sub: Console.Write(" - "); break;

                    case NodeType.Sub_Ovf: Console.Write(" - "); break;

                    case NodeType.Sub_Ovf_Un: Console.Write(" - "); break;

                    case NodeType.Mul: Console.Write(" * "); break;

                    case NodeType.Mul_Ovf: Console.Write(" * "); break;

                    case NodeType.Mul_Ovf_Un: Console.Write(" * "); break;

                    case NodeType.Div: Console.Write(" / "); break;

                    // case NodeType.Div : Console.Write(" DIV "); break;  // "DIV" ?????
                    case NodeType.Rem: Console.Write(" % "); break;          // "MOD" ?????

                    case NodeType.Or: Console.Write(" | "); break;

                    case NodeType.And: Console.Write(" & "); break;

                    case NodeType.Eq: Console.Write(" == "); break;

                    case NodeType.Ne: Console.Write(" != "); break;

                    case NodeType.Lt: Console.Write(" < "); break;

                    case NodeType.Le: Console.Write(" <= "); break;

                    case NodeType.Gt: Console.Write(" > "); break;

                    case NodeType.Ge: Console.Write(" >= "); break;

                    case NodeType.LogicalOr: Console.Write(" || "); break;

                    case NodeType.LogicalAnd: Console.Write(" && "); break;

                    case NodeType.Is: Console.Write(" is "); break;

                    case NodeType.Comma: Console.Write(","); break;

                    // case OPERATORS.In           : expression.NodeType = NodeType  // "IN" break;
                    // case OPERATORS.Implements   : expression.NodeType = NodeType  // "IMPLEMENTS" break;
                    default: Console.Write(" !! "); break;
                    }

                    add_pars = binexpr.Operand2 is BinaryExpression ||
                               binexpr.Operand2 is UnaryExpression;

                    if (add_pars)
                    {
                        Console.Write("(");
                    }
                    report(binexpr.Operand2, 0);
                    if (add_pars)
                    {
                        Console.Write(")");
                    }
                }
                else if (node is TernaryExpression)
                {
                    TernaryExpression ter = node as TernaryExpression;
                    if (ter.NodeType == NodeType.Conditional)
                    {
                        report(ter.Operand1, 0);
                        Console.Write(" ? ");
                        report(ter.Operand2, 0);
                        Console.Write(" : ");
                        report(ter.Operand3, 0);
                    }
                }
                else if (node is PostfixExpression)
                {
                    PostfixExpression postfixExpr = node as PostfixExpression;

                    report(postfixExpr.Expression, 0);

                    switch (postfixExpr.Operator)
                    {
                    case NodeType.Increment: Console.Write("++"); break;

                    case NodeType.Decrement: Console.Write("--"); break;

                    default: Console.Write("???"); break;
                    }
                }
                else if (node is LabeledStatement)
                {
                    LabeledStatement lbst = node as LabeledStatement;
                    indent(shift);
                    report(lbst.Label, 0);
                    Console.Write(" : ");
                    report(lbst.Statement, 0);
                }
                else if (node is Goto)
                {
                    Goto gt = node as Goto;
                    indent(shift);
                    Console.Write("goto ");
                    report(gt.TargetLabel, 0);
                }
                else
                {
                    indent(shift);
                    Console.WriteLine("No code for reporting {0}:{1}", node.UniqueKey, node.ToString());
                }
                break;
            }
            }
        }
示例#20
0
    public virtual void VisitConstruct(Construct cons)
    {
      if (cons == null) return;
      this.VisitExpression(cons.Constructor);
      this.VisitExpressionList(cons.Operands);
#if !MinimalReader && !CodeContracts
      this.VisitExpression(cons.Owner);
#endif
    }
    /*
    public override CompilationUnitSnippet VisitCompilationUnitSnippet(CompilationUnitSnippet snippet)
    {
      throw new ApplicationException("unimplemented");
    }
    */

    public override Expression VisitConstruct(Construct cons)
    {
      throw new ApplicationException("unimplemented");
    }
示例#22
0
 private static string construct2str(Construct c) {
   // the constructor method is
   // (Method) ((MemberBinding) c.Constructor).BoundMember;
   return
     "new " + c.Type.FullName +
     "(" + exprlist2str(c.Operands) + ")";
 }
示例#23
0
 public virtual Expression CoerceToDelegate(Expression source, TypeNode sourceType, DelegateNode targetType, bool explicitCoercion, TypeViewer typeViewer){
   if (source == null || sourceType == null || targetType == null) return null;
   if (!(sourceType is DelegateNode || sourceType is FunctionType)) return null;
   DelegateNode sourceDType = sourceType as DelegateNode;
   MemberList invokeMembers = TypeViewer.GetTypeView(typeViewer, sourceType).GetMembersNamed(StandardIds.Invoke);
   for (int i = 0, n = invokeMembers.Count; i < n; i++){
     Method invoke = invokeMembers[i] as Method;
     if (invoke == null) continue;
     //TODO: if signature is not the same, but can be coerced, emit an adapter function
     if (invoke.ReturnType != targetType.ReturnType) continue;
     if (!invoke.ParametersMatch(targetType.Parameters)) continue;
     InstanceInitializer dcons = TypeViewer.GetTypeView(typeViewer, targetType).GetConstructor(SystemTypes.Object, SystemTypes.IntPtr);
     if (dcons == null) return null;
     MemberBinding memb = new MemberBinding(source, invoke);
     memb.Type = null; 
     Expression ldftn = new UnaryExpression(memb, NodeType.Ldftn);
     ldftn.Type = SystemTypes.IntPtr;
     ExpressionList arguments = new ExpressionList(2);
     arguments.Add(source);
     arguments.Add(ldftn);
     Construct cons = new Construct(new MemberBinding(null, dcons), arguments, targetType);
     cons.SourceContext = source.SourceContext;
     return cons;
   }
   return null;
 }
示例#24
0
 public virtual Expression CoercionToNonEmptyIEnumerable(Expression source, TypeNode sourceType, TypeNode targetType, bool explicitCoercion, TypeViewer typeViewer){
   if (source == null || sourceType == null || targetType == null) return null;
   if (sourceType == SystemTypes.Object) return null;
   TypeNode sElementType = this.GetStreamElementType(sourceType, typeViewer);
   TypeNode tElementType = this.GetStreamElementType(targetType, typeViewer);
   if (!explicitCoercion && !this.ImplicitCoercionFromTo(sElementType, tElementType, typeViewer)) return null;
   //S- -> S -> T -> T+
   if (sourceType.Template == SystemTypes.GenericInvariant){
     source = new MethodCall(new MemberBinding(null, TypeViewer.GetTypeView(typeViewer, sourceType).GetMethod(StandardIds.opImplicit, sourceType)), 
       new ExpressionList(source), NodeType.Call, sElementType);
     if (explicitCoercion)
       source = this.ExplicitCoercion(source, tElementType, typeViewer);
     else
       source = this.ImplicitCoercion(source, tElementType, typeViewer);
     if (source == null) return null;
     return new Construct(new MemberBinding(null, TypeViewer.GetTypeView(typeViewer, targetType).GetConstructor(tElementType)), new ExpressionList(source), targetType);
   }
   //S -> S+ (if explicit or value type)
   if (sElementType == sourceType){
     if (!sourceType.IsValueType && !explicitCoercion) return null;
     if (sourceType != tElementType) source = this.ExplicitCoercion(source, tElementType, typeViewer);
     if (source == null) return null;
     return new Construct(new MemberBinding(null, TypeViewer.GetTypeView(typeViewer, targetType).GetConstructor(tElementType)), new ExpressionList(source), targetType);
   }
   // S* -> S+ (if explicit)
   if (sourceType.Template != SystemTypes.GenericNonEmptyIEnumerable && !explicitCoercion)
     //TODO: handle new T[] and new T{}
     return null;
   TypeNode sStreamType = SystemTypes.GenericIEnumerable.GetTemplateInstance(this.currentType, sElementType);
   Debug.Assert(TypeViewer.GetTypeView(typeViewer, sourceType).IsAssignableTo(sStreamType));
   TypeNode tStreamType = SystemTypes.GenericIEnumerable.GetTemplateInstance(this.currentType, tElementType);
   if (sStreamType != tStreamType){
     Coercer coercer = null;
     if (explicitCoercion)
       coercer = new Coercer(this.ExplicitCoercion);
     else
       coercer = new Coercer(this.ImplicitCoercion);
     TypeNode streamAdaptor = StreamAdapter.For((Interface)sStreamType, (Interface)tStreamType, this.currentType, coercer, source.SourceContext);
     if (streamAdaptor == null) return null;
     source = new Construct(new MemberBinding(null, TypeViewer.GetTypeView(typeViewer, streamAdaptor).GetConstructor(sStreamType)), new ExpressionList(source), tStreamType);
   }
   return new Construct(new MemberBinding(null, TypeViewer.GetTypeView(typeViewer, targetType).GetConstructor(tStreamType)), new ExpressionList(source), targetType);
 }
 public AwsCdkSsmParameterStoreHandler(Construct scope, string applicationName, string enviromentName, string region) : base(scope, applicationName, enviromentName, region)
 {
 }
示例#26
0
        public static void Call(Arebis.CodeGeneration.IGenerationHost host,
                                IZetboxContext ctx,
                                Serialization.SerializationMembersList serializationList,
                                string ownInterface,
                                string name,
                                string referencedInterface,
                                Relation rel,
                                RelationEndRole endRole,
                                bool callGetterSetterEvents,
                                bool updateInverseNavigator,
                                string assocNameSuffix)
        {
            // TODO: split off relation expansion in own Call() method
            RelationEnd relEnd   = rel.GetEndFromRole(endRole);
            RelationEnd otherEnd = rel.GetOtherEnd(relEnd);

            string moduleNamespace = rel.Module.Namespace;
            string implName        = name + Zetbox.API.Helper.ImplementationSuffix;
            string eventName       = "On" + name;

            string fkBackingName     = "_fk_" + name;
            string fkGuidBackingName = "_fk_guid_" + name;

            string referencedImplementation = referencedInterface
                                              + host.Settings["extrasuffix"] + Zetbox.API.Helper.ImplementationSuffix;
            string associationName = rel.GetAssociationName() + assocNameSuffix;
            string targetRoleName  = otherEnd.RoleName;

            string positionPropertyName = rel.NeedsPositionStorage(endRole)
                ? Construct.ListPositionPropertyName(relEnd)
                : null;

            string inverseNavigatorName = updateInverseNavigator && otherEnd.Navigator != null
                ? otherEnd.Navigator.Name
                : null;
            bool inverseNavigatorIsList = otherEnd.Navigator != null && otherEnd.Navigator.GetIsList();

            bool eagerLoading          = relEnd.Navigator != null && relEnd.Navigator.EagerLoading;
            bool relDataTypeExportable = rel.A.Type.ImplementsIExportable() && rel.B.Type.ImplementsIExportable();

            Call(host,
                 ctx,
                 serializationList,
                 moduleNamespace,
                 ownInterface,
                 name,
                 implName,
                 eventName,
                 fkBackingName,
                 fkGuidBackingName,
                 referencedInterface,
                 referencedImplementation,
                 associationName,
                 targetRoleName,
                 positionPropertyName,
                 inverseNavigatorName,
                 inverseNavigatorIsList,
                 eagerLoading,
                 relDataTypeExportable,
                 callGetterSetterEvents,
                 false, // ObjRef with relation cannot be calculated
                 false);
        }
示例#27
0
文件: Map.cs 项目: ryancheung/WinWar
        /// <summary>
        /// Render
        /// </summary>
        internal void Render(int setX, int setY, int setWidth, int setHeight, float tileOffsetX, float tileOffsetY)
        {
            // Render tiles
            if (tileOffsetX < 0.0f)
            {
                tileOffsetX = 0.0f;
            }
            if (tileOffsetY < 0.0f)
            {
                tileOffsetY = 0.0f;
            }

            int tilesToDrawX = (setWidth / TileWidth) + 1;
            int tilesToDrawY = (setHeight / TileHeight) + 1;

            int startTileX = ((int)tileOffsetX / TileWidth);
            int startTileY = ((int)tileOffsetY / TileHeight);

            if (tilesToDrawX + startTileX > MapWidth)
            {
                tilesToDrawX = MapWidth - startTileX;
            }
            if (tilesToDrawY + startTileY > MapHeight)
            {
                tilesToDrawY = MapHeight - startTileY;
            }

            //float innerTileOffsetX = (float)((int)(tileOffsetX * 100) % (TileWidth * 100)) / 100.0f;
            //float innerTileOffsetY = (float)((int)(tileOffsetY * 100) % (TileHeight * 100)) / 100.0f;
            int innerTileOffsetX = ((int)tileOffsetX % TileWidth);
            int innerTileOffsetY = ((int)tileOffsetY % TileHeight);

            //int count = 170;
            Performance.Push("Map rendering - Tiles");
            RenderManager.StartBatch();
            for (int y = 0; y < tilesToDrawY; y++)
            {
                for (int x = 0; x < tilesToDrawX; x++)
                {
                    int index = levelVisual.visualData[(x + startTileX) + ((y + startTileY) * MapWidth)];

                    tileSet.DrawTile(index, setX + x * TileWidth - innerTileOffsetX, setY + y * TileHeight - innerTileOffsetY, 1.0f);

                    if (DebugOptions.ShowBlockedTiles)
                    {
                        short passableValue = levelPassable.passableData[x + startTileX, y + startTileY];
                        bool  isBlocked     = passableValue > 0;
                        if (isBlocked)
                        {
                            Color col = new Color(0.0f, 1.0f, 0.0f, 0.5f);
                            if (passableValue == 128)
                            {
                                col = new Color(0.2f, 0.0f, 0.8f, 0.5f);
                            }

                            WWTexture.SingleWhite.RenderOnScreen(setX + x * TileWidth - innerTileOffsetX, setY + y * TileHeight - innerTileOffsetY,
                                                                 TileWidth, TileHeight, col);
                        }
                    }
                }
            }
            RenderManager.EndBatch();
            Performance.Pop();

            Performance.Push("Map rendering - Roads");
            // Render Roads
            for (int i = 0; i < Roads.Count; i++)
            {
                bool isVisible = true;

                Construct road = Roads[i];

                if (mapDiscoverState[road.X + road.Y * MapWidth] == MapDiscover.Unknown)
                {
                    isVisible = false;
                }

                int x = road.X - startTileX;
                int y = road.Y - startTileY;
                if (isVisible)
                {
                    tileSet.DrawRoadTile(road.Config, setX + x * TileWidth - innerTileOffsetX, setY + y * TileHeight - innerTileOffsetY, 1.0f);
                }
            }
            Performance.Pop();

            Performance.Push("Map rendering - Entities");
            // Render entities
            for (int i = 0; i < entities.Count; i++)
            {
                bool isVisible = true;

                Entity ent = entities[i];

                if (isVisible)
                {
                    ent.Render(setX, setY, tileOffsetX, tileOffsetY);
                }
            }
            Performance.Pop();

            Performance.Push("Map rendering - Selected Entities");
            // Render selected entities
            for (int i = 0; i < selectedEntities.Count; i++)
            {
                Entity selEnt = selectedEntities[i];
                Color  selCol = new Color(0, 255, 0);
                if (HumanPlayer.IsNeutralTowards(selEnt.Owner))
                {
                    selCol = new Color(255, 255, 0);
                }
                else if (HumanPlayer.IsHostileTowards(selEnt.Owner))
                {
                    selCol = new Color(255, 0, 0);
                }

                WWTexture.RenderRectangle(selEnt.GetTileRectangle(setX, setY, tileOffsetX, tileOffsetY), selCol, 3);
            }
            Performance.Pop();

            Performance.Push("Map rendering - Undiscovered places");
            RenderManager.StartBatch(BlendState.AlphaBlend);
            // Overlay undiscovered places + fog of war
            for (int y = 0; y < tilesToDrawY; y++)
            {
                for (int x = 0; x < tilesToDrawX; x++)
                {
                    int pos = (x + startTileX) + ((y + startTileY) * MapWidth);

                    if (mapDiscoverState[pos] == MapDiscover.Fog)
                    {
                        WWTexture.SingleWhite.RenderOnScreen(setX + x * TileWidth - innerTileOffsetX, setY + y * TileHeight - innerTileOffsetY,
                                                             TileWidth, TileHeight, new Color(0.0f, 0.0f, 0.0f, 0.5f));
                    }
                    else if (mapDiscoverState[pos] == MapDiscover.Unknown)
                    {
                        WWTexture.SingleWhite.RenderOnScreen(setX + x * TileWidth - innerTileOffsetX, setY + y * TileHeight - innerTileOffsetY,
                                                             TileWidth, TileHeight, new Color(0.0f, 0.0f, 0.0f, 1.0f));
                    }
                }
            }
            RenderManager.EndBatch();
            Performance.Pop();
        }
示例#28
0
        public override void Generate()
        {
#line 34 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
            this.WriteObjects("        #region ", this.GetType(), "\r\n");
#line 36 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
            var properties = cls.Properties.OrderBy(p => p.Name).ToList();
            var rels       = cls.GetRelations()
                             .OrderBy(i => i.A.RoleName).ThenBy(i => i.Verb).ThenBy(i => i.B.RoleName)
                             .OrderBy(i => i.A.Type.Name).ThenBy(i => i.B.Type.Name)
                             .ThenBy(i => i.ExportGuid)
                             .ToList();

            if (properties.Count > 0 || rels.Count > 0)
            {
#line 46 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                this.WriteObjects("        private static readonly object _propertiesLock = new object();\r\n");
                this.WriteObjects("        private static System.ComponentModel.PropertyDescriptor[] _properties;\r\n");
                this.WriteObjects("\r\n");
                this.WriteObjects("        private void _InitializePropertyDescriptors(Func<IFrozenContext> lazyCtx)\r\n");
                this.WriteObjects("        {\r\n");
                this.WriteObjects("            if (_properties != null) return;\r\n");
                this.WriteObjects("            lock (_propertiesLock)\r\n");
                this.WriteObjects("            {\r\n");
                this.WriteObjects("                // recheck for a lost race after aquiring the lock\r\n");
                this.WriteObjects("                if (_properties != null) return;\r\n");
                this.WriteObjects("\r\n");
                this.WriteObjects("                _properties = new System.ComponentModel.PropertyDescriptor[] {\r\n");
#line 59 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                foreach (var property in properties)
                {
                    string propertyName = property.Name;
                    if (property.IsAssociation() && !property.IsObjectReferencePropertySingle())
                    {
#line 65 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        this.WriteObjects("                    // property.IsAssociation() && !property.IsObjectReferencePropertySingle()\r\n");
                        this.WriteObjects("                    new ", propertyDescriptorName, "<", ifName, ", ", property.GetPropertyTypeString(), ">(\r\n");
                        this.WriteObjects("                        lazyCtx,\r\n");
                        this.WriteObjects("                        new Guid(\"", property.ExportGuid, "\"),\r\n");
                        this.WriteObjects("                        \"", propertyName, "\",\r\n");
                        this.WriteObjects("                        null,\r\n");
                        this.WriteObjects("                        obj => obj.", propertyName, ",\r\n");
                        this.WriteObjects("                        null, // lists are read-only properties\r\n");
                        this.WriteObjects("                        obj => On", propertyName, "_IsValid), \r\n");
#line 74 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                    }
                    else if (property is CalculatedObjectReferenceProperty)
                    {
#line 75 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        this.WriteObjects("                    // property is CalculatedObjectReferenceProperty\r\n");
                        this.WriteObjects("                    new ", propertyDescriptorName, "<", ifName, ", ", property.GetPropertyTypeString(), ">(\r\n");
                        this.WriteObjects("                        lazyCtx,\r\n");
                        this.WriteObjects("                        new Guid(\"", property.ExportGuid, "\"),\r\n");
                        this.WriteObjects("                        \"", propertyName, "\",\r\n");
                        this.WriteObjects("                        null,\r\n");
                        this.WriteObjects("                        obj => obj.", propertyName, ",\r\n");
                        this.WriteObjects("                        null, // CalculatedObjectReferenceProperty is a read-only property\r\n");
                        this.WriteObjects("						null), // no constraints on calculated properties \r\n");
#line 84 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                    }
                    else
                    {
#line 85 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        var isReadonly = (property is ValueTypeProperty) && ((ValueTypeProperty)property).IsCalculated;
#line 86 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        this.WriteObjects("                    // else\r\n");
                        this.WriteObjects("                    new ", propertyDescriptorName, "<", ifName, ", ", property.GetPropertyTypeString(), ">(\r\n");
                        this.WriteObjects("                        lazyCtx,\r\n");
                        this.WriteObjects("                        new Guid(\"", property.ExportGuid, "\"),\r\n");
                        this.WriteObjects("                        \"", propertyName, "\",\r\n");
                        this.WriteObjects("                        null,\r\n");
                        this.WriteObjects("                        obj => obj.", propertyName, ",\r\n");
#line 93 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        if (isReadonly)
                        {
#line 94 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                            this.WriteObjects("                        null, // calculated property\r\n");
                            this.WriteObjects("						null), // no constraints on calculated properties\r\n");
#line 96 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        }
                        else
                        {
#line 97 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                            this.WriteObjects("                        (obj, val) => obj.", propertyName, " = val,\r\n");
                            this.WriteObjects("						obj => On", propertyName, "_IsValid), \r\n");
#line 99 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        }
#line 100 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                    }
#line 101 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                }
#line 102 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                if ("Frozen".Equals(Settings["extrasuffix"]))
#line 103 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                {
#line 104 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                    this.WriteObjects("                    // skipping position columns for frozen context (not implemented)\r\n");
#line 105 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                }
                else
                {
#line 106 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                    this.WriteObjects("                    // position columns\r\n");
#line 108 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                    foreach (var rel in rels.Where(r => r.GetRelationType() == RelationType.one_n))
                    {
                        // only show debugging if there actually is an position column
                        if ((rel.A.Type == cls && rel.A.HasPersistentOrder) ||
                            (rel.B.Type == cls && rel.B.HasPersistentOrder))
                        {
#line 115 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                            this.WriteObjects("                    // rel: ", rel.A.RoleName, " ", rel.Verb, " ", rel.B.RoleName, " (", rel.ExportGuid, ")\r\n");
#line 117 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        }
                        if (rel.A.Type == cls && rel.A.HasPersistentOrder)
                        {
                            var posColumnName = Construct.ListPositionPropertyName(rel.A);

#line 122 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                            this.WriteObjects("                    // rel.A.Type == cls && rel.A.HasPersistentOrder\r\n");
                            this.WriteObjects("                    new ", propertyDescriptorName, "<", implName, ", int?>(\r\n");
                            this.WriteObjects("                        lazyCtx,\r\n");
                            this.WriteObjects("                        null,\r\n");
                            this.WriteObjects("                        \"", posColumnName, "\",\r\n");
                            this.WriteObjects("                        null,\r\n");
                            this.WriteObjects("                        obj => obj.", posColumnName, ",\r\n");
                            this.WriteObjects("                        (obj, val) => obj.", posColumnName, " = val,\r\n");
                            this.WriteObjects("						null),\r\n");
#line 132 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        }

                        if (rel.B.Type == cls && rel.B.HasPersistentOrder)
                        {
                            var posColumnName = Construct.ListPositionPropertyName(rel.B);

#line 138 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                            this.WriteObjects("                    // rel.B.Type == cls && rel.B.HasPersistentOrder\r\n");
                            this.WriteObjects("                    new ", propertyDescriptorName, "<", implName, ", int?>(\r\n");
                            this.WriteObjects("                        lazyCtx,\r\n");
                            this.WriteObjects("                        null,\r\n");
                            this.WriteObjects("                        \"", posColumnName, "\",\r\n");
                            this.WriteObjects("                        null,\r\n");
                            this.WriteObjects("                        obj => obj.", posColumnName, ",\r\n");
                            this.WriteObjects("                        (obj, val) => obj.", posColumnName, " = val,\r\n");
                            this.WriteObjects("						null),\r\n");
#line 148 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                        }
                    }
                }

#line 152 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
                this.WriteObjects("                };\r\n");
                this.WriteObjects("            }\r\n");
                this.WriteObjects("        }\r\n");
                this.WriteObjects("\r\n");
                this.WriteObjects("        protected override void CollectProperties(Func<IFrozenContext> lazyCtx, List<System.ComponentModel.PropertyDescriptor> props)\r\n");
                this.WriteObjects("        {\r\n");
                this.WriteObjects("            base.CollectProperties(lazyCtx, props);\r\n");
                this.WriteObjects("            _InitializePropertyDescriptors(lazyCtx);\r\n");
                this.WriteObjects("            props.AddRange(_properties);\r\n");
                this.WriteObjects("        }\r\n");
#line 162 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
            }
#line 163 "P:\zetbox\Zetbox.Generator\Templates\ObjectClasses\CustomTypeDescriptor.cst"
            this.WriteObjects("        #endregion // ", this.GetType(), "\r\n");
        }
示例#29
0
 private Construct/*!*/ ParseConstruct() {
   TypeNodeList varArgTypes;
   Method meth = (Method)this.GetMemberFromToken(out varArgTypes);
   int n = meth.Parameters.Count;
   Expression[] args = new Expression[n];
   ExpressionList arguments = new ExpressionList(n);
   for (int i = n-1; i >= 0; i--) args[i] = PopOperand();
   for (int i = 0; i < n; i++) arguments.Add(args[i]);
   Construct result = new Construct(new MemberBinding(null, meth), arguments);
   result.Type = meth.DeclaringType;
   return result;
 }
示例#30
0
 public AwsCdkRoleHandler(Construct scope, string applicationName, string environmentName) : base(scope, applicationName, environmentName)
 {
     TagHandler = new TagHandler();
 }
示例#31
0
		public virtual void VisitConstruct (Construct node)
		{
			if (node == null)
				return;

			VisitExpression (node.Constructor);
			VisitExpressionList (node.Arguments);
		}
示例#32
0
 public AwsSecurityGroupHandler(Construct scope, string applicationName, string environmentName, AwsCdkVpcHandler awsCdkVpcHandler) : base(scope, applicationName, environmentName)
 {
     AwsCdkVpcHandler = awsCdkVpcHandler;
 }
示例#33
0
 public MyApp(Construct scope, string id) : base(scope, id)
 {
     // define resources here
 }
    // Update is called once per frame
    void Update()
    {
        if (OnselectTaget == true)
        {
            foreach (CubeManager cube in ListInSelect)
            {
                if (cube != null)
                {
                    if (cube.CanBuild == false)
                    {
                        cube.SetState("Not");
                        cube.OnraycastIn();
                    }

                    else
                    {
                        cube.SetState("Can");
                        cube.OnraycastIn();


                        foreach (CubeManager _cube in ListBuildCube)
                        {
                            _cube.SetState("None");
                            _cube.OnraycastIn();
                        }
                    }
                }
            }

            ray = rtsCamera.ScreenPointToRay(Input.mousePosition);
            if (Physics.Raycast(ray: ray,
                                hitInfo: out hitInfo,
                                maxDistance: Mathf.Infinity,
                                layerMask: LayerMask.GetMask("Floor")))
            {
                CubeManager cube = hitInfo.collider.gameObject.GetComponent <CubeManager>();


                if (cube != null)
                {
                    setBuildSize(BuildSize, cube);
                }
            }


            if (OnholdTaget)
            {
                if (Input.GetMouseButtonDown(1))
                {
                    for (int k = 0; k < ListInSelect.Count; k++)
                    {
                        ListInSelect[k].SetState("None");
                        ListInSelect[k].OnraycastIn();
                    }
                    Player _player = FindObjectOfType <MainPlayer>();
                    _player.TakeGold(BuildPrice);
                    ResetTaget();
                    ListInSelect.Clear();
                    return;
                }
                if (Input.GetMouseButtonDown(0) && select() == false)
                {
                    return;
                }
                else
                {
                    if (Input.GetMouseButtonDown(0))
                    {
                        if (ListInSelect.Count < BuildSize.x * BuildSize.y)
                        {
                            return;
                        }
                        GameObject NewGO     = Instantiate(BuildModel, new Vector3(LatPoint.x + ((int)BuildSize.x / 2), 0, LatPoint.y + ((int)BuildSize.y / 2)), Quaternion.identity);
                        Construct  construct = NewGO.GetComponentInChildren <Construct>();
                        for (int k = 0; k < ListInSelect.Count; k++)
                        {
                            ListInSelect[k].CanBuild = false;
                            ListInSelect[k].SetState("None");
                            ListInSelect[k].OnraycastIn();
                            construct.CellInfo.Add(ListInSelect[k]);
                        }

                        construct.Group = EnumCollection.Group.Player;
                        SoundManager.instanece.PlayEffect(2);
                        NewGO.SetActive(true);
                        construct.Build();
                        ListInSelect.Clear();
                        ResetTaget();
                        uiControl.GetACtiveBuild(construct.Player);
                    }
                }
            }

            if (Input.GetMouseButtonUp(0))
            {
                OnholdTaget = true;
            }
        }
    }
        internal DotnetPipelineStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            string REPO_NAME  = "dotnet-pipeline";
            string STACK_NAME = "DotnetFunctionalStack";

            var code = Repository.FromRepositoryName(this, "ImportedRepo", REPO_NAME);

            var sourceOutput = new Artifact_();

            var cdkDeploy = new PipelineProject(this, "CDKDeploy", new PipelineProjectProps
            {
                BuildSpec = BuildSpec.FromObject(new Dictionary <string, object> {
                    ["version"] = "0.2",
                    ["phases"]  = new Dictionary <string, object>
                    {
                        ["install"] = new Dictionary <string, string>
                        {
                            ["commands"] = "npm install -g aws-cdk"
                        },
                        ["build"] = new Dictionary <string, object>
                        {
                            ["commands"] = new [] { "src/scripts/build.sh", "cdk deploy " + STACK_NAME }
                        }
                    }
                }),
                Environment = new BuildEnvironment {
                    BuildImage = LinuxBuildImage.AMAZON_LINUX_2_3
                }
            });

            var statement = new Amazon.CDK.AWS.IAM.PolicyStatement();

            statement.Effect = Effect.ALLOW;
            statement.AddActions(new [] { "*" });
            statement.AddAllResources();
            cdkDeploy.Role.AddToPolicy(statement);

            var pipeline = new Amazon.CDK.AWS.CodePipeline.Pipeline(this, "Pipeline", new PipelineProps {
                Stages = new [] {
                    new StageProps
                    {
                        StageName = "Source",
                        Actions   = new []
                        {
                            new CodeCommitSourceAction(new CodeCommitSourceActionProps
                            {
                                ActionName = "Source",
                                Repository = code,
                                Output     = sourceOutput
                            })
                        }
                    },
                    new StageProps
                    {
                        StageName = "Deploy",
                        Actions   = new []
                        {
                            new CodeBuildAction(new CodeBuildActionProps
                            {
                                ActionName = "CDK_Deploy",
                                Project    = cdkDeploy,
                                Input      = sourceOutput
                            })
                        }
                    }
                }
            });
        }
示例#36
0
    public virtual Expression VisitConstruct(Construct cons){
      if (cons == null) return null;
      cons.Constructor = this.VisitExpression(cons.Constructor);
      cons.Operands = this.VisitExpressionList(cons.Operands);
#if !MinimalReader
      cons.Owner = this.VisitExpression(cons.Owner);
#endif
      return cons;
    }
示例#37
0
    private void moveConstruct()
    {
        Construct c = meleeInteraction.gameObject.GetComponent <Construct>();

        c.Move(ForceDirection(), firingPos.rotation);
    }
示例#38
0
    public virtual Expression ImplicitCoercion(Expression source, TypeNode targetType, TypeViewer typeViewer){
      TypeNode originalTargetType = targetType;
      if (targetType == null || targetType.Name == Looker.NotFound) return source;
      if (source == null) return null;
      //HS D
      if (source is Hole)
          {
              source.Type = targetType;
              return source;
          }
      //HS D
      if (source is LambdaHole)
          {
              if (targetType == SystemTypes.Boolean)
                  source = new LambdaHole(source, new Literal(0), NodeType.Ge, source.SourceContext);                      
              source.Type = targetType;
              return source;
          }
      Literal sourceLit = source as Literal;
      if (sourceLit != null && sourceLit.Value is TypeNode){
        this.HandleError(source, Error.TypeInVariableContext, this.GetTypeName((TypeNode)sourceLit.Value), "class", "variable");
        return null;
      }
      //Ignore parentheses
      if (source.NodeType == NodeType.Parentheses){
        UnaryExpression uex = (UnaryExpression)source;
        uex.Operand = this.ImplicitCoercion(uex.Operand, targetType, typeViewer);
        if (uex.Operand == null) return null;
        uex.Type = uex.Operand.Type;
        return uex;
      }
      bool targetIsNonNullType = this.IsNonNullType(targetType);
      targetType = TypeNode.StripModifier(targetType, SystemTypes.NonNullType);
      targetType = TypeNode.StripModifier(targetType, SystemTypes.NullableType);
      //TODO: handle SkipCheck and EnforceCheck
      //Special case for closure expressions
      if (source.NodeType == NodeType.AnonymousNestedFunction)
        return this.CoerceAnonymousNestedFunction((AnonymousNestedFunction)source, targetType, false, typeViewer);
      TypeNode sourceType = source.Type;
      if (sourceType == null) sourceType = SystemTypes.Object;
      bool sourceIsNonNullType = this.IsNonNullType(source.Type);
      sourceType = TypeNode.StripModifier(sourceType, SystemTypes.NonNullType);
      sourceType = TypeNode.StripModifier(sourceType, SystemTypes.NullableType);
      if (sourceType == SystemTypes.String && !sourceIsNonNullType && source is Literal)
        sourceIsNonNullType = ((Literal)source).Value != null;
      if (this.currentParameter != null && targetType is Reference){
        UnaryExpression uex = source as UnaryExpression;
        if (uex != null){
          if (sourceIsNonNullType && !targetIsNonNullType){
            string ttypeName = this.GetTypeName(targetType);
            string stypeName = this.GetTypeName(source.Type);
            this.HandleError(source, Error.NoImplicitCoercion, stypeName, ttypeName);
            return null;
          }
          if (!sourceIsNonNullType && targetIsNonNullType){
            string ttypeName = this.GetTypeName(targetType);
            string stypeName = this.GetTypeName(source.Type);
            this.HandleError(source, Error.NoImplicitCoercion, stypeName, ttypeName);
            return null;
          }
          if (uex.NodeType == NodeType.OutAddress){
            if ((this.currentParameter.Flags & ParameterFlags.Out) == 0){
              this.currentParameter.Flags |= ParameterFlags.Out;
              string stypeName = this.GetTypeName(sourceType);
              this.currentParameter.Flags &= ~ParameterFlags.Out;
              this.HandleError(source, Error.NoImplicitCoercion, stypeName, this.GetTypeName(targetType));
              return null;
            }
          }else if (uex.NodeType == NodeType.RefAddress){
            if ((this.currentParameter.Flags & ParameterFlags.Out) != 0){
              this.currentParameter.Flags &= ~ParameterFlags.Out;
              string stypeName = this.GetTypeName(sourceType);
              this.currentParameter.Flags |= ParameterFlags.Out;
              this.HandleError(source, Error.NoImplicitCoercion, stypeName, this.GetTypeName(targetType));
              return null;
            }
          }
        }
      }
      Expression result = this.StandardImplicitCoercion(source, sourceIsNonNullType, sourceType, targetIsNonNullType, targetType, originalTargetType, typeViewer);
      if (result != null) return result;
      Method coercion = this.UserDefinedImplicitCoercionMethod(source, sourceType, targetType, true, typeViewer);
      if (coercion != null){
        if (this.IsNullableType(targetType) && this.IsNullableType(sourceType) && !this.IsNullableType(coercion.Parameters[0].Type))
          return this.CoerceWithLiftedCoercion(source, sourceType, targetType, coercion, false, typeViewer);
        ExpressionList args = new ExpressionList(1);
        args.Add(this.ImplicitCoercion(source, coercion.Parameters[0].Type, typeViewer));
        return this.ImplicitCoercion(new MethodCall(new MemberBinding(null, coercion), args, NodeType.Call, coercion.ReturnType, source.SourceContext), targetType, typeViewer);
      }
      if (sourceType == SystemTypes.Type && source is Literal)
        this.HandleError(source, Error.TypeInVariableContext, this.GetTypeName((TypeNode)((Literal)source).Value), "class", "variable");
      else if (this.IsNullableType(sourceType) && this.IsNullableType(targetType) && this.ImplicitCoercionFromTo(this.RemoveNullableWrapper(sourceType), this.RemoveNullableWrapper(targetType))) {
        TypeNode usType = this.RemoveNullableWrapper(sourceType);
        TypeNode utType = this.RemoveNullableWrapper(targetType);

        Local tempSrc = new Local(sourceType);
        Local tempTar = new Local(targetType);
        StatementList statements = new StatementList();
        BlockExpression result1 = new BlockExpression(new Block(statements));
        statements.Add(new AssignmentStatement(tempSrc, source));

        Method hasValue = sourceType.GetMethod(StandardIds.getHasValue);
        Method getValueOrDefault = sourceType.GetMethod(StandardIds.GetValueOrDefault);
        Method ctor = targetType.GetMethod(StandardIds.Ctor, utType);
        Block pushValue = new Block();
        Block done = new Block();

        Expression tempHasValue = new MethodCall(new MemberBinding(new UnaryExpression(tempSrc, NodeType.AddressOf), hasValue), null);
        tempHasValue.Type = SystemTypes.Boolean;
        statements.Add(new Branch(tempHasValue, pushValue));
        statements.Add(new AssignmentStatement(new AddressDereference(new UnaryExpression(tempTar, NodeType.AddressOf), targetType), new Literal(null, CoreSystemTypes.Object)));
        statements.Add(new Branch(null, done));
        statements.Add(pushValue);
        Expression value = new MethodCall(new MemberBinding(new UnaryExpression(tempSrc, NodeType.AddressOf), getValueOrDefault), null);
        value.Type = usType;
        value = this.ImplicitCoercion(value, utType);
        Construct cons = new Construct(new MemberBinding(null, ctor), new ExpressionList(value));
        result1.Type = ctor.DeclaringType;
        statements.Add(new AssignmentStatement(tempTar, cons));
        statements.Add(done);

        statements.Add(new ExpressionStatement(tempTar));
        return result1;
      }else
        this.HandleError(source, Error.NoImplicitCoercion, this.GetTypeName(sourceType), this.GetTypeName(originalTargetType));
      return null;
    }
示例#39
0
        public static Construct initConstruct(Transform parent)
        {
            Construct constr = GameObject.Instantiate(getAction("Construct"), parent).GetComponent <Construct>();

            return(constr);
        }
示例#40
0
        public override void Generate()
        {
#line 33 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
            this.WriteObjects("\r\n");
            this.WriteObjects("        public override void ApplyChangesFrom(", otherInterface, " obj)\r\n");
            this.WriteObjects("        {\r\n");
            this.WriteObjects("            base.ApplyChangesFrom(obj);\r\n");
            this.WriteObjects("            var other = (", clsName, ")obj;\r\n");
            this.WriteObjects("            var otherImpl = (", implName, ")obj;\r\n");
            this.WriteObjects("            var me = (", clsName, ")this;\r\n");
            this.WriteObjects("\r\n");
#line 41 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
// Only Client and Menory objects are applying calculated properties. NH + EF are re-calculating those properties when a depended object has changed.
#line 42 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
            foreach (var prop in cls.Properties.OfType <ValueTypeProperty>().OrderBy(p => p.Name))
            {
#line 43 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                if (prop.IsList)
                {
#line 44 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    if (prop.HasPersistentOrder)
                    {
#line 45 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                        this.WriteObjects("            SynchronizeLists(this._", prop.Name, "Collection, otherImpl._", prop.Name, "Collection);\r\n");
#line 46 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    }
                    else
                    {
#line 47 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                        this.WriteObjects("            SynchronizeCollections(this._", prop.Name, "Collection, otherImpl._", prop.Name, "Collection);\r\n");
#line 48 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    }
#line 49 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                }
                else
                {
#line 50 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    if (prop.IsCalculated)
                    {
#line 51 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                        this.WriteObjects("            this.", prop.Name, " = otherImpl.", prop.Name, ";\r\n");
#line 52 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    }
                    else
                    {
#line 53 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                        this.WriteObjects("            me.", prop.Name, " = other.", prop.Name, ";\r\n");
#line 54 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    }
#line 55 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                }
#line 56 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
            }
#line 57 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
            foreach (var prop in cls.Properties.OfType <CompoundObjectProperty>() /*.Where(p => !p.IsCalculated)*/.OrderBy(p => p.Name))
            {
#line 58 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                if (prop.IsList)
                {
#line 59 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    if (prop.HasPersistentOrder)
                    {
#line 60 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                        this.WriteObjects("            SynchronizeLists(this._", prop.Name, "Collection, otherImpl._", prop.Name, "Collection);\r\n");
#line 61 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    }
                    else
                    {
#line 62 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                        this.WriteObjects("            SynchronizeCollections(this._", prop.Name, "Collection, otherImpl._", prop.Name, "Collection);\r\n");
#line 63 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    }
#line 64 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                }
                else
                {
#line 65 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    this.WriteObjects("            if (me.", prop.Name, " == null && other.", prop.Name, " != null) {\r\n");
                    this.WriteObjects("                me.", prop.Name, " = (", prop.GetElementTypeString(), ")other.", prop.Name, ".Clone();\r\n");
                    this.WriteObjects("            } else if (me.", prop.Name, " != null && other.", prop.Name, " == null) {\r\n");
                    this.WriteObjects("                me.", prop.Name, " = null;\r\n");
                    this.WriteObjects("            } else if (me.", prop.Name, " != null && other.", prop.Name, " != null) {\r\n");
                    this.WriteObjects("                me.", prop.Name, ".ApplyChangesFrom(other.", prop.Name, ");\r\n");
                    this.WriteObjects("            }\r\n");
#line 72 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                }
#line 73 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
            }
#line 74 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
            foreach (var prop in cls.Properties.OfType <ObjectReferenceProperty>().Where(p => !p.IsList()).OrderBy(p => p.Name))
            {
                if (prop.RelationEnd.HasPersistentOrder)
                {
                    var positionPropertyName = Construct.ListPositionPropertyName(prop.RelationEnd);

#line 78 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                    this.WriteObjects("            this.", positionPropertyName, " = otherImpl.", positionPropertyName, ";\r\n");
#line 79 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                }
#line 80 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
                this.WriteObjects("            this._fk_", prop.Name, " = otherImpl._fk_", prop.Name, ";\r\n");
#line 81 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
            }
#line 82 "P:\zetbox\Zetbox.DalProvider.Memory.Generator\Templates\ObjectClasses\ApplyChangesFromMethod.cst"
            this.WriteObjects("        }\r\n");
        }
示例#41
0
		public virtual Expression VisitConstruct (Construct node)
		{
			if (node == null)
				return null;

			node.Constructor = VisitExpression (node.Constructor);
			node.Arguments = VisitExpressionList (node.Arguments);

			return node;
		}
示例#42
0
 // A simple construct that contains a collection of AWS S3 buckets.
 public StepfunctionsJobPollerConstruct(Construct scope, string id, StepfunctionsJobPollerConstructProps props) : base(scope, id)
 {
     _buckets = Enumerable.Range(0, props.BucketCount)
                .Select(i => new Bucket(this, $"Bucket{i}"))
                .ToList();
 }
示例#43
0
 public override Expression VisitConstruct(Construct cons){
   cons = (Construct)base.VisitConstruct(cons);
   if (cons == null) return null;
   MemberBinding mb = cons.Constructor as MemberBinding;
   if (mb == null) return cons;
   Method meth = mb.BoundMember as Method;
   if (meth == null) return cons;
   ParameterList parameters = meth.Parameters;
   if (parameters == null) return cons;
   ExpressionList operands = cons.Operands;
   int n = operands == null ? 0 : operands.Count;
   if (n > parameters.Count) n = parameters.Count;
   for (int i = 0; i < n; i++){
     //^ assert operands != null;
     Expression e = operands[i];
     if (e == null) continue;
     Parameter p = parameters[i];
     if (p == null) continue;
     if (e.Type == null || p.Type == null) continue;
     if (e.Type.IsValueType && !p.Type.IsValueType)
       operands[i] = new BinaryExpression(e, new MemberBinding(null, e.Type), NodeType.Box, p.Type);
   }
   return cons;
 }
 internal MyWidgetServiceStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
 {
     // The code that defines your stack goes here
 }
示例#45
0
 internal WafDemoCsStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
 {
     var webAcl = new CfnWebACL(this, "WebAcl", new CfnWebACLProps
     {
         DefaultAction = new CfnWebACL.DefaultActionProperty
         {
             Allow = new Dictionary <string, object>()
         },
         VisibilityConfig = new CfnWebACL.VisibilityConfigProperty
         {
             CloudWatchMetricsEnabled = true,
             SampledRequestsEnabled   = true,
             MetricName = "cs-waf-metric",
         },
         Scope = "REGIONAL",
         Name  = "csharp-webAcl",
         Rules = new object[]
         {
             new CfnWebACL.RuleProperty
             {
                 Name      = "AWS-AWSManagedRulesCommonRuleSet",
                 Priority  = 0,
                 Statement = new CfnWebACL.StatementOneProperty
                 {
                     ManagedRuleGroupStatement = new CfnWebACL.ManagedRuleGroupStatementProperty
                     {
                         VendorName = "AWS",
                         Name       = "AWSManagedRulesCommonRuleSet",
                     },
                 },
                 VisibilityConfig = new CfnWebACL.VisibilityConfigProperty
                 {
                     CloudWatchMetricsEnabled = true,
                     SampledRequestsEnabled   = true,
                     MetricName = "AWS-CS-AWSManagedRulesCommonRuleSet",
                 },
                 OverrideAction = new CfnWebACL.OverrideActionProperty
                 {
                     Count = new Dictionary <string, object>()
                 },
             },
             new CfnWebACL.RuleProperty
             {
                 Name      = "AWSManagedRulesAnonymousIpList",
                 Priority  = 1,
                 Statement = new CfnWebACL.StatementOneProperty
                 {
                     ManagedRuleGroupStatement = new CfnWebACL.ManagedRuleGroupStatementProperty
                     {
                         VendorName = "AWS",
                         Name       = "AWSManagedRulesAnonymousIpList",
                     },
                 },
                 VisibilityConfig = new CfnWebACL.VisibilityConfigProperty
                 {
                     CloudWatchMetricsEnabled = true,
                     SampledRequestsEnabled   = true,
                     MetricName = "AWS-CS-AWSManagedRulesAnonymousIpList",
                 },
                 OverrideAction = new CfnWebACL.OverrideActionProperty
                 {
                     None = new CfnWebACL.RuleActionProperty {
                         Count = false
                     },
                 },
             },
         }
     });
 }
示例#46
0
        internal ColdStartSimulatorStack(Construct scope, string id, StackProps props = null) : base(scope, id, props)
        {
            var coldStartSimulatorLambdaPolicy = new Amazon.CDK.AWS.IAM.PolicyStatement
            {
                Effect = Amazon.CDK.AWS.IAM.Effect.ALLOW
            };

            coldStartSimulatorLambdaPolicy.AddResources("*");
            coldStartSimulatorLambdaPolicy.AddActions("lambda:*");
            coldStartSimulatorLambdaPolicy.AddActions("xray:*");

            var coldStartSimulatorSetupFunction = new Function(this, "coldstartsimulator-setup", new FunctionProps
            {
                FunctionName = "coldstartsimulator-setup",
                Runtime      = Runtime.DOTNET_CORE_3_1,
                Code         = Code.FromAsset("../lambdas/coldstartsimulator/bin/Release/netcoreapp3.1/publish"),
                Handler      = "ColdStartSimulator::ColdStartSimulator.StepFunctionTasks::Setup",
                Timeout      = Duration.Seconds(31),
                MemorySize   = 512
            });

            var coldStartSimulatorInvokeLambdaFunction = new Function(this, "coldstartsimulator-invokelambda", new FunctionProps
            {
                FunctionName = "coldstartsimulator-invokelambda",
                Runtime      = Runtime.DOTNET_CORE_3_1,
                Code         = Code.FromAsset("../lambdas/coldstartsimulator/bin/Release/netcoreapp3.1/publish"),
                Handler      = "ColdStartSimulator::ColdStartSimulator.StepFunctionTasks::InvokeLambda",
                Timeout      = Duration.Seconds(31),
                MemorySize   = 512
            });

            coldStartSimulatorInvokeLambdaFunction.AddToRolePolicy(coldStartSimulatorLambdaPolicy);

            var coldStartSimulatorTouchLambdaFunction = new Function(this, "coldstartsimulator-touchlambda", new FunctionProps
            {
                FunctionName = "coldstartsimulator-touchlambda",
                Runtime      = Runtime.DOTNET_CORE_3_1,
                Code         = Code.FromAsset("../lambdas/coldstartsimulator/bin/Release/netcoreapp3.1/publish"),
                Handler      = "ColdStartSimulator::ColdStartSimulator.StepFunctionTasks::TouchLambda",
                Timeout      = Duration.Seconds(31),
                MemorySize   = 512
            });

            coldStartSimulatorTouchLambdaFunction.AddToRolePolicy(coldStartSimulatorLambdaPolicy);

            var metricS3Bucket = new Bucket(this, "metric-bucket", new BucketProps
            {
                BucketName = "coldstart-metric-bucket",
            });

            var coldStartSimulatorCollectMetricsFunction = new Function(this, "coldstartsimulator-collectmetrics", new FunctionProps
            {
                FunctionName = "coldstartsimulator-collectmetrics",
                Runtime      = Runtime.DOTNET_CORE_3_1,
                Code         = Code.FromAsset("../lambdas/coldstartsimulator/bin/Release/netcoreapp3.1/publish"),
                Handler      = "ColdStartSimulator::ColdStartSimulator.StepFunctionTasks::CollectMetrics",
                Timeout      = Duration.Seconds(31),
                MemorySize   = 512
            });

            metricS3Bucket.GrantPut(coldStartSimulatorCollectMetricsFunction);
            coldStartSimulatorCollectMetricsFunction.AddEnvironment("MetricS3BucketName", metricS3Bucket.BucketName);
            coldStartSimulatorCollectMetricsFunction.AddToRolePolicy(coldStartSimulatorLambdaPolicy);

            var setup = new LambdaInvoke(this, "Setup", new LambdaInvokeProps
            {
                LambdaFunction = coldStartSimulatorSetupFunction,
                OutputPath     = "$.Payload"
            });

            var touch = new LambdaInvoke(this, "Touch", new LambdaInvokeProps
            {
                LambdaFunction = coldStartSimulatorTouchLambdaFunction,
                OutputPath     = "$.Payload"
            });

            var invoke = new LambdaInvoke(this, "Invoke", new LambdaInvokeProps
            {
                LambdaFunction = coldStartSimulatorInvokeLambdaFunction,
                OutputPath     = "$.Payload"
            });

            var collectMetrics = new LambdaInvoke(this, "Collect Metrics", new LambdaInvokeProps
            {
                LambdaFunction = coldStartSimulatorCollectMetricsFunction,
                OutputPath     = "$.Payload"
            });

            var wait3Seconds = new Wait(this, "Wait 3 seconds", new WaitProps
            {
                Time = WaitTime.Duration(Duration.Seconds(3))
            });

            var wait30Seconds = new Wait(this, "Wait 30 seconds", new WaitProps
            {
                Time = WaitTime.Duration(Duration.Seconds(30))
            });

            var invokeAgainChoice = new Choice(this, "Invoke again?");

            invokeAgainChoice.When(Condition.BooleanEquals("$.Continue", true), touch);
            invokeAgainChoice.Otherwise(wait30Seconds);

            wait30Seconds
            .Next(collectMetrics);

            var definition = setup
                             .Next(touch)
                             .Next(wait3Seconds)
                             .Next(invoke)
                             .Next(invokeAgainChoice);

            new StateMachine(this, "ColdStartSimulatorStateMachine", new StateMachineProps
            {
                Definition = definition,
                Timeout    = Duration.Minutes(10)
            });
        }
示例#47
0
 internal AwsToolingDotnetCdkStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
 {
     // The code that defines your stack goes here
 }
示例#48
0
        internal NorthwindCdkStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
        {
            var vpc = new Vpc(this, "LabVpc", new VpcProps
            {
                MaxAzs = 2
            });



            // SQL Server

            var sg = new SecurityGroup(this, "NorthwindDatabaseSecurityGroup", new SecurityGroupProps
            {
                Vpc = vpc,

                SecurityGroupName = "Northwind-DB-SG",
                AllowAllOutbound  = false
            });

            // !!!!!!!!!! replace IP according to the instructions above
            sg.AddIngressRule(Peer.Ipv4("35.171.193.180/32"), Port.Tcp(1433)); // SQL Server
            // !!!!!!!!!!

            var sql = new DatabaseInstance(this, "NorthwindSQLServer", new DatabaseInstanceProps
            {
                Vpc = vpc,

                InstanceIdentifier = "northwind-sqlserver",
                Engine             = DatabaseInstanceEngine.SqlServerEx(new SqlServerExInstanceEngineProps {
                    Version = SqlServerEngineVersion.VER_14
                }),                                                                                                                          // SQL Server Express

                Credentials = Credentials.FromUsername("adminuser", new CredentialsFromUsernameOptions()
                {
                    Password = new SecretValue("Admin12345?")
                }),


                //MasterUsername = "******",
                //MasterUserPassword = new SecretValue("Admin12345?"),

                InstanceType   = InstanceType.Of(InstanceClass.BURSTABLE3, InstanceSize.SMALL), // t3.small
                SecurityGroups = new ISecurityGroup[] { sg },
                MultiAz        = false,
                VpcSubnets     = new SubnetSelection()
                {
                    SubnetType = SubnetType.PUBLIC
                },                              // public subnet

                DeletionProtection     = false, // you need to be able to delete database
                DeleteAutomatedBackups = true,
                BackupRetention        = Duration.Days(0),
                RemovalPolicy          = RemovalPolicy.DESTROY // you need to be able to delete database
            });;

            new CfnOutput(this, "SQLServerEndpointAddress", new CfnOutputProps
            {
                Value = sql.DbInstanceEndpointAddress
            });

            // SQL Server connection string in Systems Manager Parameter Store

            new StringParameter(this, "NorthwindDatabaseConnectionString", new StringParameterProps
            {
                ParameterName = "/Northwind/ConnectionStrings/NorthwindDatabase",
                Type          = ParameterType.STRING,
                Description   = "SQL Server connection string",
                StringValue   = string.Format("Server={0},1433;Integrated Security=false;User ID=adminuser;Password=Admin12345?;Initial Catalog=NorthwindTraders;", sql.DbInstanceEndpointAddress)
            });



            // PostgreSQL setup

            // !!!!!!!!!! add 2 rules when you use provided VM, add 1 rule when you use your computer
            sg.AddIngressRule(Peer.Ipv4("35.171.193.180/32"), Port.Tcp(5432)); // PostgreSQL
            sg.AddIngressRule(Peer.Ipv4("3.238.53.13/32"), Port.Tcp(5432));    // PostgreSQL
            // !!!!!!!!!!

            var postgreSql = new DatabaseCluster(this, "NorthwindPostgreSQL", new DatabaseClusterProps
            {
                InstanceProps = new Amazon.CDK.AWS.RDS.InstanceProps
                {
                    Vpc            = vpc,
                    InstanceType   = InstanceType.Of(InstanceClass.BURSTABLE3, InstanceSize.MEDIUM), // t3.medium
                    SecurityGroups = new ISecurityGroup[] { sg },
                    VpcSubnets     = new SubnetSelection()
                    {
                        SubnetType = SubnetType.PUBLIC
                    },                                                                     // you need to access database from your developer PC
                    ParameterGroup = ParameterGroup.FromParameterGroupName(this, "DBInstanceParameterGroup", "default.aurora-postgresql11"),
                },
                ParameterGroup    = ParameterGroup.FromParameterGroupName(this, "DBClusterParameterGroup", "default.aurora-postgresql11"),
                ClusterIdentifier = "northwind-postgresql",
                Engine            = DatabaseClusterEngine.AuroraPostgres(new AuroraPostgresClusterEngineProps
                {
                    Version = AuroraPostgresEngineVersion.VER_11_6
                }),                                                  // Aurora PostgreSQL
                Credentials = Credentials.FromUsername("adminuser", new CredentialsFromUsernameOptions
                {
                    Password = new SecretValue("Admin12345?")
                }),
                //MasterUser = new Login
                //{
                //    Username = "******",
                //    Password = new SecretValue("Admin12345?")
                //},
                Instances = 1,
                Port      = 5432,

                Backup = new BackupProps
                {
                    Retention = Duration.Days(1) // minimum is 1
                },

                DefaultDatabaseName    = "NorthwindTraders",
                InstanceIdentifierBase = "northwind-postgresql-instance",

                RemovalPolicy = RemovalPolicy.DESTROY // you need to be able to delete database,
            });;

            new CfnOutput(this, "PostgreSQLEndpointAddress", new CfnOutputProps
            {
                Value = postgreSql.ClusterEndpoint.Hostname
            });


            // Aurora PostgreSQL connection string in Systems Manager Parameter Store

            new StringParameter(this, "NorthwindPostgreSQLDatabaseConnectionString", new StringParameterProps
            {
                ParameterName = "/Northwind/ConnectionStrings/NorthwindPostgreDatabase",
                Type          = ParameterType.STRING,
                Description   = "PostgreSQL connection string",
                StringValue   = string.Format("Server={0};Database=NorthwindTraders;Username=adminuser;Password=Admin12345?", postgreSql.ClusterEndpoint.Hostname)
            });
        }
示例#49
0
 protected AbstractNodeGroup(Construct scope, string id) : base(scope, id)
 {
 }
示例#50
0
 public AwsCdkQueueHandler(Construct scope, string applicationName, string environmentName) : base(scope, applicationName, environmentName)
 {
 }
        public TheEventbridgeAtmStack(Construct scope, string id, IStackProps props = null)
            : base(scope, id, props)
        {
            //Producer Lambda
            var atmProducerLambda = new Function(this, "atmProducerLambda", new FunctionProps
            {
                Runtime = Runtime.NODEJS_12_X,
                Code    = Code.FromAsset("lambda-fns/atmProducer"),
                Handler = "handler.lambdaHandler"
            });

            var eventPolicy = new PolicyStatement(new PolicyStatementProps
            {
                Effect    = Effect.ALLOW,
                Resources = new[] { "*" },
                Actions   = new[] { "events:PutEvents" }
            });

            atmProducerLambda.AddToRolePolicy(eventPolicy);

            //Approved Transaction Consumer
            var atmConsumer1Lambda = new Function(this, "atmConsumer1Lambda", new FunctionProps
            {
                Runtime = Runtime.NODEJS_12_X,
                Code    = Code.FromAsset("lambda-fns/atmConsumer"),
                Handler = "handler.case1Handler"
            });

            var atmConsumer1LambdaRule = new Rule(this, "atmConsumer1LambdaRule", new RuleProps
            {
                Description  = "Approved transactions",
                EventPattern = new EventPattern
                {
                    Source     = new[] { "custom.myATMapp" },
                    DetailType = new[] { "transaction" },
                    Detail     = new Dictionary <string, object>
                    {
                        ["result"] = new[] { "approved" }
                    }
                }
            });

            atmConsumer1LambdaRule.AddTarget(new LambdaFunction(atmConsumer1Lambda));

            //NY Prefix Consumer
            var atmConsumer2Lambda = new Function(this, "atmConsumer2Lambda", new FunctionProps
            {
                Runtime = Runtime.NODEJS_12_X,
                Code    = Code.FromAsset("lambda-fns/atmConsumer"),
                Handler = "handler.case2Handler"
            });

            var atmConsumer2LambdaRule = new Rule(this, "atmConsumer2LambdaRule", new RuleProps
            {
                Description  = "Transactions with NY- prefix",
                EventPattern = new EventPattern
                {
                    Source     = new[] { "custom.myATMapp" },
                    DetailType = new[] { "transaction" },
                    Detail     = new Dictionary <string, object>
                    {
                        ["location"] = new []
                        {
                            new Dictionary <string, string>
                            {
                                ["prefix"] = "NY-"
                            }
                        }
                    }
                }
            });

            atmConsumer2LambdaRule.AddTarget(new LambdaFunction(atmConsumer2Lambda));

            //Not Approved Consumer
            var atmConsumer3Lambda = new Function(this, "atmConsumer3Lambda", new FunctionProps
            {
                Runtime = Runtime.NODEJS_12_X,
                Code    = Code.FromAsset("lambda-fns/atmConsumer"),
                Handler = "handler.case3Handler"
            });

            var atmConsumer3LambdaRule = new Rule(this, "atmConsumer3LambdaRule", new RuleProps
            {
                Description  = "Not approved transactions",
                EventPattern = new EventPattern
                {
                    Source     = new[] { "custom.myATMapp" },
                    DetailType = new[] { "transaction" },
                    Detail     = new Dictionary <string, object>
                    {
                        ["result"] = new[]
                        {
                            new Dictionary <string, object>
                            {
                                ["anything-but"] = "approved"
                            }
                        }
                    }
                }
            });

            atmConsumer3LambdaRule.AddTarget(new LambdaFunction(atmConsumer3Lambda));

            //API Gateway proxy integration
            // defines an API Gateway REST API resource backed by our "atmProducerLambda" function.
            new LambdaRestApi(this, "Endpoint", new LambdaRestApiProps
            {
                Handler = atmProducerLambda
            });
        }
示例#52
0
        public AppsyncGraphqlDynamodbStack(Construct parent, string id, IStackProps props) : base(parent, id, props)
        {
            const string tableName = "items";

            var itemsGraphQLApi = new CfnGraphQLApi(this, "Items", new CfnGraphQLApiProps {
                Name = "items-api",
                AuthenticationType = "API_KEY"
            });

            new CfnApiKey(this, "ItemsApiKey", new CfnApiKeyProps {
                ApiId = itemsGraphQLApi.AttrApiId
            });

            var apiSchema = new CfnGraphQLSchema(this, "ItemsSchema", new CfnGraphQLSchemaProps {
                ApiId      = itemsGraphQLApi.AttrApiId,
                Definition = Definition(tableName)
            });

            var itemsTable = new Table(this, "ItemsTable", new TableProps {
                TableName    = tableName,
                PartitionKey = new Amazon.CDK.AWS.DynamoDB.Attribute {
                    Name = String.Format("{0}Id", tableName),
                    Type = AttributeType.STRING
                },
                BillingMode = BillingMode.PAY_PER_REQUEST,
                Stream      = StreamViewType.NEW_IMAGE,

                // The default removal policy is RETAIN, which means that cdk destroy will not attempt to delete
                // the new table, and it will remain in your account until manually deleted. By setting the policy to
                // DESTROY, cdk destroy will delete the table (even if it has data in it)
                RemovalPolicy = RemovalPolicy.DESTROY
            });

            var itemsTableRole = new Role(this, "ItemsDynamoDBRole", new RoleProps {
                AssumedBy = new ServicePrincipal("appsync.amazonaws.com")
            });

            itemsTableRole.AddManagedPolicy(ManagedPolicy.FromAwsManagedPolicyName("AmazonDynamoDBFullAccess"));

            var dataSource = new CfnDataSource(this, "ItemsDataSource", new CfnDataSourceProps {
                ApiId          = itemsGraphQLApi.AttrApiId,
                Name           = "ItemsDynamoDataSource",
                Type           = "AMAZON_DYNAMODB",
                DynamoDbConfig = new Dictionary <string, string>()
                {
                    { "tableName", itemsTable.TableName },
                    { "awsRegion", this.Region }
                },
                ServiceRoleArn = itemsTableRole.RoleArn
            });

            var getOneResolver = new CfnResolver(this, "GetOneQueryResolver", new CfnResolverProps {
                ApiId                   = itemsGraphQLApi.AttrApiId,
                TypeName                = "Query",
                FieldName               = "getOne",
                DataSourceName          = dataSource.Name,
                RequestMappingTemplate  = String.Format(@"{{
                    ""version"": ""2017-02-28"",
                    ""operation"": ""GetItem"",
                    ""key"": {{
                        ""{0}"": $util.dynamodb.toDynamoDBJson($ctx.args.{0}Id)
                    }}
                    }}", tableName),
                ResponseMappingTemplate = "$util.toJson($ctx.result)"
            });

            getOneResolver.AddDependsOn(apiSchema);

            var getAllResolver = new CfnResolver(this, "GetAllQueryResolver", new CfnResolverProps {
                ApiId                   = itemsGraphQLApi.AttrApiId,
                TypeName                = "Query",
                FieldName               = "all",
                DataSourceName          = dataSource.Name,
                RequestMappingTemplate  = String.Format(@"{{
                    ""version"": ""2017-02-28"",
                    ""operation"": ""Scan"",
                    ""limit"": $util.defaultIfNull($ctx.args.limit, 20),
                    ""nextToken"": $util.toJson($util.defaultIfNullOrEmpty($ctx.args.nextToken, null))
                    }}", tableName),
                ResponseMappingTemplate = "$util.toJson($ctx.result)"
            });

            getAllResolver.AddDependsOn(apiSchema);

            var saveResolver = new CfnResolver(this, "SaveMutationResolver", new CfnResolverProps {
                ApiId                   = itemsGraphQLApi.AttrApiId,
                TypeName                = "Mutation",
                FieldName               = "save",
                DataSourceName          = dataSource.Name,
                RequestMappingTemplate  = String.Format(@"{{
                    ""version"": ""2017-02-28"",
                    ""operation"": ""PutItem"",
                    ""key"": {{
                        ""{0}Id"": {{ ""S"": ""$util.autoId()"" }}
                    }},
                    ""attributeValues"": {{
                        ""name"": $util.dynamodb.toDynamoDBJson($ctx.args.name)
                    }}
                    }}", tableName),
                ResponseMappingTemplate = "$util.toJson($ctx.result)"
            });

            saveResolver.AddDependsOn(apiSchema);

            var deleteResolver = new CfnResolver(this, "DeleteMutationResolver", new CfnResolverProps {
                ApiId                   = itemsGraphQLApi.AttrApiId,
                TypeName                = "Mutation",
                FieldName               = "delete",
                DataSourceName          = dataSource.Name,
                RequestMappingTemplate  = String.Format(@"{{
                    ""version"": ""2017-02-28"",
                    ""operation"": ""Scan"",
                    ""key"": {{
                        ""{0}Id"": $util.dynamodb.toDynamoDBJson($ctx.args.{0}Id)
                    }}
                    }}", tableName),
                ResponseMappingTemplate = "$util.toJson($ctx.result)"
            });

            deleteResolver.AddDependsOn(apiSchema);
        }
示例#53
0
    public virtual Differences VisitConstruct(Construct cons1, Construct cons2){
      Differences differences = new Differences(cons1, cons2);
      if (cons1 == null || cons2 == null){
        if (cons1 != cons2) differences.NumberOfDifferences++; else differences.NumberOfSimilarities++;
        return differences;
      }
      Construct changes = (Construct)cons2.Clone();
      Construct deletions = (Construct)cons2.Clone();
      Construct insertions = (Construct)cons2.Clone();

      Differences diff = this.VisitExpression(cons1.Constructor, cons2.Constructor);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Constructor = diff.Changes as Expression;
      deletions.Constructor = diff.Deletions as Expression;
      insertions.Constructor = diff.Insertions as Expression;
      Debug.Assert(diff.Changes == changes.Constructor && diff.Deletions == deletions.Constructor && diff.Insertions == insertions.Constructor);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      ExpressionList exprChanges, exprDeletions, exprInsertions;
      diff = this.VisitExpressionList(cons1.Operands, cons2.Operands, out exprChanges, out exprDeletions, out exprInsertions);
      if (diff == null){Debug.Assert(false); return differences;}
      changes.Operands = exprChanges;
      deletions.Operands = exprDeletions;
      insertions.Operands = exprInsertions;
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      diff = this.VisitExpression(cons1.Owner, cons2.Owner);
      if (diff == null) { Debug.Assert(false); return differences; }
      changes.Owner = diff.Changes as Expression;
      deletions.Owner = diff.Deletions as Expression;
      insertions.Owner = diff.Insertions as Expression;
      Debug.Assert(diff.Changes == changes.Owner && diff.Deletions == deletions.Owner && diff.Insertions == insertions.Owner);
      differences.NumberOfDifferences += diff.NumberOfDifferences;
      differences.NumberOfSimilarities += diff.NumberOfSimilarities;

      if (differences.NumberOfDifferences == 0) {
        differences.Changes = null;
        differences.Deletions = null;
        differences.Insertions = null;
      }else{
        differences.Changes = changes;
        differences.Deletions = deletions;
        differences.Insertions = insertions;
      }
      return differences;
    }
示例#54
0
    public override Expression VisitConstruct(Construct cons){
      if (cons == null) return cons;
      cons.Owner = this.VisitExpression(cons.Owner);
      cons.Constructor = this.VisitExpression(cons.Constructor);
      MemberBinding mb = cons.Constructor as MemberBinding;
      if (mb == null){
        Literal literal = cons.Constructor as Literal;
        if (literal == null) return cons;
        TypeNode t = literal.Value as TypeNode;
        if (t == null) return cons;
        cons.Type = t;
        cons.Constructor = mb = new MemberBinding(null, t);
        mb.SourceContext = literal.SourceContext;
      }else{
        TypeNode t = mb.BoundMember as TypeNode;
        if (t == null) return cons; //TODO: if the bound member is an instance initializer, use it.
        cons.Type = t;
      }
      AnonymousNestedFunction func = null;
      DelegateNode delType = cons.Type as DelegateNode;
      if (delType != null && cons.Operands != null && cons.Operands.Count == 1){
        Method meth = null;
        Expression ob = Literal.Null;
        Expression e = cons.Operands[0];
        MemberBinding emb = e as MemberBinding;
        if (emb != null) e = emb.BoundMemberExpression;
        TemplateInstance instance = e as TemplateInstance;
        TypeNodeList typeArguments = instance == null ? null : instance.TypeArguments;
        if (instance != null) e = instance.Expression;
        NameBinding nb = e as NameBinding;
        if (nb != null){
          meth = this.ChooseMethodMatchingDelegate(nb.BoundMembers, delType, typeArguments);
          if (meth != null && !meth.IsStatic)
            ob = new ImplicitThis();
          else if (meth == null){
            e = this.VisitExpression(e);
            if (e.Type is DelegateNode){
              meth = this.ChooseMethodMatchingDelegate(this.GetTypeView(e.Type).GetMembersNamed(StandardIds.Invoke), delType, typeArguments);
              if (meth != null)
                ob = e;
            }
          }
        }else{
          QualifiedIdentifier qualId = e as QualifiedIdentifier;
          if (qualId != null){
            ob = qualId.Qualifier = this.VisitExpression(qualId.Qualifier);
            if (ob is Literal && ob.Type == SystemTypes.Type)
              meth = this.ChooseMethodMatchingDelegate(this.GetTypeView((ob as Literal).Value as TypeNode).GetMembersNamed(qualId.Identifier), delType, typeArguments);
            else if (ob == null)
              return null;
            else if (ob != null && ob.Type != null){
              TypeNode oT = TypeNode.StripModifiers(ob.Type);
              Reference rT = oT as Reference;
              if (rT != null) oT = rT.ElementType;
              while (oT != null){
                meth = this.ChooseMethodMatchingDelegate(this.GetTypeView(oT).GetMembersNamed(qualId.Identifier), delType, typeArguments);
                if (meth != null) break;
                oT = oT.BaseType;
              }
            }
            if (meth == null){
              e = this.VisitExpression(e);
              if (e.Type is DelegateNode){
                meth = this.ChooseMethodMatchingDelegate(this.GetTypeView(e.Type).GetMembersNamed(StandardIds.Invoke), delType, typeArguments);
                if (meth != null){
                  qualId.BoundMember = new MemberBinding(e, meth, qualId.Identifier);
                  ob = e;
                }
              }
            }else
              qualId.BoundMember = new MemberBinding(ob, meth, qualId.Identifier);
          }else{
            func = e as AnonymousNestedFunction;
            if (func != null){
              meth = func.Method;
              if (meth != null){
                meth.ReturnType = delType.ReturnType;
                ParameterList mParams = meth.Parameters;
                ParameterList dParams = delType.Parameters;
                int n = mParams == null ? 0 : mParams.Count;
                int m = dParams == null ? 0 : dParams.Count;
                for (int i = 0; i < n; i++){
                  Parameter mPar = mParams[i];
                  if (mPar == null) return null;
                  if (i >= m){
                    if (mPar.Type == null) mPar.Type = SystemTypes.Object;
                    continue;
                  }
                  Parameter dPar = dParams[i];
                  if (mPar.Type == null){
                    if (dPar != null)
                      mPar.Type = dPar.Type;
                    if (mPar.Type == null)
                      mPar.Type = SystemTypes.Object;
                  }
                }
                if (n != m){
                  Node nde = new Expression(NodeType.Nop);
                  if (n == 0)
                    nde.SourceContext = cons.Constructor.SourceContext;
                  else{
                    nde.SourceContext = mParams[0].SourceContext;
                    nde.SourceContext.EndPos = mParams[n-1].SourceContext.EndPos;
                  }
                  this.HandleError(nde, Error.WrongNumberOfArgumentsForDelegate, this.GetTypeName(delType), n.ToString());
                  return null;
                }
                MemberList mems = meth.Scope == null ? null : meth.Scope.Members;
                n = mems == null ? 0 : mems.Count;
                for (int i = 0; i < n; i++){
                  ParameterField f = mems[i] as ParameterField;
                  if (f == null) continue;
                  Parameter p = f.Parameter;
                  if (p != null) f.Type = p.Type;
                }
                func = this.VisitAnonymousNestedFunction(func) as AnonymousNestedFunction;
                if (func == null) return null;
                meth = func.Method;
                if (meth == null || meth.DeclaringType == null) return null;
                ob = new CurrentClosure(meth, meth.DeclaringType);
              }
            }
          }
        }
        if (meth != null){
          Expression ldftn = null;
          MemberBinding memb = new MemberBinding(null, meth, e);
          memb.Type = null; //Signal to Checker not to complain about this reference to a method without parenthesis
          if (meth.IsVirtualAndNotDeclaredInStruct)
            ldftn = new BinaryExpression(new Expression(NodeType.Dup), memb, NodeType.Ldvirtftn);
          else{
            if (meth.IsStatic) ob = Literal.Null;
            ldftn = new UnaryExpression(memb, NodeType.Ldftn);
          }
          ldftn.Type = SystemTypes.IntPtr;
          ExpressionList arguments = cons.Operands = new ExpressionList(2);
          arguments.Add(ob);
          arguments.Add(ldftn);
          if (ob is ImplicitThis && this.currentMethod != null && this.currentMethod.IsStatic &&
            !(this.currentMethod.Scope.CapturedForClosure && meth.DeclaringType == this.currentMethod.Scope.ClosureClass)){
            this.HandleError(e, Error.ObjectRequired, this.GetMemberSignature(meth));
            return null;
          }
        }else{
          cons.Constructor = new Literal(delType);
          return cons;
        }
      }else{
        cons.Operands = this.VisitExpressionList(cons.Operands);
        UnaryExpression op2nd = cons.Operands != null && cons.Operands.Count > 1 ?
          cons.Operands[1] as UnaryExpression : null;
        if (op2nd != null){
          MemberBinding mb2nd = op2nd.Operand as MemberBinding;
          if (mb2nd != null && mb2nd.BoundMember is Method) mb2nd.Type = null;
        }
      }
      
      MemberList members = this.GetTypeView(cons.Type).GetConstructors();
      Method method = this.ResolveOverload(members, cons.Operands) as Method;
     
      if (method == null && cons.Operands != null && cons.Operands.Count == 1){
        Comprehension q = cons.Operands[0] as Comprehension;
        if (q == null) goto End;
        
        Method m2 = this.ResolveOverload(members, new ExpressionList()) as Method;
        //Method m2 = this.GetTypeView(cons.Type).GetConstructor(); // see if there is a nullary .ctor
        if (m2 == null && cons.Type.NodeType == NodeType.Class) goto End;
        TypeNode qType = TypeNode.StripModifiers(q.Type);
        if (q.Elements == null || qType== null || qType.TemplateArguments==null || qType.TemplateArguments.Count==0) goto End;

        if (this.GetTypeView(cons.Type).IsAssignableTo(SystemTypes.IList)){
          method = m2;
          q.AddMethod = SystemTypes.IList.GetMethod(StandardIds.Add,SystemTypes.Object);
        } else if ((q.Elements.Count == 0 || this.GetTypeView(qType.TemplateArguments[0]).IsAssignableTo(SystemTypes.DictionaryEntry)) && this.GetTypeView(cons.Type).IsAssignableTo(SystemTypes.IDictionary)) {
          method = m2;
          q.AddMethod = SystemTypes.IDictionary.GetMethod(StandardIds.Add,SystemTypes.Object,SystemTypes.Object);
        } else if (((q.Elements.Count == 0 || this.GetTypeView(qType.TemplateArguments[0]).IsAssignableTo(SystemTypes.DictionaryEntry)) && 
          (q.AddMethod = this.GetTypeView(cons.Type).GetMethod(StandardIds.Add,SystemTypes.Object, SystemTypes.Object)) != null) && 
          q.AddMethod.ReturnType == SystemTypes.Void){
          method = m2;
        } else if ((q.AddMethod = this.GetTypeView(cons.Type).GetMethod(StandardIds.Add,SystemTypes.Object)) != null &&
          q.AddMethod.ReturnType == SystemTypes.Int32){
          method = m2;
        } else
          q.AddMethod = null;

        // NB: if m2 is assigned to method, then the actual .ctor does *not* match the operands
        // but the Normalizer will compensate for it.
        // 2nd disjunct: don't need a .ctor method to construct a struct

        if ((method != null || cons.Type.NodeType == NodeType.Struct) && q.AddMethod!= null){
          // The Comprehension is going to replace the expression "new T{...}",
          // so it better have the same type
          // But Checker needs the T in the IEnumerable<T> that is sitting in q.Type, so
          // need a place to put it so Checker can find it. REVIEW!!!
          q.TemporaryHackToHoldType = q.Type;
          q.Type = cons.Type;
          if (method != null)
            q.nonEnumerableTypeCtor = method;
          else
            q.nonEnumerableTypeCtor = cons.Type;
          return q;
        }
      }
    End:
      
      if (method != null && method.DeclaringType == cons.Type){
        cons.Constructor = mb;
        mb.BoundMember = method;
      }
      if (cons != null) {
        Method m = method;
        if (m == null && members != null && members.Count > 0)
          m = members[0] as Method;
        if(m != null)
          this.ParameterPreselectionProcessing(m.Parameters, cons.Operands);
      }
      if (func != null){
        func.Invocation = cons;
        func.Type = cons.Type;
        return func;
      }
      if (cons.Type != null && !cons.Type.IsValueType && this.NonNullChecking)
        cons.Type = OptionalModifier.For(SystemTypes.NonNullType, cons.Type);
      return cons;
    }
示例#55
0
文件: Map.cs 项目: ryancheung/WinWar
        private void DetermineConstructConfig(Construct constr, int index, List <Construct> constructs)
        {
            int x = constr.X;
            int y = constr.Y;

            bool topNeighbour    = false;
            bool bottomNeighbour = false;
            bool leftNeighbour   = false;
            bool rightNeighbour  = false;

            for (int j = 0; j < constructs.Count; j++)
            {
                if (index == j)
                {
                    continue;
                }

                if (topNeighbour == false)
                {
                    topNeighbour = (constructs[j].X == x && constructs[j].Y == y - 1);
                }
                if (bottomNeighbour == false)
                {
                    bottomNeighbour = (constructs[j].X == x && constructs[j].Y == y + 1);
                }
                if (leftNeighbour == false)
                {
                    leftNeighbour = (constructs[j].X == x - 1 && constructs[j].Y == y);
                }
                if (rightNeighbour == false)
                {
                    rightNeighbour = (constructs[j].X == x + 1 && constructs[j].Y == y);
                }
            }

            // Endpieces
            if (topNeighbour && !bottomNeighbour && !leftNeighbour && !rightNeighbour)
            {
                constr.Config = ConstructConfig.EndPieceBottom;
            }
            if (!topNeighbour && bottomNeighbour && !leftNeighbour && !rightNeighbour)
            {
                constr.Config = ConstructConfig.EndPieceTop;
            }
            if (!topNeighbour && !bottomNeighbour && !leftNeighbour && rightNeighbour)
            {
                constr.Config = ConstructConfig.EndPieceLeft;
            }
            if (!topNeighbour && !bottomNeighbour && leftNeighbour && !rightNeighbour)
            {
                constr.Config = ConstructConfig.EndPieceRight;
            }

            // Corner pieces
            if (topNeighbour && !bottomNeighbour && leftNeighbour && !rightNeighbour)
            {
                constr.Config = ConstructConfig.CornerLeftTop;
            }
            if (!topNeighbour && bottomNeighbour && leftNeighbour && !rightNeighbour)
            {
                constr.Config = ConstructConfig.CornerLeftBottom;
            }
            if (topNeighbour && !bottomNeighbour && !leftNeighbour && rightNeighbour)
            {
                constr.Config = ConstructConfig.CornerRightTop;
            }
            if (!topNeighbour && bottomNeighbour && !leftNeighbour && rightNeighbour)
            {
                constr.Config = ConstructConfig.CornerRightBottom;
            }

            // Middle pieces
            if (!topNeighbour && !bottomNeighbour && leftNeighbour && rightNeighbour)
            {
                constr.Config = ConstructConfig.MiddlePieceLeftRight;
            }
            if (topNeighbour && bottomNeighbour && !leftNeighbour && !rightNeighbour)
            {
                constr.Config = ConstructConfig.MiddlePieceTopBottom;
            }

            // Quad piece
            if (topNeighbour && bottomNeighbour && leftNeighbour && rightNeighbour)
            {
                constr.Config = ConstructConfig.QuadPiece;
            }

            // T-Corners
            if (topNeighbour && bottomNeighbour && leftNeighbour && !rightNeighbour)
            {
                constr.Config = ConstructConfig.TPieceLeft;
            }
            if (topNeighbour && bottomNeighbour && !leftNeighbour && rightNeighbour)
            {
                constr.Config = ConstructConfig.TPieceRight;
            }
            if (!topNeighbour && bottomNeighbour && leftNeighbour && rightNeighbour)
            {
                constr.Config = ConstructConfig.TPieceBottom;
            }
            if (topNeighbour && !bottomNeighbour && leftNeighbour && rightNeighbour)
            {
                constr.Config = ConstructConfig.TPieceTop;
            }
        }
示例#56
0
 /// <summary>
 /// Converts the <see cref="Construct"/> to the hexdecimal string.
 /// </summary>
 public static string ToHAString(this Construct c, int rowCount = 8) => ((byte[])c).ToHAString(rowCount);
示例#57
0
 internal QuestionsServiceStack(Construct scope, string id, IStackProps props = null) : base(scope, id, props)
 {
     new QuestionsService(this, "Questions");
 }
示例#58
0
 public override Expression VisitConstruct(Construct cons) {
   if (cons == null) return cons;
   MemberBinding mb = cons.Constructor as MemberBinding;
   if (mb == null) {
     Literal lit = cons.Constructor as Literal;
     DelegateNode del = lit == null ? null : lit.Value as DelegateNode;
     if (del != null && cons.Operands != null && cons.Operands.Count == 1) {
       MemberList members = null;
       TypeNode offendingType = this.currentType;
       string offendingName = null;
       Expression e = cons.Operands[0];
       NameBinding nb = e as NameBinding;
       if (nb != null) {
         members = nb.BoundMembers;
         offendingName = nb.Identifier.ToString();
       } else {
         QualifiedIdentifier qualId = e as QualifiedIdentifier;
         if (qualId != null) {
           offendingName = qualId.Identifier.ToString();
           e = qualId.Identifier;
           Expression ob = qualId.Qualifier;
           if (ob is TemplateInstance) {
             this.VisitTemplateInstance((TemplateInstance)ob);
             return null;
           }
           if (ob is Literal && ob.Type == SystemTypes.Type)
             members = this.GetTypeView(offendingType = (ob as Literal).Value as TypeNode).GetMembersNamed(qualId.Identifier);
           else if (ob != null && ob.Type != null)
             members = this.GetTypeView(offendingType = TypeNode.StripModifiers(ob.Type)).GetMembersNamed(qualId.Identifier);
         }
       }
       int n = members == null ? 0 : members.Count;
       Member offendingMember = n > 0 ? members[0] : null;
       for (int i = 0; i < n; i++) {
         Method m = members[i] as Method;
         if (m != null) { offendingMember = m; break; }
       }
       if (offendingMember == null) {
         if (offendingName == null)
           this.HandleError(e, Error.MethodNameExpected);
         else
           this.HandleError(e, Error.NoSuchMember, this.GetTypeName(offendingType), offendingName);
       } else if (offendingMember is Method) {
         this.HandleError(e, Error.NoMethodMatchesDelegate, this.GetDelegateSignature(del), this.GetUnqualifiedMemberName((Method)offendingMember));
         this.HandleRelatedError(del);
         this.HandleRelatedError(offendingMember);
       } else
         this.HandleNonMethodWhereMethodExpectedError(e, offendingMember);
       return null;
     }
     return null;
   }
   InstanceInitializer c = mb.BoundMember as InstanceInitializer;
   if (c == null) {
     TypeNode consType = TypeNode.StripModifiers(cons.Type);
     if (consType != null && consType.IsValueType && (cons.Operands == null || cons.Operands.Count == 0))
       return new Local(StandardIds.NewObj, consType, cons.SourceContext);
     TypeNode t = mb.BoundMember as TypeNode;
     if (t == null)
       this.HandleError(cons, Error.NoSuchConstructor, "");
     else if (t.Name == Looker.NotFound || t.Name == null)
       this.VisitTypeReference(t); //Report appropriate error about type
     else {
       MemberList members = this.GetTypeView(t).GetConstructors();
       int n = members == null ? 0 : members.Count;
       if (n == 0) {
         if ((cons.Operands == null || cons.Operands.Count == 0) && t is ITypeParameter && 
           (((ITypeParameter)t).TypeParameterFlags & (TypeParameterFlags.DefaultConstructorConstraint|TypeParameterFlags.ValueTypeConstraint)) != 0) {
           if (this.useGenerics) {
             Method createInstance = Runtime.GenericCreateInstance.GetTemplateInstance(this.currentType, t);
             return new MethodCall(new MemberBinding(null, createInstance), null, NodeType.Call, t, cons.SourceContext);
           } else {
             if ((((ITypeParameter)t).TypeParameterFlags & TypeParameterFlags.DefaultConstructorConstraint) != 0) {
               ExpressionList arguments = new ExpressionList(Normalizer.TypeOf(t));
               MethodCall call = new MethodCall(new MemberBinding(null, Runtime.CreateInstance), arguments, NodeType.Call, SystemTypes.Object, cons.SourceContext);
               return new BinaryExpression(call, new Literal(t, SystemTypes.Type), NodeType.Castclass, t, cons.SourceContext);
             } else {
               return new Local(StandardIds.NewObj, consType, cons.SourceContext);
             }
           }
         }
         if (t.IsAbstract)
           if (t.IsSealed)
             this.HandleError(cons, Error.ConstructsAbstractSealedClass, this.GetTypeName(t));
           else
             this.HandleError(cons, Error.ConstructsAbstractClass, this.GetTypeName(t));
         else
           this.HandleError(cons, Error.NoSuchConstructor, this.GetTypeName(t));
       } else {
         this.HandleError(cons, Error.NoOverloadWithMatchingArgumentCount, t.Name.ToString(), (cons.Operands == null ? 0 : cons.Operands.Count).ToString());
       }
       for (int i = 0; i < n; i++) {
         Member m = members[i];
         if (m == null) continue;
         if (m.SourceContext.Document == null) continue;
         this.HandleRelatedError(m);
       }
     }
     return null;
   }
   if (c.DeclaringType != null && c.DeclaringType.IsAbstract) {
     if (c.DeclaringType.IsSealed)
       this.HandleError(cons, Error.ConstructsAbstractSealedClass, this.GetTypeName(c.DeclaringType));
     else
       this.HandleError(cons, Error.ConstructsAbstractClass, this.GetTypeName(c.DeclaringType));
   } else if (this.NotAccessible(c)) {
     this.HandleError(cons, Error.MemberNotVisible, this.GetMemberSignature(c));
     return null;
   }
   this.CheckForObsolesence(cons, c);
   if (!(c.DeclaringType is DelegateNode) || 
     !(cons.Operands != null && cons.Operands.Count == 2 && (cons.Operands[0].NodeType == NodeType.AnonymousNestedFunction)))
     this.CoerceArguments(c.Parameters, ref cons.Operands, false, c.CallingConvention);
   if (cons.Owner != null) {
     this.VisitExpression(cons.Owner);
     TypeNode ownerType = cons.Owner.Type;
     if (ownerType == null) { // must have been an error somewhere else
       cons.Owner = null;
     } else if (ownerType.IsValueType) {
       cons.Owner = this.typeSystem.ImplicitCoercion(cons.Owner, SystemTypes.Object, this.TypeViewer);
     }
   }
   return cons;
 }
示例#59
0
 public virtual Expression VisitConstruct(Construct cons, Construct changes, Construct deletions, Construct insertions){
   this.UpdateSourceContext(cons, changes);
   if (cons == null) return changes;
   if (changes != null){
     if (deletions == null || insertions == null)
       Debug.Assert(false);
     else{
       cons.Constructor = this.VisitExpression(cons.Constructor, changes.Constructor, deletions.Constructor, insertions.Constructor); 
       cons.Operands = this.VisitExpressionList(cons.Operands, changes.Operands, deletions.Operands, insertions.Operands);
       cons.Owner = this.VisitExpression(cons.Owner, changes.Owner, deletions.Owner, insertions.Owner);
     }
   }else if (deletions != null)
     return null;
   return cons;
 }
示例#60
0
 public void Set(Construct construct)
 {
     this.construct = construct;
     GetComponent <Image>().sprite = construct.icon;
 }