Beispiel #1
0
        public List <BookTransactions> GetListMonth(int mm)
        {
            var result = (from a in Db.Book
                          join al in Db.Transactions on
                          new { C1 = a.IdBook, C2 = a.Date.Month } equals
                          new { C1 = al.IdBook, C2 = mm } into ALL
                          from al in ALL.DefaultIfEmpty()
                          select new BookTransactions
            {
                IdBook = a.IdBook,
                Description = a.Description
            }).ToList();

            return(result);

            /*
             *          var result = Db.Book
             *                      .GroupJoin(Db.Transactions, book => book.IdBook, transactions => transactions.IdBook,
             *                 (book, transactions) => new { Book = book, Transactions = transactions.DefaultIfEmpty() })
             *             .SelectMany(a => a.Transactions, (a, transactions) => new
             *             {
             *                 a.Book.IdBook,
             *                 transactions.Value
             *             });
             *
             *          return result;
             */
        }
            public void scan(string prefix)
            {
                if (ALL.Equals(prefix))
                {
                    scanOne(Constants.HEAD);
                    scanTree(Constants.R_REFS, _refDirectory.refsDir);

                    // If any entries remain, they are deleted, drop them.
                    if (newLoose == null && curIdx < curLoose.size())
                    {
                        newLoose = curLoose.copy(curIdx);
                    }
                }
                else if (prefix.StartsWith(Constants.R_REFS) && prefix.EndsWith("/"))
                {
                    curIdx = -(curLoose.find(prefix) + 1);
                    DirectoryInfo dir = PathUtil.CombineDirectoryPath(_refDirectory.refsDir, prefix.Substring(Constants.R_REFS.Length));
                    scanTree(prefix, dir);

                    // Skip over entries still within the prefix; these have
                    // been removed from the directory.
                    while (curIdx < curLoose.size())
                    {
                        if (!curLoose.get(curIdx).getName().StartsWith(prefix))
                        {
                            break;
                        }
                        if (newLoose == null)
                        {
                            newLoose = curLoose.copy(curIdx);
                        }
                        curIdx++;
                    }

                    // Keep any entries outside of the prefix space, we
                    // do not know anything about their status.
                    if (newLoose != null)
                    {
                        while (curIdx < curLoose.size())
                        {
                            newLoose.add(curLoose.get(curIdx++));
                        }
                    }
                }
            }
Beispiel #3
0
    /*
     * Find a type by name. If the type is not found, a new type
     * is created with status NAMED.
     */
    internal static XType Lookup(string name)
    {
        /*
         * std::string is an alias for (std::u8 std::array).
         * TODO: design and implement a more generic alias system
         * for types.
         */
        if (name == "std::string")
        {
            return(ARRAY_U8);
        }

        XType xt;

        if (!ALL.TryGetValue(name, out xt))
        {
            xt        = new XType(name);
            ALL[name] = xt;
        }
        return(xt);
    }
 public static WSOperation GetOperation(string key)
 {
     return((string.IsNullOrEmpty(key) || ALL == null || !ALL.Any(o => o.Match(key))) ? Equal : ALL.FirstOrDefault(o => o.Match(key)));
 }
 public static WSOperation GetOperation(string key)
 {
     return((ALL != null && ALL.Any(o => o.Match(key))) ? ALL.FirstOrDefault(o => o.Match(key)) : NONE);
 }
Beispiel #6
0
 private static void HelpOnHelp()
 {
     Add("The command syntax for requesting additional help with NuGetHandler is:");
     Add();
     Add("  NuGetHandler -h <subject>");
     Add();
     Add("where <subject> is the desired section of help to be acquired. Given that the");
     Add("length of some of the subject matter is quite long, it is recommended that the");
     Add("output of the help system be piped to a text file for later review.");
     Add();
     Add("Some subjects will also yield the actual settings as derived from values");
     Add("present on the command line and from the various app.*.config files.");
     Add(@"To cause those values to be displayed, a verbosity value of ""detailed""");
     Add("to the command line e.g. -v detailed");
     Add();
     Add("The list of subjects follows:");
     Add(HelpSections.ToString());
     SectionBreak("Content of help sections");
     Add($"{"<none>".PadItRight()}The program summary plus this help description.");
     Add();
     Add($"{ALL.PadItRight()}Generate the entire help content (best");
     Add($"{String.Empty.PadItLeft()}redirected to a file for further perusal).");
     Add();
     Add($"{APP_CONFIG_SETTINGS.PadItRight()}Just the information as found in the appSettings");
     Add($"{String.Empty.PadItLeft()}portion of the app.config file and its possible");
     Add($"{String.Empty.PadItLeft()}app.optional.config files.");
     Add();
     Add($"{APP_CONFIG_NUSPEC_DOTNET.PadItRight()}Just the information as found in the");
     Add($"{String.Empty.PadItLeft()}DotNetNuSpecSettings section of the app.config");
     Add($"{String.Empty.PadItLeft()}file and its possible app.optional.config files.");
     Add();
     Add($"{APP_CONFIG_NUSPEC_NUGET.PadItRight()}");
     Add($"{String.Empty.PadItLeft()}NuGetNuSpecSettings section of the app.config file");
     Add($"{String.Empty.PadItLeft()}and its possible app.optional.config files.");
     Add();
     Add($"{COMMAND_LINE.PadItRight()}Help on the command line switches and named value");
     Add($"{String.Empty.PadItLeft()}pairs plus the command line introduction.");
     Add();
     Add($"{COMMAND_LINE_SWITCHES.PadItRight()}Help on just the command line switches.");
     Add();
     Add($"{COMMAND_LINE_NAMED_VALUES.PadItRight()}Help on just the command line named values.");
     Add();
     Add($"{COMMAND_SEQUENCE.PadItRight()}Complete list of commands and their respective");
     Add($"{String.Empty.PadItLeft()}command line parameters as supported in");
     Add($"{String.Empty.PadItLeft()}NuGetHandler");
     Add();
     Add($"{COMMAND_SEQUENCE_DOTNET_CORE.PadItRight()}Just the command sequence that supports .net Core");
     Add($"{String.Empty.PadItLeft()}projects (dotnet.exe)");
     Add();
     Add($"{COMMAND_SEQUENCE_NUGET.PadItRight()}Just the command sequence that supports full");
     Add($"{String.Empty.PadItLeft()}framework projects (nuget.exe)");
     Add();
     Add($"{COMMAND_SEQUENCE_DOTNET_STANDARD.PadItRight()}Just the comnmand sequence that supports .net");
     Add($"{String.Empty.PadItLeft()}standard projects (dotnet.exe)");
     Add();
     Add($"{CONFIG_INFO.PadItRight()}Display the settings for the final app.config,");
     Add($"{String.Empty.PadItLeft()}command line calculated values and other");
     Add($"{String.Empty.PadItLeft()}information as determined by the program when");
     Add($"{String.Empty.PadItLeft()}executed. If a project was designated,");
     Add($"{String.Empty.PadItLeft()}the processed project information will be");
     Add($"{String.Empty.PadItLeft()}displayed.");
     Add();
     Add($"{ENVIRONMENT.PadItRight()}Help and content for the program environment.");
     Add();
     Add($"{HELP.PadItRight()}This help description.");
     Add();
     Add($"{NUGET_PUSH.PadItRight()}The combined information concerning the locations");
     Add($"{String.Empty.PadItLeft()}(Push Repositories) of the various nuget servers");
     Add($"{String.Empty.PadItLeft()}and the corresponding destinations (Push");
     Add($"{String.Empty.PadItLeft()}Destinations) that match the repositories.");
     Add();
     Add($"{NUGET_PUSH_REPOS.PadItRight()}Just the information on the nuget server");
     Add($"{String.Empty.PadItLeft()}repositories");
     Add();
     Add($"{NUGET_PUSH_DESTINATIONS.PadItRight()}Just the information on the nuget server");
     Add($"{String.Empty.PadItLeft()}repository destinations.");
     Add();
     Add($"{POSTBUILD.PadItRight()}Emit the necessary code that should be placed");
     Add($"{String.Empty.PadItLeft()}in the Post-Build event section of the properties");
     Add($"{String.Empty.PadItLeft()}of a given project.");
     Add();
     Add($"{SETUP.PadItRight()}How to prepare to install the NuGetHandler");
     Add($"{String.Empty.PadItLeft()}program.");
     Add();
     Add($"{SUMMARY.PadItRight()}Just the summary information for the NuGetHandler");
     Add($"{String.Empty.PadItLeft()}program.");
     Add();
     Add($"{TOKENS.PadItRight()}Help on the replaceable tokens as found in the");
     Add($"{String.Empty.PadItLeft()}app.config file.");
     Add();
 }
 public void AddToALL(ALL aLL)
 {
     base.AddObject("ALL", aLL);
 }
 public static ALL CreateALL(string firstName, string lastName, string fatherName, string iDnum, long id)
 {
     ALL aLL = new ALL();
     aLL.FirstName = firstName;
     aLL.LastName = lastName;
     aLL.FatherName = fatherName;
     aLL.IDnum = iDnum;
     aLL.id = id;
     return aLL;
 }
Beispiel #9
0
    /*
     * Find an array type, for a given element type. If the array type
     * is not found, it is automatically created.
     */
    internal static XType LookupArray(XType elementType, bool embed)
    {
        string name = string.Format("({0} {1})",
                                    elementType.Name,
                                    embed ? "std::array&" : "std::array");
        XType xt;

        if (!ALL.TryGetValue(name, out xt))
        {
            if (embed && !elementType.IsEmbeddable)
            {
                throw new Exception(string.Format("type {0} is not embeddable", elementType.Name));
            }
            xt = new XType(name);
            xt.arrayElementType     = elementType;
            xt.arrayElementEmbedded = embed;
            xt.CloseArray();
            ALL[name] = xt;

            XType[] tArray            = new XType[] { xt };
            XType[] tIntArray         = new XType[] { INT, xt };
            XType[] tIntIntArray      = new XType[] { INT, INT, xt };
            XType[] tIntIntArrayArray = new XType[] {
                INT, INT, xt, xt
            };
            XType[] tEltIntArray = new XType[] {
                elementType, INT, xt
            };
            XType[] tArrayArray = new XType[] { xt, xt };

            Function.Register("std::sub", tIntIntArrayArray,
                              new NativeArrayAccessorSub(xt));
            Function.Register("std::subself", tIntIntArray,
                              new NativeArrayAccessorSubSelf(xt));
            Function.Register("std::init?", tArray,
                              new NativeArrayAccessorIsInit(xt));
            Function.Register("std::length", tArray,
                              new NativeArrayAccessorLength(xt));
            if (embed)
            {
                Function.Register("std::make", tIntArray,
                                  new NativeArrayAccessorMakeEmbed(xt));
                Function.Register("std::@&", tIntArray,
                                  new NativeArrayAccessorRef(xt));
            }
            else
            {
                Function.Register("std::make", tIntArray,
                                  new NativeArrayAccessorMakeRef(xt));
                Function.Register("std::@", tIntArray,
                                  new NativeArrayAccessorGet(xt));
                Function.Register("std::->@", tEltIntArray,
                                  new NativeArrayAccessorPut(xt));
                Function.Register("std::Z->@", tIntArray,
                                  new NativeArrayAccessorPut(xt));
                Function.Register("std::@?", tIntArray,
                                  new NativeArrayAccessorIsEltInit(xt));

                /*
                 * Arrays of references implement '=' by
                 * running that function on all elements.
                 * This is implemented with an interpreted
                 * function since it may call interpreted
                 * functions.
                 *
                 * : = (...)
                 *     ->{ a1 a2 }
                 *     a1 length ->{ len }
                 *     len a2 length = ifnot false ret then
                 *     0 ->{ i }
                 *     begin i len < while
                 *         i a1 @ i a2 @ = ifnot false ret then
                 *         i ++ ->i
                 *     repeat
                 *     true ;
                 */
                FunctionBuilder fb = new FunctionBuilder(
                    "std::=");
                /* { a1 a2 len i } */
                fb.DefLocalField("a1", null);
                fb.DefLocalField("a2", null);
                fb.DefLocalField("len", null);
                fb.DefLocalField("i", null);
                /* ->{ a1 a2 } */
                fb.DoLocal("->a2");
                fb.DoLocal("->a1");
                /* a1 length ->len */
                fb.DoLocal("a1");
                fb.Call("std::length");
                fb.DoLocal("->len");
                /* len a2 length = ifnot false ret then */
                fb.DoLocal("len");
                fb.DoLocal("a2");
                fb.Call("std::length");
                fb.Call("std::=");
                fb.AheadIf();
                fb.Literal(false);
                fb.Ret();
                fb.Then();
                /* 0 ->{ i } */
                fb.Literal(XValue.MakeInt(0));
                fb.DoLocal("->i");
                /* begin i len < while */
                fb.Begin();
                fb.DoLocal("i");
                fb.DoLocal("len");
                fb.Call("std::<");
                fb.AheadIfNot();
                fb.CSRoll(1);
                /*     i a1 @ i a2 @ = ifnot false ret then */
                fb.DoLocal("i");
                fb.DoLocal("a1");
                fb.Call("std::@");
                fb.DoLocal("i");
                fb.DoLocal("a2");
                fb.Call("std::@");
                fb.Call("std::=");
                fb.AheadIf();
                fb.Literal(false);
                fb.Ret();
                fb.Then();
                /*     i ++ ->i */
                fb.DoLocal("i");
                fb.Call("std::++");
                fb.DoLocal("->i");
                /* repeat */
                fb.Again();
                fb.Then();
                /* true ; */
                fb.Literal(true);
                fb.Ret();

                Function f = fb.Build();
                Function.Register("std::=", tArrayArray, f);

                /*
                 * The std::<> function is implemented by
                 * calling std::=, then negating.
                 */
                fb = new FunctionBuilder(
                    "std::<>");
                fb.Call("std::=");
                fb.Call("std::not");
                fb.Ret();
                f = fb.Build();
                Function.Register("std::<>", tArrayArray, f);
            }
        }
        else if (xt.arrayElementType != elementType)
        {
            throw new Exception(string.Format("type {0} already exists and is not an array of {1}", name, elementType.Name));
        }
        else if (xt.arrayElementEmbedded != embed)
        {
            throw new Exception(string.Format("elements of type {0} are {1}embedded", name, embed ? "not " : ""));
        }
        return(xt);
    }