Example #1
0
        private void LaunchViewForm(GpfProjectFile project)
        {
            _socket.Send(BitConverter.GetBytes((int)ServerCodes.Util));
            int reply = BitConverter.ToInt32(_socket.Receive(), 0);

            if (reply != (int)ServerCodes.Util)
            {
                throw new Exception("Count funtion failure. Server response was invalid.");
            }

            int port = Convert.ToInt32(tbTcpPort.Text) + 1;

            _socket.Send(BitConverter.GetBytes(port));

            reply = BitConverter.ToInt32(_socket.Receive(), 0);
            if (reply != port)
            {
                throw new Exception("Count funtion failure. Server response was invalid.");
            }

            ViewForm frm = new ViewForm();

            NetMQSocket countSocket = _context.CreatePairSocket();

            countSocket.Connect("tcp://" + tbAddress.Text + ":" + port);


            frm.Initialise(new ViewFormSetup(countSocket, project, Gpus));

            this.Hide();
            frm.Show();
        }
Example #2
0
        public static GpfProjectFile Deserialize(string projectPath)
        {
            var            s         = new FileStream(projectPath, FileMode.Open, FileAccess.Read);
            IFormatter     formatter = new BinaryFormatter();
            GpfProjectFile file      = (GpfProjectFile)formatter.Deserialize(s);

            file.RootFolder = projectPath.Substring(0, projectPath.LastIndexOf("\\") + 1);
            s.Close();
            return(file);
        }
Example #3
0
        private void btnStart_Click(object sender, EventArgs e)
        {
            if (lbSources.Items.Count < 1)
            {
                MessageBox.Show("No capture sources specified.");
                return;
            }

            string[] files = new string[lbSources.Items.Count];
            for (int k = 0; k < files.Length; k++)
            {
                files[k] = lbSources.Items[k].ToString();
            }

            CaptureProgram program      = new CaptureProgram(files);
            string         outputFolder = tbProjectFolder.Text + tbProjectName.Text + "\\";

            if (!Directory.Exists(outputFolder))
            {
                Directory.CreateDirectory(outputFolder);
            }

            program.CreateIndex(outputFolder, chIndexing.Checked);

            if (chFilter.Checked)
            {
                if (!cbGpu.Enabled)
                {
                    MessageBox.Show("Filtering requires a CUDA capable GPU with a compute capability of 3.5 or greater.");
                }
                else
                {
                    program.CreateFilter(tbFilterProgram.Text, outputFolder + "filter\\", cbGpu.SelectedIndex, Convert.ToInt32(cbBufferSize.SelectedItem.ToString()), Convert.ToInt32(cbStreams.SelectedItem.ToString()));
                }
            }

            GpfProjectFile file = new GpfProjectFile(program, outputFolder, tbProjectName.Text);

            if (GpfProjectFile.Serialize(file) != true)
            {
                return;
            }


            this.Close();

            if (OnSendComplete != null)
            {
                OnSendComplete(this, program);
            }
        }
Example #4
0
        private void CompleteFilter()
        {
            _socket.Send(BitConverter.GetBytes(1234));

            int response = BitConverter.ToInt32(_socket.Receive(), 0);

            if (response != 1234)
            {
                throw new Exception("Error getting completeion response from server: output writers reported failure.");
            }
            GpfProjectFile project = GpfProjectFile.Deserialize(CaptureProgram.ProjectPath);

            LaunchViewForm(project);
        }
Example #5
0
        private void btnTimeline_Click(object sender, EventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter     = "GPF Project File (*.gpf_project)|*.gpf_project";
            dlg.DefaultExt = "gpf_project";

            if (dlg.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            GpfProjectFile project = GpfProjectFile.Deserialize(dlg.FileName);

            LaunchViewForm(project);
        }
Example #6
0
        public static bool Serialize(GpfProjectFile file)
        {
            if (!Directory.Exists(file.RootFolder))
            {
                Directory.CreateDirectory(file.RootFolder);
            }

            if (File.Exists(file.Path) && MessageBox.Show("The solution already exists - Overwrite?",
                                                          "Overwrite Existing Project", MessageBoxButtons.OKCancel) != DialogResult.OK)
            {
                return(false);
            }

            var        s         = new FileStream(file.Path, FileMode.Create, FileAccess.Write);
            IFormatter formatter = new BinaryFormatter();

            formatter.Serialize(s, file);
            s.Close();
            return(true);
        }