Find Full Path of a folder

Sep 20, 2012 at 5:15 PM

Hi To All,

I use RAPI to connect my application and mobile device

I want to get the fullpath of the folder. My Function is there and can't return the fullpath. It just return the name of my searched folder.

I nee your help

 

public string GetFullPath(string nameFolderToSearch)
        {
string fullpath ="";
            if (App.rapi.DevicePresent)
            {

                try
                {
                    App.rapi.Connect(true, 3);
                    if (App.rapi.Connected)
                    {
                        //on parcoure le PDA pour retrouver le chemin de rgphae2012 pour recup�rer la base
                        FileList fileList = App.rapi.EnumFiles(@"\*.*");
                        const FileAttributes attrStorageCard = FileAttributes.Directory | FileAttributes.Temporary;
                        if (fileList != null)
                        {
                            foreach (FileInformation fi in fileList)
                            {
                                if (fi.FileAttributes == FileAttributes.Directory.GetHashCode() || fi.FileAttributes == attrStorageCard.GetHashCode())
                                    {//recherche dans le repertoire / du PDA
                                        //MessageBox.Show("nom repertoire = " + fi.FileName);
                                        FileList fileLists = App.rapi.EnumFiles(@fi.FileName + @"\*.*");
                                        if (fileLists != null)
                                        {
                                            foreach (FileInformation fii in fileLists)
                                            {//on compare le nom des repertoires avec "rgphae"
                                                //MessageBox.Show("nom fichier = " + fii.FileName);
                                                if (fii.FileName == nameFolderToSearch)
                                                {
                                                   fullpath = fii.FileName ;
                                                }//fin dossier
                                            }//fin foreach dossier
                                        }                                       
                                    }
                            }
                        }                       
                    }
                    else
                    {
                        MessageBox.Show("PDA non connect�", "Attention", MessageBoxButton.OK, MessageBoxImage.Stop);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                    //throw;
                }
            }
            else
            {
                MessageBox.Show("Aucun �quipement trouv�. Veuillez connecter le PDA.", "Attention", MessageBoxButton.OK, MessageBoxImage.Stop);
            }

            return fullpath;
        }