IEnumerator sendSessionData(TraceSession sess)
    {
        string jsonData = JsonUtility.ToJson(sess);

        Debug.Log(jsonData);
        string sessionTimestamp = sess.dateTime;
        string secretAuthKey    = "PJX1mOVOPUuwPv7qIyPS0J4jSEsJF4hok0gpBi0b";
        string destUrl          = $"https://rh2020-dyslexia-db.firebaseio.com/sessions/{sessionTimestamp}.json?auth={secretAuthKey}";

        using (UnityWebRequest www = UnityWebRequest.Put(destUrl, jsonData))
        {
            yield return(www.SendWebRequest());

            if (www.isNetworkError || www.isHttpError)
            {
                Debug.Log(www.error);
            }
            else
            {
                Debug.Log("Form upload complete!");
            }
        }
    }
Esempio n. 2
0
        internal static string GetTraceFolderForNode(string nodeName)
        {
            string traceFolder = null;

            lock (AppEtwTraceFolder)
            {
                if (false == AppEtwTraceFolder.ContainsKey(nodeName))
                {
                    string traceSessionName = string.Concat(AppTraceSessionNamePrefix, nodeName);
                    try
                    {
                        Utility.PerformWithRetries(
                            ctx =>
                        {
                            traceFolder = TraceSession.GetLogFilePath(traceSessionName);
                        },
                            (object)null,
                            new RetriableOperationExceptionHandler(GetLogFilePathExceptionHandler));
                        AppEtwTraceFolder[nodeName] = traceFolder;
                    }
                    catch (Exception e)
                    {
                        Utility.TraceSource.WriteError(
                            TraceType,
                            "Error occurred while determining the ETL file path for trace session {0}. {1}",
                            traceSessionName,
                            e);
                    }
                }
                else
                {
                    traceFolder = AppEtwTraceFolder[nodeName];
                }
            }

            return(traceFolder);
        }
    public void StartSession(int startingProficiency)
    {
        currentSession = new TraceSession();

        StartRound();
    }
Esempio n. 4
0
        protected override void ProcessRecord()
        {
            ErrorRecord errorRecord = null;

            if (TraceEventSession.IsElevated() != true)
            {
                errorRecord = new ErrorRecord(new InvalidOperationException("Must be elevated (Admin) to run this cmdlet."),
                                              "MissingAdminRights", ErrorCategory.InvalidOperation, null);
                WriteError(errorRecord);
                return;
            }

            processTraceRunner = new TraceSession(new PowerShellTraceOutput(eventQueue, Filter), !NoSummary);
            bool       isMainThreadFinished = false;
            const bool collectSystemStats   = false; // not available in PowerShell

            ThreadPool.QueueUserWorkItem((o) => {
                try {
                    if (string.Equals(ParameterSetName, "StartNewProcess", StringComparison.Ordinal))
                    {
                        var args = new List <string>()
                        {
                            FilePath
                        };
                        if (ArgumentList != null)
                        {
                            args.AddRange(ArgumentList);
                        }
                        processTraceRunner.TraceNewProcess(args, NewConsole, TraceChildProcesses,
                                                           collectSystemStats);
                    }
                    else
                    {
                        processTraceRunner.TraceRunningProcess(Pid, TraceChildProcesses, collectSystemStats);
                    }
                    isMainThreadFinished = true;
                } catch (Exception ex) {
                    errorRecord          = new ErrorRecord(ex, ex.GetType().FullName, ErrorCategory.InvalidOperation, null);
                    isMainThreadFinished = true;
                }
            });

            PowerShellWtraceEvent ev;

            while (!isMainThreadFinished)
            {
                while (eventQueue.TryDequeue(out ev))
                {
                    WriteObject(ev);
                }
                Thread.Sleep(100);
            }
            // the rest of the events
            while (eventQueue.TryDequeue(out ev))
            {
                WriteObject(ev);
            }

            if (errorRecord != null)
            {
                WriteError(errorRecord);
            }
        }