Exemplo n.º 1
0
        public void GetDocks(Action <IEnumerable <Dock>, Exception> callback)
        {
            if (!Directory.Exists(Paths.Docks))
            {
                Directory.CreateDirectory(Paths.Docks);
            }

            var dockConfigurations = Directory.EnumerateDirectories(Paths.Docks)
                                     .Where(d => File.Exists(Path.Combine(d, "dock.json")))
                                     .Select(d => DockConfiguration.FromFile(Path.Combine(d, "dock.json")))
                                     .DefaultIfEmpty(DockConfiguration.Default);

            var docks = dockConfigurations.Select(config => new Dock(config)).ToList();

            callback(docks, null);
        }