Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
みんな大好き Boo.Lang を SATSUGAI する方法
Search
Grabacr07
February 24, 2015
Technology
1
46k
みんな大好き Boo.Lang を SATSUGAI する方法
Visual Studio Tools for Unity 勉強会での LT 資料です。
VSTU の機能で、.sln / .csproj の生成処理にフックする方法について。
Grabacr07
February 24, 2015
Tweet
Share
More Decks by Grabacr07
See All by Grabacr07
Step up WPF
grabacr07
0
73k
デスクトップ アプリがこの先生きのこるには (2016)
grabacr07
2
88k
Windows 10 で遊ぶ Virtual Desktop
grabacr07
0
91k
Roslyn + KanColleViewer
grabacr07
0
1.2k
WPF 4.6
grabacr07
1
60k
UniRx とか Reactive Property とか
grabacr07
12
69k
Road to UI Library
grabacr07
0
270
WPF Digital Ink
grabacr07
0
38k
Modern WPF
grabacr07
0
34k
Other Decks in Technology
See All in Technology
なぜAI時代に 「イベント」を中心に考えるのか? / Why focus on "events" in the age of AI?
ytake
2
810
FAST導入1年間のふりかえり〜現実を直視し、さらなる進化を求めて〜 / Review of the first year of FAST implementation
wooootack
1
190
MCPと認可まわりの話 / mcp_and_authorization
convto
2
300
[MIRU2025]Preference Optimization for Multimodal Large Language Models for Image Captioning Tasks
keio_smilab
PRO
0
120
Vision Language Modelと自動運転AIの最前線_20250730
yuyamaguchi
2
740
「AI駆動開発」のボトルネック『言語化』を効率化するには
taniiicom
1
220
ユーザー理解の爆速化とPdMの価値
kakehashi
PRO
1
110
[MIRU25] NaiLIA: Multimodal Retrieval of Nail Designs Based on Dense Intent Descriptions
keio_smilab
PRO
1
130
東京海上日動におけるセキュアな開発プロセスの取り組み
miyabit
0
200
AIを使っていい感じにE2Eテストを書けるようになるまで / Trying to Write Good E2E Tests with AI
katawara
3
1.9k
From Live Coding to Vibe Coding with Firebase Studio
firebasethailand
1
320
Power Automate のパフォーマンス改善レシピ / Power Automate Performance Improvement Recipes
karamem0
0
270
Featured
See All Featured
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
34
5.9k
Gamification - CAS2011
davidbonilla
81
5.4k
Thoughts on Productivity
jonyablonski
69
4.8k
Reflections from 52 weeks, 52 projects
jeffersonlam
351
21k
It's Worth the Effort
3n
185
28k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
194
16k
The Straight Up "How To Draw Better" Workshop
denniskardys
235
140k
"I'm Feeling Lucky" - Building Great Search Experiences for Today's Users (#IAC19)
danielanewman
229
22k
Code Reviewing Like a Champion
maltzj
524
40k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
45
7.5k
For a Future-Friendly Web
brad_frost
179
9.8k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
Transcript
Boo.Langを SATSUGAI する方法 2015/02/24 VSTU 勉強会 Manato KAMEYA (@Grabacr07) みんな大好き
Self Introduction Work 亀谷学人 - 株式会社グラニ C# + Unity でソーシャルゲーム開発
Private Microsoft MVP for .NET (Visual C#) Room metro Tokyo staff (Windows クライアント開発 勉強会) Twitter: @Grabacr07 Facebook: manao.kameya Blog: http://grabacr.net/ 最先端の C# をフルに活用 CTO: @neuecc (UniRx 開発者)
C# Everywhere Windows Desktop WinForms, WPF Windows 8 Windows Universal
apps Mac application Xamarin.Mac Web application ASP .NET MVC, ASP .NET Web API Game Unity, Playstation Mobile SDK Mobile (iOS, Android, WP) MonoTouch, Mono for Android Embedded, IoT .NET Framework Embedded Cloud Windows Azure, AWS
Boo.Lang の襲来 Visual Studio の補完機能 電球アイコンをクリック (もしくは Ctrl + .
(dot) でも出るよ!) 例: using System.Linq; が必要、なので書いてくれる
Boo.Lang の襲来 Visual Studio の補完機能 “List” と入力して補完すると…?
Boo.Lang の襲来 Visual Studio の補完機能 “List” と入力して補完すると…? 本当に必要なのは System.Collections.Generic の方
Boo.Lang が真っ先に出てくる ので、Ctrl + . (dot) -> Enter と高速で 入力すると Boo.Lang.List になってしまう
Visual Studio Tools for Unity に対する不満 Boo.Lang.dll への参照 ぶっちゃけ必要ない! が、VSTU
が自動的に追加 (Visual Studio で削除してもムダ) VSTU が生成した .sln or .csproj に不満がある なら加工しましょう!
Project File Generation VSTU の生成処理をフックする SyntaxTree.VisualStudio.Unity.Bridge.dll VSTU をインポートすると自動的に参照 (Editor project)
デバッグ実行可能 もちろん、ブレークポイントで止められます!
Project File Generation ProjectFilesGenerator class ProjectFileGeneration - 生成された .csproj に対するフック
SolutionFileGeneration - 生成された .sln に対するフック ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) => { // 中略 // 煮るなり焼くなりお好きに return result; };
Project File Generation ProjectFilesGenerator class ProjectFileGeneration - 生成された .csproj に対するフック
SolutionFileGeneration - 生成された .sln に対するフック ProjectFilesGenerator.ProjectFileGeneration += (string name, string content) => { // 中略 // 煮るなり焼くなりお好きに return result; }; 対象ファイル名 例: "UnityVS.SampleProject1.CSharp.Editor.csproj" 生成されたファイルの中身 .csproj の場合は XML がずらずらと… 好きに加工して、文字列で返す
Boo.Lang への参照を削除 LINQ to XML を使う 本題から外れるので特に解説はしません :) static string
KillBooLang(string filename, string content) { var document = XDocument.Parse(content); document.Root .Descendants() .Where(x => x.Name.LocalName == "Reference") .Where(x => (string)x.Attribute("Include") == "Boo.Lang") .Remove(); return document.Declaration + Environment.NewLine + document.Root; }
Boo.Lang への参照を削除 LINQ to XML を使う 本題から外れるので特に解説はしません :) static string
KillBooLang(string filename, string content) { var document = XDocument.Parse(content); document.Root .Descendants() .Where(x => x.Name.LocalName == "Reference") .Where(x => (string)x.Attribute("Include") == "Boo.Lang") .Remove(); return document.Declaration + Environment.NewLine + document.Root; } … <ItemGroup> <Reference Include="mscorlib" /> <Reference Include="System" /> <Reference Include="System.XML" /> <Reference Include="System.Core" /> <Reference Include="Boo.Lang" /> <Reference Include="UnityScript.Lang" /> <Reference Include="UnityEngine"> … 要は、この行を削除 すればいいのです
Notice イベントを購読しているように見える 特に公式サンプルが… http://unityvs.com/documentation/api/project-file-generation/ Project(Solution)FileGeneration はただのデリゲート (まあ文字列返してる時点で気付けという話ではあるけども) 例えば次の場合 ProjectFilesGenerator.ProjectFileGeneration +=
Hook1; ProjectFilesGenerator.ProjectFileGeneration += Hook2; ProjectFilesGenerator.ProjectFileGeneration += Hook3; ProjectFilesGenerator.ProjectFileGeneration += Hook4;
Notice イベントを購読しているように見える 特に公式サンプルが… http://unityvs.com/documentation/api/project-file-generation/ Project(Solution)FileGeneration はただのデリゲート (まあ文字列返してる時点で気付けという話ではあるけども) 例えば次の場合 ProjectFilesGenerator.ProjectFileGeneration +=
Hook1; ProjectFilesGenerator.ProjectFileGeneration += Hook2; ProjectFilesGenerator.ProjectFileGeneration += Hook3; ProjectFilesGenerator.ProjectFileGeneration += Hook4; 有効なのは最後の 1 回だけ それ以前の 3 回は、呼び出されはする ものの、結果は無視される
Conclusion Project File Generation VSTU による .csproj / .sln 生成処理はフックできる
LINQ to XML で XML を加工して返してあげよう 例として Boo.Lang への参照を削除してみた T4 Template (.tt file) を取り込んだり、#define 定義したり? 快適な C# + Visual Studio ライフを!