Ejemplo n.º 1
0
        private PacketLogWriter LoadOutputWriter()
        {
            if ((config_format_type_ != ConfigManager.System.AutoPacketSave.SaveFormat.Value) ||
                (output_format_ == null) ||
                (output_writer_ == null)
                )
            {
                config_format_type_ = ConfigManager.System.AutoPacketSave.SaveFormat.Value;

                switch (config_format_type_)
                {
                case AutoPacketSaveFormatType.Ratatoskr:
                    output_format_ = new FileFormat.PacketLog_Rtcap.FileFormatClassImpl();
                    break;

                case AutoPacketSaveFormatType.CSV:
                    output_format_ = new FileFormat.PacketLog_Csv.FileFormatClassImpl();
                    break;

                case AutoPacketSaveFormatType.Binary:
                    output_format_ = new FileFormat.PacketLog_Binary.FileFormatClassImpl();
                    break;
                }

                if (output_format_ != null)
                {
                    output_writer_ = output_format_.CreateWriter() as PacketLogWriter;
                    output_option_ = output_format_.CreateWriterOption();
                }
            }

            return(output_writer_);
        }
Ejemplo n.º 2
0
        public static void SavePacketLog(bool overwrite, bool rule)
        {
            if (InvokeRequired)
            {
                Invoke((SavePacketLogDelegate)SavePacketLog, overwrite, rule);
                return;
            }

            var file = (FileControlParam)null;

            /* 保存先とフォーマットを取得 */
            if ((overwrite) &&
                (last_save_path_ != null) &&
                (last_save_format_ != null)
                )
            {
                /* Save */
                file = new FileControlParam()
                {
                    FilePath = last_save_path_,
                    Format   = last_save_format_,
                    Option   = last_save_option_,
                };
            }
            else
            {
                /* Save As */
                file = FileManager.PacketLogSave.SelectWriteControllerFromDialog(ConfigManager.GetCurrentDirectory());
            }

            if (file == null)
            {
                return;
            }

            if (rule)
            {
                GatePacketManager.SavePacketFile(file, FormTaskManager.GetPacketConverterClone());
            }
            else
            {
                GatePacketManager.SavePacketFile(file, null);
            }

            last_save_path_   = file.FilePath;
            last_save_format_ = file.Format;
            last_save_option_ = file.Option;

            /* カレントディレクトリ更新 */
            ConfigManager.SetCurrentDirectory(Path.GetDirectoryName(last_save_path_));
        }
Ejemplo n.º 3
0
        private void UpdateSelectFileFormatOptionView()
        {
            /* 選択中フォーマットを取得 */
            var format = CBox_FileFormatType.SelectedItem as FileFormatClass;

            /* フォーマット変更時はオプションを初期化 */
            if (select_file_format_ != format)
            {
                select_file_format_               = format;
                select_file_format_option_        = null;
                select_file_format_option_editor_ = null;

                /* オプションエディタクリア */
                GBox_FileFormatOption.Controls.Clear();

                /* オプション初期化 */
                if (select_file_format_ != null)
                {
                    select_file_format_option_ = select_file_format_.CreateReaderOption();

                    /* オプションエディタ初期化 */
                    if (select_file_format_option_ != null)
                    {
                        select_file_format_option_editor_ = select_file_format_option_.GetEditor();

                        /* オプションエディタを設定 */
                        if (select_file_format_option_editor_ != null)
                        {
                            select_file_format_option_editor_.Dock = DockStyle.Fill;
                            GBox_FileFormatOption.Controls.Add(select_file_format_option_editor_);
                        }
                    }
                }
            }

            /* オプションエディタに設定値を表示 */
            if (select_file_format_option_editor_ != null)
            {
                select_file_format_option_editor_.LoadOption(select_file_format_option_);
            }
        }
Ejemplo n.º 4
0
 public FileFormatReaderImpl(FileFormatClass fmtc) : base(fmtc)
 {
 }
Ejemplo n.º 5
0
 public FileFormatWriterImpl(FileFormatClass fmtc) : base(fmtc)
 {
 }
Ejemplo n.º 6
0
 private int GetFileFormatIndex(FileFormatClass format)
 {
     return(file_formats_.IndexOf(format));
 }