ATMLProject.managers.ProjectManager.ImportTestProgramSet C# (CSharp) Method

ImportTestProgramSet() public static method

public static ImportTestProgramSet ( ) : void
return void
        public static void ImportTestProgramSet()
        {
            String testSetPath = ATMLContext.TESTSET_PATH;
            var dlg = new OpenFileDialog();
            dlg.DefaultExt = ATMLContext.TESTSET_ARCHIVE_EXT;
            if (DialogResult.OK == dlg.ShowDialog())
            {
                string name = dlg.SafeFileName;
                name = name.Substring( 0, name.LastIndexOf( ".", StringComparison.Ordinal ) );
                string path = Path.Combine( testSetPath, name );

                bool ok2save = true;
                bool hasExisting = false;
                if (Directory.Exists( path ))
                {
                    hasExisting = true;
                    ok2save = DialogResult.Yes ==
                              MessageBox.Show(
                                  "Test Program Set \"" + name + "\" already exists. Would you like to over write it?",
                                  "V E R I F Y", MessageBoxButtons.YesNo, MessageBoxIcon.Question );
                }
                if (ok2save)
                {
                    HourGlass.Start();
                    try
                    {
                        CloseProject();
                        ZipFile zip = ZipFile.Read( dlg.FileName );
                        zip.ExtractAll( path, ExtractExistingFileAction.OverwriteSilently );
                        LogManager.Trace( "The Test Program Set has been unarchived to \"{0}\"", path );
                        OpenProject( name );
                    }
                    catch (Exception exception)
                    {
                        LogManager.Error( exception );
                    }
                    finally
                    {
                        HourGlass.Stop();
                    }
                }
            }
        }