Click here to Skip to main content
15,895,011 members
Home / Discussions / C#
   

C#

 
GeneralRe: Check if xy point is within a polygon Console App Pin
Richard MacCutchan11-Nov-18 23:43
mveRichard MacCutchan11-Nov-18 23:43 
GeneralRe: Check if xy point is within a polygon Console App Pin
OriginalGriff12-Nov-18 0:27
mveOriginalGriff12-Nov-18 0:27 
AnswerRe: Check if xy point is within a polygon Console App Pin
OriginalGriff11-Nov-18 23:31
mveOriginalGriff11-Nov-18 23:31 
QuestionWifi and LAN usage Pin
Ashfaque Hussain11-Nov-18 20:08
Ashfaque Hussain11-Nov-18 20:08 
AnswerRe: Wifi and LAN usage Pin
OriginalGriff11-Nov-18 21:17
mveOriginalGriff11-Nov-18 21:17 
GeneralRe: Wifi and LAN usage Pin
Ashfaque Hussain11-Nov-18 23:24
Ashfaque Hussain11-Nov-18 23:24 
GeneralRe: Wifi and LAN usage Pin
OriginalGriff11-Nov-18 23:34
mveOriginalGriff11-Nov-18 23:34 
GeneralRe: Wifi and LAN usage Pin
Ashfaque Hussain12-Nov-18 23:01
Ashfaque Hussain12-Nov-18 23:01 
namespace ConsoleApplication2
{

    using System;
    using System.Diagnostics;
    using System.Net.NetworkInformation;
    using System.Threading;

    class MainClass
    {
        static void Main()
        {

            NetworkInterface nic = NetworkInterface.GetAllNetworkInterfaces()[0];
            IPv4InterfaceStatistics ip4 = nic.GetIPv4Statistics();
            IPInterfaceStatistics ip = nic.GetIPStatistics();
            long ip4data = ip4.BytesReceived + ip4.BytesSent;
            long ipData = ip.BytesReceived + ip.BytesSent;
            Console.WriteLine(ip4data + ipData);
            NetworkInterface[] interfaces
                = NetworkInterface.GetAllNetworkInterfaces();

            foreach (NetworkInterface ni in interfaces)
            {
                if (ni.Name == "Ethernet")
                {
                    Console.WriteLine("LAN Usage:");
                    Console.WriteLine("    Bytes Sent: {0}",
                    ni.GetIPv4Statistics().BytesSent);
                    Console.WriteLine("    Bytes Received: {0}",
                        ni.GetIPv4Statistics().BytesReceived);
                }
                else if (ni.Name.ToLower() == "wi-fi")
                {
                    Console.WriteLine("WIFI Usage:");
                    Console.WriteLine("    Bytes Sent: {0}",
                    ni.GetIPStatistics().BytesSent);
                    Console.WriteLine("    Bytes Received: {0}",
                        ni.GetIPStatistics().BytesReceived);
                }

            }
        }
    }
}


Now can you answer?
This code is working for current system session, how do I modify to read after all the reboot session usage?
Something like below:
Windows 10 : Go to Settings -> Network & Internet -> Data Usage
You can see the 1 month data usage.
QuestionData Adapter is failing to load bulk data Pin
venky_CodeProject11-Nov-18 17:11
venky_CodeProject11-Nov-18 17:11 
AnswerRe: Data Adapter is failing to load bulk data Pin
Dave Kreskowiak11-Nov-18 17:56
mveDave Kreskowiak11-Nov-18 17:56 
GeneralRe: Data Adapter is failing to load bulk data Pin
venky_CodeProject11-Nov-18 19:26
venky_CodeProject11-Nov-18 19:26 
GeneralRe: Data Adapter is failing to load bulk data Pin
Dave Kreskowiak12-Nov-18 13:47
mveDave Kreskowiak12-Nov-18 13:47 
GeneralRe: Data Adapter is failing to load bulk data Pin
venky_CodeProject13-Nov-18 3:49
venky_CodeProject13-Nov-18 3:49 
GeneralRe: Data Adapter is failing to load bulk data Pin
Dave Kreskowiak21-Nov-18 11:15
mveDave Kreskowiak21-Nov-18 11:15 
GeneralRe: Data Adapter is failing to load bulk data Pin
venky_CodeProject22-Nov-18 18:57
venky_CodeProject22-Nov-18 18:57 
QuestionUsing MongoDB in a C# WinForm app with a repository Pin
jkirkerx10-Nov-18 12:43
professionaljkirkerx10-Nov-18 12:43 
QuestionFormatting a number and digits of precision Pin
csharpsucks6-Nov-18 12:19
csharpsucks6-Nov-18 12:19 
AnswerRe: Formatting a number and digits of precision Pin
Mycroft Holmes6-Nov-18 13:28
professionalMycroft Holmes6-Nov-18 13:28 
AnswerRe: Formatting a number and digits of precision Pin
OriginalGriff6-Nov-18 21:01
mveOriginalGriff6-Nov-18 21:01 
GeneralRe: Formatting a number and digits of precision Pin
csharpsucks7-Nov-18 4:32
csharpsucks7-Nov-18 4:32 
GeneralRe: Formatting a number and digits of precision Pin
Richard Deeming7-Nov-18 4:38
mveRichard Deeming7-Nov-18 4:38 
GeneralRe: Formatting a number and digits of precision Pin
OriginalGriff7-Nov-18 4:44
mveOriginalGriff7-Nov-18 4:44 
GeneralRe: Formatting a number and digits of precision Pin
csharpsucks7-Nov-18 6:08
csharpsucks7-Nov-18 6:08 
GeneralRe: Formatting a number and digits of precision Pin
OriginalGriff7-Nov-18 6:28
mveOriginalGriff7-Nov-18 6:28 
GeneralRe: Formatting a number and digits of precision Pin
csharpsucks7-Nov-18 6:44
csharpsucks7-Nov-18 6:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.