Skip to content

Instantly share code, notes, and snippets.

View lucas-zimerman's full-sized avatar
🇯🇵

LucasZF lucas-zimerman

🇯🇵
View GitHub Profile
@lucas-zimerman
lucas-zimerman / HttpResponseMessageExtensions.cs
Created December 19, 2020 22:50
HttpResponseMessage to Sentry Protocol
//This function creates a Sentry Request based on HttpResponseMessage
public static async Task<Request> ToSentryRequestAsync(this HttpResponseMessage responseMessage)
{
var request = new Request();
try
{
var response = await responseMessage.Content.ReadAsStringAsync().ConfigureAwait(false);
request.Other.Add("server-response", response);
}
catch
@lucas-zimerman
lucas-zimerman / gist:7904a15b54c8a1893ae83ce1b986f61c
Created March 8, 2021 18:18
C# Populate any object data with any information and also create it's subclasses. Good for testing Moq conversions.
private int _intValue;
private decimal _decimalValue;
private void SetValue(object target, PropertyInfo prop)
{
if (prop.CanWrite)
{
if (prop.PropertyType == typeof(int) || prop.PropertyType == typeof(int?))
{
prop.SetValue(target, _intValue++, null);
}
using System;
using System.Collections.Generic;
using System.Diagnostics;
namespace AnagramFinder
{
public static class Program
{
public static void Main(string[] args)
{
using System;
using System.Diagnostics;
namespace ShiftString
{
class Program
{
struct Data
{
public int leftShift { get; set; }
@lucas-zimerman
lucas-zimerman / ActionSentryCaptureMessage.cs
Created June 2, 2022 13:53
Sentry CaptureMessage for Adventure Creator
using AC;
using Sentry;
#if UNITY_EDITOR
using UnityEditor;
#endif
[System.Serializable]
public class ActionSentryCaptureMessage : Action
{
public override ActionCategory Category { get { return ActionCategory.Custom; } }
@lucas-zimerman
lucas-zimerman / ActionSentryTag.cs
Created June 2, 2022 13:54
Sentry Tag for Adventure Creator
using AC;
using Sentry;
#if UNITY_EDITOR
using UnityEditor;
#endif
[System.Serializable]
public class ActionSentryTag : Action
{
public enum SentryTagEnum
@lucas-zimerman
lucas-zimerman / gist:b6f4333c274f48a6b6b70b23cca000e9
Created August 22, 2023 04:33
Quality of Life Sentry dotnet extensions.
using System;
using Sentry;
// requires constant __MOBILE__ else SentrySdk isnt partial
public static class SentrySdkExtensions
{
// Requires SentrySdk to be partial. Otherwise can be called with SentrySdkExtensions.StartTransactionOrChild
public static ISpan StartTransactionOrChild(string name, string operation, string description = null)
{
@lucas-zimerman
lucas-zimerman / gist:2ea62cf172bf049fa61d48026135bbb9
Created April 26, 2024 18:03
MSBuild Join privacyinfo files into one (WIP)
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Clears the bundle from any privacy info file created by Sentry.-->
<Target Name="ClearSentryBundleResource" BeforeTargets="PrepareForBuild" Condition="'$(Platform)' == 'iPhone' Or '$(Platform)' == 'iOS' or $(Platform) == 'iPhoneSimulator'">
<Message Importance="high" Text="Target ClearSentryBundleResource $(Platform)"/>
<PropertyGroup>
<PrivacyInfoFileName>PrivacyInfo.xcprivacy</PrivacyInfoFileName>
<SentryTargetEnabled>true</SentryTargetEnabled>
</PropertyGroup>