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
280
WPF Digital Ink
grabacr07
0
38k
Modern WPF
grabacr07
0
34k
Other Decks in Technology
See All in Technology
モダンな現場と従来型の組織——そこに生じる "不整合" を解消してこそチームがパフォーマンスを発揮できる / Team-oriented Organization Design 20250825
mtx2s
3
350
AIと描く、未来のBacklog 〜プロジェクト管理の次の10年を想像し、創造するセッション〜
hrm_o25
0
120
ZOZOTOWNフロントエンドにおけるディレクトリの分割戦略
zozotech
PRO
4
450
プロダクトエンジニアリングで開発の楽しさを拡張する話
barometrica
0
220
Amazon S3 Vectorsは大規模ベクトル検索を低コスト化するサーバーレスなベクトルデータベースだ #jawsugsaga / S3 Vectors As A Serverless Vector Database
quiver
2
1.1k
AWSの最新サービスでAIエージェント構築に楽しく入門しよう
minorun365
PRO
10
570
フルカイテン株式会社 エンジニア向け採用資料
fullkaiten
0
8.5k
Devinを使ったモバイルアプリ開発 / Mobile app development with Devin
yanzm
0
130
MySQL HeatWave:サービス概要のご紹介
oracle4engineer
PRO
4
1.6k
[kickflow]20250319_少人数チームでのAutify活用
otouhujej
0
200
あなたの知らない OneDrive
murachiakira
0
210
20250818_KGX・One Hokkaidoコラボイベント
tohgeyukihiro
0
130
Featured
See All Featured
Testing 201, or: Great Expectations
jmmastey
45
7.6k
A Modern Web Designer's Workflow
chriscoyier
695
190k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
29
1.8k
A designer walks into a library…
pauljervisheath
207
24k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
50k
[Rails World 2023 - Day 1 Closing Keynote] - The Magic of Rails
eileencodes
36
2.5k
Keith and Marios Guide to Fast Websites
keithpitt
411
22k
Visualization
eitanlees
146
16k
Building a Modern Day E-commerce SEO Strategy
aleyda
43
7.5k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
1k
Fireside Chat
paigeccino
39
3.6k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
18
1.1k
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 ライフを!