Flush() public méthode

public Flush ( ) : void
Résultat void
Exemple #1
0
        /// <summary>
        /// For logging WARNING and higher severity.
        /// </summary>
        /// <param name="level">severity level</param>
        /// <param name="methodName">calling method</param>
        /// <param name="toLog">message to log</param>
        /// <param name="primaryState">class specific, appears before secondary state in log</param>
        /// <param name="secondaryState">class specific, appears before message in log</param>
        public void log(severity level, string methodName, string toLog, string primaryState = null, string secondaryState = null)
        {
            if (closed)
            {
                return;
            }
            lock_log.AcquireExclusive();
            try {
                if (logWriter == null)
                {
                    if (MyAPIGateway.Utilities == null || !createLog())
                    {
                        return;                         // cannot log
                    }
                }
                if (f_gridName != null)
                {
                    gridName = f_gridName.Invoke();
                }
                if (primaryState == null)
                {
                    if (f_state_primary != null)
                    {
                        default_primary = f_state_primary.Invoke();
                    }
                    primaryState = default_primary;
                }
                if (secondaryState == null)
                {
                    if (f_state_secondary != null)
                    {
                        default_secondary = f_state_secondary.Invoke();
                    }
                    secondaryState = default_secondary;
                }

                if (toLog == null)
                {
                    toLog = "no message";
                }
                if (numLines >= maxNumLines)
                {
                    return;
                }

                numLines++;
                appendWithBrackets(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss,fff"));
                appendWithBrackets(level.ToString());
                appendWithBrackets(gridName);
                appendWithBrackets(className);
                appendWithBrackets(methodName);
                appendWithBrackets(primaryState);
                appendWithBrackets(secondaryState);
                stringCache.Append(toLog);

                logWriter.WriteLine(stringCache);
                logWriter.Flush();
                stringCache.Clear();
            } catch { } finally { lock_log.ReleaseExclusive(); }
        }
Exemple #2
0
	/**
	 * Prettyprint the object to the outputstream.
	 */
	public static void print(object o, TextWriter w, bool typeheader) {
		if (o == null) {
			if(typeheader) w.WriteLine("null object");
			w.WriteLine("null");
			w.Flush();
			return;
		}

		if (o is IDictionary) {
			if(typeheader) w.WriteLine("hashtable");
			IDictionary map=(IDictionary)o;
			w.Write("{");
			foreach(object key in map.Keys) {
				w.Write(key.ToString()+"="+map[key].ToString()+", ");
			}
			w.WriteLine("}");
		} else if (o is string) {
			if(typeheader) w.WriteLine("String");
			w.WriteLine(o.ToString());
		} else if (o is DateTime) {
			if(typeheader) w.WriteLine("DateTime");
			w.WriteLine((DateTime)o);
		} else if (o is IEnumerable) {
			if(typeheader) w.WriteLine(o.GetType().Name);
			writeEnumerable(o, w);
			w.WriteLine("");
		} else {
			if(typeheader) w.WriteLine(o.GetType().Name);
			w.WriteLine(o.ToString());
		}
		
		w.Flush();
	}
        /**
         * Constructor
         *
         * @param w The workbook to interrogate
         * @param out The output stream to which the CSV values are written
         * @param encoding The encoding used by the output stream.  Null or
         * unrecognized values cause the encoding to default to UTF8
         * @exception java.io.IOException
         */
        public Escher(Workbook w, TextWriter os, string encoding)
        {
            if (encoding == null || encoding == "UnicodeBig")
                {
                encoding = "UTF8";
                }

            try
                {
                for (int i = 0; i < w.getNumberOfSheets(); i++)
                    {
                    SheetImpl s = (SheetImpl)w.getSheet(i);
                    os.Write(s.getName());
                    os.WriteLine();
                    os.WriteLine();

                    DrawingData dd = s.getDrawingData();

                    if (dd != null)
                        {
                        EscherDisplay ed = new EscherDisplay(dd, os);
                        ed.display();
                        }

                    os.WriteLine();
                    os.WriteLine();
                    os.Flush();
                    }
                os.Flush();
                }
            catch (Exception e)
                {
                Console.WriteLine(e);
                }
        }
Exemple #4
0
        public static void TextNullTextWriter(TextWriter output)
        {
            output.Flush();
            output.Dispose();

            output.WriteLine(decimal.MinValue);
            output.WriteLine(Math.PI);
            output.WriteLine();
            output.Flush();
            output.Dispose();
        }
        public override void Emit(TextWriter outputWriter)
        {

            if(TableNavigator.Select("rc:DefaultValues/rc:Value",VulcanPackage.VulcanConfig.NamespaceManager).Count == 0)
            {
                outputWriter.Flush();
                return;
            }

            StringBuilder columnBuilder = new StringBuilder();

            bool containsIdentities = _tableHelper.KeyColumnType == KeyColumnType.Identity;
            foreach (XPathNavigator nav in TableNavigator.Select("rc:Columns/rc:Column", VulcanPackage.VulcanConfig.NamespaceManager))
            {
                /* Build Column List */
                string columnName = nav.SelectSingleNode("@Name", VulcanPackage.VulcanConfig.NamespaceManager).Value;

                columnBuilder.AppendFormat(
                     "[{0}],",
                     columnName
                 );
            }

            columnBuilder.Remove(columnBuilder.Length - 1, 1);

            if (containsIdentities)
            {
                outputWriter.Write("\n");
                outputWriter.Write(String.Format(System.Globalization.CultureInfo.InvariantCulture,"\nSET IDENTITY_INSERT {0} ON\n", TableName));
            }
            TemplateEmitter te = new TemplateEmitter("InsertDefaultValues",VulcanPackage,null);

            outputWriter.Write("\n");
            foreach (XPathNavigator nav in TableNavigator.Select("rc:DefaultValues/rc:Value", VulcanPackage.VulcanConfig.NamespaceManager))
            {
                te.SetParameters(TableName, columnBuilder.ToString(),nav.Value);
                te.Emit(outputWriter);
                outputWriter.Write("\n"); ;
            }

            if (containsIdentities)
            {
                outputWriter.Write(String.Format(System.Globalization.CultureInfo.InvariantCulture,"\nSET IDENTITY_INSERT {0} OFF", TableName));
            }

            outputWriter.Write("\nGO\n");
            outputWriter.Flush();
        }
        public void Evaluate(IDictionary<string, object> context, TextReader input, TextWriter output)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }

            if (input == null)
            {
                throw new ArgumentNullException("input");
            }

            if (output == null)
            {
                throw new ArgumentNullException("output");
            }

            var vctx = this.CreateVelocityContext(context);

            //执行渲染
            var successed = this.engine.Evaluate(vctx, output, "VelocityTextTemplateEngine", input);
            output.Flush();

            if (!successed)
            {
                throw new TemplateException("Failed to render template");
            }
        }
        /**
         * Constructor
         *
         * @param w The workbook to interrogate
         * @param out The output stream to which the CSV values are written
         * @param encoding The encoding used by the output stream.  Null or
         * unrecognized values cause the encoding to default to UTF8
         * @exception java.io.IOException
         */
        public EscherDrawingGroup(Workbook w, TextWriter os, string encoding)
        {
            if (encoding == null || encoding != "UnicodeBig")
                {
                encoding = "UTF8";
                }

            try
                {
                WorkbookParser wp = (WorkbookParser)w;

                DrawingGroup dg = wp.getDrawingGroup();

                if (dg != null)
                    {
                    EscherDisplay ed = new EscherDisplay(dg, os);
                    ed.display();
                    }

                os.WriteLine();
                os.WriteLine();
                os.Flush();
                }
            catch (Exception e)
                {
                Console.WriteLine(e);
                }
        }
Exemple #8
0
		public static void GenerateResult (TextReader sr, TextWriter sw, Uri baseUri)
		{
			while (sr.Peek () > 0) {
				string uriString = sr.ReadLine ();
				if (uriString.Length == 0 || uriString [0] == '#')
					continue;
				Uri uri = (baseUri == null) ?
					new Uri (uriString) : new Uri (baseUri, uriString);

				sw.WriteLine ("-------------------------");
				sw.WriteLine (uriString);
				sw.WriteLine (uri.ToString ());
				sw.WriteLine (uri.AbsoluteUri);
				sw.WriteLine (uri.Scheme);
				sw.WriteLine (uri.Host);
				sw.WriteLine (uri.LocalPath);
				sw.WriteLine (uri.Query);
				sw.WriteLine (uri.Port);
				sw.WriteLine (uri.IsFile);
				sw.WriteLine (uri.IsUnc);
				sw.WriteLine (uri.IsLoopback);
				sw.WriteLine (uri.UserEscaped);
				sw.WriteLine (uri.HostNameType);
				sw.WriteLine (uri.AbsolutePath);
				sw.WriteLine (uri.PathAndQuery);
				sw.WriteLine (uri.Authority);
				sw.WriteLine (uri.Fragment);
				sw.WriteLine (uri.UserInfo);
				sw.Flush ();
			}
			sr.Close ();
			sw.Close ();
		}
 public LogTextWriter(string filePath, string prefix = null, string suffix = null, string newline = "\n")
 {
     _outputQueue = new ConcurrentQueue<string>();
     _outputRun = 1;
     _outputThread = new Thread(() =>
     {
         string o;
             using (FileStream _fs = File.Open(filePath, FileMode.Create, FileAccess.ReadWrite, FileShare.Read))
             {
         _innerWriter = new StreamWriter(_fs);
         _innerWriter.NewLine = newline;
         while (Thread.VolatileRead(ref _outputRun) == 1 || _outputQueue.Count > 0)
         {
             if (_outputQueue.Count > 0)
             {
                 while (_outputQueue.TryDequeue(out o))
                     _innerWriter.Write(o);
                 _innerWriter.Flush();
             }
             else
                 Thread.Sleep(_outputThreadDelay);
         }
     //				_fs.Close();
         _innerWriter.Close();
             }
     });
     _outputThread.Priority = ThreadPriority.BelowNormal;
     _outputThread.Start();
     _prefix = prefix;
     _suffix = suffix;
 }
        public void Render(ViewContext viewContext, TextWriter writer)
        {
            var content = Razor.Parse(template, viewContext.ViewData.Model, cacheName);

            writer.Write(content);
            writer.Flush();
        }
        private static void WriteExtensionClass(Type type, TextWriter output)
        {
            var usingNamespaces = new SortedSet<string>
            {
                type.Namespace,
                "System.Reactive",
                "System.Reactive.Linq"
            };

            var builder = new StringBuilder();
            builder.AppendLine("namespace EventToObservableReflection");
            builder.AppendLine("{");
            builder.AppendLine(string.Format("\tpublic static class {0}EventToObservableExtensions", type.Name));
            builder.AppendLine("\t{");

            foreach (var e in type.GetEvents())
            {
                WriteExtensionMethod(type, e, builder, usingNamespaces);
            }

            builder.AppendLine("\t}");
            builder.AppendLine("}");

            foreach (var ns in usingNamespaces)
            {
                output.WriteLine("using {0};", ns);
            }

            output.WriteLine();
            output.WriteLine(builder.ToString());
            output.Flush();
        }
Exemple #12
0
        private StreamResponseAction ExportFlush()
        {
            try
            {
                _textWriter.Flush();
                byte[] bytesInStream = _memoryStream.ToArray();
                _memoryStream.Close();

                string contentDisposition = "attachment;filename=\"" + GetFileName(_iD, _datasetRenderer.StandardFileExtension) + "\"";

                if ((bytesInStream.Length / 1000) > _maxContent)
                {
                    this.HttpContext.Response.Clear();
                    return(new StreamResponseAction("HTML result out of range"));
                }
                else
                {
                    this.HttpContext.Response.Clear();
                    this.HttpContext.Response.ContentType = _datasetRenderer.MimeType;
                    this.HttpContext.Response.AddHeader("content-disposition", contentDisposition);
                    this.HttpContext.Response.BinaryWrite(bytesInStream);
                    this.HttpContext.Response.End();
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(null);
        }
Exemple #13
0
        /// <summary>
        /// Write all settings to file. Only server should call this!
        /// </summary>
        private void writeAll()
        {
            try
            {
                settingsWriter = MyAPIGateway.Utilities.WriteFileInLocalStorage(settings_file_name, typeof(ServerSettings));

                write(strVersion, m_currentVersion.ToString());                 // must be first line

                // write settings
                foreach (KeyValuePair <SettingName, Setting> pair in AllSettings)
                {
                    write(pair.Key.ToString(), pair.Value.ValueAsString());
                }

                settingsWriter.Flush();
            }
            catch (Exception ex)
            { Logger.AlwaysLog("Failed to write settings to " + settings_file_name + ": " + ex, Rynchodon.Logger.severity.WARNING); }
            finally
            {
                if (settingsWriter != null)
                {
                    settingsWriter.Close();
                    settingsWriter = null;
                }
            }
        }
Exemple #14
0
 public static void WriteToStream(TextWriter stream, DataTable table, bool header, bool quoteall)
 {
     if (header)
     {
         for (int i = 0; i < table.Columns.Count; i++)
         {
             WriteItem(stream, table.Columns[i].Caption, quoteall);
             if (i < table.Columns.Count - 1)
                 stream.Write(',');
             else
                 stream.Write("\r\n");
         }
     }
     foreach (DataRow row in table.Rows)
     {
         for (int i = 0; i < table.Columns.Count; i++)
         {
             WriteItem(stream, row[i], quoteall);
             if (i < table.Columns.Count - 1)
                 stream.Write(',');
             else
                 stream.Write("\r\n");
         }
     }
     stream.Flush();
     stream.Close();
 }
        public void Save(IGraph g, TextWriter output)
        {
            JToken flattened = MakeExpandedForm(g);

            output.Write(flattened.ToString(Formatting.None, new JsonConverter[0]));
            output.Flush();
        }
 /// <summary>
 /// Writes the current line to the file using the given open text writer.
 /// This clears the current line after writing.
 /// </summary>
 public void WriteCurrentLineToFile( TextWriter writer )
 {
     line = line.TrimEnd( delimiter );
     writer.WriteLine( line );
     writer.Flush();
     line = "";
 }
        public void Save(IGraph g, TextWriter output)
        {
            JToken flattened = MakeExpandedForm(g);

            output.Write(flattened);
            output.Flush();
        }
 public static void GenerateScript(ProcessDef pd, TextWriter output)
 {
     
     var gd = new ProcessBooScriptGenerator(output);
     gd.GenerateScript(pd);
     output.Flush();
 }
Exemple #19
0
 private static void SaveToFile(string fileName)
 {
     SOPOWriter.Write(sb.ToString());
     SOPOWriter.Flush();
     sb.Clear();
     //w.Close();
 }
 private void IRCOutputProcedure(System.IO.TextWriter output)
 {
     System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
     stopWatch.Start();
     while (!stopThreads)
     {
         lock (commandQueue)
         {
             if (commandQueue.Count > 0) //do we have any commands to send?
             {
                 // https://github.com/justintv/Twitch-API/blob/master/IRC.md#command--message-limit
                 //have enough time passed since we last sent a message/command?
                 if (stopWatch.ElapsedMilliseconds > 1750)
                 {
                     //send msg.
                     output.WriteLine(commandQueue.Peek());
                     output.Flush();
                     //remove msg from queue.
                     commandQueue.Dequeue();
                     //restart stopwatch.
                     stopWatch.Reset();
                     stopWatch.Start();
                 }
             }
         }
     }
 }
Exemple #21
0
 /// <summary>
 /// Generate the actual code to the given writer.
 /// </summary>
 public void Generate(TextWriter writer)
 {
     var provider = CodeDomProvider.CreateProvider("CSharp");
     var options = new CodeGeneratorOptions { BracingStyle = "C" };
     provider.GenerateCodeFromCompileUnit(codeCompileUnit, writer, options);
     writer.Flush();
 }
Exemple #22
0
        /// <summary>
        /// Renders the view into the given <see cref="TextWriter"/>.
        /// </summary>
        /// <param name="viewContext">Contains the view data model.</param>
        /// <param name="writer">The <see cref="TextWriter"/> used to write the rendered output.</param>
        public void Render(ViewContext viewContext, TextWriter writer)
        {
            var content = Razor.Parse(_template, viewContext.ViewData.Model, _resourcePath);

            writer.Write(content);
            writer.Flush();
        }
Exemple #23
0
    // Use this for initialization
    void Awake()
    {
        //Get nick, owner, server, port, and channel from user
        pass = "******";
        nick = "lightzors";
        owner = "lightzors";
        server = "irc.twitch.tv";
        port = 6667;
        chan = "#fifaralle";

        //Connect to irc server and get input and output text streams from TcpClient.
        sock.Connect(server, port);
        if (!sock.Connected)
        {
            Debug.Log("Failed to connect!");
        }
        else
        {
            //Input credentials
            input = new System.IO.StreamReader(sock.GetStream());
            output = new System.IO.StreamWriter(sock.GetStream());
            output.Write(
              "PASS " + pass + "\r\n" + "USER " + nick + " 0 * :" + owner + "\r\n" +
              "NICK " + nick + "\r\n"
           );
            output.Flush();
            //Initialize IRC checking
            StartCoroutine("Refresh");
        }
    }
        /// <summary>
        /// Primary constructor
        /// </summary>
        public saveVolume(string u, string p)
        {
            m_username = u;
            m_password = p;
   
            OutputFolder = TA.DirectoryNames.GetDirectoryName(ext: "ttapiContractVolume") + 
                TA.DirectoryNames.GetDirectoryExtension(DateTime.Now.Date);
            System.IO.Directory.CreateDirectory(OutputFolder);

            ilsUpdateList = new List<EventHandler<InstrumentLookupSubscriptionEventArgs>>();

            sw = new StreamWriter(OutputFolder + "/ContractList.csv");

            sw.WriteLine("{0},{1},{2},{3},{4}", "InstrumentName",
                        "MarketKey",
                        "ProductType",
                        "ProductName",
                        "Volume");

            sw.Flush();

            TTAPISubs = new ttapiUtils.Subscription(m_username, m_password);

            IlsDictionary = TTAPISubs.IlsDictionary;
            
            TTAPISubs.asu_update = TTAPISubs.startProductLookupSubscriptions;
            TTAPISubs.PLSEventHandler = TTAPISubs.Subscribe2InstrumentCatalogs;
            TTAPISubs.ICUEventHandler = TTAPISubs.StartInstrumentLookupSubscriptionsFromCatalog;

            ilsUpdateList.Add(TTAPISubs.startPriceSubscriptions);
            TTAPISubs.priceUpdatedEventHandler = WriteVolume2File;

            TTAPISubs.ilsUpdateList = ilsUpdateList;

        }
Exemple #25
0
        static int Main(string[] args)
        {
            try
            {
                if (!File.Exists(templateName))
                {
                    Console.WriteLine(templateName + " not found."); return 1;
                }

                try
                {
                    fStream = new FileStream(@"FreeImage.cs", FileMode.Create);
                }
                catch
                {
                    Console.WriteLine("Unable to create output file."); return 2;
                }

                textOut = new StreamWriter(fStream);

                string[] content = File.ReadAllLines(templateName);

                for (int lineNumber = 0; lineNumber < content.Length; lineNumber++)
                {
                    string line = content[lineNumber].Trim();
                    Match match = searchPattern.Match(line);

                    if (match.Success && match.Groups.Count == 2 && match.Groups[1].Value != null)
                    {
                        if (!File.Exists(baseFolder + match.Groups[1].Value))
                        {
                            throw new FileNotFoundException(baseFolder + match.Groups[1].Value + " does not exist.");
                        }

                        ParseFile(baseFolder + match.Groups[1].Value);
                    }
                    else
                    {
                        textOut.WriteLine(content[lineNumber]);
                    }
                }

                return 0;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.ToString());
                //Console.WriteLine("Error while parsing.");
                return 3;
            }
            finally
            {
                if (textOut != null)
                {
                    textOut.Flush();
                    textOut.Close();
                }
            }
        }
 public void Fill(TextWriter writer)
 {
     for (int i = 1; i <= _numberOfLines; i++)
     {
         writer.WriteLine("This is line {0}.", i);
     }
     writer.Flush();
 }
        public void AppendToFile(TextWriter writer)
        {
            Guard.NotNull(writer, "writer");

            var sb =  new StringBuilder();
            writer.WriteLine("{0}\t{1}", Index, WriteTime(new StringBuilder(), Display.Days, 3, CultureInfo.InvariantCulture));
            writer.Flush();
        }
Exemple #28
0
        /// <summary>
        /// Renders the template.
        /// </summary>
        /// <param name="data">The data to use to render the template.</param>
        /// <param name="writer">The object to write the output to.</param>
        /// <param name="templateLocator">The delegate to use to locate templates for inclusion.</param>
        /// <remarks>
        /// The <paramref name="writer" /> is flushed, but not closed or disposed.
        /// </remarks>
        public void Render(object data, TextWriter writer, TemplateLocator templateLocator)
        {
            var context = new RenderContext(this, data, writer, templateLocator);

            Render(context);

            writer.Flush();
        }
 public static MessageStreamToCsvActivity WriteDataTo(IMessageStream reader, TextWriter writer)
 {
     var p = new MessageStreamToCsvActivity(reader, writer);
      p.WriteHeader();
      p.WriteData();
      writer.Flush();
      return p;
 }
Exemple #30
0
 private static void Log(string logMessage, TextWriter w)
 {
     lock (_logObject)
     {
         w.WriteLine("[{0}]: {1}", DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss"), logMessage);
         w.Flush();
     }
 }
Exemple #31
0
 public static void Log(string logMessage, TextWriter w)
 {
     lock (g_syncObject)
     {
         w.WriteLine("{0} {1} : {2}", DateTime.Now.ToLongTimeString(), DateTime.Now.ToLongDateString(), logMessage);
         w.Flush();
     }
 }
 public static DataReaderToCsvActivity WriteDataTo(IDataReader reader, TextWriter writer)
 {
     var p = new DataReaderToCsvActivity(reader, writer);
      p.WriteHeader();
      p.WriteData();
      writer.Flush();
      return p;
 }
Exemple #33
0
 public static void LogIt(String logMessage, TextWriter writer)
 {
     lock(_syncObject)
     {
         writer.WriteLine(logMessage);
         writer.Flush();
     }
 }
 /// <summary>
 /// Render a view.
 /// </summary>
 /// <param name="writer"></param>
 /// <param name="context"></param>
 /// <param name="viewData"></param>
 public void Render(TextWriter writer, ControllerContext context, IViewData viewData)
 {
     foreach (IViewEngine engine in _viewEngines.Values)
     {
         engine.Render(context, viewData, writer);
         writer.Flush();
     }
 }
 internal void GeneratePage(PortalPage page, TextWriter markupWriter, TextWriter codeBehindWriter)
 {
     InitContext(page);
     _markupTemplate.ApplyTemplate(markupWriter, _context);
     _codeTemplate.ApplyTemplate(codeBehindWriter, _context);
     markupWriter.Flush();
     codeBehindWriter.Flush();
 }
        public static void Flush()
        {
            if (Tw == null)
            {
                return;
            }

            Tw.Flush();
        }
Exemple #37
0
 private void writeJson(System.IO.TextWriter textWriter, IList <UserSummary> summaries)
 {
     textWriter.Write("[");
     foreach (UserSummary user in summaries)
     {
         textWriter.Write("{3}Rank:{0}, Reputation:{1}, Name:'{2}'{4},", user.Rank, user.Reputation, user.Name.Replace("\\", "\\\\").Replace("'", "\\'"), "{", "}");
     }
     textWriter.Write("]");
     textWriter.Flush();
 }
Exemple #38
0
 private void writeHtml(System.IO.TextWriter textWriter, IList <UserSummary> summaries)
 {
     textWriter.WriteLine("<table><tr><th>Rank</th><th>Reputation</th><th>Name</th></tr>");
     foreach (UserSummary user in summaries)
     {
         textWriter.WriteLine("<tr><td>{0}</td><td>{1}</td><td>{2}</td></tr>", user.Rank, user.Reputation, user.Name);
     }
     textWriter.Write("</table>");
     textWriter.Flush();
 }
Exemple #39
0
 public override void CreateIndexFile(string path)
 {
     using (System.IO.TextWriter texList = File.CreateText(Path.Combine(path, "index.txt")))
     {
         foreach (gcaxMLTEntry entry in Entries)
         {
             texList.WriteLine("{0},{1}", entry.Name, entry.BankID.ToString("D2"));
         }
         texList.Flush();
         texList.Close();
     }
 }
Exemple #40
0
 public void Emit(LogEvent logEvent)
 {
     if (logEvent == null)
     {
         throw new ArgumentNullException(nameof(logEvent));
     }
     lock (_syncRoot)
     {
         _textFormatter.Format(logEvent, _textWriter);
         _textWriter.Flush();
     }
 }
Exemple #41
0
        public void WriteCsSources(EntityApp app, DbFirstConfig config)
        {
            _app      = app;
            _config   = config;
            HasErrors = false;
            var fileStream = File.Create(_config.OutputPath);

            _output = new StreamWriter(fileStream);
            WriteSource();
            _output.Flush();
            _output.Dispose();
        }//method
Exemple #42
0
        /// <summary>
        /// Close this file and release internal resources.
        /// </summary>

        public void Dispose()
        {
            if (!isDisposed)
            {
                if (writer != null)
                {
                    writer.Flush();
                    writer.Dispose();
                    writer = null;
                }

                isDisposed = true;
            }
        }
Exemple #43
0
 /// <summary>
 /// Create an entry prepended by the instance-name and time-stamp with the given content.
 /// </summary>
 /// <param name="text">The content of the line to be written.</param>
 public void WriteLine(string text)
 {
     if (isTerminated)
     {
         return;
     }
     // We check for waiting content in the cache...
     if (m_cache.Length > 0)
     {
         // and write any of it to the file.
         m_writer.WriteLine(m_cache);
     }
     // Now we erase the cache's contents...
     m_cache.Clear();
     // We add the entry name and the timestamp in brackets and flanked by tabs.
     m_cache.Append("{" + entryName + "}" + DateTime.Now.ToString("\t[HH:mm:ss.ffffff]\t"));
     // Then we write the text that was specified.
     m_writer.WriteLine(m_cache.Append(text));
     // Then we empty the writer's buffer out.
     m_writer.Flush();
     // Now we erase the cache's contents.
     m_cache.Clear();
 }
Exemple #44
0
/*************************************************************************************************************************/
        public void flush_record_file()
        {
            Log.PushStackInfo("FMRS_THL.flush_record_file", "FMRS_THL_Log: entering flush_record_file()");
            Log.dbg("FMRS_THL_Log: flush record file");

            IO.TextWriter writer = IO.File.CreateText(FMRS.FILES.RECORD_TXT);
            writer.Flush();
            writer.Close();

            Throttle_Log_Buffer.Clear();
            temp_buffer.Clear();

            Log.PopStackInfo("FMRS_THL_Log: leave flush_record_file()");
        }
        public virtual void Output(string text, Level level)
        {
            if (Threshold <= level)
            {
                MainConsole.TriggerLog(level.ToString(), text);
                text = string.Format("{0}:{1}:{2}: {3}",
                                     (DateTime.Now.Hour < 10 ? "0" + DateTime.Now.Hour : DateTime.Now.Hour.ToString()),
                                     (DateTime.Now.Minute < 10 ? "0" + DateTime.Now.Minute : DateTime.Now.Minute.ToString()),
                                     (DateTime.Now.Second < 10 ? "0" + DateTime.Now.Second : DateTime.Now.Second.ToString()), text);

                Console.WriteLine(text);
                if (m_logFile != null)
                {
                    m_logFile.WriteLine(text);
                    m_logFile.Flush();
                }
            }
        }
Exemple #46
0
 public override void CreateIndexFile(string path)
 {
     using (System.IO.TextWriter texList = File.CreateText(Path.Combine(path, "index.txt")))
     {
         foreach (MLTEntry entry in Entries)
         {
             texList.WriteLine("{0},{1},{2},{3}", entry.Name, entry.BankID.ToString("D2"), entry.LoadAddress.ToString("X"), entry.AllocatedMemory.ToString());
         }
         texList.Flush();
         texList.Close();
     }
     using (System.IO.TextWriter verList = File.CreateText(Path.Combine(path, "version.txt")))
     {
         verList.WriteLine(Version);
         verList.WriteLine(Revision);
         verList.Flush();
         verList.Close();
     }
 }
        /// <summary>
        /// Writes documentation string using a given TextWriter object.
        /// Uses HelpString properties of Option and ProgramSettings objects.
        /// </summary>
        /// <param name="writer">System.IO.TextWriter object used to write documentation.</param>
        /// <exception cref="System.ArgumentException">Thrown if writer is null.</exception>
        public void PrintHelp(System.IO.TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentException(Properties.Resources.ProgramSettings_PrintHelp_WriterNull);
            }
            printHelpHeader(writer);
            writer.WriteLine();

            printGNUOptions(writer);
            writer.WriteLine();

            printGNUStandardOptions(writer);
            writer.WriteLine();

            printPlainArguments(writer);
            writer.WriteLine();

            writer.Flush();
        }
Exemple #48
0
/*************************************************************************************************************************/
        public void write_save_values_to_file()
        {
            Log.PushStackInfo("FMRS_Util.write_save_values_to_file", "entering write_save_values_to_file()");

            set_save_value(save_cat.SETTING, "Window_X", Convert.ToInt32(windowPos.x).ToString());
            set_save_value(save_cat.SETTING, "Window_Y", Convert.ToInt32(windowPos.y).ToString());
            set_save_value(save_cat.SETTING, "Armed", _SETTING_Armed.ToString());
            set_save_value(save_cat.SETTING, "Minimized", _SETTING_Minimize.ToString());
            set_save_value(save_cat.SETTING, "Enabled", _SETTING_Enabled.ToString());
            //set_save_value(save_cat.SETTING, "Messages", _SETTING_Messages.ToString());
            //set_save_value(save_cat.SETTING, "Auto_Cut_Off", _SETTING_Auto_Cut_Off.ToString());
            //set_save_value(save_cat.SETTING, "Auto_Recover", _SETTING_Auto_Recover.ToString());
            //set_save_value(save_cat.SETTING, "Throttle_Log", _SETTING_Throttle_Log.ToString());
            set_save_value(save_cat.SAVE, "Main_Vessel", _SAVE_Main_Vessel.ToString());
            set_save_value(save_cat.SAVE, "Has_Launched", _SAVE_Has_Launched.ToString());
            set_save_value(save_cat.SAVE, "Launched_At", _SAVE_Launched_At.ToString());
            set_save_value(save_cat.SAVE, "Flight_Reset", _SAVE_Flight_Reset.ToString());
            set_save_value(save_cat.SAVE, "Kick_To_Main", _SAVE_Kick_To_Main.ToString());
            set_save_value(save_cat.SAVE, "Switched_To_Dropped", _SAVE_Switched_To_Dropped.ToString());
            set_save_value(save_cat.SAVE, "Switched_To_Savefile", _SAVE_Switched_To_Savefile);
            set_save_value(save_cat.SAVE, "SaveFolder", _SAVE_SaveFolder);

            write_vessel_dict_to_Save_File_Content();

            IO.TextWriter file = IO.File.CreateText(FILES.SAVE_TXT);
            file.Flush();
            file.Close();
            file = IO.File.CreateText(FILES.SAVE_TXT);
            foreach (KeyValuePair <save_cat, Dictionary <string, string> > save_cat_block in Save_File_Content)
            {
                foreach (KeyValuePair <string, string> writevalue in save_cat_block.Value)
                {
                    file.WriteLine(save_cat_toString(save_cat_block.Key) + "=" + writevalue.Key + "=" + writevalue.Value);
                }
            }
            file.Close();

            Log.dbg("Save File written in private void write_save_values_to_file()");
            Log.PopStackInfo("leaving save_values_to_file()");
        }
Exemple #49
0
        private void Log(string msg)
        {
            //we only hold 1000 lines and we throw it all away when you get that many
            if (logger != null && logLineCount > 1000)
            {
                logger.Close();
                logger = null;
            }
            try
            {
                if (logger == null)
                {
                    logger = new StreamWriter(logFilePath, false);
                }

                logger.WriteLine(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + " " + msg);
                logger.Flush();
                ++logLineCount;
            }
            catch (Exception)
            {
            }
        }
Exemple #50
0
 public override void Flush()
 {
     lock (this) {
         writer.Flush();
     }
 }
        private void BT_ok_Click(object sender, EventArgs e)
        {
            string[] lista = retornaQueris();
            this.queryAccuracy  = lista[0];
            this.queryEficience = lista[1];
            Accuracy        accuracy     = new Accuracy(this);
            List <DBEntity> accuracyData = accuracy.getDataSource(this.queryAccuracy);

            //string folder = @"C:\Dados";

            if (!System.IO.File.Exists(nome_arquivo_accuracy))
            {
                System.IO.File.Create(nome_arquivo_accuracy).Close();
            }

            System.IO.TextWriter arquivo_accuracy = System.IO.File.AppendText(this.nome_arquivo_accuracy);
            arquivo_accuracy.Flush();
            arquivo_accuracy.WriteLine("");
            arquivo_accuracy.WriteLine("");
            arquivo_accuracy.WriteLine("Analise realizada em: " + DateTime.Now.ToString());
            arquivo_accuracy.WriteLine("");
            arquivo_accuracy.WriteLine("id_pergunta | media | moda | mediana | variancia | a_01 | a_50 | a_99 | b_01 | b_50 | b_99 | padrao_calibracao | sr_t_quadratico | sr_t_quadraticoOrdenado | sr_quadratico | sr_quadraticoOrdenado | sr_t_logaritimico | sr_t_logaritimicoOrdenado | sr_logaritimico | sr_logaritimicoOrdenado | sr_t_esferico | sr_t_esfericoOrdenado | sr_esferico | sr_esfericoOrdenado | sr_shiquadrado | sr_kullback | precision | bb_parameters | id_processos | id_especialista | idProject | idElicitationMethod | idTrainingMethod | idAnalyst | index_lastTrainingQuestion | index_lastElicitationQuestion | name_project | name_analyst | idExpert | intimityMath | intimityUncertainty | expertiseField | email | id_titulacao | titulacao | especialidade");//"(1)id_estatisticas | (2)media | (3)moda | (4)mediana | (5)variancia | (6)a_01 | (7)a_50 | (8)a_99 | (9)b_01 | (10)b_50 | (11)b_99 | (12)padrao_calibracao | (13)sr_t_quadratico | (14)sr_t_quadraticoOrdenado | (15)sr_quadratico | (16)sr_quadraticoOrdenado | (17)sr_t_logaritimico | (18)sr_t_logaritimicoOrdenado | (19)sr_logaritimico | (20)sr_logaritimicoOrdenado | (21)sr_t_esferico | (22)sr_t_esfericoOrdenado | (23)sr_esferico | (24)sr_esfericoOrdenado | (25)sr_shiquadrado | (26)sr_kullback | (27)id_processos | (28)id_especialista | (29)idProject | (30)idElicitationMethod | (31)idTrainingMethod | (32)idAnalyst | (33)index_lastTrainingQuestion | (34)index_lastElicitationQuestion | (35)name_project | (36)name_analyst | (37)idExpert | (38)intimityMath | (39)intimityUncertainty | (40)expertiseField | (41)email | (42)id_titulacao | (43)titulacao | (44)especialidade"
            //arquivo_accuracy.WriteLine ("");
            arquivo_accuracy.Flush();

            try{
                //for (int i = accuracyData.Count-1; i >0 ; i--) {
                //    Accuracy acc_i = (Accuracy )accuracyData[i];
                //    if(acc_i.id_pergunta == ((Accuracy)accuracyData[i-1]).id_pergunta)
                //        accuracyData.RemoveAt (i);
                //}
                for (int i = 0; i < accuracyData.Count; i++)
                {
                    Accuracy acc_i = (Accuracy )accuracyData[i];
                    arquivo_accuracy.Write(acc_i.id_pergunta.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.media.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.moda.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.mediana.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.variancia.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.a_01.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.a_50.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.a_99.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.b_01.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.b_50.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.b_99.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.padrao_calibracao.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_t_quadratico.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_t_quadraticoOrdenado.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_quadratico.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_quadraticoOrdenado.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_t_logaritimico.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_t_logaritimicoOrdenado.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_logaritimico.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_logaritimicoOrdenado.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_t_esferico.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_t_esfericoOrdenado.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_esferico.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_esfericoOrdenado.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_shiquadrado.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.sr_kullback.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.precision.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.bb_parameters.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.id_processos.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.id_especialista.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.idProject.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.idElicitationMethod.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.idTrainingMethod.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.idAnalyst + " | ");
                    arquivo_accuracy.Write(acc_i.index_lastTrainingQuestion + " | ");
                    arquivo_accuracy.Write(acc_i.index_lastElicitationQuestion + " | ");
                    arquivo_accuracy.Write(acc_i.name_project + " | ");
                    arquivo_accuracy.Write(acc_i.name_analyst + " | ");
                    arquivo_accuracy.Write(acc_i.idExpert.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.intimityMath.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.intimityUncertainty.ToString() + " | ");
                    arquivo_accuracy.Write(acc_i.expertiseField + " | ");
                    arquivo_accuracy.Write(acc_i.email + " | ");
                    arquivo_accuracy.Write(acc_i.id_titulacao + " | ");
                    arquivo_accuracy.Write(acc_i.titulacao + " | ");
                    arquivo_accuracy.Write(acc_i.especialidade);
                    arquivo_accuracy.WriteLine("");
                    arquivo_accuracy.Flush();
                }
            } catch (Exception exc) {
                MessageBox.Show(exc.ToString(), "ERROR: ACCURACY DATA");
            }
            arquivo_accuracy.Close();

            Efficiency      eficience      = new Efficiency(this);
            List <DBEntity> efficienceData = eficience.getDataSource(this.queryEficience);

            if (!System.IO.File.Exists(nome_arquivo_efficiency))
            {
                System.IO.File.Create(nome_arquivo_efficiency).Close();
            }
            this.tempo.Clear(); this.id_question.Clear();
            this.id_question.Add(-1);
            this.tempo.Add(-1);
            for (int i = 0; i < efficienceData.Count; i++) //extrair os tempos das datas
            {
                Efficiency eff_i = (Efficiency)efficienceData[i];
                if (eff_i.event_type == "QUESTION_IN")
                {
                    this.tmp  = 0;// this.tmp2 = 0;
                    this.tmp2 = eff_i.date.TimeOfDay.TotalMilliseconds + eff_i.mileseconds;
                }
                else if (eff_i.event_type == "PAUSE")
                {
                    this.tmp2 += eff_i.date.TimeOfDay.TotalMilliseconds + eff_i.mileseconds;
                }
                else if (eff_i.event_type == "CONTINUE")
                {
                    this.tmp += eff_i.date.TimeOfDay.TotalMilliseconds + eff_i.mileseconds;
                }
                //else if (eff_i.event_type == "SAVE_STARTING")
                //    this.tmp2 += eff_i.date.TimeOfDay.TotalMilliseconds + eff_i.mileseconds;
                //else if (eff_i.event_type == "SAVE_ENDING")
                //    this.tmp += eff_i.date.TimeOfDay.TotalMilliseconds + eff_i.mileseconds;
                else if (eff_i.event_type == "QUESTION_OUT")
                {
                    this.tmp += eff_i.date.TimeOfDay.TotalMilliseconds + eff_i.mileseconds;
                    this.tempo.Add((this.tmp - this.tmp2) / 1000);
                    this.id_question.Add(eff_i.id_pergunta);
                }
            }
            this.id_question.RemoveAt(0);
            this.tempo.RemoveAt(0);

            //this.tempo.Add(0.0); this.id_question.Add(-1);//adicionar doi elementos "trash" na lista para poder concluir a iteração

            System.IO.TextWriter arquivo_efficiency = System.IO.File.AppendText(this.nome_arquivo_efficiency);
            arquivo_efficiency.Flush();
            arquivo_efficiency.WriteLine("");
            arquivo_efficiency.WriteLine("");
            arquivo_efficiency.WriteLine("Analise realizada em: " + DateTime.Now.ToString());
            arquivo_efficiency.WriteLine("");
            arquivo_efficiency.WriteLine("tempo | id_pergunta | id_processos | id_especialista | idProject | idElicitationMethod | idTrainingMethod | idAnalyst | index_lastTrainingQuestion | index_lastElicitationQuestion | name_project | name_analyst | idExpert | intimityMath | intimityUncertainty | expertiseField | email | id_titulacao | titulacao | especialidade ");//"(1)tempo | (2)id_pergunta | (3)id_processos | (4)id_especialista | (5)idProject | (6)idElicitationMethod | (7)idTrainingMethod | (8)idAnalyst | (9)index_lastTrainingQuestion | (10)index_lastElicitationQuestion | (11)name_project | (12)name_analyst | (13)idExpert | (14)intimityMath | (15)intimityUncertainty | (16)expertiseField | (17)email | (18)id_titulacao | (19)titulacao | (20)especialidade "
            // arquivo_efficiency.WriteLine ("");
            arquivo_efficiency.Flush();
            this.id_question.Add(0);
            int j = 0;

            try {
                for (int i = 0; i < efficienceData.Count; i++)
                {
                    Efficiency eff_i = (Efficiency)efficienceData[i];
                    if (eff_i.id_pergunta == this.id_question[j])
                    {
                        arquivo_efficiency.Write(this.tempo[j].ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.id_pergunta.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.id_processos.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.id_especialista.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.id_projeto.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.idElicitationMethod.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.idTrainingMethod.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.idAnalyst + " | ");
                        arquivo_efficiency.Write(eff_i.index_lastTrainingQuestion + " | ");
                        arquivo_efficiency.Write(eff_i.index_lastElicitationQuestion + " | ");
                        arquivo_efficiency.Write(eff_i.name_project + " | ");
                        arquivo_efficiency.Write(eff_i.name_analyst + " | ");
                        arquivo_efficiency.Write(eff_i.idExpert.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.intimityMath.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.intimityUncertainty.ToString() + " | ");
                        arquivo_efficiency.Write(eff_i.expertiseField + " | ");
                        arquivo_efficiency.Write(eff_i.email + " | ");
                        arquivo_efficiency.Write(eff_i.id_titulacao + " | ");
                        arquivo_efficiency.Write(eff_i.titulacao + " | ");
                        arquivo_efficiency.Write(eff_i.especialidade);
                        arquivo_efficiency.WriteLine("");
                        arquivo_efficiency.Flush();
                        j += 1;
                    }
                }
            } catch (Exception exc) {
                MessageBox.Show(exc.ToString(), "ERROR: TIME SPENT DATA");
            }
            arquivo_efficiency.Close();
            MessageBox.Show("Conjunto de dados gerado com sucesso!!");
            this.Close();
        }
Exemple #52
0
        //new GML Writer
        private bool Write_GMLFile(System.IO.TextWriter GMLOutput, SobekCM_Item METS_Item, Dictionary <string, object> Options)
        {
            //2do confirm that this outputs a string of goodies ready to place in a GML file

            // GEt the geo-spatial information if it exists
            GeoSpatial_Information geoInfo = METS_Item.Get_Metadata_Module(GlobalVar.GEOSPATIAL_METADATA_MODULE_KEY) as GeoSpatial_Information;

            if (geoInfo == null)
            {
                return(true);
            }

            string GMLSchemaURL = "http://www.opengis.net/gml"; //create header  //2do: add custom schema
            string imageURL     = "http://ufdc.ufl.edu/";       //create imageURL

            imageURL += METS_Item.BibID;
            imageURL += "/";
            imageURL += METS_Item.VID;
            string featureCollectionURL = imageURL;                                           //create collectionURL

            GMLOutput.WriteLine("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");                //write header
            GMLOutput.WriteLine("<gml:FeatureCollection xmlns:gml=\"" + GMLSchemaURL + "\">");
            GMLOutput.WriteLine("<sobekCM:Collection URI=\"" + featureCollectionURL + "\">"); //write collectionURL

            //for points
            foreach (Coordinate_Point thisPoint in geoInfo.Points)
            {
                string featureMemberURL = imageURL;

                GMLOutput.WriteLine("<gml:featureMember>");
                GMLOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">");
                GMLOutput.WriteLine("<gml:Point>");
                GMLOutput.Write("<gml:Coordinates>");
                GMLOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " ");
                GMLOutput.Write("</gml:Coordinates>");
                GMLOutput.WriteLine(); //add line break
                GMLOutput.WriteLine("</gml:Point>");
                GMLOutput.WriteLine("</sobekCM:Item>");
                GMLOutput.WriteLine("</gml:featureMember>");
            }

            //for lines
            foreach (Coordinate_Line thisLine in geoInfo.Lines)
            {
                string featureMemberURL = imageURL;

                GMLOutput.WriteLine("<gml:featureMember>");
                GMLOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">");
                GMLOutput.WriteLine("<gml:boundedBy>");
                GMLOutput.WriteLine("<gml:Box>");
                GMLOutput.Write("<gml:Coordinates>");
                foreach (Coordinate_Point thisPoint in thisLine.Points) //for each lat/long
                {
                    GMLOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " ");
                }
                GMLOutput.Write("</gml:Coordinates>");
                GMLOutput.WriteLine(); //add line break
                GMLOutput.WriteLine("</gml:Box>");
                GMLOutput.WriteLine("</gml:boundedBy>");
                GMLOutput.WriteLine("</sobekCM:Item>");
                GMLOutput.WriteLine("</gml:featureMember>");
            }

            //for polygons
            foreach (Coordinate_Polygon thisPolygon in geoInfo.Polygons) //for each polygon with coordinates
            {
                string featureMemberURL = imageURL;
                featureMemberURL += "/";
                featureMemberURL += thisPolygon.Page_Sequence;

                GMLOutput.WriteLine("<gml:featureMember>");
                GMLOutput.WriteLine("<sobekCM:Item URL=\"" + featureMemberURL + "\">");
                GMLOutput.WriteLine("<gml:Polygon>");
                GMLOutput.WriteLine("<gml:exterior>");
                GMLOutput.WriteLine("<gml:LinearRing>");
                GMLOutput.Write("<gml:Coordinates>");
                foreach (Coordinate_Point thisPoint in thisPolygon.Edge_Points)            //for each lat/long
                {
                    GMLOutput.Write(thisPoint.Latitude + "," + thisPoint.Longitude + " "); //gml
                }
                GMLOutput.Write("</gml:Coordinates>");
                GMLOutput.WriteLine(); //gml, add line break
                GMLOutput.WriteLine("</gml:LinearRing>");
                GMLOutput.WriteLine("</gml:exterior>");
                GMLOutput.WriteLine("</gml:Polygon>");
                GMLOutput.WriteLine("<sobekCM:/Item>");
                GMLOutput.WriteLine("</gml:featureMember>");
            }


            //send closing gml tags and close gml file
            GMLOutput.WriteLine("</sobekCM:Collection>");
            GMLOutput.WriteLine("</gml:FeatureCollection>");
            GMLOutput.Flush();
            GMLOutput.Close();

            return(true);
        }
Exemple #53
0
 public override void Flush() => _out.Flush();
Exemple #54
0
 public override void Flush()
 {
     _out.Flush();
 }
Exemple #55
0
 private void ResponsePreparing(int i, System.IO.TextWriter output)
 {
     output.WriteLine(Util.SurroundScriptBlock("top.setPreparing(" + i + ");"));
     output.Flush();
 }
    /*******************************/

    public static void WriteStackTrace(System.Exception throwable, System.IO.TextWriter stream)
    {
        stream.Write(throwable.StackTrace);
        stream.Flush();
    }
Exemple #57
0
        public override void Emit(System.IO.TextWriter outputWriter)
        {
            StringBuilder columnsBuilder    = new StringBuilder();
            StringBuilder constraintBuilder = new StringBuilder();

            foreach (Column c in _tableHelper.Columns.Values)
            {
                string columnName = c.Properties["Name"];
                string columnType = c.Properties["Type"];
                bool   isNullable = c.Properties.ContainsKey("IsNullable")
                                        ? Convert.ToBoolean(c.Properties["IsNullable"])
                                        : false;

                bool isIdentity = _tableHelper.IsIdentityColumn(columnName);

                columnsBuilder.AppendFormat(
                    "\t[{0}] {1}{2}{3},\n",
                    columnName,
                    columnType,
                    isIdentity ? " IDENTITY(1,1)" : "",
                    isNullable ? "" : " NOT NULL"
                    );
            }

            StringBuilder simpleConstraintBuilder = new StringBuilder();

            // Primary Key Constraints
            int constraintCount = 0;

            foreach (Constraint c in _tableHelper.Constraints)
            {
                if (c is SimpleConstraint)
                {
                    string cString;
                    Message.Trace(Severity.Debug, "Found Constraint {0}", c.Name);
                    ConstraintEmitter ce = new ConstraintEmitter(VulcanPackage, c, _tableHelper);
                    ce.Emit(out cString);
                    simpleConstraintBuilder.AppendFormat("{0},\n", cString);
                    constraintCount++;
                }
            }

            if (constraintCount > 0)
            {
                simpleConstraintBuilder.Replace(",", "", simpleConstraintBuilder.Length - 2, 2);
            }

            TemplateEmitter te = new TemplateEmitter(
                "CreateTable",
                VulcanPackage,
                _tableHelper.Name,
                columnsBuilder.ToString(),
                simpleConstraintBuilder.ToString());

            te.Emit(outputWriter);
            outputWriter.Flush();


            //Remove the extra Comma, Leave it in if a _constraint is there...
            if (constraintCount == 0)
            {
                columnsBuilder.Replace(",", "", columnsBuilder.Length - 2, 2);
            }

            //Foreign Key Constraints
            foreach (Constraint c in _tableHelper.Constraints)
            {
                Message.Trace(Severity.Debug, "Found constraint {0}", c.Name);
                if (c is ForeignKeyConstraint)
                {
                    Message.Trace(Severity.Debug, "Found FKC {0}", c.Name);
                    ConstraintEmitter ce = new ConstraintEmitter(VulcanPackage, c, _tableHelper);
                    outputWriter.Write("\n");
                    ce.Emit(outputWriter);
                }
            }

            //Indexes
            IndexEmitter ie = new IndexEmitter(_tableHelper.Name, _tableHelper.TableNavigator, VulcanPackage);

            ie.Emit(outputWriter);

            InsertDefaultValuesEmitter ide = new InsertDefaultValuesEmitter(_tableHelper.Name, _tableHelper.TableNavigator, _tableHelper, VulcanPackage);

            ide.Emit(outputWriter);

            outputWriter.Write("\n");
        }
Exemple #58
0
 public override void FlushAndClose()
 {
     writer.Flush();
     writer.Close();
 }