private void SaveToFile() { smartEdit.Core.SerializerXML _stream = null; try { _stream = new smartEdit.Core.SerializerXML("SMARTEDIT-APP", "1.0.0.0"); _stream.OpenOutputStream(GetIniFileName()); _stream.WriteElementStart("Application"); m_AppData.WriteToSerializer(_stream); _stream.WriteElementEnd("Application"); _stream.CloseOutputStream(); _stream = null; } catch (Exception e) { throw (e); } finally { if (_stream != null) { _stream.CloseOutputStream(); } } }
public void SaveToFile() { SerializerXML _stream = null; try { _stream = new SerializerXML("JKFLOW", "1.0.0.0"); _stream.OpenOutputStream(m_FileName); WriteToSerializer(_stream); _stream.CloseOutputStream(); _stream = null; //m_IsModified = false; } catch (Exception e) { throw (e); } finally { if (_stream != null) { _stream.CloseOutputStream(); } } }
private void btCopyShape_Click(object sender, EventArgs e) { try { ToolStripItem contextMenuItem = (ToolStripItem)sender; Control contextMenu = (Control)contextMenuItem.GetCurrentParent(); System.Drawing.Point Location = (contextMenu.Location); System.Drawing.Point PointA, PointB; Core.ElementEnumerator<Core.ShapeInterface> Iterator = GetModel().GetSelectedShapes(); Core.CmdMacro Cmd = new Core.CmdMacro(); List<ShapeInterface> Shapes = new List<ShapeInterface>(); ShapeInterface Shape = null; DataObject _Data = new DataObject(); int i = 0; SerializerXML _Stream = new SerializerXML("JKFLOW", "1.0.0.0"); MemoryStream MemStream = new MemoryStream(); _Stream.OpenOutputStream(MemStream); string Node = "Shape"; while (Iterator.MoveNext()) { PointA = new System.Drawing.Point(Iterator.Current.GetBoundingBox().Left + 20, Iterator.Current.GetBoundingBox().Top + 20); PointB = new System.Drawing.Point(Iterator.Current.GetBoundingBox().Right + 20, Iterator.Current.GetBoundingBox().Bottom + 20); Shape = ShapeFactory.CreateShape(Iterator.Current.GetShapeTypeName()); Shapes.Add(Shape); _Stream.WriteElementStart(Node); Iterator.Current.WriteToSerializer(_Stream); _Stream.WriteElementEnd(Node); Cmd.AddCmd(new Core.CmdAddShape(GetModel(), Shape, PointA, PointB)); i++; } _Stream.CloseOutputStream(); //if (i != 0) GetModel().GetUndoStack().Push(Cmd); _Data.SetData(DataFormats.Text, Cmd.GetText()); _Data.SetData(Cmd.GetType(), Cmd); _Data.SetData("stream", MemStream.ToArray()); Clipboard.SetDataObject(_Data); } catch (System.Runtime.InteropServices.ExternalException) { MessageBox.Show("The Clipboard could not be accessed. Please try again."); } }