public string EncodeBase64(IQueryData data, MenuType type) { return(UrlBase64Serializer.Base64Encode(new QueryDataRaw { Type = type, Data = ProtoSerializerHelper.Serialize(data, RuntimeTypeModel.Default) })); }
public IQueryData DecodeBase64(string base64) { var rawData = UrlBase64Serializer.Base64Decode <QueryDataRaw>(base64); if (_typeMap.ContainsKey(rawData.Type)) { return((IQueryData)ProtoSerializerHelper.Deserialize(_typeMap[rawData.Type], rawData.Data, RuntimeTypeModel.Default)); } throw new Exception($"Для типа {rawData.Type} не указан тип декодинга"); }