/// <summary> /// This is where I will put the data in the UI /// </summary> /// <param name="dataObject"></param> private void CheckData(Json_Data dataObject) { // If the datat hat we got has nothing in it... if (dataObject.hits.hits.Length == 0) { // Dispaly error text proto.text = "Not Found"; port.text = "Not Found"; dest.text = "Not Found"; // Return out of this return; } // Stop the Loading animation if we need one // Set our latest packetbeat time to the most recent one _latest_time = dataObject.hits.hits[0]._source.runtime_timestamp; // Send the data to the game controller for all of our hits for (int i = 0; i < dataObject.hits.hits.Length; i++) { // Display the data proto.text = dataObject.hits.hits[i]._source.proto; port.text = dataObject.hits.hits[i]._source.id_resp_p.ToString(); dest.text = dataObject.hits.hits[i]._source.id_resp_h; } // Stop the monitor, because we only want 1 query StopMonitor(); }
/// <summary> /// Check if this data is of the bro type. /// If it is, then check it like we need to for packetbeat /// </summary> /// <typeparam name="T"></typeparam> /// <param name="data"></param> public override void CheckRequestData <T>(T data) { if (typeof(T) == typeof(Json_Data)) { // Cast the object as necessary _broData = data as Json_Data; // Make sure that we are not already running a coroutine if (_checkDataRoutine != null) { // If we are then stop it StopCoroutine(_checkDataRoutine); } // As long as we have finished checking out the previous request if (checkingState == CheckDataStates.Done) { // Otherwise, start a new coroutine _checkDataRoutine = StartCoroutine(CheckData(_broData)); } } else { return; } }
protected override void NotifyToChildrenAsChanged() { //https://api.ethermine.org/miner/ee328a992046570f45970e06155b87e813361a4a/workers //{"status":"OK","data":[{"worker":"3090-2","time":1621352400,"lastSeen":1621352367,"reportedHashrate":433797908,"currentHashrate":411547659.92833334,"validShares":343,"invalidShares":0,"staleShares":3,"averageHashrate":415222961.9435879},{"worker":"3090-5li","time":1621352400,"lastSeen":1621352367,"reportedHashrate":707161209,"currentHashrate":661196443.3458333,"validShares":549,"invalidShares":0,"staleShares":8,"averageHashrate":692508591.4666438},{"worker":"melih-kktc","time":1621352400,"lastSeen":1621352366,"reportedHashrate":1260949519,"currentHashrate":1247647384.7508333,"validShares":1036,"invalidShares":0,"staleShares":15,"averageHashrate":1220588015.0897803},{"worker":"melih-rigrig-1","time":1621352400,"lastSeen":1621352361,"reportedHashrate":406673131,"currentHashrate":460880884.27416664,"validShares":385,"invalidShares":0,"staleShares":2,"averageHashrate":397732136.68556714},{"worker":"melih-rigrig-1-redminer","time":1621352400,"lastSeen":1621352365,"reportedHashrate":258040846,"currentHashrate":265635850.07416666,"validShares":222,"invalidShares":0,"staleShares":1,"averageHashrate":245787065.04707173}]} if (!HasError() && HasText()) { isConverted = true; result = JsonUtility.FromJson <Json_Result>(GetText()); if (result.status.ToLower() == "ok") { WalletAddress address = new DefaultWalletAddress(m_addressTarget); m_resultWorkers = new WorkerLinkedData <EtherMineOrgWorkerFrame> [result.data.Length]; for (int i = 0; i < result.data.Length; i++) { Json_Data d = result.data[i]; DefaultWorkerFromWalletID worker = new DefaultWorkerFromWalletID(address, result.data[i].worker); string workerFullId = worker.GetWorkerId(); EtherMineOrgWorkerFrame frame = new EtherMineOrgWorkerFrame(); frame.SetWorkerRef(new EhterMineWorkerRef(worker)); frame.SetTime((ulong)d.time); frame.SetTimeLastSeen((ulong)d.time); frame.SetHashRate((double)d.currentHashrate, (double)d.reportedHashrate, (double)d.averageHashrate); frame.SetShares(d.validShares, d.invalidShares, d.staleShares); m_resultWorkers[i] = new WorkerLinkedData <EtherMineOrgWorkerFrame>(worker, frame); } } } else { isConverted = false; } }
public override void StartMonitor() { // Make sure that the FSM knows we are starting again base.StartMonitor(); // Send it packetbeat data dataObj = new Json_Data(); // Start the finite satate machine for the web request StartCoroutine(FSM(dataObj)); // TODO: Start the loading animation }
/// <summary> /// This will start the FSM with our specific stype of data /// </summary> public override void StartMonitor() { // Make sure that the FSM knows we are starting again base.StartMonitor(); // Send it packetbeat data _broData = new Json_Data(); // Start the finite satate machine for the web request StartCoroutine(FSM(_broData)); checkingState = CheckDataStates.Done; }
static void SetUrl() { Console.Write("Present url: " + Json_Data.WriteData("url")); Console.SetCursorPosition(0, 2); Console.Write("Write new url: "); string newUrl = Console.ReadLine(); if (!string.IsNullOrEmpty(newUrl)) { Json_Data.ModifyData("url", newUrl); } Console.Write("Saved!"); Console.ReadKey(); }
public void LoginToOwnAccount() { MainPage home = new MainPage(driver); home.goToPage(); Task.Delay(2000).Wait(); home.RodoPopUpClose(); Task.Delay(2000).Wait(); home.LoginOnPage(Json_Data.WriteData("login"), Json_Data.WriteData("password")); Task.Delay(2000).Wait(); home.EnterUserPassword(Json_Data.WriteData("userPassword")); Task.Delay(2000).Wait(); home.BookList(); driver.Quit(); PushToExcel.ListToExcel(home.bookList, home.bookLinkList); }
/// <summary> /// Check the data for a Json Object /// </summary> /// <param name="dataObject"></param> private IEnumerator CheckData(Json_Data dataObject) { // ================= Check and make sure that our data is valid ===================== // // Make sure that our data is not null if (dataObject.hits.hits.Length == 0) { _UseLastSuccess = true; // Tell this to use the last successful query yield break; //return; } // Let this know that we no longer need to bank on the last success if (_UseLastSuccess) { _UseLastSuccess = false; } // ============= Keep track of stuff to prevent duplicates =============== // Set our latest packetbeat time to the most recent one _latest_time = dataObject.hits.hits[0]._source.logstash_timestamp; packetPerQuery++; // Keep track of the state of this data checking checkingState = CheckDataStates.Running; // Send the data to the game controller for all of our hits for (int i = 0; i < dataObject.hits.hits.Length; i++) { // Set the integer IP values if this source SetIntegerValues(dataObject.hits.hits[i]._source); // If the source or dest ip's are 0 then break if (dataObject.hits.hits[i]._source.sourceIpInt != 0 && dataObject.hits.hits[i]._source.destIpInt != 0) { // Send the bro data to the game controller, and add it to the network DeviceManager.Instance.CheckIp(dataObject.hits.hits[i]._source); } // Make sure we get them smooth frames yield return(null); } packetPerQuery = 0; // We are done chekcing this now checkingState = CheckDataStates.Done; }
public async static Task RefreshNotifiedToday() { var today = DateTime.Now; var lastModified = Json_Data.LastModified(); var diff = today - lastModified; var lastModifiedHour = lastModified.Hour; var diffDays = diff.Days; logger.Info($"Last modified {diffDays} days ago"); logger.Info($"Last modified at {lastModifiedHour}"); if (diffDays > 0 || lastModifiedHour < 3) { await Notifier.ResetNotified(); logger.Info("Refreshing notifiedToday field."); } }
/// <summary> /// Cast the data how it needs to be for me to check it /// </summary> /// <typeparam name="T">The type of JSON data that we want to look at</typeparam> /// <param name="data">The serialized JSON data</param> public override void CheckRequestData <T>(T data) { // If the type of this data is of the type that we are interested in... if (typeof(T) == typeof(Json_Data)) { // Cast the object as necessary dataObj = data as Json_Data; // Check the data that we want to CheckData(dataObj); } // If this data is not the type that we care about... else { // Stop the monitor StopMonitor(); // Return out of this method return; } }
static void ShowMenu() { Console.BackgroundColor = ConsoleColor.Black; Console.Clear(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("Obecny url: " + Json_Data.WriteData("url")); Console.WriteLine(); for (int i = 0; i < menuItem.Length; i++) { if (i == selectedMenuItem) { Console.BackgroundColor = ConsoleColor.Green; Console.ForegroundColor = ConsoleColor.Black; Console.WriteLine("{0, -20}", menuItem[i]); Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.Green; } else { Console.WriteLine(menuItem[i]); } } }
public static void ListToExcel(List <string> List1, List <string> linkList) { Microsoft.Office.Interop.Excel.Application Excel; Microsoft.Office.Interop.Excel._Workbook Excel_Workbook; Microsoft.Office.Interop.Excel._Worksheet Excel_Sheet; Microsoft.Office.Interop.Excel.Range oRng; object misvalue = System.Reflection.Missing.Value; //Start Excel and get Application object. Excel = new Microsoft.Office.Interop.Excel.Application { Visible = CommonHelpers.ExcelVisible }; //Get an active workbook. Excel_Workbook = (Microsoft.Office.Interop.Excel._Workbook)(Excel.Workbooks.Open(Json_Data.WriteData("filePath"))); Excel_Sheet = (Microsoft.Office.Interop.Excel._Worksheet)Excel_Workbook.ActiveSheet; //Show all rows when Autofilter is enabled if ((Excel_Sheet.AutoFilterMode && Excel_Sheet.FilterMode) || Excel_Sheet.FilterMode) { Excel_Sheet.AutoFilter.ShowAllData(); } oRng = Excel_Sheet.UsedRange; int rowNo = oRng.Rows.Count + 1; for (int row = 0; row < List1.Count; ++row) { string[] TitleAndAuthor = PushToExcel.RemoveExtension(List1[row]); Excel_Sheet.Cells[row + rowNo, "A"] = TitleAndAuthor[1]; Excel_Sheet.Cells[row + rowNo, "B"] = TitleAndAuthor[0]; Excel_Sheet.Cells[row + rowNo, "C"] = CommonHelpers.Folder; } for (int row = 0; row < linkList.Count; ++row) { Excel_Sheet.Hyperlinks.Add(Excel_Sheet.get_Range($"B{row + rowNo}"), linkList[row], "", $"Pobierz plik {List1[row]}"); } Excel.Visible = false; Excel.UserControl = false; Excel_Workbook.Save(); Excel_Workbook.Close(); Excel.Quit(); }
public void goToPage() { driver.Navigate().GoToUrl(Json_Data.WriteData("url")); Console.WriteLine($@"Open {Json_Data.WriteData("url")} website."); }
static void InfoOption() { Console.SetCursorPosition(0, 2); Console.Write(Json_Data.WriteAllData()); Console.ReadKey(); }
public override string ToString() { return("[{0}] with size: {1}".format(Type, Json_Data.size())); }