protected string GetState() { System.Globalization.NumberFormatInfo format = Common.GetNumberFormat(); StringBuilder code = new StringBuilder(); string v = "$find(\"" + ClientID + "\")"; string needToRefresh = v + "._needToRefresh=false;"; // Check what was changed and whether we need to sync state on client and server if (_bitmapChanged) { if (HasContent) { UpdateViewport(); // Here we add some parameters of BaseViewer. code.Append(v + "._scrollingPosition=new Aurigma.GraphicsMill.PointF(" + ScrollingPosition.X.ToString(format) + "," + ScrollingPosition.Y.ToString(format) + ");"); code.Append(v + "._zoom=" + Zoom.ToString(format) + ";"); code.Append(v + "._zoomMode=" + Convert.ToInt32(ZoomMode, format).ToString(format) + ";"); code.Append(v + "._synchronizeState(\""); code.Append(SourceCacheFilename); code.Append("\","); code.Append(SourceImageParams.Width.ToString(format)); code.Append(","); code.Append(SourceImageParams.Height.ToString(format)); code.Append(","); code.Append(SourceImageParams.DpiX.ToString(format)); code.Append(","); code.Append(SourceImageParams.DpiY.ToString(format)); code.Append(","); code.Append(((int)SourceImageParams.PixelFormat).ToString(format)); code.Append(",\""); code.Append(SavePreviewImage()); code.Append("\","); if (DelayedTileLoad) { code.Append("null);"); needToRefresh = v + "._needToRefresh=true;"; } else { code.Append(GetImageTileJavaScript()); code.Append(");"); } } else { code.Append(v + "._synchronizeState(\"\",0,0,0,0,"); code.Append(((int)PixelFormat.FormatUnknown).ToString(format)); code.Append(",\"\",null);"); } } code.Append(needToRefresh); return(code.ToString()); }
public void Save(XmlDocument doc) { Config.SafeNodeSelect(doc, "/Settings/Display/AutoRotate", AutoRotate.ToString()); Config.SafeNodeSelect(doc, "/Settings/Display/CheckeredPatternBackground", CheckeredPatternBackground.ToString()); Config.SafeNodeSelect(doc, "/Settings/Display/Zoom", Zoom.ToString()); Config.SafeNodeSelect(doc, "/Settings/Display/ZoomStep", SizeMode.ToString()); Config.SafeNodeSelect(doc, "/Settings/Display/SizeMode", SizeMode.ToString()); Config.SafeNodeSelect(doc, "/Settings/Display/SizeModeOnImageLoad", SizeModeOnImageLoad.ToString()); }
public static void Save() { string regpath = string.Format(Utils.REG_USRSETTING, Constants.CODELIBRARY); LastOpenedDir = string.IsNullOrEmpty(LastOpenedDir) ? string.Empty : LastOpenedDir; LastOpenedFile = string.IsNullOrEmpty(LastOpenedFile) ? string.Empty : LastOpenedFile; Utils.SetCurrentUserRegisterKey(regpath, Constants.THEME, Theme.ToString()); Utils.SetCurrentUserRegisterKey(regpath, Constants.SORTMODE, SortMode.ToString()); Utils.SetCurrentUserRegisterKey(regpath, Constants.BACKUPMODE, BackupMode.ToString()); Utils.SetCurrentUserRegisterKey(regpath, Constants.LASTOPENEDDIR, LastOpenedDir); Utils.SetCurrentUserRegisterKey(regpath, Constants.LASTOPENEDFILE, LastOpenedFile); Utils.SetCurrentUserRegisterKey(regpath, Constants.BACKUPLOCATION, BackupLocation); Utils.SetCurrentUserRegisterKey(regpath, Constants.OPENDEFAULTONSTART, OpenDefaultOnStart.ToString()); Utils.SetCurrentUserRegisterKey(regpath, Constants.ZOOM, Zoom.ToString()); Utils.SetCurrentUserRegisterKey(regpath, Constants.SPLITTERDISTANCE, SplitterDistance.ToString()); if (string.IsNullOrEmpty(DefaultNoteType)) { DefaultNoteType = string.Empty; } Utils.SetCurrentUserRegisterKey(regpath, Constants.DEFAULT_NOTE_TYPE, DefaultNoteType); Utils.SetCurrentUserRegisterKey(regpath, Constants.PLUGINPATH, PluginPath); if (!Directory.Exists(AppFolder)) { Directory.CreateDirectory(AppFolder); } if (File.Exists(FavoriteFile)) { File.Delete(FavoriteFile); } string _json = Utils.ToJson <List <string> >(FavoriteLibs); File.WriteAllText(FavoriteFile, _json); StyleCollection.Instance.Save(RtfStylesFile); try { VersionNumber _version = new VersionNumber(Assembly.GetEntryAssembly().GetName().Version.ToString()); string _versionString = _version.ToString(); if (string.IsNullOrEmpty(_versionString)) { _versionString = string.Empty; } Utils.SetCurrentUserRegisterKey(regpath, Constants.VERSION, _versionString); } catch { } }
public void WriteXml(XmlWriter writer) { var pointConverter = new PointConverter(); var sizeConverter = new SizeConverter(); writer.WriteStartElement("WindowSettings"); writer.WriteElementString("WindowState", WindowState.ToString()); writer.WriteElementString("Location", pointConverter.ConvertToString(Location)); writer.WriteElementString("Size", sizeConverter.ConvertToString(Size)); writer.WriteElementString("Zoom", Zoom.ToString()); writer.WriteElementString("PositionInText", PositionInText.ToString()); writer.WriteEndElement(); }
public override XmlElement VToXML() { var doc = new XmlDocument(); var cameraElement = doc.CreateElement(GetComponentName <Cv_CameraComponent>()); var propertiesElement = doc.CreateElement("Properties"); propertiesElement.SetAttribute("defaultCamera", IsDefaultCamera.ToString()); propertiesElement.SetAttribute("zoom", Zoom.ToString(CultureInfo.InvariantCulture)); cameraElement.AppendChild(propertiesElement); return(cameraElement); }
public XmlDocument WriteToXml() { XmlDocument doc = new XmlDocument(); doc.LoadXml("<ClassDiagram/>"); XmlDeclaration decl = doc.CreateXmlDeclaration("1.0", "utf-8", "yes"); doc.InsertBefore(decl, doc.FirstChild); XmlAttribute zoom = doc.CreateAttribute("Zoom"); // Non-Standard attribute zoom.Value = Zoom.ToString(System.Globalization.CultureInfo.InvariantCulture); doc.DocumentElement.Attributes.Append(zoom); #region unsupported attributes - added for compatability // FIXME - Attribute not yet supported XmlAttribute majorVersion = doc.CreateAttribute("MajorVersion"); majorVersion.Value = "1"; doc.DocumentElement.Attributes.Append(majorVersion); // FIXME - Attribute not yet supported XmlAttribute minorVersion = doc.CreateAttribute("MinorVersion"); minorVersion.Value = "1"; doc.DocumentElement.Attributes.Append(minorVersion); // FIXME - Attribute not yet supported XmlAttribute membersFormat = doc.CreateAttribute("MembersFormat"); membersFormat.Value = "FullSignature"; doc.DocumentElement.Attributes.Append(membersFormat); // FIXME - Element not yet supported XmlAttribute fontName = doc.CreateAttribute("Name"); fontName.Value = "Tahoma"; XmlAttribute fontSize = doc.CreateAttribute("Size"); fontSize.Value = "8.25"; XmlElement fontElement = doc.CreateElement("Font"); fontElement.Attributes.Append(fontName); fontElement.Attributes.Append(fontSize); #endregion foreach (CanvasItemData item in itemsList) { item.Item.WriteToXml(doc); } return(doc); }
public override string ToString() { string Result = "sensor=" + Sensor.ToString(CultureInfo.InvariantCulture).ToLower(CultureInfo.InvariantCulture) + (Center == null ? "" : ("¢er=" + Center.ToString())) + "&zoom=" + Zoom.ToString(CultureInfo.InvariantCulture) + "&size=" + (Width.ToString(CultureInfo.InvariantCulture) + "x" + Height.ToString(CultureInfo.InvariantCulture)) + "&scale=" + Scale.ToString(CultureInfo.InvariantCulture) + "&format=" + Format.ToString().ToLower(CultureInfo.InvariantCulture) + "&maptype=" + MapType.ToString().ToLower(CultureInfo.InvariantCulture) + (string.IsNullOrEmpty(Language) ? "" : "&language=" + Language) + (string.IsNullOrEmpty(Region) ? "" : "®ion=" + Region); foreach (Markers Marker in Markers) { Result += "&" + Marker.ToString(); } Result += base.ToString(); return(APILocation + "?" + Result); }
/// <summary> /// Converts the map data to a URL /// </summary> /// <returns>The map as a URL</returns> public override string ToString() { string Result = "sensor=" + Sensor.ToString().ToLower().URLEncode() + (Center.IsNull() ? "" : ("¢er=" + Center.ToString().URLEncode())) + "&zoom=" + Zoom.ToString().URLEncode() + "&size=" + (Width.ToString() + "x" + Height.ToString()).URLEncode() + "&scale=" + Scale.ToString().URLEncode() + "&format=" + Format.ToString().ToLower().URLEncode() + "&maptype" + MapType.ToString().ToLower().URLEncode() + (Language.IsNullOrEmpty() ? "" : "&language=" + Language.URLEncode()) + (Region.IsNullOrEmpty() ? "" : "®ion=" + Region.URLEncode()); foreach (Markers Marker in Markers) { Result += "&" + Marker.ToString().URLEncode(); } Result += base.ToString(); return(APILocation + "?" + Result); }
/// <summary> /// Write the based LTS properties to XML /// </summary> /// <param name="doc">XML document</param> /// <param name="canvasElement">The canvas hosting element</param> protected virtual void WriteBaseProperties(XmlDocument doc, XmlElement canvasElement) { XmlAttribute attributeOfProcess = doc.CreateAttribute(NAME_PROCESS_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = Node.Text; canvasElement.Attributes.Append(attributeOfProcess); attributeOfProcess = doc.CreateAttribute(PARAMETER_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = this.Parameters.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); attributeOfProcess = doc.CreateAttribute(ZOOM_PROCESS_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = Zoom.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); //state counter attributeOfProcess = doc.CreateAttribute(STATE_COUNTER); attributeOfProcess.Value = this.StateCounter.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); }
public void WriteConfigFile(XmlTextWriter xmlWriter) { if (DeviceName.Length < 1) { DeviceName = "Settings " + DateTime.Now; } xmlWriter.WriteStartElement("CameraSettings"); Settings.WriteElement(xmlWriter, "DeviceName", DeviceName); Settings.WriteElement(xmlWriter, "DeviceNumber", DeviceNumber.ToString()); Settings.WriteElement(xmlWriter, "DeviceMode", DeviceMode.ToString()); Settings.WriteElement(xmlWriter, "Brightness", Brightness.ToString()); Settings.WriteElement(xmlWriter, "BrightnessAuto", BrightnessAuto.ToString()); Settings.WriteElement(xmlWriter, "Contrast", Contrast.ToString()); Settings.WriteElement(xmlWriter, "ContrastAuto", ContrastAuto.ToString()); Settings.WriteElement(xmlWriter, "Saturation", Saturation.ToString()); Settings.WriteElement(xmlWriter, "SaturationAuto", SaturationAuto.ToString()); Settings.WriteElement(xmlWriter, "Sharpness", Sharpness.ToString()); Settings.WriteElement(xmlWriter, "SharpnessAuto", SharpnessAuto.ToString()); Settings.WriteElement(xmlWriter, "Zoom", Zoom.ToString()); Settings.WriteElement(xmlWriter, "ZoomAuto", ZoomAuto.ToString()); Settings.WriteElement(xmlWriter, "Focus", Focus.ToString()); Settings.WriteElement(xmlWriter, "FocusAuto", FocusAuto.ToString()); Settings.WriteElement(xmlWriter, "Exposure", Exposure.ToString()); Settings.WriteElement(xmlWriter, "ExposureAuto", ExposureAuto.ToString()); Settings.WriteElement(xmlWriter, "FlipImage", FlipImage.ToString()); xmlWriter.WriteEndElement(); }
protected virtual string GetJsonDataProperties() { var mode = MapMode.ToString().ToLower(); var key = GetMapsProviderKey(PageContext.Current); var longitude = Rendering.DataSourceItem[Templates.StaticMap.Fields.CentralPointLongitude]; var latitude = Rendering.DataSourceItem[Templates.StaticMap.Fields.CentralPointLatitude]; var zoom = Zoom.ToString(); var width = Rendering.DataSourceItem[Templates.StaticMap.Fields.Width]; var height = Rendering.DataSourceItem[Templates.StaticMap.Fields.Height]; var data = new { mode, latitude, longitude, Pois, key, zoom, width, height }; return(new JavaScriptSerializer().Serialize(data)); }
public void Insert() { // save the new details var pc = new ParameterCollection(); pc.Add("Specified", TypeCode.String, Specified); pc.Add("Latitude", TypeCode.Decimal, Latitude.ToString()); pc.Add("Longitude", TypeCode.Decimal, Longitude.ToString()); pc.Add("Altitude", TypeCode.Decimal, Altitude.ToString()); pc.Add("Zoom", TypeCode.Int32, Zoom.ToString()); pc.Add("Proper", TypeCode.String, Proper); pc.Add("Accuracy", TypeCode.Int32, Accuracy.ToString()); pc.Add("Thoroughfare", TypeCode.String, Thoroughfare); pc.Add("Locality", TypeCode.String, Locality); pc.Add("SubAdministrativeArea", TypeCode.String, SubAdministrativeArea); pc.Add("AdministrativeArea", TypeCode.String, AdministrativeArea); pc.Add("PostalCode", TypeCode.String, PostalCode); pc.Add("CountryName", TypeCode.String, CountryName); pc.Add("CountryCode", TypeCode.String, CountryCode); pc.Add("AddressType", TypeCode.String, AddressType); AddressId = BewebData.InsertRecord("INSERT INTO Address (Specified, Latitude, Longitude, Altitude, Zoom, Proper, Accuracy, Thoroughfare, Locality, SubAdministrativeArea, AdministrativeArea, PostalCode, CountryName, CountryCode, AddressType) " + "VALUES (@Specified, @Latitude, @Longitude, @Altitude, @Zoom, @Proper, @Accuracy, @Thoroughfare, @Locality, @SubAdministrativeArea, @AdministrativeArea, @PostalCode, @CountryName, @CountryCode, @AddressType)", pc); }
private static void DrawDebug(int fps) { Graphics.TextureManager.TextureProgram.SetModelView(Matrix4.Identity); Graphics.TextureManager.TextureProgram.UpdateModelView(); if (ShowDebug) { TextureManager.GetMugshot(FocusedCharacter.CharData.Species, FocusedCharacter.CharData.Form, FocusedCharacter.CharData.Shiny, FocusedCharacter.CharData.Gender).RenderTile(0, 0); //TextureManager.SingleFont.RenderText(2, 32, "\u2640 \u2642", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Left, 0, Color4.White); #if GAME_MODE TextureManager.SingleFont.RenderTextShadowed(TextureManager.SCREEN_WIDTH - 2, 22, Floor + "F", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, Color4.White); #endif TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 32, fps + " FPS", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 42, UpdatesPerSecond + " UPS", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 52, DebugSpeed.ToString() + " Speed", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.LightYellow); TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 62, "F1 = Toggle Debug Menu", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 72, "F2 = Slow Down | F3 = Speed Up", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 82, "Zoom: " + Zoom.ToString(), null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); if (Print) { TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 92, "ASCII Print", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.LightYellow); } if (Intangible) { TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 102, "Intangible", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.LightYellow); } if (Jump) { TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 112, "Jump", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); } if (Turn) { TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 122, "Turn", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); } if (Diagonal) { TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 132, "Diagonal", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); } } if (ShowCoords) { TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 2, FocusedCharacter.CharLoc.X + "X", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); TextureManager.SingleFont.RenderText(TextureManager.SCREEN_WIDTH - 2, 12, FocusedCharacter.CharLoc.Y + "Y", null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Right, 0, Color4.White); } List <string> logs = Logs.Logger.GetRecentBattleLog(16); for (int i = 0; i < logs.Count; i++) { TextureManager.SingleFont.RenderText(2, 48 + 10 * i, logs[i], null, AtlasSheet.SpriteVOrigin.Top, AtlasSheet.SpriteHOrigin.Left, 0, Color4.White); } }
protected virtual bool PopulateXmlDocument(XmlDocument xmlDoc) { try { var root = xmlDoc.DocumentElement; root.SetAttribute("Version", WorkspaceVersion.ToString()); root.SetAttribute("X", X.ToString(CultureInfo.InvariantCulture)); root.SetAttribute("Y", Y.ToString(CultureInfo.InvariantCulture)); root.SetAttribute("zoom", Zoom.ToString(CultureInfo.InvariantCulture)); root.SetAttribute("Description", Description); root.SetAttribute("Category", Category); root.SetAttribute("Name", Name); var elementList = xmlDoc.CreateElement("Elements"); //write the root element root.AppendChild(elementList); foreach (var el in Nodes) { var typeName = el.GetType().ToString(); var dynEl = xmlDoc.CreateElement(typeName); elementList.AppendChild(dynEl); //set the type attribute dynEl.SetAttribute("type", el.GetType().ToString()); dynEl.SetAttribute("guid", el.GUID.ToString()); dynEl.SetAttribute("nickname", el.NickName); dynEl.SetAttribute("x", el.X.ToString(CultureInfo.InvariantCulture)); dynEl.SetAttribute("y", el.Y.ToString(CultureInfo.InvariantCulture)); dynEl.SetAttribute("isVisible", el.IsVisible.ToString().ToLower()); dynEl.SetAttribute("isUpstreamVisible", el.IsUpstreamVisible.ToString().ToLower()); dynEl.SetAttribute("lacing", el.ArgumentLacing.ToString()); el.Save(xmlDoc, dynEl, SaveContext.File); } //write only the output connectors var connectorList = xmlDoc.CreateElement("Connectors"); //write the root element root.AppendChild(connectorList); foreach (var el in Nodes) { foreach (var port in el.OutPorts) { foreach ( var c in port.Connectors.Where(c => c.Start != null && c.End != null)) { var connector = xmlDoc.CreateElement(c.GetType().ToString()); connectorList.AppendChild(connector); connector.SetAttribute("start", c.Start.Owner.GUID.ToString()); connector.SetAttribute("start_index", c.Start.Index.ToString()); connector.SetAttribute("end", c.End.Owner.GUID.ToString()); connector.SetAttribute("end_index", c.End.Index.ToString()); if (c.End.PortType == PortType.INPUT) { connector.SetAttribute("portType", "0"); } } } } //save the notes var noteList = xmlDoc.CreateElement("Notes"); //write the root element root.AppendChild(noteList); foreach (var n in Notes) { var note = xmlDoc.CreateElement(n.GetType().ToString()); noteList.AppendChild(note); note.SetAttribute("text", n.Text); note.SetAttribute("x", n.X.ToString(CultureInfo.InvariantCulture)); note.SetAttribute("y", n.Y.ToString(CultureInfo.InvariantCulture)); } return(true); } catch (Exception ex) { Debug.WriteLine(ex.Message + " : " + ex.StackTrace); return(false); } }
protected virtual bool PopulateXmlDocument(XmlDocument xmlDoc) { try { var root = xmlDoc.DocumentElement; root.SetAttribute("Version", WorkspaceVersion.ToString()); root.SetAttribute("X", X.ToString(CultureInfo.InvariantCulture)); root.SetAttribute("Y", Y.ToString(CultureInfo.InvariantCulture)); root.SetAttribute("zoom", Zoom.ToString(CultureInfo.InvariantCulture)); root.SetAttribute("Name", Name); var elementList = xmlDoc.CreateElement("Elements"); //write the root element root.AppendChild(elementList); foreach (var dynEl in Nodes.Select(el => el.Serialize(xmlDoc, SaveContext.File))) { elementList.AppendChild(dynEl); } //write only the output connectors var connectorList = xmlDoc.CreateElement("Connectors"); //write the root element root.AppendChild(connectorList); foreach (var el in Nodes) { foreach (var port in el.OutPorts) { foreach ( var c in port.Connectors.Where(c => c.Start != null && c.End != null)) { var connector = xmlDoc.CreateElement(c.GetType().ToString()); connectorList.AppendChild(connector); connector.SetAttribute("start", c.Start.Owner.GUID.ToString()); connector.SetAttribute("start_index", c.Start.Index.ToString()); connector.SetAttribute("end", c.End.Owner.GUID.ToString()); connector.SetAttribute("end_index", c.End.Index.ToString()); if (c.End.PortType == PortType.Input) { connector.SetAttribute("portType", "0"); } } } } //save the notes var noteList = xmlDoc.CreateElement("Notes"); //write the root element root.AppendChild(noteList); foreach (var n in Notes) { var note = xmlDoc.CreateElement(n.GetType().ToString()); noteList.AppendChild(note); note.SetAttribute("text", n.Text); note.SetAttribute("x", n.X.ToString(CultureInfo.InvariantCulture)); note.SetAttribute("y", n.Y.ToString(CultureInfo.InvariantCulture)); } return(true); } catch (Exception ex) { Debug.WriteLine(ex.Message + " : " + ex.StackTrace); return(false); } }
public override XmlElement WriteToXml(XmlDocument doc) { XmlElement canvasElement = doc.CreateElement(MODEL_NODE_NAME); XmlAttribute attributeOfProcess = doc.CreateAttribute(NAME_PROCESS_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = Node.Text; canvasElement.Attributes.Append(attributeOfProcess); attributeOfProcess = doc.CreateAttribute(PARAMETER_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = this.Parameters.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); attributeOfProcess = doc.CreateAttribute(ZOOM_PROCESS_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = Zoom.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); //place counter attributeOfProcess = doc.CreateAttribute(PLACE_COUNTER); attributeOfProcess.Value = this.PlaceCounter.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); //transition counter attributeOfProcess = doc.CreateAttribute(TRANSITION_COUNTER); attributeOfProcess.Value = this.TransitionCounter.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); //places XmlElement placesElement = doc.CreateElement(PLACE_NODE_NAME); canvasElement.AppendChild(placesElement); foreach (CanvasItemData item in itemsList) { if (item.Item is PNPlace) { placesElement.AppendChild(item.Item.WriteToXml(doc)); } } //transitions XmlElement transitionsElement = doc.CreateElement(TRANSITION_NODE_NAME); canvasElement.AppendChild(transitionsElement); foreach (CanvasItemData item in itemsList) { if (item.Item is PNTransition) { transitionsElement.AppendChild(item.Item.WriteToXml(doc)); } } //links XmlElement linksElement = doc.CreateElement(ARC_NODE_NAME); canvasElement.AppendChild(linksElement); foreach (Route route in diagramRouter.Routes) { if (route is PNArc) { linksElement.AppendChild(route.WriteToXml(doc)); } } return(canvasElement); }
public string toString() { return("CameraID: " + Camera.ToString() + " Pan: " + Pan.ToString() + " Tilt: " + Tilt.ToString() + " Zoom: " + Zoom.ToString()); }
public override XmlElement WriteToXml(XmlDocument doc) { XmlElement canvasElement = doc.CreateElement(MODEL_NODE_NAME); XmlAttribute attributeOfProcess = doc.CreateAttribute(NAME_PROCESS_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = Node.Text; canvasElement.Attributes.Append(attributeOfProcess); attributeOfProcess = doc.CreateAttribute(PARAMETER_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = this.Parameters.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); attributeOfProcess = doc.CreateAttribute(ZOOM_PROCESS_NODE_NAME); // Non-Standard attribute attributeOfProcess.Value = Zoom.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); //place counter attributeOfProcess = doc.CreateAttribute(PLACE_COUNTER); attributeOfProcess.Value = this.PlaceCounter.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); //transition counter attributeOfProcess = doc.CreateAttribute(TRANSITION_COUNTER); attributeOfProcess.Value = this.TransitionCounter.ToString(System.Globalization.CultureInfo.InvariantCulture); canvasElement.Attributes.Append(attributeOfProcess); //topology XmlElement topologyElement = doc.CreateElement(XmlTag.TAG_TOPOLOGY); topologyElement.SetAttribute(XmlTag.ATTR_mID, mID.ToString()); topologyElement.SetAttribute(XmlTag.ATTR_NUMOFSENSORS, mNumberOfSensors.ToString()); topologyElement.SetAttribute(XmlTag.ATTR_NUMOFPACKETS, mNumberOfPackets.ToString()); topologyElement.SetAttribute(XmlTag.ATTR_AVGBUFFER, mAvgBufferSensor.ToString()); topologyElement.SetAttribute(XmlTag.TAG_MODE, mMode); topologyElement.SetAttribute(XmlTag.TAG_ABSTRACTEDLEVEL, mAbstractedLevel); canvasElement.AppendChild(topologyElement); try { //topology-sensors foreach (WSNSensorIndie sensor in mSensors) { topologyElement.AppendChild(sensor.WriteToXml(doc)); } //topology-channels foreach (WSNChannelIndie channel in mChannels) { topologyElement.AppendChild(channel.WriteToXml(doc)); } } catch (Exception e) { } //places XmlElement placesElement = doc.CreateElement(PLACE_NODE_NAME); canvasElement.AppendChild(placesElement); foreach (CanvasItemData item in itemsList) { if (item.Item is PNPlace) { placesElement.AppendChild(item.Item.WriteToXml(doc)); } } //transitions XmlElement transitionsElement = doc.CreateElement(TRANSITION_NODE_NAME); canvasElement.AppendChild(transitionsElement); foreach (CanvasItemData item in itemsList) { if (item.Item is PNTransition) { transitionsElement.AppendChild(item.Item.WriteToXml(doc)); } } //links XmlElement linksElement = doc.CreateElement(ARC_NODE_NAME); canvasElement.AppendChild(linksElement); foreach (Route route in diagramRouter.Routes) { if (route is PNArc) { linksElement.AppendChild(route.WriteToXml(doc)); } } return(canvasElement); }