예제 #1
0
        public void TestFacade()
        {
            string newTestFiles = @".\TestInputsFacade" + DateTime.Now.Ticks;

            new Microsoft.VisualBasic.Devices.Computer().FileSystem.CopyDirectory(@".\TestInputs", newTestFiles);

            VersionBumperFacade.BumpIt(new DirectoryInfo(newTestFiles), 9, 8, 7, 6);

            string content = FileReader.ReadFileContent(newTestFiles + @"\Project1\Properties\AssemblyInfo.cs");

            Assert.IsTrue(content.Contains(@"[assembly: AssemblyVersion(""9.8.7.6"")]"));
            Assert.IsTrue(content.Contains(@"[assembly: AssemblyFileVersion(""9.8.7.6"")]"));

            content = FileReader.ReadFileContent(newTestFiles + @"\Project3\Product.wxs");
            Assert.IsTrue(content.Contains(@"Version=""9.8.7.6"""));

            Directory.Delete(newTestFiles, true);
        }
예제 #2
0
        /// <summary>
        /// Mains the specified args.
        /// </summary>
        /// <param name="args">The args.</param>
        public static void Main(string[] args)
        {
            bool isTest = false;

            try
            {
                Settings setting = new Settings();

                if (args.Length > 1)
                {
                    for (int i = 0; i < args.Length; ++i)
                    {
                        switch (args[i])
                        {
                        case "-d":
                            setting.SourceDir = new DirectoryInfo(args[++i]);
                            break;

                        case "-v":
                            setting.Major    = int.Parse(args[++i]);
                            setting.Minor    = int.Parse(args[++i]);
                            setting.Build    = int.Parse(args[++i]);
                            setting.Revision = int.Parse(args[++i]);
                            break;

                        case "-test":
                            isTest = true;
                            break;

                        default:
                            throw new ArgumentException("Unknown option: " + args[i]);
                        }
                    }
                }
                else
                {
                    PrintDoc();
                }

                if (!setting.SourceDir.Exists)
                {
                    throw new ArgumentException("can't find source dir: " + setting.SourceDir);
                }

                Console.WriteLine(string.Format("Will bump the files contained in {0} to version {1}.{2}.{3}.{4}", setting.SourceDir.FullName, setting.Major, setting.Minor, setting.Build, setting.Revision));
                VersionBumperFacade.BumpIt(setting.SourceDir, setting.Major, setting.Minor, setting.Build, setting.Revision);

                Console.WriteLine("That's all folks");
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                if (isTest)
                {
                    throw;
                }
            }
            finally
            {
                if (!isTest)
                {
                    Console.WriteLine("Press any key");
                    Console.Read();
                }
            }
        }