예제 #1
0
        private void Import(object param)
        {
            ImportInfo info = param as ImportInfo;

            if (info.TargetFiles != null && info.TargetFiles.Count > 0)
            {
                foreach (string path in info.TargetFiles)
                {
                    try
                    {
                        _trafficViewerFile.StartImport(info.Parser, path, info.Profile);
                    }
                    catch (Exception ex)
                    {
                        string error = String.Format(Resources.ImportException, path, info.Parser.Name);
                        SdkSettings.Instance.Logger.Log(TraceLevel.Error, "{0} exception thrown: {1}", error, ex.Message);
                        _trafficViewerFile.StopImport();
                        if (_exceptionMessageHandler != null)
                        {
                            _exceptionMessageHandler.Show(error);
                        }
                    }
                }
            }
            else if (info.Sender != null)
            {
                try
                {
                    _trafficViewerFile.StartImport(info.Parser, info.Sender, info.Profile);
                }
                catch (Exception ex)
                {
                    string error = String.Format(Resources.ImportException, info.Sender.ToString(), info.Parser.Name);
                    SdkSettings.Instance.Logger.Log(TraceLevel.Error, "{0}, exception thrown: {1}", error, ex.Message);
                    _trafficViewerFile.StopImport();
                    if (_exceptionMessageHandler != null)
                    {
                        _exceptionMessageHandler.Show(error);
                    }
                }
            }
        }