Exemple #1
0
        void Temp_EV_copyCanceled(List <CopyFiles.CopyFiles.ST_CopyFileDetails> filescopied)
        {
            //throw new NotImplementedException();
            MessageBox.Show("عملیات کپی متوقف شد");
            ARCHIVETableAdapter Arch_Ta = new ARCHIVETableAdapter();

            Arch_Ta.Delete_Master(_Id);

            // button2.Enabled = true;
        }
Exemple #2
0
        private void radioButton2_CheckedChanged(object sender, EventArgs e)
        {
            short Kind = 1;

            MyDBTableAdapters.ARCHIVETableAdapter Ta = new ARCHIVETableAdapter();
            if (radioButton2.Checked)
            {
                Kind = 2;
                comboBox2.SelectedIndex = 3;
                comboBox2.Enabled       = false;
                comboBox3.Enabled       = true;
                comboBox4.Enabled       = true;
            }
            if (radioButton1.Checked)
            {
                Kind = 1;
                comboBox2.SelectedIndex = 0;
                comboBox2.Enabled       = true;
                comboBox3.Enabled       = false;
            }
            if (radioButton3.Checked)
            {
                Kind = 3;
                comboBox2.SelectedIndex = 0;
                comboBox2.Enabled       = true;
                comboBox3.Enabled       = true;
            }
            if (radioButton4.Checked)
            {
                Kind = 4;
                comboBox2.SelectedIndex = 0;
                comboBox2.Enabled       = true;
                comboBox3.Enabled       = true;
            }
            MyDB.ARCHIVEDataTable Dt = Ta.SelectProgs(Kind);
            comboBox1.Items.Clear();

            for (int i = 0; i < Dt.Rows.Count; i++)
            {
                MyList.MyListItem LstTitle = new MyList.MyListItem(Dt[i]["TITLE"].ToString(), int.Parse(Dt[i]["ID"].ToString()));
                comboBox1.Items.Add(LstTitle);
            }
            if (comboBox1.Items.Count > 0)
            {
                comboBox1.SelectedIndex = 0;
            }
        }
Exemple #3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                InputLanguage.CurrentInputLanguage = InputLanguage.InstalledInputLanguages[1];
            }
            catch
            {
                MessageBox.Show("زبان فارسی به عنوان زبان دوم در سیستم وحود ندارد");
            }

            for (int i = 1; i < 32; i++)
            {
                MyList.MyListItem Lst = new MyList.MyListItem(string.Format("{0:00}", i), i);
                CmbDay.Items.Add(Lst);
                comboBox4.Items.Add(Lst);
            }
            CmbDay.SelectedIndex    = 0;
            comboBox4.SelectedIndex = 0;


            for (int i = 1; i < 13; i++)
            {
                MyList.MyListItem Lst = new MyList.MyListItem(string.Format("{0:00}", i), i);
                CmbMonth.Items.Add(Lst);
                comboBox5.Items.Add(Lst);
            }
            CmbMonth.SelectedIndex  = 0;
            comboBox5.SelectedIndex = 0;


            for (int i = 1380; i < 1400; i++)
            {
                MyList.MyListItem Lst = new MyList.MyListItem(i.ToString(), i);
                CmbYear.Items.Add(Lst);
                comboBox6.Items.Add(Lst);
            }
            CmbYear.SelectedIndex   = 0;
            comboBox6.SelectedIndex = 0;


            MyDBTableAdapters.ARCHIVETableAdapter Ta = new ARCHIVETableAdapter();
            MyDB.ARCHIVEDataTable Dt = Ta.SelectProgs(1);
            comboBox1.Items.Clear();

            for (int i = 0; i < Dt.Rows.Count; i++)
            {
                MyList.MyListItem LstTitle = new MyList.MyListItem(Dt[i]["TITLE"].ToString(), int.Parse(Dt[i]["ID"].ToString()));
                comboBox1.Items.Add(LstTitle);
            }


            comboBox3.Items.Clear();
            for (int i = 1; i < 366; i++)
            {
                MyList.MyListItem Lst = new MyList.MyListItem(i.ToString(), i);
                comboBox3.Items.Add(Lst);
            }
            comboBox3.SelectedIndex = 0;


            comboBox1.SelectedIndex = 0;
            comboBox2.SelectedIndex = 0;
        }
Exemple #4
0
        protected void Upload()
        {
            try
            {
                axVLCPlugin21.playlist.items.clear();
                axVLCPlugin21.playlist.add("file:///" + dataGridView1.Rows[_Index].Cells[0].Value.ToString(), "dfccdcdcd", null);
                axVLCPlugin21.playlist.playItem(0);

                Thread.Sleep(7000);
                if (axVLCPlugin21.playlist.items.count > 0)
                {
                    dataGridView1.Rows[_Index].Cells[8].Value = "In Progress";
                    //axVLCPlugin21.playlist.togglePause();

                    DateTime Dt = DateConversion.JD2GD(dataGridView1.Rows[_Index].Cells[5].Value.ToString() + "/" +
                                                       dataGridView1.Rows[_Index].Cells[6].Value.ToString() + "/" +
                                                       dataGridView1.Rows[_Index].Cells[7].Value.ToString());

                    MediaFile VideoFile = new MediaFile(dataGridView1.Rows[_Index].Cells[0].Value.ToString());

                    string Du = "0";
                    try
                    {
                        if (VideoFile.Video.Count > 0)
                        {
                            Du = VideoFile.Video[0].DurationMillis.ToString();
                        }
                        else
                        {
                            if (VideoFile.Audio.Count > 0)
                            {
                                Du = VideoFile.Audio[0].DurationMillis.ToString();
                            }
                        }
                    }
                    catch
                    {
                        Du = "0";
                    }

                    DateTime DtDelivery = DateConversion.JD2GD(dataGridView1.Rows[_Index].Cells[15].Value.ToString() + "/" +
                                                               dataGridView1.Rows[_Index].Cells[16].Value.ToString() + "/" +
                                                               dataGridView1.Rows[_Index].Cells[17].Value.ToString());
                    ARCHIVETableAdapter Arch_Ta = new ARCHIVETableAdapter();
                    string FileName             = Arch_Ta.Insert_FileMaster(dataGridView1.Rows[_Index].Cells[1].Value.ToString(),
                                                                            short.Parse(dataGridView1.Rows[_Index].Cells[4].Value.ToString()),
                                                                            Du,
                                                                            "",
                                                                            dataGridView1.Rows[_Index].Cells[2].Value.ToString(),
                                                                            dataGridView1.Rows[_Index].Cells[3].Value.ToString(),
                                                                            Dt, bool.Parse(dataGridView1.Rows[_Index].Cells[10].Value.ToString()),
                                                                            short.Parse(dataGridView1.Rows[_Index].Cells[11].Value.ToString()),
                                                                            int.Parse(dataGridView1.Rows[_Index].Cells[9].Value.ToString()),
                                                                            short.Parse(dataGridView1.Rows[_Index].Cells[13].Value.ToString()),
                                                                            radioButton2.Checked, dataGridView1.Rows[_Index].Cells[14].Value.ToString(), DtDelivery).ToString();

                    _FileName = dataGridView1.Rows[_Index].Cells[0].Value.ToString();
                    _Id       = int.Parse(FileName);

                    ////////////////////////////////////////

                    axVLCPlugin21.playlist.items.clear();
                    axVLCPlugin21.playlist.stop();


                    string        DestFolder = "\\\\192.168.10.32\\Arch$\\" + Arch_Ta.Getdate()[0]["YYYY-MM-DD"].ToString() + "\\";
                    DirectoryInfo DestDir    = new DirectoryInfo(DestFolder);
                    if (!DestDir.Exists)
                    {
                        DestDir.Create();
                    }

                    string DestFilePath = DestFolder + FileName;

                    progressBar1.Value = 0;
                    label12.Text       = "0%";
                    if (Path.GetExtension(dataGridView1.Rows[_Index].Cells[0].Value.ToString()).ToLower() == ".mp4")
                    {
                        List <String> TempFiles = new List <String>();
                        TempFiles.Add(dataGridView1.Rows[_Index].Cells[0].Value.ToString());
                        CopyFiles.CopyFiles Temp = new CopyFiles.CopyFiles(TempFiles, DestFilePath + ".mp4");
                        //Temp.EV_copyCanceled += Temp_EV_copyCanceled;
                        //Temp.EV_copyComplete += Temp_EV_copyComplete;
                        CopyFiles.DIA_CopyFiles TempDiag = new CopyFiles.DIA_CopyFiles();
                        TempDiag.SynchronizationObject = this;
                        Temp.CopyAsync(TempDiag);
                    }
                    else
                    {
                        if (Path.GetExtension(dataGridView1.Rows[_Index].Cells[0].Value.ToString()).ToLower() == ".wav")
                        {
                            List <String> TempFiles = new List <String>();
                            TempFiles.Add(dataGridView1.Rows[_Index].Cells[0].Value.ToString());
                            CopyFiles.CopyFiles Temp = new CopyFiles.CopyFiles(TempFiles, DestFilePath + ".wav");
                            //Temp.EV_copyCanceled += Temp_EV_copyCanceled;
                            //Temp.EV_copyComplete += Temp_EV_copyComplete;
                            CopyFiles.DIA_CopyFiles TempDiag = new CopyFiles.DIA_CopyFiles();
                            TempDiag.SynchronizationObject = this;
                            Temp.CopyAsync(TempDiag);
                        }
                        else
                        {
                            Process proc = new Process();
                            if (Environment.Is64BitOperatingSystem)
                            {
                                proc.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) + "\\ffmpeg64";
                            }
                            else
                            {
                                proc.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) + "\\ffmpeg32";
                            }
                            string InterLaced = "-flags +ildct+ilme";



                            proc.StartInfo.Arguments             = "-i " + "\"" + dataGridView1.Rows[_Index].Cells[0].Value.ToString() + "\"" + "  -r 25 -b 10000k  -ar 48000 -ab 192k -async 1 " + InterLaced + "   -y  " + "\"" + DestFilePath + ".mp4" + "\"";
                            proc.StartInfo.RedirectStandardError = true;
                            proc.StartInfo.UseShellExecute       = false;
                            proc.StartInfo.CreateNoWindow        = true;
                            proc.EnableRaisingEvents             = true;
                            // proc.Exited += new EventHandler(myProcess_Exited);
                            if (!proc.Start())
                            {
                                MessageBox.Show("Error Coverting File, Check FileName ,No Persian And Special Character");
                                return;
                            }

                            proc.PriorityClass = ProcessPriorityClass.RealTime;
                            StreamReader reader = proc.StandardError;
                            string       line;
                            while ((line = reader.ReadLine()) != null)
                            {
                                if (richTextBox1.Lines.Length > 5)
                                {
                                    richTextBox1.Text = "";
                                }
                                FindDuration(line, "1");
                                richTextBox1.Text          += (line) + " \n";
                                richTextBox1.SelectionStart = richTextBox1.Text.Length;
                                richTextBox1.ScrollToCaret();
                                Application.DoEvents();
                            }
                            proc.Close();
                        }
                    }



                    if (Path.GetExtension(dataGridView1.Rows[_Index].Cells[0].Value.ToString()).ToLower() != ".wav")
                    {
                        Arch_Ta.Update_FilePath(DestFilePath + ".mp4", int.Parse(FileName));
                        double SelectedTime = 10;
                        SelectedTime = Math.Round((SelectedTime * 25));

                        Process proc2 = new Process();
                        if (Environment.Is64BitOperatingSystem)
                        {
                            proc2.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) + "\\ffmpeg64";
                        }
                        else
                        {
                            proc2.StartInfo.FileName = Path.GetDirectoryName(Application.ExecutablePath) + "\\ffmpeg32";
                        }
                        proc2.StartInfo.Arguments             = "-i " + "\"" + dataGridView1.Rows[_Index].Cells[0].Value.ToString() + "\"" + " -filter:v select=\"eq(n\\," + SelectedTime.ToString() + ")\",scale=320:240,crop=iw:240 -vframes 1  -y    \"" + DestFilePath + ".png\"";
                        proc2.StartInfo.RedirectStandardError = true;
                        proc2.StartInfo.UseShellExecute       = false;
                        proc2.StartInfo.CreateNoWindow        = true;
                        proc2.Exited += new EventHandler(myProcess_Exited);
                        if (!proc2.Start())
                        {
                            richTextBox1.Text += " \n" + "Error starting";
                            return;
                        }
                        StreamReader reader2 = proc2.StandardError;
                        string       line2;
                        richTextBox1.Text          += "Start create Image: " + _Id + ".png\n";
                        richTextBox1.SelectionStart = richTextBox1.Text.Length;
                        richTextBox1.ScrollToCaret();
                        Application.DoEvents();
                        while ((line2 = reader2.ReadLine()) != null)
                        {
                            if (richTextBox1.Lines.Length > 5)
                            {
                                richTextBox1.Text = "";
                            }
                            richTextBox1.Text          += (line2) + " \n";
                            richTextBox1.SelectionStart = richTextBox1.Text.Length;
                            richTextBox1.ScrollToCaret();
                            Application.DoEvents();
                        }
                        proc2.Close();
                        richTextBox1.Text          += "End Create Image: " + _Id + ".png\n";
                        richTextBox1.SelectionStart = richTextBox1.Text.Length;
                        richTextBox1.ScrollToCaret();
                        Application.DoEvents();
                    }
                    else
                    {
                        Arch_Ta.Update_FilePath(DestFilePath + ".wav", int.Parse(FileName));
                    }

                    axVLCPlugin21.playlist.items.clear();
                    axVLCPlugin21.playlist.stop();


                    try
                    {
                        System.IO.File.Delete(_FileName);
                    }
                    catch (Exception Exp)
                    {
                        MessageBox.Show(Exp.Message);
                        throw;
                    }

                    dataGridView1.Rows[_Index].Cells[8].Value = "Done";
                    _Index = QeueProcess();
                    if (_Index >= 0)
                    {
                        Upload();
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }