SilverAzide / Gadgets

Gadgets for Rainmeter
Other
361 stars 12 forks source link

Migrating the Total Usage of Upload and Download from Network Meter by addgadgets.com #91

Closed rockychf closed 9 months ago

rockychf commented 9 months ago

I was using the Network Meter v9.6 by addgadgets.com before and now I changed to use Rainmeter + Gadgets (Network Meter), may I know how can I modified the Total Usage in Network Meter of Gadgets so that I can migrate the Total Usage of Upload and Download data from the old Network Meter I was using?

SilverAzide commented 9 months ago

Yes! I did this years ago as well. Unfortunately, it has been so long ago that I can't recall where the addgadgets.com data file was located, but I suppose it won't matter as long as you can see the value shown in the gadget.

To migrate the data, you have two choices based on whether you are using the Network Meter or Network Meter Pro gadget. I will warn you that the Network Meter (non-Pro) has a dependency on Rainmeter which is VERY fragile due to the unfortunate way Rainmeter keeps track of the network stats. You may find that Rainmeter will lose track of the stats and they will be hopelessly unstable over time. This is the main reason I created the Network Meter Pro skin variant.

If you are using the Network Meter (which is purely dependent on Rainmeter):

  1. Open the Rainmeter Manage window and on the Settings tab check the "Debug mode" and "Log to file" options, the restart Rainmeter. If these options are already checked, skip this step.
  2. Open the Rainmeter Manage window and on the Settings tab click the "Show log file" button.
  3. Near the top of the file you will find a section labeled "NETWORK-INTERFACE: Count=nnn". Below here are every network adapter that exists on your PC, including virtual adapters. You need to track down the actual adapter(s) used by your system. To do this, search for the text string "Hardware=Yes". For each match, you'll see one of the physical (real) network adapters on your machine. It will look something like:
    17: Name: Realtek USB GbE Family Controller #1
    Alias: Ethernet
    GUID: {...}
    Type=Ethernet(6), Hardware=Yes, Filter=No
    IfIndex=20, State=Connected, Status=Up(1)
  4. For each adapter that you want to transfer to Rainmeter, note down the adapter Name and the IfIndex value. If you don't need the adapter (because you were not monitoring them with the sidebar gadget) you can skip it.
  5. For each of the adapters you noted in step 4, write down the total number of bytes, not megabytes or gigabytes, as shown the sidebar gadget or from the data file it uses. There will be two values, the Up (or Out) value and the Down (or In) value.
  6. Shut down Rainmeter, if it is running (required).
  7. Open the Rainmeter network stats file, which is normally C:\Users\<username>\AppData\Roaming\Rainmeter\Rainmeter.stats.
  8. In this file you'll see pairs of values, like In20 and Out20. The number appended to each of these corresponds to the IfIndex value you noted earlier. All you need to do is edit each pair of values that apply to the adapter you noted down previously, and change the In/Out values to match the sidebar gadget.
  9. Save the Rainmeter.stats file and restart Rainmeter. Your network values shown in any Rainmeter skin (not just mine) will now match the old sidebar gadgets.

Read this wiki article (first section) for a warning. Your total session stats can change to incorrect values at almost any time due to the way Rainmeter stats are tracked by IfIndex values, which change frequently.

If you are using the Network Meter Pro:

  1. If you have not installed the NetMonitor service, do this first and make sure it is running. You can do this from the Settings skin. Once the service is running (it needs to run first to gather your adapter data), stop it by clicking the Stop button in the Settings skin.
  2. Do the first FIVE steps in the instructions above, if you have not already done so. However, you can safely ignore any reference to the IfIndex values, as NetMonitor does not care about these.
  3. Next, open the Windows Registry Editor (regedit) and navigate to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Gadgets\NetMonitor.
  4. In this branch, you will see a sub-key for every network adapter on your system (same as the list in the Rainmeter debug log).
  5. Locate each key that exactly matches the name of one of your adapters. For each key, there will be a value named TotalBytesIn and TotalBytesOut. Edit each of these to match the values you noted in the sidebar gadget (make sure you edit the decimal value, not hexadecimal).
  6. Once you've done all the adapters, close the Registry Editor and restart the NetMonitor service.
  7. Restart Rainmeter if not running. Your "Pro" skins should now show "Total" values that match your sidebar gadgets.
SilverAzide commented 9 months ago

P.S.: Just a reminder that the Network Meter (both Pro and non-Pro) show the sum total of all configured adapters in the "Total". For example, if you configure both Ethernet and WiFi adapters, you'll see the total is the sum of both adapters. You can temporarily change the configuration to a single adapter to test that your transferred values are being shown correctly. If you leave all the adapter settings blank, then the skin will only show data for the active adapter (or what Rainmeter decides is the active one).