Exemplo n.º 1
0
        /// <summary>
        ///     Initializes a new instance of the
        ///     <see cref="FileSystemSizeInfoGetter" /> class.
        /// </summary>
        /// <param name="cancellationToken">The cancellation token.</param>
        /// <param name="searchPaths">The search paths.</param>
        /// <param name="excludedPaths">The excluded paths.</param>
        /// <param name="scope">The scope.</param>
        /// <param name="shouldExcludeExtensions">
        ///     if set to <c>true</c>
        ///     [should exclude extensions].
        /// </param>
        /// <param name="extensions">The extensions.</param>
        /// <param name="minFileSize">Minimum size of the file.</param>
        /// <param name="maxFileSize">Maximum size of the file.</param>
        /// <param name="minFolderSize">Minimum size of the folder.</param>
        /// <param name="maxFolderSize">Maximum size of the folder.</param>
        /// <param name="minFolderContents">
        ///     The minimum folder
        ///     contents.
        /// </param>
        /// <param name="maxFolderContents">
        ///     The maximum folder
        ///     contents.
        /// </param>
        /// TODO Edit XML Comment Template for #ctor
        internal FileSystemSizeInfoGetter(
            CancellationToken cancellationToken,
            IEnumerable <string> searchPaths,
            IEnumerable <string> excludedPaths,
            Scope scope,
            bool shouldExcludeExtensions,
            IEnumerable <string> extensions = null,
            int?minFileSize       = null,
            int?maxFileSize       = null,
            int?minFolderSize     = null,
            int?maxFolderSize     = null,
            int?minFolderContents = null,
            int?maxFolderContents = null)
        {
            CancellationToken = cancellationToken;

            foreach (var searchPath in searchPaths)
            {
                CancellationToken.ThrowIfCancellationRequested();
                SearchDirectories.Add(new DirectoryInfo(searchPath));
            }

            ExcludedPaths           = excludedPaths;
            Scope                   = scope;
            ShouldExcludeExtensions = shouldExcludeExtensions;
            Extensions              = extensions;
            MinFileSize             = minFileSize * BytesInMegaByte;
            MaxFileSize             = maxFileSize * BytesInMegaByte;
            MinFolderSize           = minFolderSize * BytesInMegaByte;
            MaxFolderSize           = maxFolderSize * BytesInMegaByte;
            MinFolderContents       = minFolderContents * BytesInMegaByte;
            MaxFolderContents       = maxFolderContents * BytesInMegaByte;
        }
Exemplo n.º 2
0
        private void ExecuteSimpleSearch()
        {
            ObservableCollection <string> tmpSave = SearchDirectories;

            SearchDirectories.Clear();

            if (IsSearchingUserData)
            {
                SearchDirectories.Add(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile));
            }
            else if (IsSearchingThisPc)
            {
                SearchDirectories.Add(Path.GetPathRoot(Environment.SystemDirectory));
            }
            else
            {
                foreach (string drive in Environment.GetLogicalDrives())
                {
                    SearchDirectories.Add(drive);
                }
            }

            ExecuteAdvancedSearch();

            // Restore SearchDirectories
            SearchDirectories = tmpSave;
        }
 protected override OptionSet OnCreateOptions() => new OptionSet
 {
     { "a|assembly=", "One or more assemblies to merge", v => Assemblies.Add(v) },
     { "o|output=", "The output path to use for the merged assembly", v => SetOutputPath(v) },
     { "s|search=", "One or more search directories", v => SearchDirectories.Add(v) },
     { "inject-assemblyname", "Add the assembly names to the types", _ => InjectAssemblyNames = true },
 };
Exemplo n.º 4
0
 public DefaultNetAssemblyResolver(params string[] directories)
     : this()
 {
     foreach (var directory in directories)
     {
         SearchDirectories.Add(directory);
     }
 }
Exemplo n.º 5
0
 protected override OptionSet OnCreateOptions() => new OptionSet
 {
     { "o|output=", "The output path to use for the merged assembly", v => OutputPath = v },
     { "s|search=", "One or more search directories", v => SearchDirectories.Add(v) },
     { "inject-assembly-name", "Add the assembly names to the types", _ => InjectAssemblyNames = true },
     { "attribute-type=", "The full name of the attribute", v => AttributeFullName = v },
     { "n|assembly-name=", "The name of the merged assembly", v => AssemblyName = v },
     { "inject-assemblyname", "[Obsolete] Use `--inject-assembly-name`", _ => InjectAssemblyNames = true },
 };
Exemplo n.º 6
0
 public MergeCommand()
     : base("merge", "Merges the various AndroidX libraries.")
 {
     Options = new OptionSet
     {
         $"usage: {Program.Name} {Name} [OPTIONS]",
         "",
         Help,
         "",
         { "a|assembly=", "One or more assemblies to merge", v => Assemblies.Add(v) },
         { "o|output=", "The output path to use for the merged assembly", v => SetOutputPath(v) },
         { "s|search=", "One or more search directories", v => SearchDirectories.Add(v) },
         { "inject-assemblyname", "Add the assembly names to the types", _ => InjectAssemblyNames = true },
         { "?|h|help", "Show this message and exit", _ => ShowHelp = true },
     };
 }
Exemplo n.º 7
0
        private void DetectMonoGacDirectories()
        {
            if (Directory.Exists("/usr/lib/mono/gac"))
            {
                GacDirectories.Add(new GacDirectory("/usr/lib/mono/gac"));
            }

            string mostRecentMonoDirectory = Directory
                                             .EnumerateDirectories("/usr/lib/mono")
                                             .Where(d => d.EndsWith("-api"))
                                             .OrderByDescending(x => x)
                                             .FirstOrDefault();

            if (mostRecentMonoDirectory != null)
            {
                SearchDirectories.Add(mostRecentMonoDirectory);
            }
        }
Exemplo n.º 8
0
 private void AddSearchDirectory()
 {
     SearchDirectories.Add(NewSearchDirectory);
     NewSearchDirectory = string.Empty;
 }