예제 #1
0
        /// <summary>
        /// Dumps the currently selected window information.
        /// </summary>
        private void Dump()
        {
            if (CurrentInfo == null)
            {
                ErrorBox.Show(this, "Can't dump if no window selected.");
                return;
            }

            var filename = GetFileName();
            if (string.IsNullOrEmpty(filename)) return;

            try
            {
                var text = CurrentInfo.Dump();
                using (var writer = File.CreateText(filename))
                {
                    writer.Write(text);
                    writer.Flush();
                }
            }
            catch (Exception ex)
            {
                var message = string.Format("Could not create dump file for handle {0}: {1}", CurrentInfo.Handle, ex.Message);
                log.Error(message, ex);
                ErrorBox.Show(this, message);
            }
        }