/// <summary>
        /// Load a file with sarif data by identifying
        /// the first internal .a11ytest file and opening
        /// it as a snapshot
        /// </summary>
        /// <param name="path"></param>
        /// <param name="selectedElementId"></param>
        private void HandleLoadingSarifData(string path, int?selectedElementId = null)
        {
            var allyFileData = OpenSarif.ExtractA11yTestFile(path);

            string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            try
            {
                File.WriteAllBytes(tempPath, Convert.FromBase64String(allyFileData));
                HandleLoadingSnapshotData(tempPath, selectedElementId);
            }
            catch (Exception)
            {
                File.Delete(tempPath);
            }
        }
예제 #2
0
        /// <summary>
        /// Load a file with sarif data by identifying
        /// the first internal .a11ytest file and opening
        /// it as a snapshot
        /// </summary>
        /// <param name="path"></param>
        /// <param name="selectedElementId"></param>
        private void HandleLoadingSarifData(string path, int?selectedElementId = null)
        {
            var allyFileData = OpenSarif.ExtractA11yTestFile(path);

            string tempPath = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());

            try
            {
                File.WriteAllBytes(tempPath, Convert.FromBase64String(allyFileData));
                HandleLoadingSnapshotData(tempPath, selectedElementId);
            }
#pragma warning disable CA1031 // Do not catch general exception types
            catch (Exception e)
            {
                e.ReportException();
                File.Delete(tempPath);
            }
#pragma warning restore CA1031 // Do not catch general exception types
        }