Ejemplo n.º 1
0
        public async Task <IActionResult> Edit(string id, [Bind("ClosureId,Reason,ConcId,AttrId,DateClosure,DurationClosure")] Closures closures)
        {
            if (id != closures.ClosureId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(closures);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ClosuresExists(closures.ClosureId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AttrId"] = new SelectList(_context.Attractions, "AttractionId", "AttractionId", closures.AttrId);
            ViewData["ConcId"] = new SelectList(_context.Concessions, "ConcessionId", "ConcessionId", closures.ConcId);
            ViewData["Reason"] = new SelectList(_context.ReasonTable, "ReasonIndex", "Reason", closures.Reason);
            return(View(closures));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Define this instance.
        /// </summary>
        public override void Define()
        {
            base.Define();

            // Keywords
            // Keywords.Add("", new KeywordDescriptor(KeywordType.Keyword, KeywordColor, ""));

            // Parameters
            // Keywords.Add("", new KeywordDescriptor(KeywordType.MethodParameters, MethodParameterColor, ""));

            // Define HTML formats
            Formats.Add(new FormatDescriptor("<!--", "-->", CommentColor));
            Formats.Add(new FormatDescriptor("\"", "\"", StringLiteralColor));
            Formats.Add(new FormatDescriptor("<code>", "</code>", StatementColor));
            Formats.Add(new FormatDescriptor("`", "`", StatementColor));
            Formats.Add(new FormatDescriptor("&", ";", PreprocessorDirectiveColor));
            Formats.Add(new FormatDescriptor("<", ">", KeywordColor));

            // Define MarkDown formats
            Formats.Add(new FormatDescriptor("#", TypeColor));
            Formats.Add(new FormatDescriptor(">", ValueTypeColor));
            Formats.Add(new FormatDescriptor("[", "]", ReferenceTypeColor));
            Formats.Add(new FormatDescriptor("(", ")", AccessModifierColor));
            Formats.Add(new FormatDescriptor("**", "**", ModifierColor));
            Formats.Add(new FormatDescriptor("_", "_", SelectionStatementColor));

            // Define additional closures
            Closures.Add(new LanguageClosure('*'));
            Closures.Add(new LanguageClosure('_'));
            Closures.Add(new LanguageClosure('`'));

            // Define formatting commands
            FormattingCommands.Add(new LanguageFormatCommand("Stong", "**", "**"));
            FormattingCommands.Add(new LanguageFormatCommand("Emphasize", "_", "_"));
            FormattingCommands.Add(new LanguageFormatCommand("Inline Code", "`", "`"));
            FormattingCommands.Add(new LanguageFormatCommand("Code Block", "```\n", "\n```"));
            FormattingCommands.Add(new LanguageFormatCommand("Comment", "<!--", "-->"));
            FormattingCommands.Add(new LanguageFormatCommand());
            FormattingCommands.Add(new LanguageFormatCommand("Unordered List", "* "));
            FormattingCommands.Add(new LanguageFormatCommand("Ordered List", "1. "));
            FormattingCommands.Add(new LanguageFormatCommand("Block Quote", "> "));
            FormattingCommands.Add(new LanguageFormatCommand());

            var Headings = new LanguageFormatCommand("Headings");

            Headings.SubCommands.Add(new LanguageFormatCommand("Heading 1", "# "));
            Headings.SubCommands.Add(new LanguageFormatCommand("Heading 2", "## "));
            Headings.SubCommands.Add(new LanguageFormatCommand("Heading 3", "### "));
            Headings.SubCommands.Add(new LanguageFormatCommand("Heading 4", "#### "));
            Headings.SubCommands.Add(new LanguageFormatCommand("Heading 5", "##### "));
            Headings.SubCommands.Add(new LanguageFormatCommand("Heading 6", "###### "));
            FormattingCommands.Add(Headings);

            FormattingCommands.Add(new LanguageFormatCommand());
            FormattingCommands.Add(new LanguageFormatCommand("Link", "[", "]()"));
            FormattingCommands.Add(new LanguageFormatCommand("Image", "![](", ")"));
            FormattingCommands.Add(new LanguageFormatCommand("Image Link", "[ ![](", ")](LinkImageHere)"));
        }
Ejemplo n.º 3
0
            private void AddCapture([NotNull] ITreeNode closure, [NotNull] IDeclaredElement element)
            {
                if (!Closures.TryGetValue(closure, out var captures))
                {
                    Closures.Add(closure, captures = new JetHashSet <IDeclaredElement>());
                }

                captures.Add(element);
            }
Ejemplo n.º 4
0
        public new void Accept(ObjectField field)
        {
            IOutputType      type         = field.Type;
            SelectionSetNode selectionSet = Context.FieldSelection.SelectionSet;

            (type, selectionSet) = UnwrapOffsetBasedPaging(type, selectionSet);
            IType elementType = type.IsListType() ? type.ElementType() : type;

            Closures.Push(new SelectionClosure(elementType.ToClrType(), "e"));
            VisitSelections(type, selectionSet);
        }
Ejemplo n.º 5
0
            public void ProcessAfterInterior(ITreeNode element)
            {
                if (element is IAnonymousFunctionExpression || element is IQueryParameterPlatform)
                {
                    var lambda = myClosures.Pop();
                    Assertion.Assert(lambda == element, "lambda == element");

                    if (!Closures.ContainsKey(lambda))
                    {
                        ClosurelessLambdas.Add(lambda);
                    }
                }
            }
Ejemplo n.º 6
0
                public void Free()
                {
                    foreach (var scope in NestedScopes)
                    {
                        scope.Free();
                    }
                    NestedScopes.Free();

                    foreach (var closure in Closures)
                    {
                        closure.Free();
                    }
                    Closures.Free();
                }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("ClosureId,Reason,ConcId,AttrId,DateClosure,DurationClosure")] Closures closures)
        {
            if (ModelState.IsValid)
            {
                _context.Add(closures);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AttrId"] = new SelectList(_context.Attractions, "AttractionId", "AttractionName", closures.AttrId);
            ViewData["ConcId"] = new SelectList(_context.Concessions, "ConcessionId", "ConcessionName", closures.ConcId);
            ViewData["Reason"] = new SelectList(_context.ReasonTable, "ReasonIndex", "Reason", closures.Reason);
            return(View(closures));
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Define this instance.
        /// </summary>
        public virtual void Define()
        {
            // Initialize
            Keywords.Clear();
            Formats.Clear();
            Closures.Clear();
            FormattingCommands.Clear();

            // Define the default set of closures
            Closures.Add(new LanguageClosure('(', ')'));
            Closures.Add(new LanguageClosure('[', ']'));
            Closures.Add(new LanguageClosure('<', '>'));
            Closures.Add(new LanguageClosure('{', '}'));
            Closures.Add(new LanguageClosure('"'));
        }
Ejemplo n.º 9
0
        protected override bool EnterList(IFieldSelection selection)
        {
            if (selection.Field.Member is PropertyInfo)
            {
                (IOutputType type, SelectionSetNode selectionSet) =
                    UnwrapOffsetBasedPaging(selection.Field.Type, selection.Selection.SelectionSet);

                Type clrType = type.IsListType() ?
                               type.ElementType().ToClrType() :
                               type.ToClrType();

                Closures.Push(new SelectionClosure(clrType, "e" + Closures.Count));

                return(VisitSelections(type, selectionSet));
            }

            return(false);
        }
Ejemplo n.º 10
0
 static void Main(string[] args)
 {
     Console.WriteLine(Closures()(30));
 }
Ejemplo n.º 11
0
        public void Print(StringBuilder Buf, int Idt = 0)
        {
            String Ident;
            int    VarIndexStart = 0;

            Ident = "";
            for (int I = 0; I < Idt; I++)
            {
                Ident += "    ";
            }

            if (Parent != null)
            {
                String args = "";
                for (int I = 0; I < Parameters; I++)
                {
                    args += String.Format("argument_{0}, ", I);
                }
                if (args.Length != 0)
                {
                    args = args.Substring(0, args.Length - 2);
                }

                Buf.Append(String.Format("{0}function {1}({2})\n", Ident, AsFnString(), args));

                for (int I = 0; I < Parameters; I++)
                {
                    Buf.Append(String.Format("00:{0}    local var_{1} = argument_{1}\n", Ident, I));
                }

                VarIndexStart = Parameters;
            }

            for (int I = VarIndexStart; I < this.Registers; I++)
            {
                Buf.Append(String.Format("00:{0}    local var_{1} = nil\n", Ident, I));
            }

            Closures.ForEach((closure) =>
            {
                for (int I = 0; I < closure.UpVals; I++)
                {
                    Buf.Append(String.Format("00:{0}    upval_{1}_for_{2} = nil\n", Ident, I, closure.ClosureID));
                }
            });

            Buf.Append(String.Format("00:{0}    local R1 = nil\n", Ident));

            for (int I = 0; I < Instructions.Count; I++)
            {
                int             RealIndex = I;
                StringBuilder   SB;
                BaseInstruction Instruction;

                Instruction = Instructions[I];
                SB          = new StringBuilder();

                if (Instruction.Implemented())
                {
                    Instruction.Decompile(SB, this, ref I);
                }
                else
                {
                    SB.Append("instruction missing: " + Instruction.GetFullName());
                }

                SB.ToString().Replace("\r", "").Split('\n').ToList().ForEach((line) =>
                {
                    Buf.Append(String.Format("{1}:{0}    {2}\n", Ident, RealIndex.ToString("00"), line));
                });
            }


            Closures.ForEach((closure) =>
            {
                closure.Print(Buf, Idt + 1);
            });

            if (Parent != null)
            {
                Buf.Append(String.Format("{0}end\n", Ident));
            }
        }