public void FromXml(XmlNode node) { _graphicsDriver = GraphicsDriver.D3D9; _renderAtScreenRes = false; SerializeUtils.DeserializeFromXML(this, node); }
public void FromXml(XmlNode node) { _totalScore = 0; _guid = Guid.Empty; _enableGameExplorer = false; _description = string.Empty; _releaseDate = DateTime.Now; _genre = DEFAULT_GENRE; _version = DEFAULT_VERSION; _windowsExperienceIndex = 1; _developerName = string.Empty; _developerURL = string.Empty; _enhancedSaveGames = false; _saveGameExtension = string.Empty; _saveGamesFolderName = null; _binaryFilesInSourceControl = false; _guiAlphaStyle = GUIAlphaStyle.Classic; _spriteAlphaStyle = SpriteAlphaStyle.Classic; _runGameLoopsWhileDialogOptionsDisplayed = false; _inventoryHotspotMarker = new InventoryHotspotMarker(); _useLowResCoordinatesInScript = true; _audioIndexer = 0; _enforceNewAudio = false; SerializeUtils.DeserializeFromXML(this, node); if (_guid == Guid.Empty) { _guid = Guid.NewGuid(); } if (_saveGamesFolderName == null) { this.SaveGameFolderName = _gameName; } }
public TextParser(XmlNode node) { foreach (XmlNode wordNode in SerializeUtils.GetChildNodes(node, "Words")) { _words.Add(new TextParserWord(wordNode)); } }
protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability) { Init(MAIN_UNLOADED_ROOM_FOLDER_NAME); foreach (XmlNode unloadedRoomNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "Rooms")) { _items.Add(new UnloadedRoom(unloadedRoomNode)); } }
public GlobalVariables(XmlNode node) { foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "Variables")) { GlobalVariable newVariable = new GlobalVariable(childNode); _variables.Add(newVariable.Name, newVariable); } }
protected override void FromXmlBackwardsCompatability(XmlNode parentNodeForBackwardsCompatability) { Init(MAIN_CHARACTER_FOLDER_NAME); foreach (XmlNode invNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "Characters")) { _items.Add(CreateItem(invNode)); } }
protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability) { Init(MAIN_DIALOG_FOLDER_NAME); foreach (XmlNode dialogNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "Dialogs")) { _items.Add(new Dialog(dialogNode)); } }
protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability) { Init(MAIN_INVENTORY_ITEM_FOLDER_NAME); foreach (XmlNode inventoryItemNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "InventoryItems")) { _items.Add(new InventoryItem(inventoryItemNode)); } }
public void FromXml(XmlNode node) { _propertyDefinitions.Clear(); foreach (XmlNode child in SerializeUtils.GetChildNodes(node, "PropertyDefinitions")) { _propertyDefinitions.Add(new CustomPropertySchemaItem(child)); } }
public ViewLoop(XmlNode node) { ID = Convert.ToInt32(SerializeUtils.GetElementString(node, "ID")); RunNextLoop = Boolean.Parse(SerializeUtils.GetElementString(node, "RunNextLoop")); foreach (XmlNode frameNode in SerializeUtils.GetChildNodes(node, "Frames")) { _frames.Add(new ViewFrame(frameNode)); } }
public View(XmlNode node) { ID = Convert.ToInt32(SerializeUtils.GetElementString(node, "ID")); Name = SerializeUtils.GetElementString(node, "Name"); foreach (XmlNode loopNode in SerializeUtils.GetChildNodes(node, "Loops")) { _loops.Add(new ViewLoop(loopNode)); } }
public void FromXml(System.Xml.XmlNode node) { _lastBuildConfiguration = AGS.Types.BuildConfiguration.Unknown; // Allow for earlier versions of the XML if (node != null && node.SelectSingleNode("WorkspaceState") != null) { SerializeUtils.DeserializeFromXML(this, node); } }
public virtual void ToXml(XmlTextWriter writer) { SerializeUtils.SerializeToXML(this, writer); writer.WriteStartElement("Controls"); foreach (GUIControl control in _controls) { control.ToXml(writer); } writer.WriteEndElement(); }
public Translation(XmlNode node) { this.Name = SerializeUtils.GetElementString(node, "Name"); _modified = false; _normalFont = null; _speechFont = null; _rightToLeftText = null; _encodingHint = null; _encoding = Encoding.Default; LoadData(); }
public void FromXml(XmlNode node) { Reset(); foreach (XmlNode child in SerializeUtils.GetChildNodes(node, "Interactions")) { int index = SerializeUtils.GetAttributeInt(child, "Index"); _scriptFunctionNames[index] = child.InnerText; if (_scriptFunctionNames[index] == string.Empty) { _scriptFunctionNames[index] = null; } } }
private void FromXml(XmlNode node) { Init(node.Attributes["Name"].InnerText); foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "SubFolders")) { _subFolders.Add(CreateFolder(childNode)); } foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, this.XmlItemListNodeName)) { _items.Add(CreateItem(childNode)); } }
public void FromXml(XmlNode node) { XmlNode lipSyncNode = node.SelectSingleNode("LipSync"); this.Type = (LipSyncType)Enum.Parse(typeof(LipSyncType), SerializeUtils.GetElementString(lipSyncNode, "Type")); this.DefaultFrame = Convert.ToInt32(SerializeUtils.GetElementString(lipSyncNode, "DefaultFrame")); int nodeIndex = 0; foreach (XmlNode frameNode in SerializeUtils.GetChildNodes(lipSyncNode, "Frames")) { _lipSyncCharsForFrame[nodeIndex] = frameNode.InnerText; nodeIndex++; } }
protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability) { Init(MAIN_GUI_FOLDER_NAME); foreach (XmlNode guiNode in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "GUIs")) { if (guiNode.FirstChild.Name == NormalGUI.XML_ELEMENT_NAME) { _items.Add(new NormalGUI(guiNode)); } else { _items.Add(new TextWindowGUI(guiNode)); } } }
public Dialog(XmlNode node) { _scriptChangedSinceLastCompile = true; _id = Convert.ToInt32(SerializeUtils.GetElementString(node, "ID")); _name = SerializeUtils.GetElementString(node, "Name"); _showTextParser = Boolean.Parse(SerializeUtils.GetElementString(node, "ShowTextParser")); XmlNode scriptNode = node.SelectSingleNode("Script"); // Luckily the CDATA section is easy to read back _script = scriptNode.InnerText; foreach (XmlNode child in SerializeUtils.GetChildNodes(node, "DialogOptions")) { _options.Add(new DialogOption(child)); } }
public InventoryItem(XmlNode node) { _currentlyDeserializing = true; _cursorImage = -1; SerializeUtils.DeserializeFromXML(this, node); if (_cursorImage == -1) { _cursorImage = _image; } _interactions.FromXml(node); _currentlyDeserializing = false; }
public Sprite(XmlNode node) { _number = Convert.ToInt32(node.Attributes["Slot"].InnerText); _width = Convert.ToInt32(node.Attributes["Width"].InnerText); _height = Convert.ToInt32(node.Attributes["Height"].InnerText); _colorDepth = Convert.ToInt32(node.Attributes["ColorDepth"].InnerText); if (node.Attributes["AlphaChannel"] != null) { _alphaChannel = Convert.ToBoolean(node.Attributes["AlphaChannel"].InnerText); } if (node.Attributes["ColoursLockedToRoom"] != null) { _coloursLockedToRoom = Convert.ToInt32(node.Attributes["ColoursLockedToRoom"].InnerText); } if (node.SelectSingleNode("Source") != null) { XmlNode sourceNode = node.SelectSingleNode("Source"); try { _sourceFile = SerializeUtils.GetElementString(sourceNode, "FileName"); _offsetX = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "OffsetX")); _offsetY = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "OffsetY")); _frame = Convert.ToInt32(SerializeUtils.GetElementString(sourceNode, "Frame")); _remapToGamePalette = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "RemapToGamePalette")); _remapToRoomPalette = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "RemapToRoomPalette")); _tranparentColour = (SpriteImportTransparency)Enum.Parse(typeof(SpriteImportTransparency), SerializeUtils.GetElementString(sourceNode, "ImportMethod")); } catch (InvalidDataException) { // pass } try { _importAlphaChannel = Convert.ToBoolean(SerializeUtils.GetElementString(sourceNode, "ImportAlphaChannel")); } catch (InvalidDataException) { _importAlphaChannel = true; } } }
public Script(XmlNode node) { if (node.Name != "Script") { throw new AGS.Types.InvalidDataException("Script node incorrect"); } _fileName = SerializeUtils.GetElementString(node, "FileName"); _name = SerializeUtils.GetElementString(node, "Name"); _description = SerializeUtils.GetElementString(node, "Description"); _author = SerializeUtils.GetElementString(node, "Author"); _version = SerializeUtils.GetElementString(node, "Version"); _uniqueKey = Convert.ToInt32(SerializeUtils.GetElementString(node, "Key")); _isHeader = Convert.ToBoolean(SerializeUtils.GetElementString(node, "IsHeader")); LoadFromDisk(); _modified = false; }
public GUI(XmlNode rootGuiNode) : this() { SerializeUtils.DeserializeFromXML(this, rootGuiNode); _controls = new List <GUIControl>(); foreach (XmlNode node in SerializeUtils.GetChildNodes(rootGuiNode, "Controls")) { if (node.Name == "GUIButton") { _controls.Add(new GUIButton(node)); } else if (node.Name == "GUIInventory") { _controls.Add(new GUIInventory(node)); } else if (node.Name == "GUILabel") { _controls.Add(new GUILabel(node)); } else if (node.Name == "GUIListBox") { _controls.Add(new GUIListBox(node)); } else if (node.Name == "GUISlider") { _controls.Add(new GUISlider(node)); } else if (node.Name == "GUITextBox") { _controls.Add(new GUITextBox(node)); } else if (node.Name == "GUITextWindowEdge") { _controls.Add(new GUITextWindowEdge(node)); } else { throw new InvalidDataException("Unknown control type: " + node.Name); } } }
public PaletteEntry[] ReadPaletteFromXML(XmlNode parentOfPaletteNode) { PaletteEntry[] palette = new PaletteEntry[PALETTE_SIZE]; for (int i = 0; i < palette.Length; i++) { palette[i] = new PaletteEntry(i, _palette[i].Colour); palette[i].ColourType = _palette[i].ColourType; } foreach (XmlNode palNode in SerializeUtils.GetChildNodes(parentOfPaletteNode, "Palette")) { PaletteEntry paletteEntry = palette[Convert.ToInt32(palNode.Attributes["Index"].InnerText)]; paletteEntry.Colour = Color.FromArgb( Convert.ToInt32(palNode.Attributes["Red"].InnerText), Convert.ToInt32(palNode.Attributes["Green"].InnerText), Convert.ToInt32(palNode.Attributes["Blue"].InnerText)); paletteEntry.ColourType = (PaletteColourType)Enum.Parse(typeof(PaletteColourType), palNode.Attributes["Type"].InnerText); } return(palette); }
public BaseFolderCollection(XmlNode node) { if (node.Name != this.XmlFolderNodeName) { throw new InvalidDataException("Incorrect node passed to " + this.XmlFolderNodeName); } _name = node.Attributes["Name"].InnerText; _items = new List <T>(); _subFolders = new List <U>(); foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "SubFolders")) { _subFolders.Add(CreateFolder(childNode)); } foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, this.XmlItemListNodeName)) { _items.Add(CreateItem(childNode)); } }
public SpriteFolder(XmlNode node) { if (node.Name != "SpriteFolder") { throw new InvalidDataException("Incorrect node passed to SpriteFolder"); } _name = node.Attributes["Name"].InnerText; _sprites = new List <Sprite>(); _subFolders = new List <ISpriteFolder>(); foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "SubFolders")) { _subFolders.Add(new SpriteFolder(childNode)); } foreach (XmlNode childNode in SerializeUtils.GetChildNodes(node, "Sprites")) { _sprites.Add(new Sprite(childNode)); } }
public Sprite(XmlNode node) { _number = Convert.ToInt32(node.Attributes["Slot"].InnerText); _width = Convert.ToInt32(node.Attributes["Width"].InnerText); _height = Convert.ToInt32(node.Attributes["Height"].InnerText); _colorDepth = Convert.ToInt32(node.Attributes["ColorDepth"].InnerText); if (node.Attributes["AlphaChannel"] != null) { _alphaChannel = Convert.ToBoolean(node.Attributes["AlphaChannel"].InnerText); } if (node.SelectSingleNode("Source") != null) { XmlNode sourceNode = node.SelectSingleNode("Source"); _sourceFile = SerializeUtils.GetElementString(sourceNode, "FileName"); } if (node.Attributes["ColoursLockedToRoom"] != null) { _coloursLockedToRoom = Convert.ToInt32(node.Attributes["ColoursLockedToRoom"].InnerText); } }
protected override void FromXmlBackwardsCompatability(System.Xml.XmlNode parentNodeForBackwardsCompatability) { Init(MAIN_SCRIPT_FOLDER_NAME); Script header = null; Script script = null; foreach (XmlNode node in SerializeUtils.GetChildNodes(parentNodeForBackwardsCompatability, "Scripts")) { if (header == null) { header = new Script(node); } else { script = new Script(node); _items.Add(new ScriptAndHeader(header, script)); header = null; script = null; } } }
public void FromXml(XmlNode node) { node = node.SelectSingleNode("Game"); _settings.FromXml(node); if (node.SelectSingleNode(_defaultSetup.GetType().Name) != null) { // Only for >= 3.4.1 _defaultSetup.FromXml(node); } _lipSync.FromXml(node); _propertySchema.FromXml(node); if (node.SelectSingleNode("InventoryHotspotMarker") != null) { // Pre-3.0.3 InventoryHotspotMarker marker = new InventoryHotspotMarker(); marker.FromXml(node); _settings.InventoryHotspotMarker = marker; } foreach (XmlNode msgNode in SerializeUtils.GetChildNodes(node, "GlobalMessages")) { _globalMessages[Convert.ToInt32(msgNode.Attributes["ID"].InnerText) - GLOBAL_MESSAGE_ID_START] = msgNode.InnerText; } _plugins.Clear(); foreach (XmlNode pluginNode in SerializeUtils.GetChildNodes(node, "Plugins")) { _plugins.Add(new Plugin(pluginNode)); } _rooms = new UnloadedRoomFolders(node.SelectSingleNode("Rooms").FirstChild, node); _guis = new GUIFolders(node.SelectSingleNode("GUIs").FirstChild, node); _inventoryItems = new InventoryItemFolders(node.SelectSingleNode("InventoryItems").FirstChild, node); _textParser = new TextParser(node.SelectSingleNode("TextParser")); _characters = new CharacterFolders(node.SelectSingleNode("Characters").FirstChild, node); _playerCharacter = null; string playerCharText = SerializeUtils.GetElementString(node, "PlayerCharacter"); if (playerCharText.Length > 0) { int playerCharID = Convert.ToInt32(playerCharText); foreach (Character character in RootCharacterFolder.AllItemsFlat) { if (character.ID == playerCharID) { _playerCharacter = character; break; } } } _dialogs = new DialogFolders(node.SelectSingleNode("Dialogs").FirstChild, node); _cursors.Clear(); foreach (XmlNode cursNode in SerializeUtils.GetChildNodes(node, "Cursors")) { _cursors.Add(new MouseCursor(cursNode)); } _fonts.Clear(); foreach (XmlNode fontNode in SerializeUtils.GetChildNodes(node, "Fonts")) { _fonts.Add(new Font(fontNode)); } _palette = ReadPaletteFromXML(node); _sprites = new SpriteFolder(node.SelectSingleNode("Sprites").FirstChild); _views = new ViewFolders(node.SelectSingleNode("Views").FirstChild); _deletedViewIDs.Clear(); if (node.SelectSingleNode("DeletedViews") != null) { foreach (XmlNode transNode in SerializeUtils.GetChildNodes(node, "DeletedViews")) { _deletedViewIDs.Add(Convert.ToInt32(transNode.InnerText), null); } } _scripts = new ScriptFolders(node.SelectSingleNode("Scripts").FirstChild, node); if (node.SelectSingleNode("AudioClips") != null) { _audioClips = new AudioClipFolders(node.SelectSingleNode("AudioClips").FirstChild); } else { _audioClips = new AudioClipFolders("Main"); _audioClips.RootFolder.DefaultPriority = AudioClipPriority.Normal; _audioClips.RootFolder.DefaultRepeat = InheritableBool.False; _audioClips.RootFolder.DefaultVolume = 100; } _audioClipTypes.Clear(); if (node.SelectSingleNode("AudioClipTypes") != null) { foreach (XmlNode clipTypeNode in SerializeUtils.GetChildNodes(node, "AudioClipTypes")) { _audioClipTypes.Add(new AudioClipType(clipTypeNode)); } } _translations.Clear(); if (node.SelectSingleNode("Translations") != null) { foreach (XmlNode transNode in SerializeUtils.GetChildNodes(node, "Translations")) { _translations.Add(new Translation(transNode)); } } if (node.SelectSingleNode("GlobalVariables") != null) { _globalVariables = new GlobalVariables(node.SelectSingleNode("GlobalVariables")); } else { _globalVariables = new GlobalVariables(); } _oldInteractionVariables.Clear(); if (node.SelectSingleNode("OldInteractionVariables") != null) { foreach (XmlNode varNode in SerializeUtils.GetChildNodes(node, "OldInteractionVariables")) { _oldInteractionVariables.Add(new OldInteractionVariable(SerializeUtils.GetAttributeString(varNode, "Name"), SerializeUtils.GetAttributeInt(varNode, "Value"))); } } if (_savedXmlVersionIndex == null) { // Pre-3.0.3, upgrade co-ordinates ConvertCoordinatesToNativeResolution(); } }
public void ToXml(XmlTextWriter writer) { SerializeUtils.SerializeToXML(this, writer, false); writer.WriteElementString("FileLastModifiedDate", _fileLastModifiedDate.ToString("u")); writer.WriteEndElement(); }