Example #1
0
        public void WritesAfterLoad()
        {
            string      excludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.ExcludeName);
            ExcludeFile excludeFile     = new ExcludeFile(this.Repo.Context, excludeFilePath);

            this.Repo.Context.FileSystem.FileExists(excludeFilePath).ShouldEqual(false);
            excludeFile.LoadOrCreate();
            this.Repo.Context.FileSystem.FileExists(excludeFilePath).ShouldEqual(true);

            excludeFile.FolderChanged("A\\B");
            excludeFile.FolderChanged("A\\D");

            List <string> expectedContents = new List <string>()
            {
                "*", "!/A", "!/A/B", "!/A/B/*", "!/A/D", "!/A/D/*"
            };

            this.CheckFileContents(excludeFilePath, expectedContents);

            excludeFile = new ExcludeFile(this.Repo.Context, excludeFilePath);
            excludeFile.LoadOrCreate();
            excludeFile.FolderChanged("a\\f");

            expectedContents = new List <string>()
            {
                "*", "!/A", "!/A/B", "!/A/B/*", "!/A/D", "!/A/D/*", "!/a/f", "!/a/f/*"
            };
            this.CheckFileContents(excludeFilePath, expectedContents);
        }
Example #2
0
        public void HasDefaultEntriesAfterLoad()
        {
            string      excludeFilePath = Path.Combine(this.Repo.GitParentPath, GVFS.Common.GVFSConstants.DotGit.Info.ExcludeName);
            ExcludeFile excludeFile     = new ExcludeFile(this.Repo.Context, excludeFilePath);

            this.Repo.Context.FileSystem.FileExists(excludeFilePath).ShouldEqual(false);
            excludeFile.LoadOrCreate();
            this.Repo.Context.FileSystem.FileExists(excludeFilePath).ShouldEqual(true);

            List <string> expectedContents = new List <string>()
            {
                "*"
            };

            this.CheckFileContents(excludeFilePath, expectedContents);
        }
Example #3
0
        public ExcludeDialogue(string swfFileName)
        {
            InitializeComponent();
            mExcludeFile = new ExcludeFile(swfFileName, new ExcludeFile.XMLErrorCallback(XMLErrorHandler));
            mExcludeFile.GenerateExcludeContext();

            foreach (string classExclude in mExcludeFile.Context.ExcludeClasses)
            {
                mExcludedClassesList.Items.Add(classExclude);
            }

            foreach (string classInclude in mExcludeFile.Context.IncludeClasses)
            {
                AddIncludeClass(classInclude);
            }
            mChangesSinceGeneration = false;
        }
Example #4
0
        /// <summary>
        /// Returns a string value containing the command line arguments to pass directly to the executable file.
        /// </summary>
        /// <returns>
        /// A string value containing the command line arguments to pass directly to the executable file.
        /// </returns>
        protected override string GenerateCommandLineCommands()
        {
            const string errorReturnValue = "";

            if (false == ValidateInputAssemblies() ||
                false == ValidateOutputFile())
            {
                return(errorReturnValue);
            }


            #region " ILMerge.exe Command-Line Arguments "

            /*
             * [/lib:directory]*
             * [/log[:filename]]
             * [/keyfile:filename [/delaysign]]
             * [/internalize[:filename]]
             * [/t[arget]:(library|exe|winexe)]
             * [/closed]
             * [/ndebug]
             * [/ver:version]
             * [/copyattrs [/allowMultiple]]
             * [/xmldocs]
             * [/attr:filename]
             * ([/targetplatform:<version>[,<platformdir>]]|v1|v1.1|v2|v4)
             * [/useFullPublicKeyForReferences]
             * [/zeroPeKind]
             * [/wildcards]
             * [/allowDup[:typename]]*
             * [/allowDuplicateResources]
             * [/union]
             * [/align:n]
             * /out:filename
             * <primary assembly> [<other assemblies>...]
             */
            #endregion " ILMerge.exe Command-Line Arguments "

            var builder = new CommandLineBuilder();

            if (null != DuplicateTypeNames && DuplicateTypeNames.Length > 0)
            {
                foreach (var item in DuplicateTypeNames)
                {
                    var typeName = item.ItemSpec;
                    builder.AppendSwitch(string.Format("/allowDup:{0}", typeName.Trim()));
                }
            }
            else if (AllowDuplicateTypeNames)
            {
                builder.AppendSwitch("/allowDup");
            }

            if (AllowMultipleAssemblyLevelAttributes)
            {
                builder.AppendSwitch("/allowMultiple");
            }

            if (AllowWildCards)
            {
                builder.AppendSwitch("/wildcards");
            }

            if (AllowZeroPeKind)
            {
                builder.AppendSwitch("/zeroPeKind");
            }

            if (false == string.IsNullOrWhiteSpace(AttributeFile))
            {
                builder.AppendSwitch(string.Format("/attr:\"{0}\"", AttributeFile.Trim()));
            }

            if (Closed)
            {
                builder.AppendSwitch("/closed");
            }

            if (CopyAttributes)
            {
                builder.AppendSwitch("/copyattrs");
            }

            if (false == DebugInfo)
            {
                builder.AppendSwitch("/ndebug");
            }

            if (DelaySign)
            {
                builder.AppendSwitch("/delaysign");
            }

            if (FileAlignment != DefaultFileAlignment)
            {
                builder.AppendSwitch(string.Format("/align:{0}", FileAlignment));
            }

            if (Internalize)
            {
                builder.AppendSwitch(string.Format("/internalize{0}", string.IsNullOrWhiteSpace(ExcludeFile) ? "" : string.Format(":\"{0}\"", ExcludeFile.Trim())));
            }

            if (false == string.IsNullOrWhiteSpace(KeyFile))
            {
                builder.AppendSwitch(string.Format("/keyfile:\"{0}\"", KeyFile.Trim()));
            }

            if (false == string.IsNullOrWhiteSpace(LogFile))
            {
                builder.AppendSwitch(string.Format("/log:\"{0}\"", LogFile.Trim()));
            }

            if (false == PublicKeyTokens)
            {
                builder.AppendSwitch("/useFullPublicKeyForReferences");
            }

            if (null != SearchDirectories && SearchDirectories.Length > 0)
            {
                foreach (var item in SearchDirectories)
                {
                    var directory = item.ItemSpec;
                    builder.AppendSwitch(string.Format("/lib:\"{0}\"", directory.Trim()));
                }
            }

            // Target Platform
            if (false == string.IsNullOrWhiteSpace(TargetPlatformDirectory) &&
                false == string.IsNullOrWhiteSpace(TargetPlatformVersion))
            {
                var value = string.Format("{0},\"{1}\"", TargetPlatformVersion.Trim().ToLowerInvariant(), TargetPlatformDirectory.Trim());
                builder.AppendSwitch(string.Format("/targetplatform:{0}", value));
            }

            if (false == string.IsNullOrWhiteSpace(TargetType))
            {
                builder.AppendSwitch(string.Format("/target:{0}", TargetType.Trim().ToLowerInvariant()));
            }

            if (UnionMerge)
            {
                builder.AppendSwitch("/union");
            }

            if (XmlDocumentation)
            {
                builder.AppendSwitch("/xmldocs");
            }

            if (false == string.IsNullOrWhiteSpace(Version))
            {
                builder.AppendSwitch(string.Format("/ver:{0}", Version.Trim()));
            }

            // OutputFile is added after all other switches and before the InputAssemblies.
            builder.AppendSwitch(string.Format("/out:\"{0}\"", OutputFile));

            // InputAssemblies must be added after all other switches.
            if (null != InputAssemblies && InputAssemblies.Length > 0)
            {
                foreach (var inputAssemblyPath in InputAssemblies)
                {
                    builder.AppendTextUnquoted(string.Format(" \"{0}\"", inputAssemblyPath));
                }
            }

            return(builder.ToString());
        }
Example #5
0
        //
        //	Helpers
        //

        private void Destroy()
        {
            mExcludeFile = null;
        }