public AppcastViewModel()
			: base(false)
		{
			Constants.SetApplicationName("Appcast");
			// TODO try to fill in as much info automatically as possible
			AppcastItems = new ObservableCollection<AppcastItemViewModel>();
			Instructions = "Enter the appcast information below and press 'Save'";
			AcceptChanges();
#if TESTING
			var testingFolder = new DirectoryInfo(@"C:\code\tubeCentric.root\ASSETS\10centmail\");
			var binaryFolder =
				new DirectoryInfo(@"C:\code\tubeCentric.root\amazon tools.root\Amazon SES\Amazon Email\bin\Release\");

			var item = new AppcastItemViewModel(
				Path.Combine(binaryFolder.FullName, @"TenCentMail.exe"),
				Path.Combine(testingFolder.FullName, @"releasenotes.txt"),
				Path.Combine(testingFolder.FullName, @"NetSparkle_DSA.priv"));

			OutputPath = Path.Combine(testingFolder.FullName, @"testappcast.xml");
			Language = "en";
			var appInfo = new AppInfo(Assembly.LoadFrom(item.PathToBinary));
			var appName = appInfo.Title;
			var appNameNoSpaces = appName.Replace(' ', '_');
			ApplicationName = string.Format("{0} Changelog", appName);
			AppcastName = appNameNoSpaces;

			Description = @"Most recent changes with links to updates.";
			AppcastAddress = @"http://carverlab.com/appcast";
			AppcastItems.Add(item);
			IsValid = true;
#endif
		}
		public void AddReleaseToAppcast(string releaseFilePath, string releaseNotesFileName, string privateKeyFileName,
										bool resetEntireModel = false)
		{
			if (resetEntireModel)
			{
				Clear();
				string title;
				Version version;
				Helper.GetFileInformation(releaseFilePath, out version, out title);
				var appNameNoSpaces = title.Replace(' ', '_');
				//ApplicationName = String.Format("{0} Changelog", title);
				//AppTitle = title;
				ApplicationName = title;
				AppcastName = appNameNoSpaces;
			}
			var item = new AppcastItemViewModel(this, releaseFilePath, releaseNotesFileName, privateKeyFileName);
			item.PropertyChanged += PropertyChangeTracking;
			AppcastItems.Add(item);
		}
Example #3
0
		static int Main(string[] args)
		{
			Constants.SetApplicationName("Appcast");
#if TESTING
			var testargs = new List<string>
			               	{
			               		"-i",
			               		@"C:\code\tubeCentric.root\amazon tools.root\Amazon SES\TenCentMail.Setup\bin\Release\en-us\TenCentMail.msi",
			               		
								"-o",
			               		@"C:\Users\curtis\Documents\CarverLab\TenCentMail\appcast2.xml",
			               		
								"-r",
			               		@"C:\Users\curtis\Documents\CarverLab\TenCentMail\releasenotes.0.2.txt",
			               		
								"-k",
			               		@"C:\Users\curtis\Documents\CarverLab\TenCentMail\NetSparkle_DSA.priv",
			               	};
			args = testargs.ToArray();
#endif

			var config = new Config(args);

			if (args.Length == 0)
			{
				config.ShowHelp();
				return 1;
			}
			try
			{
				config.Parse();
			}
			catch (Exception exception)
			{
				System.Console.WriteLine(exception);
				return 200;
			}

			config.Logo(System.Console.Error);

			var bootstrapper = new SimpleBootstrapper();
			bootstrapper.Run();
			var appcast = new AppcastViewModel();

			string did;
			if (config.OutputPath.Exists && !config.Overwrite)
			{
				appcast.Load(config.OutputPath.FullName);
				did = "Updated";
			}
			else
			{
				appcast.AppcastBaseAddress = config.AppcastBaseAddress;
				appcast.AppcastName = config.AppcastName;
				appcast.ApplicationName = config.ApplicationName;
				appcast.Description = config.Description;
				appcast.Language = config.Language;
				appcast.OutputPath = config.OutputPath;
				var link = new Uri(config.AppcastBaseAddress);
				appcast.AppcastLink = string.Format("{0}/{1}/{2}", link.AbsolutePath, appcast.ApplicationName, appcast.AppcastName);
				did = "Created";
			}

			string releaseNotesPath = null;
			if (config.ReleaseNotesPath != null)
			{
				releaseNotesPath = config.ReleaseNotesPath.FullName;
			}
			if (string.IsNullOrEmpty(appcast.AppcastName) && !string.IsNullOrEmpty(config.AppcastName))
			{
				appcast.AppcastName = config.AppcastName;
			}
			if (string.IsNullOrEmpty(appcast.ApplicationName) && !string.IsNullOrEmpty(config.ApplicationName))
			{
				appcast.ApplicationName = config.ApplicationName;
			}
			if (string.IsNullOrEmpty(appcast.AppcastBaseAddress) && !string.IsNullOrEmpty(config.AppcastBaseAddress))
			{
				appcast.AppcastBaseAddress = config.AppcastBaseAddress;
			}
			var item = new AppcastItemViewModel(appcast, config.InputPath.FullName, releaseNotesPath, config.PrivateKeyPath.FullName);
			appcast.AppcastItems.Add(item);

			appcast.Save(appcast.OutputPath.FullName);
			//Environment.SetEnvironmentVariable("AppcastAppVersion", item.Version.ToString(3), EnvironmentVariableTarget.Machine);
			File.WriteAllText("appcastappversion.txt", item.Version.ToString(3));

			System.Console.WriteLine(@"{0} {1}", did, appcast.OutputPath);
			return 0;
		}