Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Game Attack Combos : WPF Hybrid Smart Client for Combo Calculations

, 23 May 2009
A WPF hybrid smart client for calculating attack combos in the Prince of Persia game.
Prize winner in Competition "Smart Client Article Contest"
GameAttackCombos_Src.zip
ComboServices
App_Data
ComboPackagesService.svc
GameAttackCombos.snk
Properties
GameAttackCombos.mdf
GameAttackCombos_log.LDF
Packages
PrinceOfPersia2008.gcp
PrinceOfPersia2010.gcp
PackageComboFiles
Properties
ServiceData
GameAttackCombosModel.edmx
Properties
Assets
Button Icons.design
Game Attack Combos Icon.design
Game Attack Combos Icon.ico
Prince of Persia 2008
Prince of Persia 2010
PrinceOfPersia2010Background.png
PrinceOfPersia2010Icon.png
PrinceOfPersia2008Background.png
PrinceOfPersia2008Icon.png
ComboClient
Game Attack Combos Icon.ico
Properties
Resources
Service References
Supporting
Themes
ComboServices
ComboPackagesService.disco
ComboPackagesService.wsdl
ComboPackagesService1.wsdl
configuration.svcinfo
configuration91.svcinfo
Reference.svcmap
app.manifest
ComboLogic
Properties
GameAttackCombos_Standalone.zip
Packages
PrinceOfPersia2008.gcp
PrinceOfPersia2010.gcp
Resources
using System;
using System.IO;
using GG.GameAttackCombos.Logic;

namespace PackageComboFiles {

	class Program {

		const int ExpectedStaticArgCount = 6;

		/// <summary>
		/// The main entry point to this console application.
		/// </summary>
		/// <param name="args">
		/// Command line arguments:
		/// <list type="number">
		///		<item>the path and file name of the combo package file to create</item>
		///		<item>the path to the combo definition XML file</item>
		///		<item>the path to the skin XAML file</item>
		///		<item>the path(s) to any skin resource file</item>
		/// </list>
		/// </param>
		static void Main(string[] args) {
			if (args == null || args.Length < ExpectedStaticArgCount) {
				Console.WriteLine("Please specify the paths and version necessary to package the combo files.");
				DisplayUsage();
			} else {
				try {
					// Check that the first argument is a valid path.
					FileInfo PackageFile = new FileInfo(args[0]);
				} catch {
					Console.WriteLine("The specified <PackageFileName> is not a valid file path and name.");
					DisplayUsage();
					return;
				}

				try {
					// Check that the third argument is a valid version.
					Version PackageVersion = new Version(args[2]);
				} catch {
					Console.WriteLine("The specified <Version> is not a valid version.");
					DisplayUsage();
					return;
				}

				// Make sure each of the other args reference existing file paths.
				for (int i = 3; i < args.Length; i++) {
					if (!File.Exists(args[i])) {
						Console.WriteLine("The specified paths of files to be packaged must exist.");
						Console.WriteLine();
						return;
					}
				}

				// Separate any skin resource paths specified in the arguments.
				string[] SkinResourcePaths = null;
				if (args.Length > ExpectedStaticArgCount) {
					SkinResourcePaths = new string[args.Length - ExpectedStaticArgCount];
					Array.Copy(args, ExpectedStaticArgCount, SkinResourcePaths, 0, SkinResourcePaths.Length);
				}

				// Create the package.
				if (ComboPackage.CreatePackageFile(args[0], args[1], args[2], args[3], args[4], args[5], SkinResourcePaths)) {
					Console.WriteLine("The package was successfully created!");
					Console.WriteLine();
				} else {
					Console.WriteLine("An error occurred creating the package.");
					Console.WriteLine();
				}
			}
		}

		static void DisplayUsage() {
			Console.WriteLine("Usage:");
			Console.WriteLine();
			Console.WriteLine("PackageComboFiles <PackageFileName> <Title> <Version> <ComboDefinitionFileName> <SkinFileName> <SkinResourceFile1> ... <SkinResourceFileN>");
			Console.WriteLine("-----------------------------------------------------------");
			Console.WriteLine("<PackageFileName>         The full path and file name of the combo package file");
			Console.WriteLine("                          to create.");
			Console.WriteLine("<Title>                   The title of the package file to create.");
			Console.WriteLine("<Version>                 The version of the package file to create. This value");
			Console.WriteLine("                          must be in the format: major.minor[.build[.revision]]");
			Console.WriteLine("<ComboDefinitionFileName> The full path to the combo definition XML file to");
			Console.WriteLine("                          include.");
			Console.WriteLine("<SkinFileName>            The full path to the skin XAML file to include.");
			Console.WriteLine("<SkinResourceFile1..N>    The full path to any skin resource files to include.");
			Console.WriteLine();
		}

	}

}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Matt Sollars
Web Developer
United States United States
I began programming on my Commodore 64 at around the age of 12. After migrating to DOS and then Windows, I decided to take on the Web. Several languages and platforms later, I have settled in with .NET nicely. I am currently the owner of a software consulting company and lead application developer for a learning-based technology consultation company.
 
The love of a finished application is usually at war with the desire to improve it as soon as it's released (they're never really finished).

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 23 May 2009
Article Copyright 2009 by Matt Sollars
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid