コード例 #1
0
        public StringCollector()
        {
            try{

            localizer = new LocalizerWithCollector();
            StringTable.gStringTable = localizer;

            }
            catch (Exception ex)
            {
                Debugger debugger = new Debugger(this);
                debugger.DebugError(this, "String collector creation failed",ex);
                debugger.EndDebugLog();

            }
        }
コード例 #2
0
        private void WriteStringFile()
        {
            try
            {
                List<string> strings = localizer.GetCollectedStrings();
                //debugger.Debug(this, "writing strings to file - count: " + strings.Count);
                uint fileHandle = 0u;
                string result = Simulator.CreateScriptErrorFile(ref fileHandle);
                if (fileHandle != 0u)
                {
                    // The XmlWriter has methods to write anything
                    CustomXmlWriter xmlWriter = new CustomXmlWriter(fileHandle);
                    foreach (string key in strings)
                    {
                        xmlWriter.WriteToBuffer(key);
                        xmlWriter.WriteToBuffer(System.Environment.NewLine);
                    }
                    xmlWriter.FlushBufferToFile();

                    Simulator.CloseScriptErrorFile(fileHandle);

                }

            }
            catch (Exception ex)
            {
                Debugger debugger = new Debugger(this);
                debugger.DebugError(this, "String collector failed to write file", ex);
                debugger.EndDebugLog();
            }
        }