public static void ValidateGameAttributes(game game) { if (String.IsNullOrWhiteSpace(game.name)) { throw GameValidator.GenerateEmptyAttributeException("Game", "name"); } if (String.IsNullOrWhiteSpace(game.id)) { throw GameValidator.GenerateEmptyAttributeException("Game", "id", game.name); } if (String.IsNullOrWhiteSpace(game.gameurl)) { throw GameValidator.GenerateEmptyAttributeException("Game", "gameurl", game.name); } if (String.IsNullOrWhiteSpace(game.version)) { throw GameValidator.GenerateEmptyAttributeException("Game", "version", game.name); } if (String.IsNullOrWhiteSpace(game.iconurl)) { throw GameValidator.GenerateEmptyAttributeException("Game", "iconurl", game.name); } if (game.scriptVersion == "0.0.0.0") { throw GameValidator.GenerateEmptyAttributeException("Game", "scriptVersion", game.name); } }
private static void Start() { if (Converto8sFiles) { Converto8S(); return; } var gv = new GameValidator(BuildDirectory); gv.OnWarning += delegate(string message, object[] args) { var old = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Warning: " + string.Format(message, args)); Console.ForegroundColor = old; }; Console.WriteLine("Running tests on {0}", BuildDirectory); gv.RunTests(); if (Validate) { return; } Console.WriteLine("Building packages"); BuildPackages(); if (LocalFeedInstall) { InstallLocalFeed(); } //testXsd(); }
private static void Start() { var gv = new GameValidator(BuildDirectory); Console.WriteLine("Running tests on {0}", BuildDirectory); gv.RunTests(); if (Validate) { return; } Console.WriteLine("Building packages"); BuildPackages(); //testXsd(); }
public static void ValidateGameAttributes(game game) { if (String.IsNullOrWhiteSpace(game.name)) { throw GameValidator.GenerateEmptyAttributeException("Game", "name"); } if (String.IsNullOrWhiteSpace(game.id)) { throw GameValidator.GenerateEmptyAttributeException("Game", "id", game.name); } if (String.IsNullOrWhiteSpace(game.gameurl)) { throw GameValidator.GenerateEmptyAttributeException("Game", "gameurl", game.name); } if (String.IsNullOrWhiteSpace(game.version)) { throw GameValidator.GenerateEmptyAttributeException("Game", "version", game.name); } if (String.IsNullOrWhiteSpace(game.iconurl)) { throw GameValidator.GenerateEmptyAttributeException("Game", "iconurl", game.name); } //TODO: Some way of automatically retrieving the most current python API version so we don't have to manually change this every time var newestPythonVersion = "3.1.0.2"; if (game.scriptVersion == "0.0.0.0") { throw GameValidator.GenerateEmptyAttributeException("Game", "scriptVersion", game.name); } else if (game.scriptVersion != newestPythonVersion) { GenerateWarningMessage("This game is using an outdated Python Script Version ({0}).\nConsider upgrading to the newest API version {1}", game.scriptVersion, newestPythonVersion); } }
private static void Start() { if (Converto8sFiles) { Converto8S(); return; } var gv = new GameValidator(BuildDirectory); Console.WriteLine("Running tests on {0}", BuildDirectory); gv.RunTests(); if (Validate) { return; } Console.WriteLine("Building packages"); BuildPackages(); if (LocalFeedInstall) { InstallLocalFeed(); } //testXsd(); }
private static void BuildPackages() { var directory = new DirectoryInfo(BuildDirectory); XmlSerializer serializer = new XmlSerializer(typeof(game)); var fs = File.Open(directory.GetFiles().First(x => x.Name == "definition.xml").FullName, FileMode.Open); var game = (game)serializer.Deserialize(fs); fs.Close(); GameValidator.ValidateGameAttributes(game); var builder = new NuGet.PackageBuilder() { Id = game.id, Description = game.description, ProjectUrl = new Uri(game.gameurl), Version = new SemanticVersion(game.version), Title = game.name, IconUrl = new Uri(game.iconurl), }; foreach (var author in game.authors.Split(',')) { builder.Authors.Add(author); } foreach (var tag in game.tags.Split(' ')) { builder.Tags.Add(tag); } // files and maybe release notes var baseRefPath = "\\def"; foreach (var dir in directory.GetDirectories()) { if (dir.Name == "Sets") { var refpath = baseRefPath + "\\" + "Sets" + "\\"; foreach (var setdir in dir.GetDirectories()) { var doc = XDocument.Load(Path.Combine(setdir.FullName, "set.xml")); var gameId = doc.Root.Attribute("id").Value; var setRefPath = refpath + gameId; foreach (var f in setdir.GetFiles("*", SearchOption.AllDirectories)) { var relPath = f.FullName.Replace(setdir.FullName, setRefPath); var pf = new PhysicalPackageFile() { SourcePath = f.FullName, TargetPath = relPath }; builder.Files.Add(pf); } } } else { var refpath = baseRefPath + "\\" + dir.Name; var files = dir.GetFiles("*", SearchOption.AllDirectories); foreach (var f in files) { var relPath = f.FullName.Replace(dir.FullName, refpath); var pf = new PhysicalPackageFile() { SourcePath = f.FullName, TargetPath = relPath }; builder.Files.Add(pf); } } } var defFile = new FileInfo(Path.Combine(directory.FullName, "definition.xml")); var defFilePack = new PhysicalPackageFile() { SourcePath = defFile.FullName, TargetPath = defFile.FullName.Replace(defFile.Directory.FullName, baseRefPath) }; builder.Files.Add(defFilePack); //var allFiles = directory // .GetFiles("*.*", SearchOption.AllDirectories) // .Where(x=>x.Extension.ToLower() != ".nupkg" && x.Extension.ToLower() != ".o8g"); //foreach (var file in allFiles) //{ // //Sets\0abccf03-2825-4b6e-ba59-698408a2005c // var path = file.FullName; // var relPath = path.Replace(directory.FullName, "\\def"); // var pf = new PhysicalPackageFile() { SourcePath = path, TargetPath = relPath }; // builder.Files.Add(pf); //} var feedPath = Path.Combine(directory.FullName, game.name + '-' + game.version + ".nupkg"); // var olPath = Path.Combine(directory.FullName, game.name + '-' + game.version + ".o8g"); // O8gPath = olPath; NupkgPath = feedPath; Console.WriteLine("Feed Path: " + feedPath); // Console.WriteLine("Manual Path: " + olPath); var filestream = File.Open(feedPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None); builder.Save(filestream); filestream.Flush(true); filestream.Close(); // filestream = File.Open(olPath, FileMode.Create, FileAccess.ReadWrite, FileShare.None); // builder.Save(filestream); // filestream.Flush(true); // filestream.Close(); }
private static void Start() { if (Converto8sFiles) { Converto8S(); return; } var gv = new GameValidator(BuildDirectory); Console.WriteLine("Running tests on {0}",BuildDirectory); gv.RunTests(); if (Validate) return; Console.WriteLine("Building packages"); BuildPackages(); if (LocalFeedInstall) InstallLocalFeed(); //testXsd(); }
private static void Start() { var gv = new GameValidator(BuildDirectory); Console.WriteLine("Running tests on {0}",BuildDirectory); gv.RunTests(); if (Validate) return; Console.WriteLine("Building packages"); BuildPackages(); //testXsd(); }
private static void Start() { if (Converto8sFiles) { Converto8S(); return; } var gv = new GameValidator(BuildDirectory); gv.OnWarning += delegate(string message, object[] args) { var old = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine("Warning: " + string.Format(message,args)); Console.ForegroundColor = old; }; Console.WriteLine("Running tests on {0}",BuildDirectory); gv.RunTests(); if (Validate) return; Console.WriteLine("Building packages"); BuildPackages(); if (LocalFeedInstall) InstallLocalFeed(); //testXsd(); }