public WriteLineAsync ( ) : System.Threading.Tasks.Task | ||
return | System.Threading.Tasks.Task |
public static async Task ReadOutChannels(XmlTvReader reader, StreamWriter resultsFileStream) { var channels = reader.GetChannels().Distinct().ToList(); resultsFileStream.Write(EntityExtensions.GetHeader("Channels")); foreach (var channel in channels) { System.Console.WriteLine("Retrieved Channel: {0} - {1}", channel.Id, channel.DisplayName); resultsFileStream.Write(channel.GetChannelDetail()); } var totalProgrammeCount = 0; resultsFileStream.Write("\r\n"); foreach (var channel in channels) { System.Console.WriteLine("Processing Channel: {0}", channel.DisplayName); resultsFileStream.Write(EntityExtensions.GetHeader("Programs for " + channel.DisplayName)); var channelProgrammeCount = await ReadOutChannelProgrammes(reader, channel, resultsFileStream); totalProgrammeCount += channelProgrammeCount; await resultsFileStream.WriteLineAsync(String.Format("Total Programmes for {1}: {0}", channelProgrammeCount, channel.DisplayName)); } await resultsFileStream.WriteLineAsync(String.Format("Total Programmes: {0}", totalProgrammeCount)); }
private async void ClientWork(object state) { int clientId = (int)state; using (var channel = this.connection.ConnectChannel()) { using (StreamWriter writer = new StreamWriter(channel)) { using (StreamReader reader = new StreamReader(channel)) { string request = string.Format("Hello from {0}", clientId); string response; await writer.WriteLineAsync(request); await writer.FlushAsync(); response = await reader.ReadLineAsync(); await writer.WriteLineAsync(request); await writer.FlushAsync(); response = await reader.ReadLineAsync(); await channel.StopSendingAsync(); await channel.FlushAsync(); if (reader.EndOfStream) { Console.WriteLine("Client feel right!"); } } } } if (Interlocked.Decrement(ref pendingCount) == 0) { lock (termLock) { Monitor.Pulse(termLock); } } }
public async Task Save(string path, BlackHoleGameTable gameTable) { try { using (StreamWriter writer = new StreamWriter(path)) { // save the game status and details writer.Write(gameTable.TableSize + " "); await writer.WriteAsync(gameTable.GameStatus + " "); await writer.WriteAsync(gameTable.CoordinatesOfChosenField.Item1 + " " + gameTable.CoordinatesOfChosenField.Item2 + " "); await writer.WriteAsync(gameTable.IsGameActive + " "); await writer.WriteAsync(gameTable.PlayerAScore + " "); await writer.WriteAsync(gameTable.PlayerBScore + ""); // save the game table values await writer.WriteLineAsync(); for (Int32 row = 0; row < gameTable.TableSize; ++row) { for (Int32 column = 0; column < gameTable.TableSize; ++column) { await writer.WriteAsync(gameTable[row, column] + " "); } await writer.WriteLineAsync(); } } } catch { throw new BlackHoleGameDataException("Save file path is wrong."); } }
private static async Task WorkAsync(Channel channel) { using (channel) { using (var reader = new StreamReader(channel)) { using (var writer = new StreamWriter(channel)) { string request = await reader.ReadLineAsync(); await writer.WriteLineAsync(request); await writer.FlushAsync(); request = await reader.ReadLineAsync(); await writer.WriteLineAsync(request); await writer.FlushAsync(); Console.WriteLine("Server waiting for close"); if (reader.EndOfStream) { Console.WriteLine("Server feel right!"); } await channel.StopSendingAsync(); await channel.FlushAsync(); } } } }
public async Task DoSomethingWithClientAsync() { try { using (var stream = _client.GetStream()) { using (var sr = new StreamReader(stream)) using (var sw = new StreamWriter(stream)) { await sw.WriteLineAsync("Hi. This is x2 TCP/IP easy-to-use server").ConfigureAwait(false); await sw.FlushAsync().ConfigureAwait(false); var data = default(string); while (!((data = await sr.ReadLineAsync().ConfigureAwait(false)).Equals("exit", StringComparison.OrdinalIgnoreCase))) { await sw.WriteLineAsync(data).ConfigureAwait(false); await sw.FlushAsync().ConfigureAwait(false); } } } } finally { if (_ownsClient && _client != null) { (_client as IDisposable).Dispose(); _client = null; } } }
public override async Task WriteToStreamAsync(Type type, object value, Stream stream, HttpContent content, TransportContext transportContext) { using (stream) { Encoding encoding = SelectCharacterEncoding(content.Headers); using (var writer = new StreamWriter(stream, encoding)) { var individuals = value as IEnumerable<Individual>; if (individuals != null) { foreach (var individu in individuals) { await writer.WriteLineAsync(String.Format("{0,-10};{1,-10};{2,-10}", individu.Id, individu.FirstName, individu.LastName)); } await writer.FlushAsync(); } var individual = value as Individual; if (individual != null) { await writer.WriteLineAsync(String.Format("{0,-10};{1,-10};{2,-10}", individual.Id, individual.FirstName, individual.LastName)); await writer.FlushAsync(); } } } }
// чтение данных из текстового файла private void ReadDaysFromDatabase() { try { using (var reader = new StreamReader(Environment.CurrentDirectory + DataFile)) { uint allBudget, costsCount; UInt32.TryParse(reader.ReadLine(), out allBudget); UInt32.TryParse(reader.ReadLine(), out costsCount); _allBudget = allBudget; for (var i = 0; i < costsCount; i++) { var costsString = reader.ReadLine(); var date = reader.ReadLine(); uint costs; UInt32.TryParse(costsString, out costs); _days.Add(new Day(DateTime.Parse(date), costs)); } } } catch (Exception) { // файл с данными не существует - создадим его using (var writer = new StreamWriter(Environment.CurrentDirectory + DataFile)) { // бюждет - незвестен // кол-во трат - неизвестно writer.WriteLineAsync("0"); writer.WriteLineAsync("0"); } } }
public static async Task WriteTo(IHttpHeaders headers, Stream stream) { #if PCL && !ASYNC_PCL var writer = new StreamWriter(new NonDisposableStream(stream), Encoding.UTF8, 128); #else var writer = new StreamWriter(stream, Encoding.UTF8, 128, true); #endif try { writer.NewLine = "\r\n"; if (headers != null) { foreach (var header in headers) { await writer.WriteLineAsync($"{header.Key}: {string.Join(", ", header.Value)}"); } } await writer.WriteLineAsync(); } finally { writer.Dispose(); } }
public void adduse(string n, string h, string gru) { // string n, h; // n = Console.ReadLine(); // h = Console.ReadLine(); if (n == "administrator") { Console.WriteLine("nie mozesz utwozyc uzytkownika o takej nazwie"); } else { string[] f = File.ReadAllLines(sciezka); int b = 0, c = f.Length; for (int i = 2; i < c - 2; i = i + 3) { if (n == f[i]) { b = 1; } } if (b == 1) { Console.WriteLine("juz istnieje taki uzytkownik"); } else { string[] t = File.ReadAllLines(grupa); b = 0; c = t.Length; for (int i = 0; i < c; i++) { if (t[i] == gru) { b = 1; } } if (b == 1) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(sciezka, true)) { file.WriteLineAsync(n); file.WriteLineAsync(h); file.WriteLineAsync(gru); } iwezel.create(ref p, n, 'k', "Home"); } else { Console.WriteLine("nie istnieje taka grupa"); } } } }
private async Task ProcessQueue(string queue) { try { var events = MessageQueue.GetBatch<PerfEvent>(queue) .ToList(); // Group by hour var groups = events.GroupBy(e => new { e.TimestampUtc.Date, e.TimestampUtc.Hour }); await Task.WhenAll(groups.Select(async group => { if (group.Any()) { string dir = Path.Combine(LogDirectory, queue); if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } // Determine the file name for the log string fileName = Path.Combine( dir, String.Format("{0:yyyyMMdd}{1}.csv", group.Key.Date, group.Key.Hour)); // Append to the log using (var strm = new FileStream(fileName, FileMode.Append, FileAccess.Write, FileShare.None)) using (var writer = new StreamWriter(strm)) { foreach (var evt in group) { var fields = evt.Fields.OrderBy(p => p.Key); if (strm.Length == 0) { await writer.WriteLineAsync( "Source,Timestamp,Duration," + String.Join(",", fields.Select(f => f.Key))); await writer.FlushAsync(); } await writer.WriteLineAsync( CsvEscape(evt.Source) + "," + CsvEscape(evt.TimestampUtc.ToString("O")) + "," + CsvEscape(evt.Duration.TotalMilliseconds.ToString("0.00")) + "," + String.Join(",", fields.Select(f => CsvEscape(f.Value == null ? String.Empty : f.Value.ToString())))); } } } })); } catch (Exception) { throw; } }
public static async void LogUnhandledException(Exception e) { var logsFolder = await ApplicationData.Current.LocalFolder .CreateFolderAsync("Logs", CreationCollisionOption.OpenIfExists); var file = await logsFolder.CreateFileAsync(String.Format("{0}.log", DateTime.Now.Ticks)); var stream = await file.OpenStreamForWriteAsync(); using (var writer = new StreamWriter(stream)) { await writer.WriteLineAsync(e.Message); if (e.StackTrace != null) await writer.WriteLineAsync(e.StackTrace); } }
public static void LogError(string error) { string appPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); if (appPath != null) { string configFile = Path.Combine(appPath, "errorlogs.txt"); var file = new StreamWriter(configFile, true); file.WriteLineAsync("-----------------"); file.WriteLine(error); file.WriteLineAsync("---------------------"); file.Close(); Console.WriteLine("Error=>{0}", error); } }
public async Task Invoke(IDictionary<string, object> environment) { var response = environment["owin.ResponseBody"] as Stream; using (var writer = new StreamWriter(response)) { await writer.WriteLineAsync(string.Format("Demo Component!", _options.Name)); foreach (var option in _options.MoreOptions) { _next.Invoke(environment); Console.WriteLine("I hope this works"); await writer.WriteLineAsync(string.Format("Option: {0}", option)); } } }
protected async Task Listen(Socket socket) { Stream ioStream = socket.GetStream(); StreamReader reader = new StreamReader(ioStream); StreamWriter writer = new StreamWriter(ioStream); await writer.WriteLineAsync(FtpResponse.PositiveCompletionReply.ServiceReady.ToString()); await writer.FlushAsync(); string command; while (true) { string result = await RunCommand(await reader.ReadLineAsync()); await writer.WriteLineAsync(result); await writer.FlushAsync(); } }
public async Task Invoke(IDictionary<string, object> environment) { var response = environment["owin.ResponseBody"] as Stream; if (response != null) using (var writer = new StreamWriter(response)) { await writer.WriteLineAsync(string.Format("Hello {0}!", _options.Name)); foreach (var option in _options.MoreOptions) { //_next.Invoke(environment); await writer.WriteLineAsync(string.Format("Option: {0}", option)); } } }
private async void SaveTokens_FileOk(object sender, CancelEventArgs e) { var cardsList = await Task.Run(() => { return this.tokenizationService.GetEntries().OrderBy(x => x.Token); }); var filename = (sender as SaveFileDialog).FileName; using (StreamWriter sw = new StreamWriter(filename)) { await sw.WriteLineAsync(string.Format("{0,-16} - {1,-16}", "Token", "Card number")); foreach (var item in cardsList) { await sw.WriteLineAsync(string.Format("{0} - {1}", item.Token, item.CardNumber)); } } UnlockScreen(); }
async Task<string> SendRPCAsync(string methodName, params object[] args) { var jsonArgs = new List<string>(); foreach(var arg in args) { if(arg is string) { jsonArgs.Add(String.Format("\"{0}\"", arg)); } else { jsonArgs.Add(arg.ToString()); } } var rpc = String.Format("{{\"id\": 1, \"method\": \"{0}\", \"params\": [{1}]}}", methodName, String.Join(", ", jsonArgs)); await ClientLock.WaitAsync(); try { var writer = new StreamWriter(ClientStream); await writer.WriteLineAsync(rpc); await writer.FlushAsync(); var reader = new StreamReader(ClientStream); return await reader.ReadLineAsync(); } finally { ClientLock.Release(); } }
public override void Handle() { using (var sw = new StreamWriter(@"D:\JobText.txt", true)) { sw.WriteLineAsync(DateTime.Now.ToString()); } }
/* =========================================================================================== * Edinaldo IT Singular / Thiago Aoki Kenko TransFolha * Jan/2019 * Métodos para gravar em arquivo texto assincrono * ===========================================================================================*/ public async Task _GravaLogAsync(string pMensagem) { string glbNomeArquivoLOG = "TransFolha.API"; DateTime dataAgora = DateTime.Now; string Nomefolder = @"C:\\TEMP\\"; string NomeArquivo = "C:\\TEMP\\" + glbNomeArquivoLOG + "_" + dataAgora.ToString("yyyy-MM-dd") + ".log"; if (!Directory.Exists(Nomefolder)) { //Criamos um com o nome folder Directory.CreateDirectory(Nomefolder); } using (System.IO.StreamWriter writer = new System.IO.StreamWriter(@NomeArquivo, true)) { try { await writer.WriteLineAsync(dataAgora.ToString() + " - " + pMensagem); } finally { } } }
private async Task Log(string value) { var logFile = ConfigurationManager.AppSettings["LogFile"]; if (string.IsNullOrWhiteSpace(logFile)) throw new Exception("Misconfigured Log File"); var replacement = ConfigurationManager.AppSettings["ReplaceWith"]; using (FileStream fs = new FileStream(logFile, FileMode.OpenOrCreate, FileSystemRights.AppendData, FileShare.Write, 4096, FileOptions.None)) using (StreamWriter sw = new StreamWriter(fs)) { sw.AutoFlush = true; if (!string.IsNullOrEmpty(replacement)) { var sb = new StringBuilder(value); sb.Replace(WindowsNL, replacement); sb.Replace(RiscNL, replacement); sb.Replace(UnixNL, replacement); sb.Replace(MacNL, replacement); value = sb.ToString(); } await sw.WriteLineAsync(value); } }
public static async Task SendAndReceive() { using (var client = new TcpClient()) { await client.ConnectAsync(host, port); using (NetworkStream stream = client.GetStream()) using (var writer = new StreamWriter(stream, Encoding.ASCII, 1024, leaveOpen: true)) using (var reader = new StreamReader(stream, Encoding.ASCII, true, 1024, leaveOpen: true)) { writer.AutoFlush = true; string line = string.Empty; do { WriteLine("enter a string, bye to exit"); line = ReadLine(); await writer.WriteLineAsync(line); string result = await reader.ReadLineAsync(); WriteLine($"received {result} from server"); } while (line != "bye"); WriteLine("so long, and thanks for all the fish"); } } }
public HttpResponseMessage Get() { var resp = new HttpResponseMessage { Content = new PushStreamContent(async (respStream, content, context) => { try { var wordsToSend = Lipsum.Split(' '); using (var writer = new StreamWriter(respStream)) { foreach (var word in wordsToSend) { await writer.WriteLineAsync(word); await writer.FlushAsync(); await Task.Delay(millisecondsDelay: 250); } } } catch (Exception ex) { return; } finally { respStream.Close(); } }, "text/plain") }; return resp; }
protected override async Task WriteTextToFileCore(IStorageFile file, string contents) { using (var sw = new StreamWriter(file.Path, true)) { await sw.WriteLineAsync(contents); } }
public async Task Write(string path) { using (var stream = new StreamWriter(path)) { await stream.WriteLineAsync("#EXTM3U"); foreach (var track in tracklist.Tracks) { await stream.WriteLineAsync(string.Format("#EXTINF:{0},{1} - {2}", (int)track.TaglibFile.Properties.Duration.TotalSeconds , string.IsNullOrEmpty(track.TaglibFile.Tag.JoinedAlbumArtists) ? track.TaglibFile.Tag.JoinedPerformers : track.TaglibFile.Tag.JoinedAlbumArtists , track.TaglibFile.Tag.Title)); await stream.WriteLineAsync(track.Path); } } }
public async Task HandleClientAsync(TcpClient c) { string msg = null; bool connected = true; Console.WriteLine($"Connection accepted {DateTime.Now.ToShortTimeString()}"); using (var output = new StreamWriter(c.GetStream(), UTF32Encoding.ASCII) { AutoFlush = true }) { using (var input = new StreamReader(c.GetStream(), UTF32Encoding.ASCII)) { while (connected) { switch (msg = await input.ReadLineAsync()) { case "done": connected = false; break; default: await output.WriteLineAsync(msg); break; } } } } c.Close(); Console.WriteLine("bye..."); }
/// <summary> /// Writes the logevent to the log file async. /// </summary> /// <param name="args">The log event arguments.</param> /// <exception cref="System.IO.IOException">Thrown if unable to write to file.</exception> /// <returns>A Task object that can be used to listen for completion of the work.</returns> public async Task OnLogEventAsync(LogArgs args) { using (StreamWriter sw = new StreamWriter(this.Filename, true, Encoding.UTF8)) { await sw.WriteLineAsync(args.ToString()); } }
public async void SendMessageAsync() { try { using (var pipe = new NamedPipeServerStream(verb, PipeDirection.Out, 1, PipeTransmissionMode.Message, PipeOptions.Asynchronous)) using (var stream = new StreamWriter(pipe)) { var connectionTask = Task.Factory.FromAsync(pipe.BeginWaitForConnection, pipe.EndWaitForConnection, null); var timeoutTask = Task.Delay(2000); var firstTask = await Task.WhenAny(connectionTask, timeoutTask); if (firstTask == timeoutTask) { pipe.EndWaitForConnection(connectionTask); return; } stream.AutoFlush = true; await stream.WriteLineAsync(selectedFile); } } catch (Exception exception) { //OnSendMessageException(pipeName, new MessengerExceptionEventArgs(exception)); } }
public static async Task ProcessStream(Stream networkStream) { try { StreamReader reader = new StreamReader(networkStream); StreamWriter writer = new StreamWriter(networkStream); writer.AutoFlush = true; while (true) { string request = await reader.ReadLineAsync(); if (request != null) { Console.WriteLine("Received echo: " + request); string echo_str = await CommandResolve.Resolve(request); if (!String.IsNullOrEmpty(echo_str)) { await writer.WriteLineAsync(echo_str); } else break; // unvalid command or command complete } else break; // Client closed connection } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// Saves the transmission to the specified <paramref name="stream"/>. /// </summary> internal static async Task SaveAsync(Transmission transmission, Stream stream) { var writer = new StreamWriter(stream); try { await writer.WriteLineAsync(transmission.EndpointAddress.ToString()).ConfigureAwait(false); await writer.WriteLineAsync(Transmission.ContentTypeHeader + ":" + transmission.ContentType).ConfigureAwait(false); await writer.WriteLineAsync(Transmission.ContentEncodingHeader + ":" + transmission.ContentEncoding).ConfigureAwait(false); await writer.WriteLineAsync(string.Empty).ConfigureAwait(false); await writer.WriteAsync(Convert.ToBase64String(transmission.Content)).ConfigureAwait(false); } finally { writer.Flush(); } }
public async Task Error(Exception ex) { using (var log = new StreamWriter(File.OpenWrite("err.log"))) { await log.WriteLineAsync(ex.ToString()); } }
private async void DumpExportFilesAsync(string orders) { SelectedPath = FileUtility.GetExportsDirectory().ToLower(); if(SelectedPath=="not defined") { MessageBox.Show("Working folder MUST be defined first", "Import tool warning", MessageBoxButton.OK); IsSaved=false; return; } try { string fileName = Path.Combine(SelectedPath, @"ExportOrders-" + DateTime.Now.ToString("ddmmyyy").Replace(':', '-') + ".csv"); using (var fs = new FileStream(fileName, FileMode.OpenOrCreate)) { fs.Close(); using (var wr = new StreamWriter(fileName, false)) { await wr.WriteLineAsync(orders); } } IsSaved = true; }catch(IOException ex) { MessageBox.Show("Error copying import oders\nDetails=>" + ex.Message); IsSaved = false; } }
private async Task SendServiceMessage(Message packet) { var command = packet.Json; try { using (var tcpClient = new TcpClient()) { await tcpClient.ConnectAsync(IPAddress.Loopback, 22005); using (var stream = tcpClient.GetStream()) using (var sw = new StreamWriter(stream, Encoding.UTF8)) { if (tcpClient.Connected) { await sw.WriteLineAsync(command); await sw.FlushAsync(); } } } } catch (Exception e) { Console.WriteLine(e.Message); } }
public async Task InvokeAsync(HttpContext httpContext) { httpContext.Request.EnableBuffering(); if (httpContext.Request != null) { string dateTime = DateTime.Now.ToString(); string pathStr = httpContext.Request.Path; string methodStr = httpContext.Request.Method; string queryStr = httpContext.Request.QueryString.ToString(); string bodyStr = ""; using (var reader = new StreamReader(httpContext.Request.Body, Encoding.UTF8, true, 1024, true)) { bodyStr = await reader.ReadToEndAsync(); httpContext.Request.Body.Position = 0; } string log = dateTime + "\t" + pathStr + "\t" + methodStr + "\t" + queryStr + "\t" + bodyStr; //zapisz do pliku (domyślnie tworzy nowy plik, jeśli nie istnieje using (System.IO.StreamWriter file = new System.IO.StreamWriter(@".\requestsLog.txt", true)) { await file.WriteLineAsync(bodyStr); } } // wywołaj nast middleware if (_next != null) { await _next(httpContext); } }
public static async Task SaveConfigToFile(CollectionConfiguration config, string path) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(path)) { var text = WriteXml(config); await file.WriteLineAsync(text); } }
// 创建用户 public async Task CreateAsync(IdentityUser user) { user.Id = Guid.NewGuid().ToString(); using (var stream = new IO.StreamWriter(_filePath, true, Encoding.UTF8)) { await stream.WriteLineAsync(user.ToString()); } }
static int WriteLineAsync(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 1) { System.IO.StreamWriter obj = (System.IO.StreamWriter)ToLua.CheckObject <System.IO.StreamWriter>(L, 1); System.Threading.Tasks.Task o = obj.WriteLineAsync(); ToLua.PushObject(L, o); return(1); } else if (count == 2 && TypeChecker.CheckTypes <char>(L, 2)) { System.IO.StreamWriter obj = (System.IO.StreamWriter)ToLua.CheckObject <System.IO.StreamWriter>(L, 1); char arg0 = (char)LuaDLL.lua_tonumber(L, 2); System.Threading.Tasks.Task o = obj.WriteLineAsync(arg0); ToLua.PushObject(L, o); return(1); } else if (count == 2 && TypeChecker.CheckTypes <string>(L, 2)) { System.IO.StreamWriter obj = (System.IO.StreamWriter)ToLua.CheckObject <System.IO.StreamWriter>(L, 1); string arg0 = ToLua.ToString(L, 2); System.Threading.Tasks.Task o = obj.WriteLineAsync(arg0); ToLua.PushObject(L, o); return(1); } else if (count == 2 && TypeChecker.CheckTypes <char[]>(L, 2)) { System.IO.StreamWriter obj = (System.IO.StreamWriter)ToLua.CheckObject <System.IO.StreamWriter>(L, 1); char[] arg0 = ToLua.CheckCharBuffer(L, 2); System.Threading.Tasks.Task o = obj.WriteLineAsync(arg0); ToLua.PushObject(L, o); return(1); } else if (count == 4) { System.IO.StreamWriter obj = (System.IO.StreamWriter)ToLua.CheckObject <System.IO.StreamWriter>(L, 1); char[] arg0 = ToLua.CheckCharBuffer(L, 2); int arg1 = (int)LuaDLL.luaL_checknumber(L, 3); int arg2 = (int)LuaDLL.luaL_checknumber(L, 4); System.Threading.Tasks.Task o = obj.WriteLineAsync(arg0, arg1, arg2); ToLua.PushObject(L, o); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to method: System.IO.StreamWriter.WriteLineAsync")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
public async Task <bool> Write(string message) { Debug.WriteLine("Recive Step2"); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Fereshteh\source\repos\BusManagement\fredle2.txt", true)) { await file.WriteLineAsync(message); } return(true); }
public async Task <ActionResult> Export([Bind(Prefix = "ID")] int FlightID = 0) { if (!exLogic.User.hasAccess("FLIGHT.MAP")) { return(HttpNotFound("You do not have acces to this section")); } using (var tempFiles = new System.CodeDom.Compiler.TempFileCollection()) { string ExportFileName = tempFiles.AddExtension("csv"); // do something with the file here using (System.IO.StreamWriter stream = new System.IO.StreamWriter(ExportFileName)) { var query = from d in ctx.FlightMapDatas where d.FlightID == FlightID orderby d.ReadTime select new { ReadTime = (DateTime)d.ReadTime, Lat = d.Latitude, Lng = d.Longitude, Altitude = d.Altitude, Speed = d.Speed, Satellite = d.Satellites, Pitch = d.Pitch, Roll = d.Roll, Heading = d.Heading, Voltage = d.voltage, Distance = d.Distance }; if (query.Any()) { await stream.WriteLineAsync("DateTime,Lat,Lng,Altitude,Speed,Satellite,Pitch,Roll,Heading,Voltage,Distance"); foreach (var row in query.ToList()) { await stream.WriteLineAsync($"{row.ReadTime.ToString("yyyy-MM-dd HH:mm:ss")},{row.Lat},{row.Lng},{row.Altitude},{row.Speed},{row.Satellite},{row.Pitch},{row.Roll},{row.Heading},{row.Voltage},{row.Distance}"); } } //if(query.Any()) } //using (System.IO.StreamWriter stream) return(File(System.IO.File.OpenRead(ExportFileName), "text/csv", $"Flight-{FlightID}.csv")); }//using (var tempFiles) }
public async Task <bool> Write2(string message) { // StreamWriter streamWriter = new StreamWriter(@"C:\Users\Fereshteh\source\repos\BusManagement\fredle.txt", false);// (@"C:\Users\Fereshteh\source\repos\BusManagement\test.txt"); Debug.WriteLine("Recive Step2"); //streamWriter.Write(message); using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\Fereshteh\source\repos\BusManagement\fredle2.txt")) { await file.WriteLineAsync("zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz vvvvvvvvvvvvvvvvvv ddddddddddddddddddd"); } return(true); }
public async Task Log() { logging = true; CheckPathsAndIfNotExistCreate(); var logWriter = new System.IO.StreamWriter(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + "/" + fileName, true); foreach (var item in messages) { await logWriter.WriteLineAsync($"[{DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss")}] {item}"); } messages.Clear(); logWriter.Close(); logWriter.Dispose(); logging = false; }
public static void LogInfo(string MethodName, object message) { try { StringBuilder sb = new StringBuilder(); sb.AppendLine(DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss")); sb.AppendLine("caller: " + MethodName + "\n: " + message); using (System.IO.StreamWriter str = new System.IO.StreamWriter(filename, true)) { str.WriteLineAsync(sb.ToString()); } } catch { } }
public async static void SaveSecretCloud(string NewApiPri) { string tempFolderPath = Path.GetTempPath(); tempFolderPath += "SecretCloud.txt"; // This text is added only once to the file. try { using (System.IO.StreamWriter file = new System.IO.StreamWriter(tempFolderPath, false)) { await file.WriteLineAsync(NewApiPri); } } catch (Exception ex) { GlobalClass.Log("ERROR @ WriteFileToPath NewApiPri" + ex.ToString()); } }
public static async void WriteFileToPath(string input_path, string linestowrite) { string path = input_path; // This text is added only once to the file. try { using (System.IO.StreamWriter file = new System.IO.StreamWriter(path, true)) { await file.WriteLineAsync(linestowrite); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("ERROR @ WriteFileToPath" + ex.ToString()); } }
private void InsertData(object ms) { int t = 10; int.TryParse(ms.ToString(), out t); //这里采用了TryParse方法,避免不能转换时出现异常 // 结果先写入测试文件 using (System.IO.StreamWriter scoreFile = new System.IO.StreamWriter(@"./score.txt", true)) { while (CommandData.isRunning) { fd = dh.GetFrameData(HandType.Right, Definition.MODEL_TYPE); scoreFile.WriteLineAsync(String.Format("{0}\t{1}\t{2}", GetCurrentTime(), Login.UserName, rhb.GetScore())); Event.Set(); Thread.Sleep(t); //让线程暂停 } } }
public static string LogError(Exception ex) { string message = ""; try { message = GetExceptionMessages(ex); StringBuilder sb = new StringBuilder(); sb.AppendLine("Date and Time: " + DateTime.Now.ToString("dd-MMM-yyyy hh:mm:ss")); sb.AppendLine("ErrorMessage: \n " + message); sb.AppendLine(ex.StackTrace); using (System.IO.StreamWriter str = new System.IO.StreamWriter(filename, true)) { str.WriteLineAsync(sb.ToString()); } } catch { } return(message); }
public void dodajgru(string n) { string[] t = File.ReadAllLines(grupa); int b = 0, c = t.Length; for (int i = 0; i < c; i++) { if (t[i] == n) { b = 1; } } if (b == 0) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(grupa, true)) { file.WriteLineAsync(n); } } else { Console.WriteLine("taka grua juz istnieje"); } }
private async Task MessageReceived(SocketMessage message) { FlashWindow(Process.GetCurrentProcess().MainWindowHandle); SocketGuild server = ((SocketGuildChannel)message.Channel).Guild; Console.WriteLine(message.Author + " said:"); Console.WriteLine(message.Content); using (System.IO.StreamWriter file = new System.IO.StreamWriter($"{server.Name} - Log.txt", true)) { await file.WriteLineAsync(System.DateTime.Now + " | " + message.Channel + " | " + message.Author + " said:"); await file.WriteLineAsync(message.Content); } if (message.Content.ToLower() == "!pog") {//<:pog:524455455506956308> Willko Official IEmote emote = Emote.Parse("<:Pog:478342281183756288>"); //IEmote emote = Emote.Parse("<:pog:524455455506956308>"); var m = (RestUserMessage)await message.Channel.GetMessageAsync(message.Id); await m.AddReactionAsync(emote); await message.Channel.SendMessageAsync("<:Pog:478342281183756288>"); } if (message.Content.ToLower().Contains("!pog purge ")) { try { int messageCount = int.Parse(message.Content.Substring(10)); IEnumerable <IMessage> messages = await message.Channel.GetMessagesAsync(messageCount + 1).Flatten(); await message.Channel.DeleteMessagesAsync(messages); if (messageCount > 1) { await message.Channel.SendMessageAsync("Successfully deleted " + messageCount + " messages"); Console.WriteLine("Successfully deleted " + messageCount + " messages"); } else { await message.Channel.SendMessageAsync("Successfully deleted " + messageCount + " message"); Console.WriteLine("Successfully deleted " + messageCount + " message"); } } catch (Exception e) { await message.Channel.SendMessageAsync("***Invalid Input*** \n" + e.Message); Console.WriteLine(" Invalid Input " + e.Message); } } if (message.Content.ToLower().Contains("<@524377330857148432> Thank".ToLower()) || message.Content.ToLower().Contains("<@524377330857148432> Ty".ToLower())) {//<:pog:524455455506956308> Willko Official Console.WriteLine("Thanks Recieved"); IEmote emote = new Emoji("😉"); await message.Channel.SendMessageAsync("You're very welcome " + emote); } // angelo foreach (string d in shitlist) { if (message.Author.Id.ToString() == d) { await message.Channel.SendMessageAsync(responses[new Random().Next(0, responses.Length)]); } } // Sam Hyde if (message.Content.ToLower() == "!hydeme") { Console.WriteLine("Sending hydeman"); await message.Channel.SendFileAsync("hyde\\hyde (" + r.Next(1, 9) + ").jpg", hydecaption[r.Next(hydecaption.Length)]); } if (message.Content.ToLower().Contains("!fun")) { Console.WriteLine("Sending fun fact"); int hh = r.Next(funfacts.Length); await message.Channel.SendMessageAsync(funfacts[hh] + "```" + funfactsd[hh] + "```"); } }
public void Log(string msg) { System.IO.StreamWriter file = new System.IO.StreamWriter(actualLogName, true); file.WriteLineAsync(msg); file.Close(); }
public static async Task <bool> CheckAddressListEthereum(string projectName, Campaign campaign, IProgress <ProgressStatus> progressinfo, string etherscanKey) { int counter = 0; Etherscan ethreScan = new Etherscan(etherscanKey); Connection connected = null; int currentAddressProgress = 0; int totalAddress = campaign.Partecipants.Count; int currentTransactionProgress = 0; int totalTransaction = 0; string runResults = "results.txt"; System.IO.StreamWriter fileResult = new System.IO.StreamWriter(runResults); xmlBounty bountydata = new xmlBounty(projectName + "_results.xml"); foreach (KeyValuePair <string, string> address in campaign.Partecipants) { await fileResult.WriteLineAsync(address.Value + " connected with:"); string stringJson = ethreScan.GetTransactions(address.Key); JObject json = JObject.Parse(stringJson); JArray transactions = (JArray)json["result"]; currentTransactionProgress = 0; totalTransaction = transactions.Count; foreach (JObject element in json["result"]) { if (element["from"].Value <string>() == address.Key) { connected = ethreScan.CheckIfAnyTrasactionWithOtherAddress(campaign.Partecipants, element["to"].Value <string>()); } else if (element["to"].Value <string>() == address.Key) { connected = ethreScan.CheckIfAnyTrasactionWithOtherAddress(campaign.Partecipants, element["from"].Value <string>()); } if (connected.Result == true) { bountydata.AddUserEth(address.Value, address.Key); fileResult.WriteLine(campaign.Partecipants[connected.Address] + " -> " + element["tokenName"].Value <string>() + "(" + element["tokenSymbol"].Value <string>() + ")" + "https://etherscan.io/tx/" + element["hash"].Value <string>() + " " + element["from"].Value <string>() + " " + element["to"].Value <string>()); //Console.WriteLine(addressList[connected.Address] + " -> " + element["tokenName"].Value<string>() + "(" + element["tokenSymbol"].Value<string>() + ")" + "https://etherscan.io/tx/" + element["hash"].Value<string>() + " " + element["from"].Value<string>() + " " + element["to"].Value<string>()); bountydata.AddUserEthConnection(address.Value, address.Key, campaign.Partecipants[connected.Address], connected.Address, campaign.Name, element); } currentTransactionProgress++; ReportProgressStatus(progressinfo, totalTransaction, currentTransactionProgress, campaign.Name + " - Checked transactions " + currentTransactionProgress + "/" + totalTransaction, Report.Transaction); } currentAddressProgress++; ReportProgressStatus(progressinfo, totalAddress, currentAddressProgress, campaign.Name + " - Verified " + address.Key + " - " + currentAddressProgress + "/" + totalAddress, Report.Address); counter++; } fileResult.Close(); return(true); }
static void Main(string[] args) { Admin Aktuz; Uzytkownik Aktu; int a; Uruchomienie U = new Uruchomienie(); pom g = new pom(); string slowo = null; int o = 0; int ile = 0; iwezel.create(ref g, "Root", 'k', "Root"); iwezel.create(ref g, "Home", 'k', "Root"); ZarzadcaProcesow zarzadcapr = new ZarzadcaProcesow(); Pamiec pam = new Pamiec(16 * 16); proces init = new proces(1, 20); zarzadcapr.dodaj_doWsz(init); // // String wczytane; // int o=0; // string slowo=null; // ZarzadcaProcesow zarzadcapr = new ZarzadcaProcesow(); // iwezel.create(ref g, "Root", 'k', "Root"); // iwezel.create(ref g, "Home", 'k', "Root"); // początek logowania int bre = 0; while (bre != 1) { a = U.spr(); if (a == 1) { string ha; Console.Write("Ustaw hasło do konta administratora:"); ha = Console.ReadLine(); Aktuz = new Admin("administrator", ha, g, o, slowo, zarzadcapr, ile, pam, init); using (System.IO.StreamWriter file = new System.IO.StreamWriter(Aktuz.sciezka, true)) { file.WriteLineAsync(); file.WriteLineAsync(ha); } bre = Aktuz.polecenia(); } else { Logowanie S = new Logowanie(); S.Log(); while (a != 1 && a != 2) { try { a = S.spr(); } catch (System.IndexOutOfRangeException) { Console.Write("złe dane\npodaj je jeszcze raz\n"); S.Log(); } } if (a == 2) { Aktuz = new Admin(S.login, S.haslo, g, o, slowo, zarzadcapr, ile, pam, init); bre = Aktuz.polecenia(); } if (a == 1) { Aktu = new Uzytkownik(S.login, S.haslo, g, o, slowo, zarzadcapr, ile, pam, init); bre = Aktu.polecenia(); } } } // koniec logowania return; }
//////////////////////////////////////////////////////////////////////// public async System.Threading.Tasks.Task <object> TimTick(object[] parameters) { string password = ""; byte[] decryptedArr = new byte[1]; NameValueCollection formData = new NameValueCollection(); //while (true) { if (TimTickEnabled == true) { Uri uriStr; string autoIncrementIndexOfData = cntAutoInc.ToString(); string InputString = ""; if (password == "" && GlobalClass.TestSecretCloud() == true) { password = GlobalClass.ReadSecretCloud(); //Sha256 } //******************* INITIATE PHPSESSION *************************** CookieAwareWebClient webClient = new CookieAwareWebClient(); webClient.Encoding = System.Text.Encoding.Default; formData.Clear(); formData["username"] = "******"; formData["password"] = ""; if ((formData["password"] == "") && GlobalClass.TestPasswordCloud() == true) { formData["password"] = GlobalClass.ReadPasswordCloud(); //Sha256 } Uri.TryCreate("http://your.url.here/lo.php", UriKind.RelativeOrAbsolute, out uriStr); Task <byte[]> loTaskString = webClient.UploadValuesTaskAsync(uriStr, "POST", formData); await loTaskString; byte[] responseBytes = loTaskString.Result; string responseHTML = Encoding.UTF8.GetString(responseBytes); if (Uri.TryCreate("http://your.url.here", UriKind.RelativeOrAbsolute, out uriStr) == false) { System.Diagnostics.Debug.WriteLine("NO"); } foreach (Cookie cookie in webClient.CookieContainer.GetCookies(uriStr)) { System.Diagnostics.Debug.WriteLine(cookie.Name); System.Diagnostics.Debug.WriteLine(cookie.Value); } //******************* INITIATE PHPSESSION *************************** //******************* DOWNLOAD XML FILE LIST *************************** Uri.TryCreate("http://your.url.here/filelist.php", UriKind.RelativeOrAbsolute, out uriStr); Task <string> fileListTaskString = webClient.DownloadStringTaskAsync(uriStr); await fileListTaskString; string fileList = fileListTaskString.Result; DataSet ds = new DataSet(); byte[] byteArray = Encoding.UTF8.GetBytes(fileList); ds.ReadXml(new MemoryStream(byteArray)); if (ds.Tables.Count > 0) { var result = ds.Tables[0]; } dataGridView1.DataSource = ds.Tables[0]; //******************* DOWNLOAD XML FILE LIST *************************** //******************* CHECK MAX ID *************************** DataTable dtMaxId = ds.Tables[0]; using (var ms = new MemoryStream()) { int cnt = dtMaxId.Rows.Count; Int64 newID = Convert.ToInt64(dtMaxId.Rows[cnt - 1]["id"]); autoIncrementIndexOfData = newID.ToString(); if (lastId < newID) { lastId = newID; Debug.WriteLine(autoIncrementIndexOfData); //******************* CHECK TIME *************************** DateTime tim = Convert.ToDateTime(dtMaxId.Rows[cnt - 1]["time"]); { Debug.WriteLine(tim); } double timCmop = Convert.ToDouble((DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds); if (!((Convert.ToDouble(((tim.ToUniversalTime().AddSeconds(1)) - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds) - timCmop) >= 0.0)) { //last picture is oler than ten seconds Debug.WriteLine("No newId"); return(0); } //******************* CHECK TIME *************************** } else //no new Id { Debug.WriteLine("No newId"); return(0); } } //******************* CHECK MAX ID *************************** //******************* CHECK TIME *************************** //DataTable dtMaxTime = ds.Tables[0]; //using (var ms = new MemoryStream()) //{ // int cnt = dtMaxTime.Rows.Count; // DateTime tim = Convert.ToDateTime(dtMaxTime.Rows[cnt - 1]["time"]); // { // Debug.WriteLine(tim); // } //} //******************* CHECK TIME *************************** //******************* DOWNLOAD IV *************************** Task <byte []> ivArrTaskByte = webClient.DownloadDataTaskAsync("http://your.url.here/listiv.php?id=" + autoIncrementIndexOfData); await ivArrTaskByte; byte[] ivArr = ivArrTaskByte.Result; //******************* DOWNLOAD IV *************************** //******************* DOWNLOAD LENGTH *************************** Task <byte[]> lengthTaskByte = webClient.DownloadDataTaskAsync("http://your.url.here/getLen.php?id=" + autoIncrementIndexOfData); await lengthTaskByte; byte[] length = lengthTaskByte.Result; //filesize from files int fileSize = 0; foreach (byte l in length) { fileSize += (byte)(l - (byte)(0x30)); fileSize *= 10; } fileSize /= 10; System.Diagnostics.Debug.WriteLine("filesize: " + fileSize.ToString()); //******************* DOWNLOAD LENGTH *************************** //******************* DOWNL DATA *************************** Uri.TryCreate("http://your.url.here/dwnl_delete.php?id=" + autoIncrementIndexOfData, UriKind.RelativeOrAbsolute, out uriStr); Task <string> InputTaskString = webClient.DownloadStringTaskAsync(uriStr); await InputTaskString; InputString = InputTaskString.Result; //******************* DOWNL DATA *************************** // Create sha256 hash SHA256 mySHA256 = SHA256Managed.Create(); byte[] key = mySHA256.ComputeHash(Encoding.ASCII.GetBytes(password)); try { string decrypted = this.DecryptString(InputString, key, ivArr, fileSize); decryptedArr = Convert.FromBase64String(decrypted); //******************* DECRYPT *************************** //******************* CHECK SIGN *************************** Encoding encoding = Encoding.UTF8; DataTable dt = ds.Tables[0]; BinaryFormatter bf = new BinaryFormatter(); string dbSignStr = ""; using (var ms = new MemoryStream()) { foreach (DataRow row in dt.Rows) { if (row["id"].ToString() == autoIncrementIndexOfData) { Debug.WriteLine(row["sign"].ToString()); bf.Serialize(ms, row["sign"]); dbSignStr = row["sign"].ToString(); } } byte[] signObj = ms.ToArray(); } StringBuilder sBuilder = new StringBuilder(); using (HMACSHA256 hmac = new HMACSHA256(key)) { var hash = hmac.ComputeHash(StringToStream(decrypted)); // Create a new Stringbuilder to collect the bytes and create a string. // Loop through each byte of the hashed data // and format each one as a hexadecimal string. for (int i = 0; i < hash.Length; i++) { sBuilder.Append(hash[i].ToString("x2")); } // Return the hexadecimal string. Debug.WriteLine(sBuilder.ToString()); } //******************* CHECK SIGN *************************** if (sBuilder.ToString() == dbSignStr) //check signature { //SIGNATURE CHECK SUCCESSFUL try { using (System.IO.StreamWriter file = new System.IO.StreamWriter(dwnlPath, true)) { await file.WriteLineAsync(Encoding.UTF8.GetChars(decryptedArr)); } } catch (Exception ex) { //GlobalClass.Log("ERROR @ WriteFileToPath" + ex.ToString()); } //******************* CHECK SIGN *************************** } } catch { } finally { } try { Stream newStream = ByteArrToStream(decryptedArr); // Stretches the image to fit the pictureBox. if (pictureBox1.Image == null) { pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; } if (pictureBox1.Image != null) { pictureBox1.Image.Dispose(); } using (Image MyImage = Image.FromStream(newStream)) { pictureBox1.Image = (Image)MyImage.Clone(); pictureBox1.Update(); pictureBox1.Refresh(); } } catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.ToString()); } } else //false { //stop await System.Threading.Tasks.Task.Delay(1000); return(0); } } return(0); }
public async Task StartAsync() { string path = @"config.dkk"; string[] readText = File.ReadAllLines(path); string key = readText[0]; await Client.LoginAsync(TokenType.Bot, key); await Client.StartAsync(); await Client.SetGameAsync("%help"); Client.Log += x => { Console.WriteLine(x.Message); return(Task.CompletedTask); }; Commands.CommandErrored += (result, ctx, provider) => { Console.WriteLine(result.Exception.ToString()); return(Task.CompletedTask); }; Client.MessageReceived += async s => { if (!(s is SocketUserMessage msg)) { return; //Do some checks } if (!msg.Author.IsBot) { Console.WriteLine(msg.Author + " said: " + msg.Content); try { SocketGuild server = ((SocketGuildChannel)msg.Channel).Guild; using (System.IO.StreamWriter file = new System.IO.StreamWriter($"logs/{server.Name} - Log.txt", true)) { await file.WriteLineAsync(System.DateTime.Now + " | " + msg.Channel + " | " + msg.Author + " said: " + msg.Content); } } catch (Exception e) { Console.WriteLine(e.Message); } } if (msg.Author.IsBot) { return; } if (msg.Author.Id == Client.CurrentUser.Id) { return; } var context = new CommandHandlingService(msg); if (!CommandUtilities.HasAnyPrefix(msg.Content, new[] { "%" }, StringComparison.OrdinalIgnoreCase, out string usedPrefix, out string cmd) == true) { return; } var result = await Commands.ExecuteAsync(cmd, context, Provider); //Try to run Command if (result is FailedResult failResult) { await context.Channel.SendMessageAsync(failResult.Reason); } return; }; await Task.Delay(-1); //Wait forever to keep the bot running }
public static async Task <bool> CheckAddressListBitcoin(string projectName, Campaign campaign, IProgress <ProgressStatus> progressinfo) { int counter = 0; Smartbit bitcoinScan = new Smartbit(); Connection connected = null; int currentAddressProgress = 0; int totalAddress = campaign.Partecipants.Count; int currentTransactionProgress = 0; int totalTransaction = 0; string runResults = "results.txt"; System.IO.StreamWriter fileResult = new System.IO.StreamWriter(runResults); xmlBounty bountydata = new xmlBounty(projectName + "_results.xml"); foreach (KeyValuePair <string, string> address in campaign.Partecipants) { await fileResult.WriteLineAsync(address.Value + " connected with:"); totalTransaction = bitcoinScan.GetTransactionsCount(address.Key); if (totalTransaction == 0) { continue; } int limit = 100; string stringJson = bitcoinScan.GetTransactions(address.Key, 100); JObject jsonTransactions = JObject.Parse(stringJson); bool firstRun = true; currentTransactionProgress = 0; while (jsonTransactions != null || firstRun == true) { firstRun = false; try { foreach (JToken element in jsonTransactions["address"]["transactions"]) { string stringTransactionJson = bitcoinScan.GetTransactionDetails(element["txid"].ToString()); string transactionId = element["txid"].ToString(); //Console.WriteLine("Checking Transaction:" + transactionId); JObject json = JObject.Parse(stringTransactionJson); Dictionary <string, double> addressInput = new Dictionary <string, double>(); if (json["transaction"]["inputs"].Count() > 0) { if (json["transaction"]["inputs"][0].Count() > 0) { foreach (JToken jsonAddress in json["transaction"]["inputs"]) { if (addressInput.ContainsKey(jsonAddress["addresses"][0].Value <string>()) == false) { addressInput.Add(jsonAddress["addresses"][0].Value <string>(), Double.Parse(jsonAddress["value"].Value <string>())); } } } } Dictionary <string, double> addressOutputList = new Dictionary <string, double>(); if (json["transaction"]["outputs"].Count() > 0) { if (json["transaction"]["outputs"][0].Count() > 0) { if (json["transaction"]["outputs"][0]["addresses"].Count() > 0) { foreach (JToken jsonAddress in json["transaction"]["outputs"][0]["addresses"]) { addressOutputList.Add(jsonAddress.Value <string>(), Double.Parse(json["transaction"]["outputs"][0]["value"].Value <string>())); } } } } foreach (KeyValuePair <string, double> addressIn in addressInput) { if (addressInput.Count > 1 && addressIn.Key != address.Key) { connected = bitcoinScan.CheckIfAnyTrasactionWithinInput(campaign.Partecipants, addressIn.Key); SaveConnection(campaign, connected, bountydata, address, fileResult, addressIn, transactionId, addressInput); } if (addressOutputList.ContainsKey(address.Key) && addressIn.Key != address.Key) { connected = bitcoinScan.CheckIfAnyTrasactionWithOtherAddress(campaign.Partecipants, addressIn.Key); SaveConnection(campaign, connected, bountydata, address, fileResult, addressIn, transactionId, addressInput); } } foreach (KeyValuePair <string, double> addressOut in addressOutputList) { if (addressInput.ContainsKey(address.Key) && addressOut.Key != address.Key) { connected = bitcoinScan.CheckIfAnyTrasactionWithOtherAddress(campaign.Partecipants, addressOut.Key); SaveConnection(campaign, connected, bountydata, address, fileResult, addressOut, transactionId, addressInput); } } currentTransactionProgress++; ReportProgressStatus(progressinfo, totalTransaction, currentTransactionProgress, campaign.Name + " - Checked transactions " + currentTransactionProgress + "/" + totalTransaction, Report.Transaction); } } catch (Exception e) { Console.WriteLine(e); throw; } string NextLink = jsonTransactions["address"]["transaction_paging"]["next_link"] .Value <string>(); if (NextLink != null) { stringJson = bitcoinScan.GetHtmlFromUrlLimit(NextLink, limit, out limit); jsonTransactions = JObject.Parse(stringJson); } else { jsonTransactions = null; } } currentAddressProgress++; ReportProgressStatus(progressinfo, totalAddress, currentAddressProgress, campaign.Name + " - Verified " + address.Key + " - " + currentAddressProgress + "/" + totalAddress, Report.Address); counter++; } fileResult.Close(); return(true); }