Exemplo n.º 1
0
 /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
 /* TODO ERROR: Skipped RegionDirectiveTrivia */
 public void loadLocation()
 {
     changeDataLoadedState(true);
     loadIpAddressData = new HttpDataGetData(enVars, "https://api.ipify.org");
     loadIpAddressData.initialize();
     loadIpAddressData.startRequest();
 }
Exemplo n.º 2
0
        /* TODO ERROR: Skipped EndRegionDirectiveTrivia */
        /* TODO ERROR: Skipped RegionDirectiveTrivia */
        private void sendCrashReports()
        {
            taskManager.setStatus("checkUpdates", Conversions.ToInteger(tasksManager.tasksManagerClass.BUSY));

            // TODO: send encryped and auth crach reports plus add latency time on more
            var crashFile = new FileInfo(Path.Combine(state.basePath, "crash.log"));

            crashFile.Refresh();
            if (crashFile.Exists & state.SendDiagnosticData && BasicLibraries.FileManagementLib.FileInUse(Path.Combine(state.basePath, "crash.log")))
            {
                updateStatusMessage?.Invoke(this, "sending crash report data...");
                string report = My.MyProject.Computer.FileSystem.ReadAllText(Path.Combine(state.basePath, "crash.log"), System.Text.Encoding.UTF8);
                var    logs   = Strings.Split(report, "-------------end report---------------");
                sendCrashData = new HttpDataGetData(state, state.customization.crashReportServerAddr);
                sendCrashData.initialize();
                for (int i = 0, loopTo = logs.Length - 1; i <= loopTo; i++)
                {
                    if (logs[i].Replace(" ", "").Replace(System.Environment.NewLine, "").Equals(""))
                    {
                        continue;
                    }

                    var vars = new Dictionary <string, string>();
                    vars.Add("uuid", state.userId);
                    vars.Add("report", Uri.EscapeDataString(logs[i]));
                    sendCrashData.loadQueue(vars, null, state.libraryPath);
                }

                sendCrashData.startRequest();
            }
            else
            {
                taskManager.setStatus("checkUpdates", Conversions.ToInteger(tasksManager.tasksManagerClass.FINISHED));
            }
        }
Exemplo n.º 3
0
        private void loadIpAddressData_dataArrived(object sender, string responseData, Dictionary <string, string> misc)
        {
            IPAddress _ip = null;

            if (IPAddress.TryParse(responseData, out _ip).Equals(true))
            {
                enVars.currentIpAddress = responseData;
                loadLocationCoordinates = new HttpDataGetData(enVars, "http://ip-api.com/json/" + responseData);
                loadLocationCoordinates.initialize();
                loadLocationCoordinates.startRequest();
            }
        }
Exemplo n.º 4
0
 private void loadLocationCoordinates_dataArrived(object sender, string responseData, Dictionary <string, string> misc)
 {
     AeonLabs.Environment.environmentVarsCore.locationDataStructure locationDataItem;
     locationDataItem = enVars.locationData;
     try
     {
         var jsonLatResult = JsonConvert.DeserializeObject <Dictionary <string, object> >(responseData);
         if (jsonLatResult.ContainsKey("lat") & jsonLatResult.ContainsKey("lon"))
         {
             locationDataItem.latitude  = jsonLatResult["lat"].ToString().Replace(",", ".");
             locationDataItem.longitude = jsonLatResult["lon"].ToString().Replace(",", ".");
             enVars.locationData        = locationDataItem;
             loadLocationData           = new HttpDataGetData(enVars, "http://nominatim.openstreetmap.org/reverse?format=json&lat=" + enVars.locationData.latitude + "&lon=" + enVars.locationData.longitude + "&zoom=18&addressdetails=1");
             loadLocationData.initialize();
             loadLocationData.startRequest();
         }
     }
     catch (Exception ex)
     {
         changeDataLoadedState(false, LOAD_LOCATION);
         enVars.stateErrorMessage = ex.ToString();
     }
 }