Exemple #1
0
        private void MixedGrid_PreviewDrop(object sender, DragEventArgs e)
        {
            Sys_ProcessOn();
            MixedGrid.AllowDrop = false;
            Array pathArr = (Array)e.Data.GetData(DataFormats.FileDrop);

            P_Mixed = new ProcessClass(pathArr, ProcessClass.ProcessMode.Mixed, 44100, 320, "mp3");
            P_Mixed.OutputReceived += P_Mixed_OutputReceived;
            P_Mixed.ProcessExited  += Sys_ProcessOff;
            P_Mixed.ProgressUpdate += P_Mixed_ProgressUpdate;
            P_Mixed.Start();
        }
Exemple #2
0
        private void VocalGrid_PreviewDrop(object sender, DragEventArgs e)
        {
            Sys_ProcessOn();
            VocalGrid.AllowDrop = false;
            Array pathArr = (Array)e.Data.GetData(DataFormats.FileDrop);

            P_Vocal = new ProcessClass(pathArr, ProcessClass.ProcessMode.Vocal, 44100, 0, "");
            P_Vocal.OutputReceived += P_Vocal_OutputReceivedEvent;
            P_Vocal.ProcessExited  += Sys_ProcessOff;
            P_Vocal.ProgressUpdate += P_Vocal_ProgressUpdate;
            P_Vocal.Start();
        }
Exemple #3
0
        private void MusicGrid_PreviewDrop(object sender, DragEventArgs e)
        {
            Sys_ProcessOn();
            MusicGrid.AllowDrop = false;
            Array pathArr = (Array)e.Data.GetData(DataFormats.FileDrop);

            P_Music = new ProcessClass(pathArr, ProcessClass.ProcessMode.Music, 44100, 0, "");
            P_Music.OutputReceived += P_Music_OutputReceivedEvent;
            P_Music.ProcessExited  += Sys_ProcessOff;
            P_Music.ProgressUpdate += P_Music_ProgressUpdate;
            P_Music.FileFinished   += P_Music_FileFinished;
            P_Music.Start();
        }
Exemple #4
0
        public MainWindow()
        {
            InitializeComponent();

            Process currentProcess = Process.GetCurrentProcess();

            currentProcess.PriorityClass = ProcessPriorityClass.RealTime;
            Thread primaryThread = Thread.CurrentThread;

            primaryThread.Priority = ThreadPriority.Highest;
            //UI初始化
            AboutBox.Text             = "Version 2.1";
            Description.Visibility    = Visibility.Hidden;
            Initialization.Visibility = Visibility.Hidden;
            ES = ES_REQUIRE.OFF;

            //功能实例化
            P_Vocal = new ProcessClass(null, ProcessClass.ProcessMode.Vocal, 0, 0, "");
            P_Music = new ProcessClass(null, ProcessClass.ProcessMode.Music, 0, 0, "");
            P_Mixed = new ProcessClass(null, ProcessClass.ProcessMode.Mixed, 0, 0, "");

            //释放资源
            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\\Bin\\ffmpeg.exe") || !File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\\Bin\\lame.exe"))
            {
                Initialization.Visibility = Visibility.Visible;
                Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\\Bin");
                Thread ExportResource_T = new Thread(delegate()
                {
                    if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\\Bin\\ffmpeg.exe"))
                    {
                        //Console.WriteLine(VerifyResource("gz.ffmpeg.exe"));
                        if (VerifyResource("gz.ffmpeg.exe.gz") == "93c97daed6a266c388c4335746941d40")
                        {
                            ExportResource(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\\Bin\\ffmpeg.exe", "gz.ffmpeg.exe.gz");
                        }
                        else
                        {
                            ProcessLog("VERIFICATION FAILED at  " + DateTime.Now.ToString());
                            Environment.Exit(0);
                        }
                    }
                    if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\\Bin\\lame.exe"))
                    {
                        //Console.WriteLine(VerifyResource("gz.lame.exe"));
                        if (VerifyResource("gz.lame.exe.gz") == "eb3cd03670397c7d39973532ac3ef5d8")
                        {
                            ExportResource(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\\Bin\\lame.exe", "gz.lame.exe.gz");
                        }
                        else
                        {
                            ProcessLog("VERIFICATION FAILED at  " + DateTime.Now.ToString());
                            Environment.Exit(0);
                        }
                    }

                    double O = 1;
                    while (O > 0)
                    {
                        O = O - 0.1;
                        Dispatcher.Invoke(new Action(() =>
                        {
                            Initialization.Opacity = O;
                        }));
                        Thread.Sleep(20);
                    }
                    Dispatcher.Invoke(new Action(() =>
                    {
                        Initialization.Visibility = Visibility.Hidden;
                    }));
                });
                ExportResource_T.Start();
            }

            //UI初始化
            this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            this.Topmost = true;

            VocalProgressBar.BarOpacity = 0;
            MusicProgressBar.BarOpacity = 0;
            MixedProgressBar.BarOpacity = 0;

            if (!File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\AFPT\\DescriptionHided"))
            {
                Description.Visibility = Visibility.Visible;
            }

            log += "[Software] Initial Complete at  " + DateTime.Now.ToString();

            //显示UI
            MainGrid.Opacity = 0;
            Thread T = new Thread(delegate()
            {
                double O = 0;
                while (O < 1)
                {
                    Dispatcher.Invoke(new Action(() =>
                    {
                        MainGrid.Opacity = O;
                    }));
                    O = O + 0.1;
                    Thread.Sleep(10);
                }
            });

            T.Start();

            VocalProgressBar.Reseted += delegate { Dispatcher.Invoke(new Action(() => { VocalGrid.AllowDrop = true; })); };
            MusicProgressBar.Reseted += delegate { Dispatcher.Invoke(new Action(() => { MusicGrid.AllowDrop = true; })); };
            MixedProgressBar.Reseted += delegate { Dispatcher.Invoke(new Action(() => { MixedGrid.AllowDrop = true; })); };
        }