コード例 #1
0
        public override void writeOut(System.IO.StreamWriter sw, SqfConfigObjects.SqfConfigFile cfg)
        {
            string tab      = new string('\t', this.Parent.getAllParentsOf <Interfaces.iCodeBlock>().Count);
            var    caseList = this.Cases;

            if (caseList.Count == 0)
            {
                sw.WriteLine(tab + "default {");
            }
            else
            {
                foreach (var it in caseList)
                {
                    sw.Write(tab + "case ");
                    it.writeOut(sw, cfg);
                    sw.Write(":");
                }
                sw.WriteLine("{");
            }
            HelperClasses.PrintCodeHelpers.printPrivateArray(this, tab, sw, cfg);
            HelperClasses.PrintCodeHelpers.printCodeLines(this.CodeInstructions.GetRange(0, this.CodeInstructions.Count - 1), tab, sw, cfg);
            var lastInstruction = CodeInstructions.Last();

            if (!(lastInstruction is Break))
            {
                lastInstruction.writeOut(sw, cfg);
                sw.WriteLine(";");
            }
            sw.Write(tab + "}");
        }