-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Heatmaps & Graphs - complete (I hope). So so many changes, more than …
…I can remember.
- Loading branch information
Showing
35 changed files
with
9,165 additions
and
5,550 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows.Forms; | ||
|
||
namespace OSRTT_Launcher | ||
{ | ||
class CFuncs | ||
{ | ||
public DialogResult showMessageBox(string title, string message, MessageBoxButtons buttons, MessageBoxIcon icon) | ||
{ | ||
if (!Properties.Settings.Default.SuppressDiagBox) | ||
{ | ||
DialogResult d = MessageBox.Show(title, message, buttons, icon); | ||
return d; | ||
} | ||
else | ||
{ | ||
return DialogResult.None; | ||
} | ||
} | ||
|
||
public string createFileName(string resultsFolderPath, string searchParams) | ||
{ | ||
decimal fileNumber = 001; | ||
// search /Results folder for existing file names, pick new name | ||
string[] existingFiles = Directory.GetFiles(resultsFolderPath, "*" + searchParams); | ||
// Search \Results folder for existing results to not overwrite existing or have save conflict errors | ||
foreach (var s in existingFiles) | ||
{ | ||
decimal num = 0; | ||
try | ||
{ num = decimal.Parse(Path.GetFileNameWithoutExtension(s).Remove(3)); } | ||
catch | ||
{ Console.WriteLine("Non-standard file name found"); } | ||
if (num >= fileNumber) | ||
{ | ||
fileNumber = num + 1; | ||
} | ||
} | ||
return fileNumber.ToString("000") + searchParams; | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
using Newtonsoft.Json; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Net.Http; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Management; | ||
|
||
namespace OSRTT_Launcher | ||
{ | ||
class DataUpload | ||
{ | ||
public class SystemInfo | ||
{ | ||
public string boardSerial { get; set; } | ||
public CPU cpu { get; set; } | ||
public GPU gpu { get; set; } | ||
public RAM ram { get; set; } | ||
public string MACAddress { get; set; } | ||
} | ||
public class CPU | ||
{ | ||
public string CPUName { get; set; } | ||
public int Cores { get; set; } | ||
public int LogicalProcessors { get; set; } | ||
} | ||
public class GPU | ||
{ | ||
public string GPUName { get; set; } | ||
public Int64 VRAM { get; set; } | ||
public string GPUDriver { get; set; } | ||
} | ||
public class RAM | ||
{ | ||
public Int64 totalCapcity { get; set; } | ||
public int sticks { get; set; } | ||
public int FormFactor { get; set; } | ||
public string PartNumber { get; set; } | ||
public int RamSpeed { get; set; } | ||
public int RamVolts { get; set; } | ||
} | ||
Thread uploadThread; | ||
public async void UploadData(object data, string url) | ||
{ | ||
string json = JsonConvert.SerializeObject(data); | ||
var httpContent = new StringContent(json, Encoding.UTF8, "application/json"); | ||
var httpClient = new HttpClient(); | ||
var httpResponse = await httpClient.PostAsync(url, httpContent); | ||
} | ||
|
||
public void systemInfo() | ||
{ | ||
SystemInfo si = new SystemInfo | ||
{ | ||
boardSerial = Properties.Settings.Default.serialNumber, | ||
cpu = new CPU(), | ||
gpu = new GPU(), | ||
ram = new RAM() | ||
}; | ||
ManagementObjectSearcher cpu = new ManagementObjectSearcher("select * from Win32_Processor"); | ||
foreach (ManagementObject cpuObj in cpu.Get()) | ||
{ | ||
si.cpu.CPUName = cpuObj["Name"].ToString(); | ||
si.cpu.Cores = Convert.ToInt32(cpuObj["NumberOfCores"]); | ||
si.cpu.LogicalProcessors = Convert.ToInt32(cpuObj["NumberOfLogicalProcessors"]); | ||
} | ||
ManagementObjectSearcher gpu = new ManagementObjectSearcher("select * from Win32_VideoController"); | ||
foreach (ManagementObject gpuObj in gpu.Get()) | ||
{ | ||
si.gpu.GPUName = gpuObj["Name"].ToString(); | ||
si.gpu.VRAM = Convert.ToInt64(gpuObj["AdapterRAM"]); | ||
si.gpu.GPUDriver = gpuObj["DriverVersion"].ToString(); | ||
} | ||
ManagementObjectSearcher ram = new ManagementObjectSearcher("select * from Win32_PhysicalMemory "); | ||
Int64 capacity = 0; | ||
int sticks = 0; | ||
foreach (ManagementObject ramObj in ram.Get()) | ||
{ | ||
capacity += Convert.ToInt64(ramObj["Capacity"]); | ||
sticks += 1; | ||
si.ram.FormFactor = Convert.ToInt32(ramObj["FormFactor"]); | ||
si.ram.PartNumber = ramObj["PartNumber"].ToString(); | ||
si.ram.RamSpeed = Convert.ToInt32(ramObj["ConfiguredClockSpeed"]); | ||
si.ram.RamVolts = Convert.ToInt32(ramObj["ConfiguredVoltage"]); | ||
} | ||
si.ram.totalCapcity = capacity; | ||
si.ram.sticks = sticks; | ||
ManagementObjectSearcher nac = new ManagementObjectSearcher("select * from Win32_NetworkAdapterConfiguration"); | ||
foreach (ManagementObject nacObj in nac.Get()) | ||
{ | ||
bool enabled = (bool)nacObj["IPEnabled"]; | ||
if (enabled) | ||
{ | ||
si.MACAddress = nacObj["MACAddress"].ToString(); | ||
} | ||
} | ||
//UploadData(si, "https://api.osrtt.com/systemInfo"); | ||
} | ||
public void UploadRawData(List<List<ProcessData.rawResultData>> rawData) | ||
{ | ||
// thread this | ||
string url = "https://api.osrtt.com/rawData"; | ||
UploadData(rawData, url); | ||
} | ||
public void UploadGammaData(List<ProcessData.gammaResult> gamma) | ||
{ | ||
string url = "https://api.osrtt.com/gammaData"; | ||
UploadData(gamma, url); | ||
} | ||
public void UploadTestLatency(List<int> testLatency) | ||
{ | ||
string url = "https://api.osrtt.com/testLatency"; | ||
UploadData(testLatency, url); | ||
} | ||
public void UploadRunSettings(ProcessData.runSettings testLatency) | ||
{ | ||
string url = "https://api.osrtt.com/runSetting"; | ||
UploadData(testLatency, url); | ||
} | ||
|
||
// PC config... | ||
|
||
public void ShareResults( | ||
List<List<ProcessData.rawResultData>> rawData, | ||
List<ProcessData.gammaResult> gamma, | ||
List<int> testLatency, | ||
ProcessData.runSettings runSetting | ||
// PC config | ||
) | ||
{ | ||
Guid g = Guid.NewGuid(); | ||
// put guid in request _somewhere_ | ||
UploadRawData(rawData); | ||
UploadGammaData(gamma); | ||
UploadTestLatency(testLatency); | ||
UploadRunSettings(runSetting); | ||
} | ||
} | ||
} |
Oops, something went wrong.