ProcessCode() 공개 메소드

public ProcessCode ( string file ) : void
file string
리턴 void
예제 #1
0
        public static void LoadCodes(string rawsFolder, string extension, bool isDirectory, bool collectDocCodes)
        {
            languages = new Dictionary<string, EACodeLanguage>();
            LanguageProcessor pro = new LanguageProcessor(collectDocCodes,
                new TemplateComparer(), stringComparer);
            IPointerMaker<int> ptrMaker = new GBAPointerMaker();
            if (isDirectory)
            {
                pro.ProcessCode(rawsFolder, extension);
            }
            else
            {
                pro.ProcessCode(rawsFolder);
            }
            foreach (KeyValuePair<string, ICodeTemplateStorer> item in pro.Languages)
            {
                Tuple<string, List<Priority>>[][] pointerList;

                switch (item.Key)
                {
                    case "FE6":
                        pointerList = FE6CodeLanguage.PointerList;
                        break;
                    case "FE7":
                        pointerList = FE7CodeLanguage.PointerList;
                        break;
                    case "FE8":
                        pointerList = FE8CodeLanguage.PointerList;
                        break;
                    default:
                        throw new NotSupportedException("Language " + item.Key + " not supported.");
                }
                ICodeTemplateStorer storer = item.Value;
                if (item.Key == "FE8")
                {
                    storer.AddCode(new GenericFE8Template(), Priority.none);
                }
                EACodeLanguage language = new EACodeLanguage(
                    item.Key, ptrMaker,
                    pointerList,
                    storer, stringComparer
                    );
                languages[item.Key] = language;
            }
        }
예제 #2
0
        public static void MakeDoc(string output, string rawsFolder, 
            string extension, bool isDirectory, string header, string footer)
        {
            var pro = new LanguageProcessor(true,
                new TemplateComparer(), stringComparer);
            //IPointerMaker<int> ptrMaker = new GBAPointerMaker();
            if (isDirectory)
            {
                pro.ProcessCode(rawsFolder, extension);
            }
            else
            {
                pro.ProcessCode(rawsFolder);
            }
            using (StreamWriter writer = File.CreateText(output))
            {
                if (header != null)
                {
                    writer.WriteLine(File.ReadAllText(header));
                    writer.WriteLine();
                }

                pro.WriteDocs(writer);

                if (footer != null)
                {
                    writer.WriteLine(File.ReadAllText(footer));
                    writer.WriteLine();
                }
            }
        }
        public static void LoadCodes()
        {
            if (languages != null)
            {
                languages.Clear();
            }
            else
            {
                languages = new Dictionary<String, EACodeLanguage>();
            }

            LanguageProcessor processor = new LanguageProcessor(false,
                new TemplateComparer(), stringComparer);
            processor.ProcessCode("Language raws", ".txt");

            IPointerMaker ptrMaker = new GBAPointerMaker();

            foreach (KeyValuePair<string, ICodeTemplateStorer> item in processor.Languages)
            {
                Tuple<string, List<Priority>>[][] pointerList;

                switch (item.Key)
                {
                    case "FE6":
                        pointerList = FE6CodeLanguage.PointerList;
                        break;
                    case "FE7":
                        pointerList = FE7CodeLanguage.PointerList;
                        break;
                    case "FE8":
                        pointerList = FE8CodeLanguage.PointerList;
                        break;
                    default:
                        throw new NotSupportedException("Language " + item.Key + " not supported.");
                }
                EACodeLanguage language = new EACodeLanguage(
                    item.Key, ptrMaker,
                    pointerList,
                    item.Value, stringComparer
                    );
                language.MessageLog = messageLog;
                languages[item.Key] = language;
            }
        }