Exemplo n.º 1
0
        public static void CmdMySqlQuery(TexFile file, StreamReader reader, bool single = false)
        {
            int idx;

            string texVariable   = "";
            string subVariable   = "";
            string query         = "";
            bool   isQuery       = false;
            bool   isSubVariable = false;

            while ((idx = reader.Read()) != -1)
            {
                char c = (char)idx;
                if (c == '{')
                {
                    continue;
                }

                if (c == '}' || c == '\r' || c == '\n')
                {
                    if (isQuery)
                    {
                        break;
                    }
                    isQuery = true;
                    continue;
                }

                if (isQuery)
                {
                    if (c == '!' && query.Length > 0 && query[^ 1..] == "!")
                    {
                        query         = query[..^ 1];
Exemplo n.º 2
0
        public static void Parse(string[] args)
        {
            RawArgs = args;
            if (args.Length == 0)
            {
                PrintHelp();
                return;
            }

            string currentArg = "";

            foreach (string arg in args)
            {
                if (arg.Trim().Length < 1)
                {
                    continue;
                }

                if (arg.Contains("-"))
                {
                    currentArg = arg;
                    continue;
                }

                if (currentArg == "" || currentArg == "-f" || currentArg == "--file")
                {
                    RootFile = new TexFile(arg);
                }
                else if (currentArg == "-o" || currentArg == "--output")
                {
                    Directory.CreateDirectory(arg);
                    OutputDir = arg;
                }
                else if (currentArg == "-h" || currentArg == "--help")
                {
                    PrintHelp();
                }

                currentArg = "";
            }

            if (RootFile == null)
            {
                return;
            }

            if (OutputDir == null)
            {
                OutputDir = Path.Combine(RootFile.DirectoryPath, "ArmiTex");
            }

            OutputFile = new TexFile(true);
        }