Ejemplo n.º 1
0
        public static List <ProcessMsg.Model.AtributosArchivoBo> GetComponentesOficiales(string rutaOficial)
        {
            List <ProcessMsg.Model.AtributosArchivoBo> lista = new List <ProcessMsg.Model.AtributosArchivoBo>();

            try
            {
                var dirs = new System.IO.DirectoryInfo(rutaOficial).GetDirectories().ToList();
                foreach (var dir in dirs)
                {
                    var files = new System.IO.DirectoryInfo(System.IO.Path.Combine(rutaOficial, dir.Name)).GetFiles();
                    files.ToList().ForEach(x =>
                    {
                        lista.Add(new ProcessMsg.Model.AtributosArchivoBo
                        {
                            Name       = x.Name,
                            LastWrite  = x.LastWriteTime,
                            Version    = FileVersionInfo.GetVersionInfo(x.FullName).FileVersion,
                            Length     = x.Length,
                            DateCreate = x.CreationTime
                        });
                    });
                }

                return(lista.Where(x => x.Version != null).ToList());
            }
            catch (Exception ex)
            {
                var msg = "Excepcion Controlada: " + ex.Message;
                throw new Exception(msg, ex);
            }
        }
Ejemplo n.º 2
0
    private ObservableCollection <String> ProcessFiles(string path)
    {
        string[] directories;
        ObservableCollection <String> fileList = new ObservableCollection <string>();
        var files = new System.IO.DirectoryInfo(path).GetFiles("*.dll").Select(x => x.Name);             //Directory.GetFiles(path).Where(name => name.EndsWith(".mp3", StringComparison.OrdinalIgnoreCase));

        fileList = new ObservableCollection <String>(files.ToList <String>());


        //your processing further
        //directories = Directory.GetDirectories(path);
        //foreach (string directory in directories)
        //{
        //    // Process each directory recursively
        //    ProcessFiles(directory);
        //}

        return(fileList);
    }