Пример #1
0
 public static void WriteStyle(XmlWriter writer, string name, int key, string className = null, Color?foreGround = null, Color?background = null, bool eolFilled = false, bool bold = false)
 {
     writer.WriteStartElement("style");
     writer.WriteAttributeString("name", name);
     writer.WriteAttributeString("key", key.ToString());
     if (className != null)
     {
         writer.WriteAttributeString("class", className);
     }
     if (foreGround.HasValue)
     {
         writer.WriteAttributeString("fore", HighlightingHelper.GetRPGString(foreGround.Value));
     }
     if (background.HasValue)
     {
         writer.WriteAttributeString("back", HighlightingHelper.GetRPGString(background.Value));
     }
     if (eolFilled)
     {
         writer.WriteAttributeString("eolfilled", eolFilled.ToString().ToLower());
     }
     if (bold)
     {
         writer.WriteAttributeString("bold", bold.ToString().ToLower());
     }
     writer.WriteEndElement();
 }
Пример #2
0
 public static void WriteStyle(XmlWriter writer, string name, int styleID, Color fgColor, Color bgColor, string fontName, int fontStyle, int?fontSize)
 {
     writer.WriteStartElement("WordsStyle");
     writer.WriteAttributeString("name", name);
     writer.WriteAttributeString("styleID", styleID.ToString());
     writer.WriteAttributeString("fgColor", HighlightingHelper.GetRPGString(fgColor));
     writer.WriteAttributeString("bgColor", HighlightingHelper.GetRPGString(bgColor));
     writer.WriteAttributeString("fontName", fontName);
     writer.WriteAttributeString("fontStyle", fontStyle.ToString());
     if (fontSize.HasValue)
     {
         writer.WriteAttributeString("fontSize", fontSize.Value.ToString());
     }
     writer.WriteEndElement();
 }
Пример #3
0
        private static int Main(string[] args)
        {
            TextWriterMessageLog writerMessageLog = new TextWriterMessageLog(Console.Error);
            StreamWriter         logWriter        = null;

            if ((Program.RunConfig = ReadProgramArguments(args, (ILog)writerMessageLog)) != null)
            {
                if (Program.RunConfig.errorFile != null)
                {
                    logWriter = new StreamWriter(Program.RunConfig.errorFile);
                    writerMessageLog.Writer = logWriter;
                }

                // doc generation does raw loading on its own, load in a standard manner for everything else
                if (Program.RunConfig.execType != ProgramRunConfig.RunExecType.GenDoc)
                {
                    Program.LoadCodes(false);
                }

                switch (Program.RunConfig.execType)
                {
                case ProgramRunConfig.RunExecType.GenDoc:
                    Program.MakeDoc(
                        Program.RunConfig.outputFile,
                        Program.RunConfig.rawsFolder,
                        Program.RunConfig.rawsExtension,
                        Program.RunConfig.isDirectory,
                        Program.RunConfig.docHeader,
                        Program.RunConfig.docFooter
                        );

                    break;

                case ProgramRunConfig.RunExecType.GenPNHighlight:
                    try {
                        HighlightingHelper.GetProgrammersNotepadlanguageDoc(
                            (IEnumerable <EACodeLanguage>)Program.Languages.Values,
                            Program.RunConfig.outputFile
                            );
                    } catch (Exception e) {
                        writerMessageLog.AddError(e.Message);
                    }

                    break;

                case ProgramRunConfig.RunExecType.GenNppHighlight:
                    throw new NotImplementedException();

                case ProgramRunConfig.RunExecType.Disassemble:
                    Program.Disassemble((ILog)writerMessageLog);
                    break;

                case ProgramRunConfig.RunExecType.Assemble:
                    Program.Assemble((ILog)writerMessageLog);
                    break;
                }
            }

            int exitStatus = 0;

            if (writerMessageLog.ErrorCount != 0)
            {
                exitStatus = 1;
            }

            if (Program.RunConfig == null || !Program.RunConfig.quiet)
            {
                writerMessageLog.PrintAll();
            }

            writerMessageLog.Clear();

            if (logWriter != null)
            {
                logWriter.Dispose();
            }

            return(exitStatus);
        }