Skip to content

Instantly share code, notes, and snippets.

View sailro's full-sized avatar

Sebastien Lebreton sailro

View GitHub Profile
@sailro
sailro / Program.cs
Created March 3, 2020 17:25
Playing with Analyzers and Roslyn
using Microsoft.CodeAnalysis;
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Reflection;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Text;
@sailro
sailro / Program.cs
Last active April 26, 2022 15:26
Mimic Unity Player Announce
using System;
using System.Threading;
using SyntaxTree.VisualStudio.Unity.Messaging;
// copy SyntaxTree.VisualStudio.Unity.Messaging.dll along with Program.cs
// on mac you can find it here: /Applications/Visual\ Studio.app/Contents/Resources/lib/monodevelop/AddIns/MonoDevelop.Unity/SyntaxTree.VisualStudio.Unity.Messaging.dll
// compile with: csc Program.cs -r:SyntaxTree.VisualStudio.Unity.Messaging.dll
// depending on the VSTU/VSTUM version, you will need to add -r:netstandard.dll
@sailro
sailro / ProjectFileHook.cs
Created October 2, 2014 08:09
Fix an assembly reference in a Visual Studio Tools for Unity project
using System;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
using SyntaxTree.VisualStudio.Unity.Bridge;
using UnityEngine;
[InitializeOnLoad]
@sailro
sailro / demo.js
Last active April 22, 2020 17:27
hookMonacoCompletionProvider(provider) {
const provideCompletionItems = provider.prototype.provideCompletionItems;
const owner = this;
provider.prototype.provideCompletionItems = async function (model, position, context, token) {
// reuse 'this' to preserve context through call (using apply)
const result = await provideCompletionItems.apply(this, [model, position, context, token]);
if (!result || !result.suggestions)
return result;
@sailro
sailro / EditorScript.cs
Last active December 18, 2018 17:31
Remove 'latest'LangVersion added by Unity 2018.3 which is not supported by VS 2015
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
using System;
using System.Linq;
using System.Reflection;
using System.Threading;
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.Text;
namespace SyntaxTree.VisualStudio.Unity.Debugger.Evaluation
{
internal static class DebugSyntaxFactory
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
@sailro
sailro / ProjectFileHook.cs
Last active May 22, 2018 16:38
Fix Unity project generation with .NET Standard
using System.IO;
using System.Linq;
using System.Text;
using System.Xml.Linq;
using UnityEditor;
#if ENABLE_VSTU
using SyntaxTree.VisualStudio.Unity.Bridge;
@sailro
sailro / CheckFile.cs
Last active March 9, 2018 05:49
Check Authenticode, StrongName and assembly references
using System;
using System.Text;
using Mono.Cecil;
using System.Security.Cryptography.X509Certificates;
namespace CheckFiles
{
[Flags]
enum CheckTypes
{