Ejemplo n.º 1
0
        public static bool InstallAll(Log log, IEnumerable <string> files, StuffFlags flags = 0, IEnumerable <string> optionalDefines = null)
        {
            try
            {
                var tasks  = new List <Task>();
                var retval = true;

                foreach (var file in files)
                {
                    tasks.Add(Task.Factory.StartNew(
                                  () =>
                    {
                        try
                        {
                            if (!Install(log, file, flags, optionalDefines))
                            {
                                retval = false;
                            }
                        }
                        catch (Exception e)
                        {
                            log.Error(file.ToRelativePath() + ": " + e.Message);
                            retval = false;
                        }
                    }));
                }

                Task.WaitAll(tasks.ToArray());
                return(retval);
            }
            finally
            {
                DownloadCache.AutoCollect(log);
            }
        }
Ejemplo n.º 2
0
        public static void CleanAll(Log log, IEnumerable <string> files)
        {
            try
            {
                foreach (var file in files)
                {
                    try
                    {
                        var parentDirectory = Path.GetDirectoryName(file);
                        Disk.DeleteDirectory(log, Path.Combine(parentDirectory, ".uno", "stuff"));

                        foreach (var item in StuffObject.Load(file, StuffFlags.AcceptAll))
                        {
                            Disk.DeleteDirectory(log,
                                                 Path.Combine(
                                                     parentDirectory,
                                                     item.Key.Replace('/', Path.DirectorySeparatorChar)));
                        }
                    }
                    catch (Exception e)
                    {
                        log.Error(file.ToRelativePath() + ": " + e.Message);
                    }
                }
            }
            finally
            {
                DownloadCache.AutoCollect(log);
            }
        }
Ejemplo n.º 3
0
 public static bool Install(Log log, string filename, StuffFlags flags = 0, IEnumerable <string> optionalDefines = null)
 {
     try
     {
         return(new Installer(log, filename, flags, optionalDefines).Install());
     }
     finally
     {
         DownloadCache.AutoCollect(log);
     }
 }
Ejemplo n.º 4
0
        public static bool IsUpToDate(Log log, string filename, StuffFlags flags = 0, IEnumerable <string> optionalDefines = null)
        {
            try
            {
                var parentDir = Path.GetDirectoryName(filename);

                foreach (var item in StuffObject.Load(filename, flags, optionalDefines))
                {
                    var itemKey   = item.Key.Replace('/', Path.DirectorySeparatorChar);
                    var itemFile  = Path.Combine(parentDir, ".uno", "stuff", itemKey);
                    var targetDir = Path.Combine(parentDir, itemKey);
                    if (!IsItemUpToDate(log, targetDir, itemFile, item.Value?.ToString(), flags))
                    {
                        return(false);
                    }
                }

                return(true);
            }
            finally
            {
                DownloadCache.AutoCollect(log);
            }
        }