Exemplo n.º 1
0
		public static IReadOnlyCollection<FileInfo> GenerateSchema(FileInfo xmlFile)
		{
			try
			{
				LH.Write($"\rGenerating Schema (FileInfo): {xmlFile.Name}\t\t\t\t\t");

				IReadOnlyCollection<string> args = GetXSDArguments(xmlFile);
				bool result = CallXSD(args);

				if (!result)
					throw new FileLoadException($"The call to XSD failed on the file:\r\n{xmlFile.FullName}");

				ImportFileType importType = ESRIHelper.GetImportFileType(xmlFile);
				string fileExtension = ESRIHelper.GetImportFileExtension(importType);

				string fileName = xmlFile.Name.Replace(fileExtension, "")
					.Trim('.')
					.Trim();

				IReadOnlyCollection<FileInfo> results = WorkingDirectory.GetFiles($"{fileName}*{ESRIHelper.XmlSchemaExtension}",
					SearchOption.AllDirectories);

				return results;
			}
			catch (Exception e)
			{
				LH.Error($"\r\n{e.Message}\r\n{e}");
				throw;
			}
		}
Exemplo n.º 2
0
        public void LoadGame(FileInfo path)
        {
            NeedsSave = false;

            _workingDirectory = path.Directory;

            var files = WorkingDirectory.GetFiles("*.*", SearchOption.AllDirectories);

            foreach (var file in files)
            {
                var asset = ViewModelLocator.AssetsTabViewModel.LoadAsset(file);
                if (file.FullName == path.FullName)
                {
                    // registers the game definition asset

                    var gameSerializer = new GameSerializer();
                    Game                   = (Game)gameSerializer.Deserialize(path.FullName);
                    Asset                  = new AssetController(AssetType.Xml);
                    asset.LockName         = true;
                    asset.IsReserved       = true;
                    Asset.SelectedAsset    = asset;
                    Asset.PropertyChanged += AssetUpdated;
                    {
                    };
                }
            }
        }