Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            LoaderConfiguration config = new LoaderConfiguration();

            if (!CommandLine.Parser.Default.ParseArguments(args, config))
            {
                return;
            }
            config.SetupDates();

            var           logger  = new Logger();
            LoaderContext context = null;

            try
            {
                context = new LoaderContext();
                IGitProvider provider = GetProvider(config.ProviderType);
                var          loader   = new Loader(context, logger);
                loader.Load(provider, config.Repo, config.From, config.To);
            }
            catch (Exception ex)
            {
                logger.Log(ex.Message);
            }
            finally
            {
                if (context != null)
                {
                    context.Dispose();
                }
            }
        }
Ejemplo n.º 2
0
        public ComponentIndexFile AddFile(string file)
        {
            ComponentIndexFile cf  = new ComponentIndexFile(file);
            LoaderContext      ctx = new LoaderContext();

            try {
                cf.Update(ctx);
            } finally {
                ctx.Dispose();
            }
            if (cf.Components.Count == 0)
            {
                return(null);
            }
            else
            {
                files.Add(cf);
                return(cf);
            }
        }
		public ComponentIndexFile AddFile (string file)
		{
			ComponentIndexFile cf = new ComponentIndexFile (file);
			LoaderContext ctx = new LoaderContext ();
			try {
				cf.Update (ctx);
			} finally {
				ctx.Dispose ();
			}
			if (cf.Components.Count == 0)
				return null;
			else {
				files.Add (cf);
				return cf;
			}
		}
		internal ComponentIndex GetComponentIndex (ProgressMonitor monitor)
		{
			// Returns an index of all components that can be added to the toolbox.
			
			ComponentIndex index = ComponentIndex.Load ();
			
			// Get the list of assemblies that need to be updated
			
			HashSet<string> files = new HashSet<string> ();
			List<ComponentIndexFile> toupdate = new List<ComponentIndexFile> ();
			List<ComponentIndexFile> todelete = new List<ComponentIndexFile> ();
			foreach (ComponentIndexFile ia in index.Files) {
				files.Add (ia.FileName);
				if (!File.Exists (ia.FileName))
					todelete.Add (ia);
				if (ia.NeedsUpdate)
					toupdate.Add (ia);
				if (monitor.CancellationToken.IsCancellationRequested)
					return index;
			}
			
			// Look for new assemblies
			
			foreach (TargetRuntime runtime in Runtime.SystemAssemblyService.GetTargetRuntimes ()) {
				foreach (SystemAssembly asm in runtime.AssemblyContext.GetAssemblies ()) {
					if (files.Add (asm.Location)) {
						ComponentIndexFile c = new ComponentIndexFile (asm.Location);
						index.Files.Add (c);
						toupdate.Add (c);
					}
					if (monitor.CancellationToken.IsCancellationRequested)
						return index;
				}
			}
			
			foreach (ComponentIndexFile ia in todelete) {
				index.Files.Remove (ia);
			}
			
			if (toupdate.Count > 0) {
				monitor.BeginTask (GettextCatalog.GetString ("Looking for components..."), toupdate.Count);
				LoaderContext ctx = new LoaderContext ();
				try {
					foreach (ComponentIndexFile ia in toupdate) {
						ia.Update (ctx);
						monitor.Step (1);
						if (monitor.CancellationToken.IsCancellationRequested)
							return index;
					}
				} finally {
					ctx.Dispose ();
					monitor.EndTask ();
				}
			}
			
			if (toupdate.Count > 0 || todelete.Count > 0)
				index.Save ();
			
			return index;
		}
Ejemplo n.º 5
0
        internal ComponentIndex GetComponentIndex(IProgressMonitor monitor)
        {
            // Returns an index of all components that can be added to the toolbox.

            ComponentIndex index = ComponentIndex.Load();

            // Get the list of assemblies that need to be updated

            HashSet <string>          files    = new HashSet <string> ();
            List <ComponentIndexFile> toupdate = new List <ComponentIndexFile> ();
            List <ComponentIndexFile> todelete = new List <ComponentIndexFile> ();

            foreach (ComponentIndexFile ia in index.Files)
            {
                files.Add(ia.FileName);
                if (!File.Exists(ia.FileName))
                {
                    todelete.Add(ia);
                }
                if (ia.NeedsUpdate)
                {
                    toupdate.Add(ia);
                }
                if (monitor.IsCancelRequested)
                {
                    return(index);
                }
            }

            // Look for new assemblies

            foreach (TargetRuntime runtime in Runtime.SystemAssemblyService.GetTargetRuntimes())
            {
                foreach (SystemAssembly asm in runtime.AssemblyContext.GetAssemblies())
                {
                    if (files.Add(asm.Location))
                    {
                        ComponentIndexFile c = new ComponentIndexFile(asm.Location);
                        index.Files.Add(c);
                        toupdate.Add(c);
                    }
                    if (monitor.IsCancelRequested)
                    {
                        return(index);
                    }
                }
            }

            foreach (ComponentIndexFile ia in todelete)
            {
                index.Files.Remove(ia);
            }

            if (toupdate.Count > 0)
            {
                monitor.BeginTask(GettextCatalog.GetString("Looking for components..."), toupdate.Count);
                LoaderContext ctx = new LoaderContext();
                try {
                    foreach (ComponentIndexFile ia in toupdate)
                    {
                        ia.Update(ctx);
                        monitor.Step(1);
                        if (monitor.IsCancelRequested)
                        {
                            return(index);
                        }
                    }
                } finally {
                    ctx.Dispose();
                    monitor.EndTask();
                }
            }

            if (toupdate.Count > 0 || todelete.Count > 0)
            {
                index.Save();
            }

            return(index);
        }