Exemple #1
0
        // Search_Audio_Files

        private void Audio_Start()
        {
            if (!Bass.BASS_Init(-1, SAMPLERATE, BASSInit.BASS_DEVICE_DEFAULT | BASSInit.BASS_DEVICE_FREQ, IntPtr.Zero))
            {
                MessageBox.Show(String.Format("Stream error: {0}", Bass.BASS_ErrorGetCode()), "Error");
                this.Close();
            }

            Form1_Next_Title(ListParam [iFnames].Fname);
            Audio_Stream = Bass.BASS_StreamCreateFile(ListParam [iFnames].Fname, 0, 0, BASSFlag.BASS_DEFAULT);
            if (Audio_Stream == 0)
            {
                MessageBox.Show(String.Format("Stream error: {0}", Bass.BASS_ErrorGetCode()), "Error");
                this.Close();
            }

            flen    = Bass.BASS_ChannelGetLength(Audio_Stream);
            _syncer = Bass.BASS_ChannelSetSync(Audio_Stream, BASSSync.BASS_SYNC_END, 0, _syncProcEndStream, IntPtr.Zero);
            Bass.BASS_ChannelPlay(Audio_Stream, false);
            Bass.BASS_ChannelSetAttribute(Form1.Audio_Stream, BASSAttribute.BASS_ATTRIB_VOL, (float)Volume / 10.0f);

            if (0 < ListParam [iFnames].Resample)             // если уже есть данные
            {
                Tab_To_Parm(ListParam [iFnames]);
                if (bPanel)
                {
                    Panel1.Reload();
                }
            }

            timer1.Interval = Interval;
            timer1.Enabled  = true;
            timer2.Enabled  = true;
        }
Exemple #2
0
        protected void Upload_1(object sender, EventArgs e)
        {
            // upload file asp.net 元件
            string userID  = Request.LogonUserIdentity.Name.Split('\\')[1].Trim().ToUpper();
            string csvPath = Server.MapPath("~/Files/") + Path.GetFileName(FileUpload_ASP.PostedFile.FileName); //讀檔

            FileUpload_ASP.SaveAs(csvPath);                                                                     //temp file
            DataTable dt = new DataTable();

            _msg = "";
            dt.Columns.AddRange(new DataColumn[10] {
                new DataColumn("Customer_ID", typeof(string)), new DataColumn("Category", typeof(string)), new DataColumn("Part", typeof(string)), new DataColumn("Part_Id", typeof(string)), new DataColumn("Yield_Impact_Item", typeof(string)), new DataColumn("Key_Module", typeof(string)), new DataColumn("Data_Source", typeof(string)), new DataColumn("Critical_Item", typeof(string)), new DataColumn("EDA_Item", typeof(string)), new DataColumn("MAIN_ID", typeof(string))
            });
            string csvData = File.ReadAllText(csvPath);


            foreach (string row in csvData.Split('\n'))     //讀csv檔
            {
                if (!string.IsNullOrEmpty(row))
                {
                    dt.Rows.Add();
                    int i = 0;

                    foreach (string cell in row.Split(','))
                    {
                        dt.Rows[dt.Rows.Count - 1][i] = cell;
                        i++;
                    }
                }
            }

            Mailmaxid = DBProcess_sign.maxID();
            int countID = int.Parse(Mailmaxid.Rows[0][0].ToString()) + 1;

            for (int i = 1; i < dt.Rows.Count; i++)     //匯入資料庫,剃除表頭
            {
                DBProcess_sign.Upload_Data(countID + i, dt.Rows[i]["Customer_ID"].ToString().Trim(), dt.Rows[i]["Category"].ToString().Trim(), dt.Rows[i]["Part"].ToString().Trim(), dt.Rows[i]["Part_Id"].ToString().Trim(), dt.Rows[i]["Yield_Impact_Item"].ToString().Trim(), dt.Rows[i]["Key_Module"].ToString().Trim(), dt.Rows[i]["Data_Source"].ToString().Trim(), dt.Rows[i]["Critical_Item"].ToString().Trim(), dt.Rows[i]["EDA_Item"].ToString().Trim(), dt.Rows[i]["MAIN_ID"].ToString().Trim(), userID, ref _msg);
                if (_msg != "")
                {
                    X.MessageBox.Alert("提示", "Import data was error format problem ").Show();
                    Groceries.Delfile(csvPath);
                    break;
                }
            }
            X.MessageBox.Alert("提示", "共 " + dt.Rows.Count + "筆,更新完畢。").Show();
            System.Threading.Thread.Sleep(300);
            Groceries.Delfile(csvPath);
            Panel2.Reload();
            Panel1.Reload();
        }
Exemple #3
0
        // Audio_Stop

        public static void Audio_Next(int idx = -1)
        {
            if (0 <= idx)             // select
            {
                idx %= ListParam.Count;
                if (idx != iFnames)
                {
                    if (0 < ListParam [iFnames].Resample)
                    {
                        Tab_To_Parm(ListParam [iFnames]);
                    }
                    iFnames = idx;
                    if (bPanel)
                    {
                        Panel1.Reload();
                    }
                }
            }
            else
            {
                Parm_To_Tab(ListParam [iFnames]);
                if (idx == -1)
                {
                    iFnames = (iFnames + 1) % ListParam.Count;                     // next
                }
                else
                {
                    iFnames = (iFnames - 1 + ListParam.Count) % ListParam.Count;                     // prev
                }
            }
            if (Audio_Stream == 0)
            {
                himself.Audio_Start();
            }
            else
            {
                bRestart = true;
            }
        }