把总配置文件得到目录 ,然后放到ArrayList里面,然后再读出来,        public static void Run(ArrayList  ss)
        {
            foreach (string s in ss)
            {              
                    FileSystemWatcher watcher = new FileSystemWatcher();
                    watcher.Path = s;//@"d:\DownLoads";//args[1];
                    /* Watch for changes in LastAccess and LastWrite times, and 
                       the renaming of files or directories. */
                    //watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
                    //   | NotifyFilters.FileName | NotifyFilters.DirectoryName;
                    //// Only watch text files.
                    watcher.Filter = "*.flv";                    // Add event handlers.
                    //watcher.Changed += new FileSystemEventHandler(OnChanged);
                    watcher.Created += new FileSystemEventHandler(OnCreated);
                    //watcher.Deleted += new FileSystemEventHandler(OnChanged);
                    //watcher.Renamed += new RenamedEventHandler(OnChanged);                    // Begin watching.
                    watcher.EnableRaisingEvents = true;
            
            }      
        }
Code2
    string fn = myQ.Dequeue();
                        string temp = new FileInfo(fn).FullName;
                        Process P = Process.Start("flvmdi.exe," + temp);
                        WriteLog(fn, name);c:\\Downloads\\出现两个斜杠,应该怎么办

解决方案 »

  1.   

    Process P = Process.Start("flvmdi.exe," + temp);error
      

  2.   

    /// <summary>
            /// Read Config File
            /// </summary>
            /// <returns></returns>
            private static ArrayList readConfig()
            {
                string FilePath = Application.StartupPath + ConfigFile;
                StreamReader sr = new StreamReader(FilePath, System.Text.Encoding.UTF8);
                ArrayList list = new ArrayList();            try
                {
                    while (sr.Peek() != -1)
                    {
                        string tmp = sr.ReadLine();
                        if (tmp != string.Empty || tmp != null)
                        {
                            list.Add(tmp);
                        }
                    }
                }
                catch (Exception fileex)
                {
                    MessageBox.Show("File Exception:" + fileex.ToString());
                }
                return list;
            }
        
            private void btnStartWatching_Click(object sender, EventArgs e)
            {
                this.Text = "Watching ... ...";
                ArrayList list = readConfig();            for (int i = 0; i < list.Count ; i++)
                {             
                    lbxFolderList.Items.Add(list[i]);
                }
                Run(list);
            }        public static void Run(ArrayList  ss)
            {
                try
                {
                    foreach (string s in ss)
                    {
                        FileSystemWatcher watcher = new FileSystemWatcher();
                        watcher.Path = s;                    watcher.Filter = "*.flv";                    // Add event handlers.
                        //watcher.Changed += new FileSystemEventHandler(OnChanged);
                        watcher.Created += new FileSystemEventHandler(OnCreated);
                        //watcher.Deleted += new FileSystemEventHandler(OnChanged);
                        //watcher.Renamed += new RenamedEventHandler(OnChanged);                    // Begin watching.
                        watcher.EnableRaisingEvents = true;                }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            private static void OnCreated(object sender, FileSystemEventArgs e)
            {
                string name = e.Name;
                string path = e.FullPath;            try
                {
                    //if file extension is flv
                    if (new FileInfo(path).Extension == ".flv")
                    {
                        myQ.Enqueue(path);
                        while (myQ.Count != 0)
                        {
                            string fn = myQ.Dequeue();
                            Process P = Process.Start("flvmdi.exe," +fn);
                            WriteLog(fn, name);
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Exception Message:" + ex.ToString());
                }
            }