public StarMapFeature(SerializationInfo info, StreamingContext context) { //m_Stride = info.GetInt32("m_Stride"); //m_BytesPerPixel = info.GetInt32("m_BytesPerPixel"); m_MaxBrightness = info.GetByte("m_MaxBrightness"); m_MaxBrightnessFirstKey = info.GetUInt64("m_MaxBrightnessFirstKey"); m_MaxBrightnessPixels = info.GetInt32("m_MaxBrightnessPixels"); m_Generation = info.GetInt32("m_Generation"); m_Merges = info.GetInt32("m_Merges"); m_FeatureId = info.GetInt32("FeatureId"); m_Intencity = info.GetUInt32("m_Intencity"); int count = info.GetInt32("m_Pixels.Count"); int idx = -1; m_Pixels = new SortedDictionary<ulong, uint>(); for (int i = 0; i < count; i++) { idx++; ulong key = info.GetUInt64(string.Format("m_Pixels.{0}.Key", idx)); uint val = info.GetUInt32(string.Format("m_Pixels.{0}.Value", idx)); m_Pixels.Add(key, val); } }
public Credentials(SerializationInfo info, StreamingContext context) { int version = 0; try { version = info.GetInt32("version"); } catch { } if (version == 0) { Host = info.GetString("m_Host"); Port = info.GetInt32("m_Port"); WorkspaceID = info.GetUInt64("m_ID"); WorkspaceName = info.GetString("m_Name"); UserName = info.GetString("m_UserName"); UserSmtp = info.GetString("m_UserSmtp"); Nonce = (byte[])info.GetValue("m_Nonce", (new byte[] { }).GetType()); Type = (Credentials.CredType)Enum.Parse(typeof(CredType), info.GetString("m_type")); Password = info.GetString("m_pwd"); Ticket = (byte[])info.GetValue("m_ticket", (new byte[] { }).GetType()); IsAdmin = info.GetBoolean("m_IsAdmin"); UserID = info.GetUInt32("m_UserId"); } else { Host = info.GetString("Host"); Port = info.GetInt32("Port"); WorkspaceID = info.GetUInt64("ID"); WorkspaceName = info.GetString("Name"); UserName = info.GetString("UserName"); UserSmtp = info.GetString("UserSmtp"); Nonce = (byte[])info.GetValue("Nonce", (new byte[] { }).GetType()); Type = (Credentials.CredType)Enum.Parse(typeof(CredType), info.GetString("Type")); Password = info.GetString("Password"); Ticket = (byte[])info.GetValue("Ticket", (new byte[] { }).GetType()); IsAdmin = info.GetBoolean("IsAdmin"); UserID = info.GetUInt32("UserID"); if (version == 2) IsPublic = info.GetBoolean("IsPublic"); } newCreds.KasID = new KasIdentifier(Host, (UInt16)Port); newCreds.ExternalID = WorkspaceID; newCreds.KwsName = WorkspaceName; newCreds.UserName = UserName; newCreds.UserEmailAddress = UserSmtp; newCreds.AdminFlag = IsAdmin; newCreds.PublicFlag = IsPublic; newCreds.UserID = UserID; newCreds.Ticket = Ticket; newCreds.Pwd = Password; }
private CSharpSerializableCompilationOptions(SerializationInfo info, StreamingContext context) { this.options = new CSharpCompilationOptions( outputKind: (OutputKind)info.GetInt32(OutputKindString), moduleName: info.GetString(ModuleNameString), mainTypeName: info.GetString(MainTypeNameString), scriptClassName: info.GetString(ScriptClassNameString), usings: (string[])info.GetValue(UsingsString, typeof(string[])), cryptoKeyContainer: info.GetString(CryptoKeyContainerString), cryptoKeyFile: info.GetString(CryptoKeyFileString), delaySign: (bool?)info.GetValue(DelaySignString, typeof(bool?)), optimizationLevel: (OptimizationLevel)info.GetInt32(OptimizeString), checkOverflow: info.GetBoolean(CheckOverflowString), allowUnsafe: info.GetBoolean(AllowUnsafeString), fileAlignment: info.GetInt32(FileAlignmentString), baseAddress: info.GetUInt64(BaseAddressString), platform: (Platform)info.GetInt32(PlatformString), generalDiagnosticOption: (ReportDiagnostic)info.GetInt32(GeneralDiagnosticOptionString), warningLevel: info.GetInt32(WarningLevelString), specificDiagnosticOptions: ((Dictionary<string, ReportDiagnostic>)info.GetValue(SpecificDiagnosticOptionsString, typeof(Dictionary<string, ReportDiagnostic>))).ToImmutableDictionary(), highEntropyVirtualAddressSpace: info.GetBoolean(HighEntropyVirtualAddressSpaceString), subsystemVersion: SubsystemVersion.Create(info.GetInt32(SubsystemVersionMajorString), info.GetInt32(SubsystemVersionMinorString)), runtimeMetadataVersion: info.GetString(RuntimeMetadataVersionString), concurrentBuild: info.GetBoolean(ConcurrentBuildString), xmlReferenceResolver: XmlFileResolver.Default, sourceReferenceResolver: SourceFileResolver.Default, metadataReferenceResolver: MetadataFileReferenceResolver.Default, metadataReferenceProvider: MetadataFileReferenceProvider.Default, assemblyIdentityComparer: DesktopAssemblyIdentityComparer.Default, strongNameProvider: new DesktopStrongNameProvider(), metadataImportOptions: (MetadataImportOptions)info.GetByte(MetadataImportOptionsString), features: ((string[])info.GetValue(FeaturesString, typeof(string[]))).AsImmutable()); }
public struct1(SerializationInfo info, StreamingContext context) { str1 = info.GetString("str1"); str2 = info.GetString("str2"); ulong1 = info.GetUInt64("ulong1"); ushort1 = info.GetUInt16("ushort1"); ushort2 = info.GetUInt16("ushort2"); }
public Highscore(SerializationInfo info, StreamingContext ctxt) { id = info.GetString("ID"); score = info.GetUInt64("Score"); drawingAuthor = info.GetString("Author"); drawingItem = info.GetString("Item"); scorerName = info.GetString("Scorer"); scoreTimestamp = (DateTime)info.GetValue("Timestamp", typeof(DateTime)); }
private unsafe UIntPtr(SerializationInfo info, StreamingContext context) { ulong num = info.GetUInt64("value"); if ((Size == 4) && (num > 0xffffffffL)) { throw new ArgumentException(Environment.GetResourceString("Serialization_InvalidPtrValue")); } this.m_value = (void*) num; }
private UIntPtr(SerializationInfo info, StreamingContext context) { ulong uInt = info.GetUInt64("value"); if (UIntPtr.Size == 4 && uInt > (ulong)-1) { throw new ArgumentException(Environment.GetResourceString("Serialization_InvalidPtrValue")); } this.m_value = uInt; }
[System.Security.SecurityCritical] // auto-generated private unsafe UIntPtr(SerializationInfo info, StreamingContext context) { ulong l = info.GetUInt64("value"); if (Size==4 && l>UInt32.MaxValue) { throw new ArgumentException(Environment.GetResourceString("Serialization_InvalidPtrValue")); } m_value = (void *)l; }
protected JournalEntry(SerializationInfo info, StreamingContext context) { Created = info.GetDateTime("Created"); if (!_unsignedIdsInJournal.HasValue) { try { Id = info.GetUInt64("Id"); _unsignedIdsInJournal = true; } catch (Exception) { Id = (ulong) info.GetInt64("Id"); _unsignedIdsInJournal = false; } } else if (_unsignedIdsInJournal.Value) Id = info.GetUInt64("Id"); else Id = (ulong) info.GetInt64("Id"); }
/// <summary> /// Construct from a stream of serialized data /// </summary> /// <param name="info"></param> /// <param name="con"></param> public DataOperation(SerializationInfo info, StreamingContext con) { m_ClassId = info.GetUInt32("_ClassId"); m_ClassName = info.GetString("_ClassName"); // WARNING:: enum deserialize causes an exception // serialization of an enum prints the string // representation of the enum value, so we need to // deserialize to a string and convert to the relvant // enum value. // ENUM Deserialization - read as string and convert string to ENUM value String s = info.GetString("_OperationType"); m_OperationType = (OperationType)Enum.Parse(typeof(OperationType), s, true); m_InstanceId = info.GetUInt64("_OperationUID"); m_ExecuteId = info.GetUInt64("_ExecuteUID"); String dt = info.GetString("_Created"); DateTime.TryParse(dt, null , System.Globalization.DateTimeStyles.AssumeLocal , out m_InstanceCreated); dt = info.GetString("_Executed"); DateTime.TryParse(dt, null , System.Globalization.DateTimeStyles.AssumeLocal , out m_OperationExecuted); dt = info.GetString("_Completed"); DateTime.TryParse(dt, null , System.Globalization.DateTimeStyles.AssumeLocal , out m_OperationCompleted); // deserialization resets the static instance count // from the input stream, all previous data is overwritten lock (myMutex) { if (s_InstanceId < m_InstanceId) { s_InstanceId = m_InstanceId; } } }
public ServiceModel(SerializationInfo info, StreamingContext context) { try { this.Id = info.GetUInt64("Id"); this.Name = info.GetString("Name"); this.TypeName = info.GetString("TypeName"); this.Settings = (Dictionary<string, object>)info.GetValue("Settings", typeof(Dictionary<string, object>)); this.ManagerCode = info.GetString("ManagerCode"); } catch (SerializationException ex) { System.Diagnostics.Debug.WriteLine(string.Format("Тип: {0} Ошибка:{1} Сообщение:{2}", this.GetType().Name, ex.GetType().Name, ex.Message)); } }
/// <summary> /// Creates a new <see cref="CommandFrame"/> from serialization parameters. /// </summary> /// <param name="info">The <see cref="SerializationInfo"/> with populated with data.</param> /// <param name="context">The source <see cref="StreamingContext"/> for this deserialization.</param> protected CommandFrame(SerializationInfo info, StreamingContext context) : base(info, context) { // Deserialize command frame m_idCode = info.GetUInt64("idCode64Bit"); }
protected CompilationOptions(SerializationInfo info, StreamingContext context) { Initialize( outputKind: (OutputKind)info.GetInt32(OutputKindString), moduleName: info.GetString(ModuleNameString), mainTypeName: info.GetString(MainTypeNameString), scriptClassName: info.GetString(ScriptClassNameString), cryptoKeyContainer: info.GetString(CryptoKeyContainerString), cryptoKeyFile: info.GetString(CryptoKeyFileString), delaySign: (bool?)info.GetValue(DelaySignString, typeof(bool?)), optimize: info.GetBoolean(OptimizeString), checkOverflow: info.GetBoolean(CheckOverflowString), fileAlignment: info.GetInt32(FileAlignmentString), baseAddress: info.GetUInt64(BaseAddressString), platform: (Platform)info.GetInt32(PlatformString), generalDiagnosticOption: (ReportDiagnostic)info.GetInt32(GeneralDiagnosticOptionString), warningLevel: info.GetInt32(WarningLevelString), specificDiagnosticOptions: ((Dictionary<string, ReportDiagnostic>)info.GetValue(SpecificDiagnosticOptionsString, typeof(Dictionary<string, ReportDiagnostic>))).ToImmutableDictionary(), highEntropyVirtualAddressSpace: info.GetBoolean(HighEntropyVirtualAddressSpaceString), debugInformationKind: (DebugInformationKind)info.GetInt32(DebugInformationKindString), subsystemVersion: (SubsystemVersion)info.GetValue(SubsystemVersionString, typeof(SubsystemVersion)), concurrentBuild: info.GetBoolean(ConcurrentBuildString), xmlReferenceResolver: XmlFileResolver.Default, sourceReferenceResolver: SourceFileResolver.Default, metadataReferenceResolver: MetadataFileReferenceResolver.Default, metadataReferenceProvider: MetadataFileReferenceProvider.Default, assemblyIdentityComparer: DesktopAssemblyIdentityComparer.Default, strongNameProvider: new DesktopStrongNameProvider(), metadataImportOptions: (MetadataImportOptions)info.GetByte(metadataImportOptionsString)); }
private SpookyHash(SerializationInfo info, StreamingContext context) { _data = (ulong[])info.GetValue("d", typeof(ulong[])); _state0 = info.GetUInt64("s0"); _state1 = info.GetUInt64("s1"); _state2 = info.GetUInt64("s2"); _state3 = info.GetUInt64("s3"); _state4 = info.GetUInt64("s4"); _state5 = info.GetUInt64("s5"); _state6 = info.GetUInt64("s6"); _state7 = info.GetUInt64("s7"); _state8 = info.GetUInt64("s8"); _state9 = info.GetUInt64("s9"); _state10 = info.GetUInt64("s10"); _state11 = info.GetUInt64("s11"); _length = info.GetInt32("l"); _remainder = info.GetInt32("r"); }
/// <summary> /// Deserializing constructor. /// </summary> public Workspace(SerializationInfo info, StreamingContext context) { Int32 version = info.GetInt32("WorkspaceVersion"); InternalID = info.GetUInt64("m_internalID"); // This is an old workspace which needs to be rebuilt. if (version < 5) { FileKwsDeserializer dsr = (FileKwsDeserializer)KwmSpawner.Instance.KwmDsr.CurKwsDsr; // Get the folder information. try { dsr.FolderID = UInt64.Parse(info.GetString("m_parentFolderID").Substring(6)); dsr.FolderIndex = info.GetInt32("m_indexInFolder"); } catch (Exception) { } // Update the credentials. CoreData.Credentials = ((Credentials)info.GetValue("credentials", typeof(Credentials))).newCreds; // Set the rebuild information. MainStatus = KwsMainStatus.RebuildRequired; KwsRebuildInfo rebuildInfo = CoreData.RebuildInfo; rebuildInfo.DeleteCachedEventsFlag = true; rebuildInfo.DeleteLocalDataFlag = false; rebuildInfo.UpgradeFlag = true; if (version >= 3) { AppKfs appKfs = (AppKfs)info.GetValue("m_appKfs", typeof(AppKfs)); appKfs.Share.CompatLastKwsEventID = info.GetUInt64("m_lastEventID"); appKfs.Initialize(this); AppTree[KAnpType.KANP_NS_KFS] = appKfs; } } // Pre-desintermediation and later. else { MainStatus = (KwsMainStatus)info.GetValue("MainStatus", typeof(KwsMainStatus)); KAnpState = (KwsKAnpState)info.GetValue("KAnpState", typeof(KwsKAnpState)); CoreData = (KwsCoreData)info.GetValue("CoreData", typeof(KwsCoreData)); UserTask = (KwsTask)info.GetValue("UserTask", typeof(KwsTask)); // Post-desintermediation. if (version >= 6) { KasLoginHandler = (KwsKasLoginHandler)info.GetValue("KasLoginHandler", typeof(KwsKasLoginHandler)); AppException = (Exception)info.GetValue("AppException", typeof(Exception)); } } // Create a temporary KAS object. Kas = new WmKas(CoreData.Credentials.KasID); }
/// <summary> /// Try to get the desired serialized UInt64 element. If not present, use /// defVal instead. /// </summary> public static void TryGetUInt64(SerializationInfo info, ref UInt64 var, String name, UInt64 defVal) { try { var = defVal; var = info.GetUInt64(name); } catch (Exception) { } }
// De-serialize an "UIntPtr" value. internal unsafe UIntPtr(SerializationInfo info, StreamingContext context) { if(info == null) { throw new ArgumentNullException("info"); } ulong value = info.GetUInt64("value"); if(Size == 4) { if(value > (ulong)(UInt32.MaxValue)) { throw new ArgumentException(_("Overflow_Pointer")); } } value_ = (void *)value; }
/// <summary> /// Deserializing constructor. /// </summary> public WorkspaceManager(SerializationInfo info, StreamingContext context) { Int32 version = Misc.GetSerializationVersion(info); Logging.Log("Deserializing WorkspaceManager from version " + version + "."); // Handle old folder list. if (version == 3 || version == 4) { FileKwmDeserializer dsr = (FileKwmDeserializer)KwmSpawner.Instance.KwmDsr; dsr.FolderList = (kwm.WorkspaceFolderList)info.GetValue("m_wsFolders", typeof(kwm.WorkspaceFolderList));; } // If we're deserializing version >= 5, trust the serialized // workspace IDs, otherwise reset from 0. if (version >= 5) { PublicKwsID = info.GetUInt64("PublicKwsID"); NextKwsInternalId = info.GetUInt64("NextKwsInternalId"); // Deserialize the workspace browser. KwmSpawner.Instance.KwmDsr.Browser = (SerializedKwsBrowser)info.GetValue("KwsBrowser", typeof(SerializedKwsBrowser)); } }