internal static void LoadIntoObjectFromByteArray(IPersistStream persistableObject, byte[] byteStream) { SafeHGlobalHandle hGlobal = SafeHGlobalHandle.AllocHGlobal(byteStream.Length); IntPtr destination = SafeNativeMethods.GlobalLock(hGlobal); if (IntPtr.Zero == destination) { throw System.ServiceModel.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new OutOfMemoryException()); } try { Marshal.Copy(byteStream, 0, destination, byteStream.Length); IStream pStm = SafeNativeMethods.CreateStreamOnHGlobal(hGlobal, false); try { persistableObject.Load(pStm); } finally { Marshal.ReleaseComObject(pStm); } } finally { SafeNativeMethods.GlobalUnlock(hGlobal); } }
public void Save(IPersistStream stream) { if (_dataset == null) { return; } stream.Save("ConnectionString", _dataset.ConnectionString); stream.Save("DatasetID", _datasetID); _dataset.WriteMetadata(stream); }
public void Load(IPersistStream stream) { if (_application == null) return; if (_application == null) return; while (true) { ModulePersist moduleper = stream.Load("Module", null, new ModulePersist(_application)) as ModulePersist; if (moduleper == null) break; } }
public void Save(IPersistStream stream) { if (_polyline == null || stream == null) { return; } for (int i = 0; i < _polyline.PathCount; i++) { stream.Save("Path", new PersistablePointCollection(_polyline[i])); } }
public void Save(IPersistStream stream) { if (_pColl == null) { return; } for (int i = 0; i < _pColl.PointCount; i++) { stream.Save("v", new PersistablePoint(_pColl[i])); } }
public void Save(IPersistStream stream) { if (_polygon == null || stream == null) { return; } for (int i = 0; i < _polygon.RingCount; i++) { stream.Save("Ring", new PersistablePointCollection(_polygon[i])); } }
public void SetObject <T>(T obj) { if (Marshal.IsComObject(obj)) { IntPtr punk = Marshal.GetIUnknownForObject(obj); if (IntPtr.Zero == punk) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.UnableToRetrievepUnk))); } try { IntPtr persistStream = IntPtr.Zero; Guid iidPersistStream = typeof(IPersistStream).GUID; int hr = Marshal.QueryInterface(punk, ref iidPersistStream, out persistStream); if (HR.S_OK == hr) { try { if (IntPtr.Zero == persistStream) { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.PersistWrapperIsNull))); } IPersistStream persistableObject = (IPersistStream)System.Runtime.Remoting.Services.EnterpriseServicesHelper.WrapIUnknownWithComObject(persistStream); try { this.dataStream = PersistHelper.PersistIPersistStreamToByteArray(persistableObject); this.clsid = typeof(T).GUID; } finally { Marshal.ReleaseComObject(persistableObject); } } finally { Marshal.Release(persistStream); } } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.CLSIDDoesNotSupportIPersistStream, typeof(T).GUID.ToString("B")))); } } finally { Marshal.Release(punk); } } else { throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ArgumentException(SR.GetString(SR.NotAComObject))); } }
public void Load(IPersistStream stream) { _elements.Clear(); _selectedelements.Clear(); IGraphicElement grElement; while ((grElement = (IGraphicElement)stream.Load("GraphicElement", null)) != null) { _elements.Add(grElement); } }
public void Load(IPersistStream stream) { if (_renderer == null) { return; } _renderer.MinimumScale = (double)stream.Load("MinScale", 0.0); _renderer.MaximumScale = (double)stream.Load("MaxScale", 0.0); _renderer.Renderer = stream.Load("Renderer", null) as IFeatureRenderer; }
public void Save(IPersistStream stream) { if (_queries == null) { return; } foreach (QueryTheme theme in _queries) { stream.Save("Query", theme); } }
public void Save(IPersistStream stream) { if (_row == null || _row.Table == null || _row.Table.Columns == null) { return; } foreach (DataColumn col in _row.Table.Columns) { stream.Save(col.ColumnName, _row[col.ColumnName]); } }
public void Save(IPersistStream stream) { stream.Save("Key", _key); if (_key.ToLower() == "password") { stream.Save("Val", Crypto.Encrypt(_value, "gView.Encrypted.Password")); } else { stream.Save("Val", _value); } }
public void Save(IPersistStream stream) { stream.Save("__DictionaryKeys", GetKeys()); foreach (string key in _dictionary.Keys) { if (_dictionary[key] != null) { stream.Save(key, _dictionary[key]); } } }
public void Load(IPersistStream stream) { _key = (string)stream.Load("Key", String.Empty); if (_key.ToLower() == "password") { _value = Crypto.Decrypt((string)stream.Load("Val", String.Empty), "gView.Encrypted.Password"); } else { _value = (string)stream.Load("Val", String.Empty); } }
public void Save(IPersistStream stream) { if (_renderer == null) { return; } stream.Save("MinScale", _renderer.MinimumScale); stream.Save("MaxScale", _renderer.MaximumScale); stream.Save("Renderer", _renderer.Renderer); }
public void Load(IPersistStream stream) { _minScale = (double)stream.Load("MinScale", 0.0); _maxScale = (double)stream.Load("MaxScale", 0.0); _symbol = (ISymbol)stream.Load("Symbol"); _filterType = (FilterType)stream.Load("FilterType", (int)FilterType.None); _filter = (gView.Framework.OGC.WFS.Filter)stream.Load("Filter"); SetLegendText(); }
public void Save(IPersistStream stream) { if (_polyline == null || _polyline.PathCount != 1) { return; } for (int i = 0; i < _polyline[0].PointCount; i++) { stream.Save("Point", _polyline[0][i]); } }
public void Load(IPersistStream stream) { _useRefScale = (bool)stream.Load("useRefScale", true); _renderers.Clear(); IFeatureRenderer renderer; while ((renderer = stream.Load("FeatureRenderer", null) as IFeatureRenderer) != null) { _renderers.Add(renderer); } }
public void Save(IPersistStream stream) { if (_map == null || _schemas == null) { return; } stream.Save("Name", _map.Name); foreach (ISnapSchema schema in _schemas) { stream.Save("SnapSchema", schema); } }
public void Load(IPersistStream stream) { string connectionString = (string)stream.Load("connectionstring", ""); if (_fdb != null) { _fdb.Dispose(); _fdb = null; } this.ConnectionString = connectionString; this.Open(); }
public void Save(IPersistStream stream) { if (_key == null) { stream.Save("key", "__gview_all_other_values__"); } else { stream.Save("key", _key); } stream.Save("symbol", _symbol); }
public void Save(IPersistStream stream) { stream.SaveEncrypted("connectionstring", this.ConnectionString); /* * foreach(IDatasetElement element in _layers) * { * if(element is IFeatureLayer) * stream.Save("IFeatureLayer",element); * } * */ }
public override void ReadMetadata(IPersistStream stream) { if (!(this is IMap)) return; IMap map = (IMap)this; base.ReadMetadata(stream); //XmlStreamObject streamObject; //while ((streamObject = (XmlStreamObject)stream.Load("MetaNode", null)) != null) //{ //} }
public void Save(IPersistStream stream) { base.Save(stream); stream.Save("forecolor", _forecolor.ToArgb()); stream.Save("backcolor", _backcolor.ToArgb()); stream.Save("hatchstyle", (int)_hatchStyle); if (_outlineSymbol != null) { stream.Save("outlinesymbol", _outlineSymbol); } }
public static byte[] SaveLayerToStream(ILayer paramLayer) { byte[] buffer = null; if (paramLayer is IPersistStream) { IPersistStream stream = paramLayer as IPersistStream; XMLStream class2 = new XMLStream(); stream.Save((IStream)class2, 0); buffer = class2.SaveToBytes(); } return(buffer); }
public void Save(IPersistStream stream) { stream.Save("dbconn", _dbConn.ToString()); stream.Save("table", _table); stream.Save("idfield", _idField); stream.Save("xfield", _xField); stream.Save("yfield", _yField); if (_sRef != null) { stream.Save("sref", _sRef.ToXmlString()); } }
public void Load(IPersistStream stream) { if (_datasets == null) return; string ConnectionString = (string)stream.Load("ConnectionString",""); int datasetID = (int)stream.Load("DatasetID", -1); if (datasetID >= 0 && datasetID < _datasets.Count && _datasets[datasetID].ConnectionString == ConnectionString) { _datasets[datasetID].ReadMetadata(stream); } }
public void Save(IPersistStream stream) { stream.Save("ConnectionString", this.ConnectionString); stream.Save("Type", (int)_type); if (_class != null) { stream.Save("WMS_SRS", _class.SRSCode); stream.Save("WMS_GetMapFormat", _class.GetMapFormat); stream.Save("WMS_InfoFormat", _class.FeatureInfoFormat); stream.Save("UseSLD_BODY", _class.UseSLD_BODY); } }
public void Load(IPersistStream stream) { if (_ageometry == null || stream == null) { return; } PersistableGeometry p; while ((p = stream.Load("Geometry", null, new PersistableGeometry()) as PersistableGeometry) != null) { _ageometry.AddGeometry(p.Geometry); } }
public void Save(IPersistStream stream) { stream.Save("useRefScale", _useRefScale); foreach (IFeatureRenderer renderer in _renderers) { if (renderer == null) { continue; } stream.Save("ScaleRenderer", new ScaleRendererPersist(renderer as ScaleRenderer)); } }
public void Load(IPersistStream stream) { if (_polygon == null || stream == null) { return; } PersistablePointCollection p; while ((p = stream.Load("Ring", null, new PersistablePointCollection(new Ring())) as PersistablePointCollection) != null) { _polygon.AddRing(p.PointCollection as IRing); } }
public MapGraphicTrackExtension() { ILineElement traceElement = new LineElementClass(); SetDefaultSymbol(traceElement); //add a tag to the trace line IElementProperties elemProps = (IElementProperties)traceElement; elemProps.Name = "{E63706E1-B13C-4184-8AB8-97F67FA052D4}"; bool showTrace = true; propSet = new PropertySetClass(); propSet.SetProperty("Line Element", traceElement); propSet.SetProperty("Show Trace", showTrace); persist = (IPersistStream)propSet; }
internal static byte[] PersistIPersistStreamToByteArray(IPersistStream persistableObject) { byte[] buffer; IStream pStm = SafeNativeMethods.CreateStreamOnHGlobal(SafeHGlobalHandle.InvalidHandle, false); try { persistableObject.Save(pStm, true); SafeHGlobalHandle hGlobalFromStream = SafeNativeMethods.GetHGlobalFromStream(pStm); if ((hGlobalFromStream == null) || (IntPtr.Zero == hGlobalFromStream.DangerousGetHandle())) { throw Fx.AssertAndThrow("HGlobal returned from GetHGlobalFromStream is NULL"); } buffer = ConvertHGlobalToByteArray(hGlobalFromStream); } finally { Marshal.ReleaseComObject(pStm); } return buffer; }
public static extern int OleSaveToStream(IPersistStream pPStm, IStream pStm);
public static extern void OleSaveToStream(IPersistStream persistStream, IStream stream);