Exemple #1
0
        static void Main(string[] args)
        {
            List <string>  lines   = new List <string>();
            List <CScript> scripts = new List <CScript>();

            string scriptlist = ".\\scripts.lst";

            if (!File.Exists(scriptlist))
            {
                ExitGracefully("scripts.lst not found");
            }

            lines.AddRange(File.ReadAllLines(scriptlist));



            foreach (string str in lines)
            {
                char[]   seperators = { ' ', '\t' };
                string[] tokens     = str.Split(seperators);

                if (tokens.Length < 3)
                {
                    continue;
                }

                if (tokens[0] == "$")
                {
                    CScript script = new CScript();
                    script.id = Convert.ToInt32(tokens[1]);

                    int num = new Int32();

                    for (int i = 2; i < tokens.Length; i++)
                    {
                        if (tokens[i] != "")
                        {
                            script.name = tokens[i];
                            num         = i;
                            break;
                        }
                    }

                    for (int i = num; i < tokens.Length; i++)
                    {
                        if (tokens[i] == "#")
                        {
                            script.description = String.Join(" ", tokens, i + 1, tokens.Length - (i + 1));
                            script.description = script.description.Trim();
                            break;
                        }
                    }
                    scripts.Add(script);
                }
            }

            Console.Out.WriteLine("Generating _scripts.fos...");
            GenerateScriptFile(scripts);
            ExitGracefully("Generation completed!");
        }
Exemple #2
0
        static void Main(string[] args)
        {
            List<string> lines = new List<string>();
            List<CScript> scripts = new List<CScript>();

            string scriptlist = ".\\scripts.lst";

            if (!File.Exists(scriptlist))
                ExitGracefully("scripts.lst not found");

            lines.AddRange(File.ReadAllLines(scriptlist));

            foreach (string str in lines)
            {
                char[] seperators = { ' ', '\t' };
                string[] tokens = str.Split(seperators);

                if (tokens.Length < 3)
                    continue;

                if (tokens[0] == "$")
                {
                    CScript script = new CScript();
                    script.id = Convert.ToInt32(tokens[1]);

                    int num = new Int32();

                    for (int i = 2; i < tokens.Length; i++)
                    {
                        if (tokens[i] != "")
                        {
                            script.name = tokens[i];
                            num = i;
                            break;
                        }
                    }

                    for (int i = num; i < tokens.Length; i++)
                    {
                        if (tokens[i] == "#")
                        {
                            script.description = String.Join(" ", tokens, i + 1, tokens.Length - (i + 1));
                            script.description = script.description.Trim();
                            break;
                        }
                    }
                    scripts.Add(script);
                }

            }

            Console.Out.WriteLine("Generating _scripts.fos...");
            GenerateScriptFile(scripts);
            ExitGracefully("Generation completed!");
        }