├── tools
└── nuget.exe
├── serialization
└── Feature.Maps
│ ├── Roles
│ └── modules
│ │ └── Feature Maps Admin.yml
│ ├── FieldTypes
│ ├── Maps.yml
│ └── Maps
│ │ ├── Map Field
│ │ ├── Menu.yml
│ │ └── Menu
│ │ │ ├── Clear Location.yml
│ │ │ └── Set Location.yml
│ │ └── Map Field.yml
│ ├── Media
│ └── Maps.yml
│ ├── Renderings
│ ├── Maps.yml
│ └── Maps
│ │ └── Map.yml
│ ├── Settings
│ ├── Maps
│ │ ├── Map Types
│ │ │ ├── hybrid.yml
│ │ │ ├── roadmap.yml
│ │ │ ├── terrain.yml
│ │ │ └── satellite.yml
│ │ └── Map Types.yml
│ └── Maps.yml
│ └── Templates
│ ├── Maps
│ ├── Map Type
│ │ ├── __Standard Values.yml
│ │ ├── Map Type.yml
│ │ └── Map Type
│ │ │ └── Name.yml
│ ├── _MapPoint.yml
│ ├── _MapRenderingParameters.yml
│ ├── _MapPoint
│ │ ├── Map Point.yml
│ │ └── Map Point
│ │ │ ├── MapPointLocation.yml
│ │ │ ├── MapPointName.yml
│ │ │ └── MapPointAddress.yml
│ ├── _MapRenderingParameters
│ │ ├── Map Rendering Parameters.yml
│ │ ├── Map Rendering Parameters
│ │ │ ├── ZoomLevel.yml
│ │ │ ├── CenterLocation.yml
│ │ │ ├── EnableScaleControl.yml
│ │ │ ├── EnableZoomControl.yml
│ │ │ ├── EnableMapTypeControl.yml
│ │ │ ├── EnableRotateControl.yml
│ │ │ ├── EnableStreetViewControl.yml
│ │ │ ├── EnableCenterMapControl.yml
│ │ │ └── MapType.yml
│ │ └── __Standard Values.yml
│ ├── _MapPoints Folder.yml
│ └── Map Type.yml
│ └── Maps.yml
├── NuGet.config
├── src
├── RainbowCodeGeneration
│ ├── packages.config
│ ├── Models
│ │ └── Template.cs
│ ├── IItemDataExtensions.cs
│ ├── Rainbow
│ │ └── TreeRootFactory.cs
│ ├── RainbowCodeGeneration.nuspec
│ ├── Properties
│ │ └── AssemblyInfo.cs
│ ├── RainbowReader.cs
│ ├── RainbowCodeGeneration.csproj
│ ├── SitecoreTemplates.tt.pp
│ ├── Inflector.cs
│ └── StringExtensions.cs
└── RainbowCodeGeneration.Test
│ ├── app.config
│ ├── Properties
│ └── AssemblyInfo.cs
│ ├── packages.config
│ ├── SitecoreKnownItems.cs
│ ├── SitecoreKnownItems.tt
│ ├── SitecoreTemplates.tt
│ ├── RainbowCodeGeneration.Test.csproj
│ └── SitecoreTemplates.cs
├── license.txt
├── UnicornCodeGeneration.sln
├── .gitattributes
├── .gitignore
└── README.md
/tools/nuget.exe:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/heikof/RainbowCodeGeneration/HEAD/tools/nuget.exe
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Roles/modules/Feature Maps Admin.yml:
--------------------------------------------------------------------------------
1 | ---
2 | Role: |
3 | modules\Feature Maps Admin
4 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/FieldTypes/Maps.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "90eca743-f108-4883-9f24-85a237582f7f"
3 | Parent: "76e6d8c7-1f93-4712-872b-da3c96b808f2"
4 | Template: "a87a00b1-e6db-45ab-8b54-636fec3b5523"
5 | Path: /sitecore/system/Field types/Maps
6 | DB: core
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151211T055224Z
15 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/FieldTypes/Maps/Map Field/Menu.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "af7c93d2-2fbb-4385-9112-0ea61d5e45d6"
3 | Parent: "a19e84af-dfa5-4f63-85ce-4c326f6e3e9b"
4 | Template: "a87a00b1-e6db-45ab-8b54-636fec3b5523"
5 | Path: /sitecore/system/Field types/Maps/Map Field/Menu
6 | DB: core
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151211T070609Z
15 |
--------------------------------------------------------------------------------
/NuGet.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/Models/Template.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Rainbow.Model;
3 |
4 | namespace RainbowCodeGeneration.Models
5 | {
6 | public class Template
7 | {
8 | public IItemData Item { get; private set; }
9 | public IEnumerable Fields { get; private set; }
10 |
11 |
12 | public Template(IItemData item, IEnumerable fields)
13 | {
14 | this.Item = item;
15 | this.Fields = fields;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/IItemDataExtensions.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using Rainbow.Model;
3 |
4 | namespace RainbowCodeGeneration
5 | {
6 | public static class ItemDataExtensions
7 | {
8 | public static string GetSharedField(this IItemData item, string fieldName)
9 | {
10 | if (item == null || !item.SharedFields.Any())
11 | return string.Empty;
12 | return item.SharedFields.FirstOrDefault(f => f.NameHint == fieldName)?.Value ?? string.Empty;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Media/Maps.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "af1ffed1-2d18-4950-b25c-92482f86c1a4"
3 | Parent: "4e5e3bfb-c253-4764-9f60-309172f9f592"
4 | Template: "fe5dd826-48c6-436d-b87a-7c4210c7413b"
5 | Path: /sitecore/media library/Feature/Maps
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20160620T132449Z
15 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
16 | Hint: __Created by
17 | Value: |
18 | sitecore\admin
19 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Renderings/Maps.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "02eda08e-78e1-409c-9655-a2f43abe09f3"
3 | Parent: "da61ad50-8fdb-4252-a68f-b4470b1c9fe8"
4 | Template: "a87a00b1-e6db-45ab-8b54-636fec3b5523"
5 | Path: /sitecore/layout/Renderings/Feature/Maps
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151203T082037Z
15 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
16 | Hint: __Created by
17 | Value: |
18 | sitecore\admin
19 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Settings/Maps/Map Types/hybrid.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "bb3472c7-e61e-4ed2-9b25-25b1e02f73aa"
3 | Parent: "07674169-6ecb-4534-9d90-f2bb2feb2bfa"
4 | Template: "04c34cf5-b7ea-4408-88e8-5fc851173dbd"
5 | Path: /sitecore/system/Settings/Feature/Maps/Map Types/hybrid
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151214T093324Z
15 | - ID: "4a724065-e4ca-4cdd-9027-f56ceef1b082"
16 | Hint: Name
17 | Value: hybrid
18 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Settings/Maps/Map Types/roadmap.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "d9ed37c4-b27d-4353-863f-3b3683a14fd5"
3 | Parent: "07674169-6ecb-4534-9d90-f2bb2feb2bfa"
4 | Template: "04c34cf5-b7ea-4408-88e8-5fc851173dbd"
5 | Path: /sitecore/system/Settings/Feature/Maps/Map Types/roadmap
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151214T093336Z
15 | - ID: "4a724065-e4ca-4cdd-9027-f56ceef1b082"
16 | Hint: Name
17 | Value: roadmap
18 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Settings/Maps/Map Types/terrain.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "c6bd7927-a5f1-40a6-806a-81ec543ef2e1"
3 | Parent: "07674169-6ecb-4534-9d90-f2bb2feb2bfa"
4 | Template: "04c34cf5-b7ea-4408-88e8-5fc851173dbd"
5 | Path: /sitecore/system/Settings/Feature/Maps/Map Types/terrain
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151214T093346Z
15 | - ID: "4a724065-e4ca-4cdd-9027-f56ceef1b082"
16 | Hint: Name
17 | Value: terrain
18 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Settings/Maps/Map Types/satellite.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "220acbad-f147-4ea0-9ae7-079f84c6fd89"
3 | Parent: "07674169-6ecb-4534-9d90-f2bb2feb2bfa"
4 | Template: "04c34cf5-b7ea-4408-88e8-5fc851173dbd"
5 | Path: /sitecore/system/Settings/Feature/Maps/Map Types/satellite
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151214T093341Z
15 | - ID: "4a724065-e4ca-4cdd-9027-f56ceef1b082"
16 | Hint: Name
17 | Value: satellite
18 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Settings/Maps.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "933308ac-1959-4515-bb18-c4cf011f2d9d"
3 | Parent: "256655ec-8f3a-45b5-ad90-b63bc25b8067"
4 | Template: "a87a00b1-e6db-45ab-8b54-636fec3b5523"
5 | Path: /sitecore/system/Settings/Feature/Maps
6 | DB: master
7 | SharedFields:
8 | - ID: "06d5295c-ed2f-4a54-9bf2-26228d113318"
9 | Hint: __Icon
10 | Value: apps/32x32/map.png
11 | Languages:
12 | - Language: en
13 | Versions:
14 | - Version: 1
15 | Fields:
16 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
17 | Hint: __Created
18 | Value: 20151214T092626Z
19 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
20 | Hint: __Created by
21 | Value: |
22 | sitecore\admin
23 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/Map Type/__Standard Values.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "fb9a9d95-ec81-4ada-85ba-00be5de0fba9"
3 | Parent: "04c34cf5-b7ea-4408-88e8-5fc851173dbd"
4 | Template: "04c34cf5-b7ea-4408-88e8-5fc851173dbd"
5 | Path: /sitecore/templates/Feature/Maps/Map Type/__Standard Values
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151214T093145Z
15 | - ID: "4a724065-e4ca-4cdd-9027-f56ceef1b082"
16 | Hint: Name
17 | Value: $name
18 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
19 | Hint: __Created by
20 | Value: |
21 | sitecore\admin
22 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration.Test/app.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/Rainbow/TreeRootFactory.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Rainbow.Storage;
3 |
4 | namespace RainbowCodeGeneration.Rainbow
5 | {
6 | class TreeRootFactory : ITreeRootFactory
7 | {
8 | private readonly string _name;
9 | private readonly string _path;
10 | private readonly string _databaseName;
11 |
12 | public TreeRootFactory(string name, string path, string databaseName)
13 | {
14 | _name = name;
15 | _path = path;
16 | _databaseName = databaseName;
17 | }
18 |
19 | public IEnumerable CreateTreeRoots()
20 | {
21 | yield return new TreeRoot(_name, _path, _databaseName);
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Settings/Maps/Map Types.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "07674169-6ecb-4534-9d90-f2bb2feb2bfa"
3 | Parent: "933308ac-1959-4515-bb18-c4cf011f2d9d"
4 | Template: "a87a00b1-e6db-45ab-8b54-636fec3b5523"
5 | Path: /sitecore/system/Settings/Feature/Maps/Map Types
6 | DB: master
7 | SharedFields:
8 | - ID: "1172f251-dad4-4efb-a329-0c63500e4f1e"
9 | Hint: __Masters
10 | Type: TreelistEx
11 | Value: "{04C34CF5-B7EA-4408-88E8-5FC851173DBD}"
12 | Languages:
13 | - Language: en
14 | Versions:
15 | - Version: 1
16 | Fields:
17 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
18 | Hint: __Created
19 | Value: 20151214T092658Z
20 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
21 | Hint: __Created by
22 | Value: |
23 | sitecore\admin
24 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/FieldTypes/Maps/Map Field/Menu/Clear Location.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "37435a81-a160-4b7f-9c4b-3ee12bcf1fb5"
3 | Parent: "af7c93d2-2fbb-4385-9112-0ea61d5e45d6"
4 | Template: "998b965e-6ab8-4568-810f-8101d60d0cc3"
5 | Path: /sitecore/system/Field types/Maps/Map Field/Menu/Clear Location
6 | DB: core
7 | SharedFields:
8 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
9 | Hint: __Sortorder
10 | Value: 0
11 | - ID: "cab694fc-e37c-44eb-9012-488b775cf638"
12 | Hint: Message
13 | Value: "map:clearLocation(id=$Target)"
14 | Languages:
15 | - Language: en
16 | Fields:
17 | - ID: "9b72a62b-2775-423d-b17a-ec34a9f31af8"
18 | Hint: Display name
19 | Value: Clear
20 | Versions:
21 | - Version: 1
22 | Fields:
23 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
24 | Hint: __Created
25 | Value: 20151211T070700Z
26 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/FieldTypes/Maps/Map Field/Menu/Set Location.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "e9ca92bb-a76d-4258-9bc9-d7f1802182e7"
3 | Parent: "af7c93d2-2fbb-4385-9112-0ea61d5e45d6"
4 | Template: "998b965e-6ab8-4568-810f-8101d60d0cc3"
5 | Path: /sitecore/system/Field types/Maps/Map Field/Menu/Set Location
6 | DB: core
7 | SharedFields:
8 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
9 | Hint: __Sortorder
10 | Value: "-100"
11 | - ID: "cab694fc-e37c-44eb-9012-488b775cf638"
12 | Hint: Message
13 | Value: "map:setLocation(id=$Target)"
14 | Languages:
15 | - Language: en
16 | Fields:
17 | - ID: "9b72a62b-2775-423d-b17a-ec34a9f31af8"
18 | Hint: Display name
19 | Value: Pick Location
20 | Versions:
21 | - Version: 1
22 | Fields:
23 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
24 | Hint: __Created
25 | Value: 20151211T070700Z
26 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapPoint.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "1e6a8c8c-6646-4776-8ab4-615265669633"
3 | Parent: "b327be93-876a-49c3-9275-422937bca4a3"
4 | Template: "ab86861a-6030-46c5-b394-e8f99e8b87db"
5 | Path: /sitecore/templates/Feature/Maps/_MapPoint
6 | DB: master
7 | SharedFields:
8 | - ID: "06d5295c-ed2f-4a54-9bf2-26228d113318"
9 | Hint: __Icon
10 | Value: Applications/32x32/form_blue.png
11 | - ID: "12c33f3f-86c5-43a5-aeb4-5598cec45116"
12 | Hint: __Base template
13 | Type: tree list
14 | Value: "{1930BBEB-7805-471A-A3BE-4858AC7CF696}"
15 | Languages:
16 | - Language: en
17 | Versions:
18 | - Version: 1
19 | Fields:
20 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
21 | Hint: __Created
22 | Value: 20151203T130812Z
23 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
24 | Hint: __Created by
25 | Value: |
26 | sitecore\admin
27 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/FieldTypes/Maps/Map Field.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "a19e84af-dfa5-4f63-85ce-4c326f6e3e9b"
3 | Parent: "90eca743-f108-4883-9f24-85a237582f7f"
4 | Template: "f8a17d6a-118e-4cd7-b5f5-88ff37a4f237"
5 | Path: /sitecore/system/Field types/Maps/Map Field
6 | DB: core
7 | SharedFields:
8 | - ID: "06d5295c-ed2f-4a54-9bf2-26228d113318"
9 | Hint: __Icon
10 | Value: Control/32x32/edit.png
11 | - ID: "6bf5ed07-bc70-42f4-bb77-c017d340950e"
12 | Hint: Assembly
13 | Value: Sitecore.Feature.Maps
14 | - ID: "9fe6154a-a16e-4827-99f6-f51533c34ec8"
15 | Hint: Class
16 | Value: Sitecore.Feature.Maps.Sitecore.shell.Applications.ContentEditor.FieldTypes.MapField
17 | Languages:
18 | - Language: en
19 | Versions:
20 | - Version: 1
21 | Fields:
22 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
23 | Hint: __Created
24 | Value: 20151211T055314Z
25 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
26 | Hint: __Created by
27 | Value: |
28 | sitecore\admin
29 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "b327be93-876a-49c3-9275-422937bca4a3"
3 | Parent: "8f343079-3cc5-4ef7-bc27-32addb46f45e"
4 | Template: "0437fee2-44c9-46a6-abe9-28858d9fee8c"
5 | Path: /sitecore/templates/Feature/Maps
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151203T130756Z
15 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
16 | Hint: __Created by
17 | Value: |
18 | sitecore\admin
19 | - Language: "ja-JP"
20 | Fields:
21 | - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb"
22 | Hint: __Display name
23 | Value: 地図
24 | Versions:
25 | - Version: 1
26 | Fields:
27 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
28 | Hint: __Created
29 | Value: 20170323T054803Z
30 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
31 | Hint: __Created by
32 | Value: |
33 | sitecore\Admin
34 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "d77856c3-8a5e-452c-8854-f2965edf25e0"
3 | Parent: "b327be93-876a-49c3-9275-422937bca4a3"
4 | Template: "ab86861a-6030-46c5-b394-e8f99e8b87db"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters
6 | DB: master
7 | SharedFields:
8 | - ID: "06d5295c-ed2f-4a54-9bf2-26228d113318"
9 | Hint: __Icon
10 | Value: Applications/32x32/form_blue.png
11 | - ID: "12c33f3f-86c5-43a5-aeb4-5598cec45116"
12 | Hint: __Base template
13 | Type: tree list
14 | Value: "{8CA06D6A-B353-44E8-BC31-B528C7306971}"
15 | - ID: "f7d48a55-2158-4f02-9356-756654404f73"
16 | Hint: __Standard values
17 | Value: "{8DC4EAC1-57C2-45F0-B9AC-0D96CB1707CF}"
18 | Languages:
19 | - Language: en
20 | Versions:
21 | - Version: 1
22 | Fields:
23 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
24 | Hint: __Created
25 | Value: 20151209T141538Z
26 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
27 | Hint: __Created by
28 | Value: |
29 | sitecore\admin
30 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/Map Type/Map Type.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "f2890dd2-04b8-4529-b2c5-90de35136acb"
3 | Parent: "04c34cf5-b7ea-4408-88e8-5fc851173dbd"
4 | Template: "e269fbb5-3750-427a-9149-7aa950b49301"
5 | Path: /sitecore/templates/Feature/Maps/Map Type/Map Type
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151214T093140Z
15 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
16 | Hint: __Created by
17 | Value: |
18 | sitecore\admin
19 | - Language: "ja-JP"
20 | Fields:
21 | - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb"
22 | Hint: __Display name
23 | Value: 地図の形式
24 | Versions:
25 | - Version: 1
26 | Fields:
27 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
28 | Hint: __Created
29 | Value: 20170323T054803Z
30 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
31 | Hint: __Created by
32 | Value: |
33 | sitecore\Admin
34 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapPoint/Map Point.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "9bd240d2-a645-4e05-9412-5905729cfa51"
3 | Parent: "1e6a8c8c-6646-4776-8ab4-615265669633"
4 | Template: "e269fbb5-3750-427a-9149-7aa950b49301"
5 | Path: /sitecore/templates/Feature/Maps/_MapPoint/Map Point
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151203T130847Z
15 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
16 | Hint: __Created by
17 | Value: |
18 | sitecore\admin
19 | - Language: "ja-JP"
20 | Fields:
21 | - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb"
22 | Hint: __Display name
23 | Value: 地図の地点
24 | Versions:
25 | - Version: 1
26 | Fields:
27 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
28 | Hint: __Created
29 | Value: 20170323T054804Z
30 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
31 | Hint: __Created by
32 | Value: |
33 | sitecore\Admin
34 |
--------------------------------------------------------------------------------
/license.txt:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 | Copyright (c) 2016-2017 Heiko Franz
3 |
4 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
5 |
6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
7 |
8 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "55d248e4-6f66-4c00-9653-beceae53e8b7"
3 | Parent: "d77856c3-8a5e-452c-8854-f2965edf25e0"
4 | Template: "e269fbb5-3750-427a-9149-7aa950b49301"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters
6 | DB: master
7 | Languages:
8 | - Language: en
9 | Versions:
10 | - Version: 1
11 | Fields:
12 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
13 | Hint: __Created
14 | Value: 20151209T141628Z
15 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
16 | Hint: __Created by
17 | Value: |
18 | sitecore\admin
19 | - Language: "ja-JP"
20 | Fields:
21 | - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb"
22 | Hint: __Display name
23 | Value: 地図表示 パラメータ
24 | Versions:
25 | - Version: 1
26 | Fields:
27 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
28 | Hint: __Created
29 | Value: 20170323T054805Z
30 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
31 | Hint: __Created by
32 | Value: |
33 | sitecore\Admin
34 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/ZoomLevel.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "405a9441-2f1c-4278-a3dd-3d9f818227be"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/ZoomLevel
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: "Single-Line Text"
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 300
14 | Languages:
15 | - Language: en
16 | Versions:
17 | - Version: 1
18 | Fields:
19 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
20 | Hint: __Created
21 | Value: 20151209T152539Z
22 | - Language: "ja-JP"
23 | Fields:
24 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
25 | Hint: Title
26 | Value: 縮尺レベル
27 | Versions:
28 | - Version: 1
29 | Fields:
30 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
31 | Hint: __Created
32 | Value: 20170323T054805Z
33 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
34 | Hint: __Created by
35 | Value: |
36 | sitecore\Admin
37 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/CenterLocation.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "3016477a-1dac-460c-a3e2-0e8834e685bd"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/CenterLocation
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: "Single-Line Text"
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 100
14 | Languages:
15 | - Language: en
16 | Versions:
17 | - Version: 1
18 | Fields:
19 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
20 | Hint: __Created
21 | Value: 20151209T141628Z
22 | - Language: "ja-JP"
23 | Fields:
24 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
25 | Hint: Title
26 | Value: 中央の地点
27 | Versions:
28 | - Version: 1
29 | Fields:
30 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
31 | Hint: __Created
32 | Value: 20170323T054805Z
33 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
34 | Hint: __Created by
35 | Value: |
36 | sitecore\Admin
37 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableScaleControl.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "92514b1f-0f21-4a91-af7f-852e283e1019"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableScaleControl
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: Checkbox
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 700
14 | Languages:
15 | - Language: en
16 | Versions:
17 | - Version: 1
18 | Fields:
19 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
20 | Hint: __Created
21 | Value: 20151214T084952Z
22 | - Language: "ja-JP"
23 | Fields:
24 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
25 | Hint: Title
26 | Value: 縮尺コントロールの有効
27 | Versions:
28 | - Version: 1
29 | Fields:
30 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
31 | Hint: __Created
32 | Value: 20170323T054807Z
33 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
34 | Hint: __Created by
35 | Value: |
36 | sitecore\Admin
37 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableZoomControl.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "c77614fb-8ef2-4418-a486-6cf014b70f22"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableZoomControl
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: Checkbox
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 500
14 | Languages:
15 | - Language: en
16 | Versions:
17 | - Version: 1
18 | Fields:
19 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
20 | Hint: __Created
21 | Value: 20151214T084952Z
22 | - Language: "ja-JP"
23 | Fields:
24 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
25 | Hint: Title
26 | Value: ズームコントロールの有効
27 | Versions:
28 | - Version: 1
29 | Fields:
30 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
31 | Hint: __Created
32 | Value: 20170323T054806Z
33 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
34 | Hint: __Created by
35 | Value: |
36 | sitecore\Admin
37 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapPoints Folder.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "31713995-c6bf-4ccb-8807-198493508afa"
3 | Parent: "b327be93-876a-49c3-9275-422937bca4a3"
4 | Template: "ab86861a-6030-46c5-b394-e8f99e8b87db"
5 | Path: /sitecore/templates/Feature/Maps/_MapPoints Folder
6 | DB: master
7 | SharedFields:
8 | - ID: "12c33f3f-86c5-43a5-aeb4-5598cec45116"
9 | Hint: __Base template
10 | Type: tree list
11 | Value: "{1930BBEB-7805-471A-A3BE-4858AC7CF696}"
12 | Languages:
13 | - Language: en
14 | Versions:
15 | - Version: 1
16 | Fields:
17 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
18 | Hint: __Created
19 | Value: 20151204T040014Z
20 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
21 | Hint: __Created by
22 | Value: |
23 | sitecore\admin
24 | - Language: "ja-JP"
25 | Fields:
26 | - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb"
27 | Hint: __Display name
28 | Value:
29 | Versions:
30 | - Version: 1
31 | Fields:
32 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
33 | Hint: __Created
34 | Value: 20170323T054805Z
35 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
36 | Hint: __Created by
37 | Value: |
38 | sitecore\Admin
39 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableMapTypeControl.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "3fdda0ea-96ef-4533-b658-e071a2a8e052"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableMapTypeControl
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: Checkbox
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 600
14 | Languages:
15 | - Language: en
16 | Versions:
17 | - Version: 1
18 | Fields:
19 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
20 | Hint: __Created
21 | Value: 20151214T084952Z
22 | - Language: "ja-JP"
23 | Fields:
24 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
25 | Hint: Title
26 | Value: 地図形式コントロールの有効
27 | Versions:
28 | - Version: 1
29 | Fields:
30 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
31 | Hint: __Created
32 | Value: 20170323T054806Z
33 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
34 | Hint: __Created by
35 | Value: |
36 | sitecore\Admin
37 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableRotateControl.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "fd762e2f-71f8-44ac-ae55-22cdb29cdba2"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableRotateControl
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: Checkbox
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 900
14 | Languages:
15 | - Language: en
16 | Versions:
17 | - Version: 1
18 | Fields:
19 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
20 | Hint: __Created
21 | Value: 20151214T084952Z
22 | - Language: "ja-JP"
23 | Fields:
24 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
25 | Hint: Title
26 | Value: ルートコントロールの有効
27 | Versions:
28 | - Version: 1
29 | Fields:
30 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
31 | Hint: __Created
32 | Value: 20170323T054807Z
33 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
34 | Hint: __Created by
35 | Value: |
36 | sitecore\Admin
37 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableStreetViewControl.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "a7862bd0-2ddc-4745-9a03-31d297c12bcd"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableStreetViewControl
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: Checkbox
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 800
14 | Languages:
15 | - Language: en
16 | Versions:
17 | - Version: 1
18 | Fields:
19 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
20 | Hint: __Created
21 | Value: 20151214T084952Z
22 | - Language: "ja-JP"
23 | Fields:
24 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
25 | Hint: Title
26 | Value: ストリートビューの有効
27 | Versions:
28 | - Version: 1
29 | Fields:
30 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
31 | Hint: __Created
32 | Value: 20170323T054807Z
33 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
34 | Hint: __Created by
35 | Value: |
36 | sitecore\Admin
37 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableCenterMapControl.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "35f8d3e6-887e-4e54-b715-b81459846cbb"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/EnableCenterMapControl
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: Checkbox
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 400
14 | Languages:
15 | - Language: en
16 | Versions:
17 | - Version: 1
18 | Fields:
19 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
20 | Hint: __Created
21 | Value: 20151209T141628Z
22 | - Language: "ja-JP"
23 | Fields:
24 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
25 | Hint: Title
26 | Value: センターマップコントロールの有効
27 | Versions:
28 | - Version: 1
29 | Fields:
30 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
31 | Hint: __Created
32 | Value: 20170323T054805Z
33 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
34 | Hint: __Created by
35 | Value: |
36 | sitecore\Admin
37 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/__Standard Values.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "8dc4eac1-57c2-45f0-b9ac-0d96cb1707cf"
3 | Parent: "d77856c3-8a5e-452c-8854-f2965edf25e0"
4 | Template: "d77856c3-8a5e-452c-8854-f2965edf25e0"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/__Standard Values
6 | DB: master
7 | SharedFields:
8 | - ID: "3094d236-5985-4c4f-ae6a-e30740885532"
9 | Hint: Caching
10 | Value: 0|0|0|0|0|0|0|0
11 | Languages:
12 | - Language: en
13 | Versions:
14 | - Version: 1
15 | Fields:
16 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
17 | Hint: __Created
18 | Value: 20151209T141740Z
19 | - ID: "3016477a-1dac-460c-a3e2-0e8834e685bd"
20 | Hint: CenterLocation
21 | Value: "-5.055576,3.803790"
22 | - ID: "3fdda0ea-96ef-4533-b658-e071a2a8e052"
23 | Hint: EnableMapTypeControl
24 | Type: Checkbox
25 | Value: 1
26 | - ID: "405a9441-2f1c-4278-a3dd-3d9f818227be"
27 | Hint: ZoomLevel
28 | Value: 0
29 | - ID: "90d0bbdc-ea74-4d9a-a570-dafd6edc5f92"
30 | Hint: MapType
31 | Value: roadmap
32 | - ID: "c77614fb-8ef2-4418-a486-6cf014b70f22"
33 | Hint: EnableZoomControl
34 | Type: Checkbox
35 | Value: 1
36 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/RainbowCodeGeneration.nuspec:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | RainbowCodeGeneration
5 | 0.3
6 | RainbowCodeGeneration
7 | Heiko Franz
8 | Heiko Franz
9 | http://opensource.org/licenses/MIT
10 | https://github.com/heikof/RainbowCodeGeneration
11 |
12 | false
13 | Code generation for Unicorn / Rainbow - a serialisation tool for Sitecore
14 | A simple set of utility classes and a sample T4 template that allow easy code generation for Sitecore templates from Rainbow / Unicorn serialized items. Currently, only the YAML serialization format is supported.
15 | Copyright 2016-2017
16 | rainbow unicorn sitecore serialization serialisation codegeneration
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapRenderingParameters/Map Rendering Parameters/MapType.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "90d0bbdc-ea74-4d9a-a570-dafd6edc5f92"
3 | Parent: "55d248e4-6f66-4c00-9653-beceae53e8b7"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters/Map Rendering Parameters/MapType
6 | DB: master
7 | SharedFields:
8 | - ID: "1eb8ae32-e190-44a6-968d-ed904c794ebf"
9 | Hint: Source
10 | Value: "{07674169-6ECB-4534-9D90-F2BB2FEB2BFA}"
11 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
12 | Hint: Type
13 | Value: Droplist
14 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
15 | Hint: __Sortorder
16 | Value: 50
17 | Languages:
18 | - Language: en
19 | Versions:
20 | - Version: 1
21 | Fields:
22 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
23 | Hint: __Created
24 | Value: 20151214T093416Z
25 | - Language: "ja-JP"
26 | Fields:
27 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
28 | Hint: Title
29 | Value: 地図形式
30 | Versions:
31 | - Version: 1
32 | Fields:
33 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
34 | Hint: __Created
35 | Value: 20170323T054805Z
36 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
37 | Hint: __Created by
38 | Value: |
39 | sitecore\Admin
40 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/Map Type/Map Type/Name.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "4a724065-e4ca-4cdd-9027-f56ceef1b082"
3 | Parent: "f2890dd2-04b8-4529-b2c5-90de35136acb"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/Map Type/Map Type/Name
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: "Single-Line Text"
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 100
14 | - ID: "dec8d2d5-e3cf-48b6-a653-8e69e2716641"
15 | Hint: __Security
16 | Value: |
17 | ar|Everyone|pe|+field:read|!*|pd|+field:read|!*|ar|modules\Feature Maps Admin|pe|+field:write|pd|+field:write|
18 | Languages:
19 | - Language: en
20 | Versions:
21 | - Version: 1
22 | Fields:
23 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
24 | Hint: __Created
25 | Value: 20151214T093140Z
26 | - Language: "ja-JP"
27 | Fields:
28 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
29 | Hint: Title
30 | Value: 名前
31 | Versions:
32 | - Version: 1
33 | Fields:
34 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
35 | Hint: __Created
36 | Value: 20170323T054804Z
37 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
38 | Hint: __Created by
39 | Value: |
40 | sitecore\Admin
41 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Renderings/Maps/Map.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "7dfd9396-cb94-4174-9721-9419a2aa68e3"
3 | Parent: "02eda08e-78e1-409c-9655-a2f43abe09f3"
4 | Template: "99f8905d-4a87-4eb8-9f8b-a9bebfb3add6"
5 | Path: /sitecore/layout/Renderings/Feature/Maps/Map
6 | DB: master
7 | SharedFields:
8 | - ID: "4867d192-326a-4aa4-81ef-ea430e224aff"
9 | Hint: Css assets
10 | Value: /styles/maps/maps.min.css
11 | - ID: "51b435bc-f7b9-478a-9c51-52916af96ff5"
12 | Hint: Path
13 | Value: /Views/Maps/Map.cshtml
14 | - ID: "7d24e54f-5c16-4314-90c9-6051aa1a7da1"
15 | Hint: Parameters Template
16 | Value: "{D77856C3-8A5E-452C-8854-F2965EDF25E0}"
17 | - ID: "b5b27af1-25ef-405c-87ce-369b3a004016"
18 | Hint: Datasource Location
19 | Value: "site:mappoints"
20 | - ID: "c7c26117-dbb1-42b2-ab5e-f7223845cca3"
21 | Hint: __Thumbnail
22 | Value: |
23 |
24 | - ID: "e514a1eb-ddba-44f7-8528-82ca2280f778"
25 | Hint: JavaScript assets
26 | Value: |
27 | /scripts/maps/markerclusterer.js
28 | /scripts/maps/maps.js
29 |
30 | - ID: "ef7c5528-7307-4e19-863b-da19eed6a9ed"
31 | Hint: Open Properties after Add
32 | Value: 1
33 | Languages:
34 | - Language: en
35 | Versions:
36 | - Version: 1
37 | Fields:
38 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
39 | Hint: __Created
40 | Value: 20151204T050308Z
41 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/Map Type.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "04c34cf5-b7ea-4408-88e8-5fc851173dbd"
3 | Parent: "b327be93-876a-49c3-9275-422937bca4a3"
4 | Template: "ab86861a-6030-46c5-b394-e8f99e8b87db"
5 | Path: /sitecore/templates/Feature/Maps/Map Type
6 | DB: master
7 | SharedFields:
8 | - ID: "06d5295c-ed2f-4a54-9bf2-26228d113318"
9 | Hint: __Icon
10 | Value: Apps/32x32/Objects.png
11 | - ID: "12c33f3f-86c5-43a5-aeb4-5598cec45116"
12 | Hint: __Base template
13 | Type: tree list
14 | Value: "{1930BBEB-7805-471A-A3BE-4858AC7CF696}"
15 | - ID: "f7d48a55-2158-4f02-9356-756654404f73"
16 | Hint: __Standard values
17 | Value: "{FB9A9D95-EC81-4ADA-85BA-00BE5DE0FBA9}"
18 | Languages:
19 | - Language: en
20 | Versions:
21 | - Version: 1
22 | Fields:
23 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
24 | Hint: __Created
25 | Value: 20151214T093127Z
26 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
27 | Hint: __Created by
28 | Value: |
29 | sitecore\admin
30 | - Language: "ja-JP"
31 | Fields:
32 | - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb"
33 | Hint: __Display name
34 | Value: 地図の形式
35 | Versions:
36 | - Version: 1
37 | Fields:
38 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
39 | Hint: __Created
40 | Value: 20170323T054803Z
41 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
42 | Hint: __Created by
43 | Value: |
44 | sitecore\Admin
45 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapPoint/Map Point/MapPointLocation.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "f686ac8e-1d33-45db-8e1a-1b40cd491e7a"
3 | Parent: "9bd240d2-a645-4e05-9412-5905729cfa51"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapPoint/Map Point/MapPointLocation
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: Map Field
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 500
14 | - ID: "dec8d2d5-e3cf-48b6-a653-8e69e2716641"
15 | Hint: __Security
16 | Value: |
17 | ar|Everyone|pe|+field:read|!*|pd|+field:read|!*|ar|modules\Feature Maps Admin|pe|+field:write|pd|+field:write|
18 | Languages:
19 | - Language: en
20 | Fields:
21 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
22 | Hint: Title
23 | Value: Location
24 | Versions:
25 | - Version: 1
26 | Fields:
27 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
28 | Hint: __Created
29 | Value: 20151211T063930Z
30 | - Language: "ja-JP"
31 | Fields:
32 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
33 | Hint: Title
34 | Value: 場所
35 | Versions:
36 | - Version: 1
37 | Fields:
38 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
39 | Hint: __Created
40 | Value: 20170323T054804Z
41 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
42 | Hint: __Created by
43 | Value: |
44 | sitecore\Admin
45 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapPoint/Map Point/MapPointName.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "f12c22bb-e57d-4fab-96e1-1229e4e7ff0e"
3 | Parent: "9bd240d2-a645-4e05-9412-5905729cfa51"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapPoint/Map Point/MapPointName
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: "Single-Line Text"
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 100
14 | - ID: "dec8d2d5-e3cf-48b6-a653-8e69e2716641"
15 | Hint: __Security
16 | Value: |
17 | ar|Everyone|pe|+field:read|!*|pd|+field:read|!*|ar|modules\Feature Maps Admin|pe|+field:write|pd|+field:write|
18 | Languages:
19 | - Language: en
20 | Fields:
21 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
22 | Hint: Title
23 | Value: Title
24 | Versions:
25 | - Version: 1
26 | Fields:
27 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
28 | Hint: __Created
29 | Value: 20151204T040001Z
30 | - Language: "ja-JP"
31 | Fields:
32 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
33 | Hint: Title
34 | Value: タイトル
35 | Versions:
36 | - Version: 1
37 | Fields:
38 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
39 | Hint: __Created
40 | Value: 20170323T054804Z
41 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
42 | Hint: __Created by
43 | Value: |
44 | sitecore\Admin
45 |
--------------------------------------------------------------------------------
/serialization/Feature.Maps/Templates/Maps/_MapPoint/Map Point/MapPointAddress.yml:
--------------------------------------------------------------------------------
1 | ---
2 | ID: "0295c01d-214c-4c23-afc2-3f0b4e88b643"
3 | Parent: "9bd240d2-a645-4e05-9412-5905729cfa51"
4 | Template: "455a3e98-a627-4b40-8035-e683a0331ac7"
5 | Path: /sitecore/templates/Feature/Maps/_MapPoint/Map Point/MapPointAddress
6 | DB: master
7 | SharedFields:
8 | - ID: "ab162cc0-dc80-4abf-8871-998ee5d7ba32"
9 | Hint: Type
10 | Value: "Multi-Line Text"
11 | - ID: "ba3f86a2-4a1c-4d78-b63d-91c2779c1b5e"
12 | Hint: __Sortorder
13 | Value: 200
14 | - ID: "dec8d2d5-e3cf-48b6-a653-8e69e2716641"
15 | Hint: __Security
16 | Value: |
17 | ar|Everyone|pe|+field:read|!*|pd|+field:read|!*|ar|modules\Feature Maps Admin|pe|+field:write|pd|+field:write|
18 | Languages:
19 | - Language: en
20 | Fields:
21 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
22 | Hint: Title
23 | Value: Address
24 | Versions:
25 | - Version: 1
26 | Fields:
27 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
28 | Hint: __Created
29 | Value: 20151204T040001Z
30 | - Language: "ja-JP"
31 | Fields:
32 | - ID: "19a69332-a23e-4e70-8d16-b2640cb24cc8"
33 | Hint: Title
34 | Value: 住所
35 | Versions:
36 | - Version: 1
37 | Fields:
38 | - ID: "25bed78c-4957-4165-998a-ca1b52f67497"
39 | Hint: __Created
40 | Value: 20170323T054804Z
41 | - ID: "5dd74568-4d4b-44c1-b513-0af5f4cda34f"
42 | Hint: __Created by
43 | Value: |
44 | sitecore\Admin
45 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration.Test/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("RainbowCodeGeneration.Test")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("RainbowCodeGeneration.Test")]
13 | [assembly: AssemblyCopyright("Copyright © 2016")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("a43da3a0-5a7b-49b9-82b6-9f3d3842dad8")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.0.0.0")]
36 | [assembly: AssemblyFileVersion("1.0.0.0")]
37 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("RainbowCodeGeneration")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("RainbowCodeGeneration")]
13 | [assembly: AssemblyCopyright("Copyright © Heiko Franz 2016-2017")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("cdb0bd49-c133-4282-929e-e640ec45ca2d")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("0.3.0.0")]
36 | [assembly: AssemblyFileVersion("0.3.0.0")]
37 |
--------------------------------------------------------------------------------
/UnicornCodeGeneration.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.24720.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RainbowCodeGeneration", "src\RainbowCodeGeneration\RainbowCodeGeneration.csproj", "{CDB0BD49-C133-4282-929E-E640EC45CA2D}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RainbowCodeGeneration.Test", "src\RainbowCodeGeneration.Test\RainbowCodeGeneration.Test.csproj", "{A43DA3A0-5A7B-49B9-82B6-9F3D3842DAD8}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {CDB0BD49-C133-4282-929E-E640EC45CA2D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {CDB0BD49-C133-4282-929E-E640EC45CA2D}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {CDB0BD49-C133-4282-929E-E640EC45CA2D}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {CDB0BD49-C133-4282-929E-E640EC45CA2D}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {A43DA3A0-5A7B-49B9-82B6-9F3D3842DAD8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {A43DA3A0-5A7B-49B9-82B6-9F3D3842DAD8}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {A43DA3A0-5A7B-49B9-82B6-9F3D3842DAD8}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {A43DA3A0-5A7B-49B9-82B6-9F3D3842DAD8}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration.Test/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | ###############################################################################
2 | # Set default behavior to automatically normalize line endings.
3 | ###############################################################################
4 | * text=auto
5 |
6 | ###############################################################################
7 | # Set default behavior for command prompt diff.
8 | #
9 | # This is need for earlier builds of msysgit that does not have it on by
10 | # default for csharp files.
11 | # Note: This is only used by command line
12 | ###############################################################################
13 | #*.cs diff=csharp
14 |
15 | ###############################################################################
16 | # Set the merge driver for project and solution files
17 | #
18 | # Merging from the command prompt will add diff markers to the files if there
19 | # are conflicts (Merging from VS is not affected by the settings below, in VS
20 | # the diff markers are never inserted). Diff markers may cause the following
21 | # file extensions to fail to load in VS. An alternative would be to treat
22 | # these files as binary and thus will always conflict and require user
23 | # intervention with every merge. To do so, just uncomment the entries below
24 | ###############################################################################
25 | #*.sln merge=binary
26 | #*.csproj merge=binary
27 | #*.vbproj merge=binary
28 | #*.vcxproj merge=binary
29 | #*.vcproj merge=binary
30 | #*.dbproj merge=binary
31 | #*.fsproj merge=binary
32 | #*.lsproj merge=binary
33 | #*.wixproj merge=binary
34 | #*.modelproj merge=binary
35 | #*.sqlproj merge=binary
36 | #*.wwaproj merge=binary
37 |
38 | ###############################################################################
39 | # behavior for image files
40 | #
41 | # image files are treated as binary by default.
42 | ###############################################################################
43 | #*.jpg binary
44 | #*.png binary
45 | #*.gif binary
46 |
47 | ###############################################################################
48 | # diff behavior for common document formats
49 | #
50 | # Convert binary document formats to text before diffing them. This feature
51 | # is only available from the command line. Turn it on by uncommenting the
52 | # entries below.
53 | ###############################################################################
54 | #*.doc diff=astextplain
55 | #*.DOC diff=astextplain
56 | #*.docx diff=astextplain
57 | #*.DOCX diff=astextplain
58 | #*.dot diff=astextplain
59 | #*.DOT diff=astextplain
60 | #*.pdf diff=astextplain
61 | #*.PDF diff=astextplain
62 | #*.rtf diff=astextplain
63 | #*.RTF diff=astextplain
64 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration.Test/SitecoreKnownItems.cs:
--------------------------------------------------------------------------------
1 |
2 |
3 | //------------------------------------------------------------------------------
4 | //
5 | // This code was generated based on the Unicorn serialisation items
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | // ReSharper disable InconsistentNaming
12 | namespace RainbowCodeGeneration.Test
13 | {
14 | using global::Sitecore.Data;
15 |
16 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
17 | public struct SitecoreKnownItems
18 | {
19 |
20 | ///
21 | /// Maps
22 | ///
23 | /// Path: /sitecore/layout/Renderings/Feature/Maps
24 | /// ID: 02eda08e-78e1-409c-9655-a2f43abe09f3
25 | ///
26 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
27 | public struct Maps
28 | {
29 | ///
30 | /// The ID for /sitecore/layout/Renderings/Feature/Maps
31 | ///
32 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
33 | public static ID Id = new ID("{02eda08e-78e1-409c-9655-a2f43abe09f3}");
34 |
35 | ///
36 | /// The TemplateId string for /sitecore/layout/Renderings/Feature/Maps
37 | ///
38 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
39 | public const string TemplateId = "a87a00b1-e6db-45ab-8b54-636fec3b5523";
40 |
41 | ///
42 | /// Map
43 | ///
44 | /// Path: /sitecore/layout/Renderings/Feature/Maps/Map
45 | /// ID: 7dfd9396-cb94-4174-9721-9419a2aa68e3
46 | ///
47 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
48 | public struct Map
49 | {
50 | ///
51 | /// The ID for /sitecore/layout/Renderings/Feature/Maps/Map
52 | ///
53 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
54 | public static ID Id = new ID("{7dfd9396-cb94-4174-9721-9419a2aa68e3}");
55 |
56 | ///
57 | /// The TemplateId string for /sitecore/layout/Renderings/Feature/Maps/Map
58 | ///
59 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
60 | public const string TemplateId = "99f8905d-4a87-4eb8-9f8b-a9bebfb3add6";
61 |
62 | }
63 | }
64 |
65 | }
66 | }
67 |
68 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/RainbowReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using Rainbow.Model;
5 | using Rainbow.Storage;
6 | using Rainbow.Storage.Yaml;
7 | using RainbowCodeGeneration.Models;
8 | using RainbowCodeGeneration.Rainbow;
9 |
10 | namespace RainbowCodeGeneration
11 | {
12 | public static class RainbowReader
13 | {
14 | private static readonly Guid TemplateGuid = new Guid("{AB86861A-6030-46C5-B394-E8F99E8B87DB}");
15 | private const string MasterDb = "master";
16 |
17 | public static IEnumerable GetTemplates(string physicalRootPath, string treeName, string treePath)
18 | {
19 | if (treeName == "YOUR FEATURE NAME HERE" && treePath == "/sitecore/templates/YOUR TEMPLATE PATH HERE")
20 | return Enumerable.Empty(); // don't act on unconfigured T4 template (to avoid exception on installation)
21 | var ds = GetSystemDataStore(physicalRootPath, treeName, treePath);
22 | var templates = ds.GetMetadataByTemplateId(TemplateGuid, MasterDb);
23 |
24 | return templates.Select(tempalte => ds.GetById(tempalte.Id, MasterDb))
25 | .Select(item => new Template(item, GetTemplateFields(item)));
26 | }
27 |
28 |
29 | public static IEnumerable GetItems(string physicalRootPath, string treeName, string treePath)
30 | {
31 | // don't act on unconfigured T4 template (to avoid exception on installation)
32 | if (string.IsNullOrWhiteSpace(treeName) || string.IsNullOrWhiteSpace(treePath))
33 | return Enumerable.Empty();
34 |
35 | var ds = GetSystemDataStore(physicalRootPath, treeName, treePath);
36 | return ds.GetByPath(treePath, MasterDb);
37 | }
38 |
39 | private static SerializationFileSystemDataStore GetSystemDataStore(string physicalRootPath, string treeName, string treePath)
40 | {
41 | if (!System.IO.Directory.Exists(physicalRootPath))
42 | throw new InvalidOperationException($"Could not find the root path {physicalRootPath}");
43 | if (!System.IO.Directory.Exists($"{physicalRootPath}\\{treeName}"))
44 | throw new InvalidOperationException(
45 | $"Could not find the tree with path {physicalRootPath}\\{treeName}");
46 |
47 | return new SerializationFileSystemDataStore(physicalRootPath, false,
48 | new TreeRootFactory(treeName, treePath, MasterDb),
49 | new YamlSerializationFormatter(null, null));
50 | }
51 |
52 | private static IEnumerable GetTemplateFields(IItemData template)
53 | {
54 | return template.GetChildren().SelectMany(templateSection => templateSection.GetChildren());
55 | }
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration.Test/SitecoreKnownItems.tt:
--------------------------------------------------------------------------------
1 | <#@ template debug="false" hostspecific="true" language="C#" #>
2 | <#@ output extension=".cs" #>
3 | <#@ assembly name="System.Core" #>
4 | <# // NOTE - Reference your NuGet packages for Rainbow and RainbowCodeGeneration here #>
5 | <#@ assembly name="$(SolutionDir)packages\Rainbow.Core.2.0.0\lib\net452\Rainbow.dll" #>
6 | <#@ assembly name="$(SolutionDir)packages\Rainbow.Storage.Yaml.2.0.0\lib\net452\Rainbow.Storage.Yaml.dll" #>
7 | <#@ assembly name="$(SolutionDir)src\RainbowCodeGeneration\bin\debug\RainbowCodeGeneration.dll" #>
8 | <# // NOTE - Reference your Sitecore.Kernel.dll and Sitecore.Logging.dll here #>
9 | <#@ assembly name="$(SolutionDir)packages\Sitecore.Kernel.NoReferences.9.0.171002\lib\net462\Sitecore.Kernel.dll" #>
10 | <#@ assembly name="$(SolutionDir)packages\Sitecore.Logging.NoReferences.9.0.171002\lib\net462\Sitecore.Logging.dll" #>
11 | <#@ assembly name="$(SolutionDir)packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.0.0\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" #>
12 | <#@ assembly name="$(SolutionDir)packages\Microsoft.Extensions.DependencyInjection.1.0.0\lib\netstandard1.1\Microsoft.Extensions.DependencyInjection.dll" #>
13 | <#
14 | // CONFIGURATION
15 | var physicalFileStore = @"..\..\serialization"; // the path to your serialisation items
16 | var treeName = "Feature.Maps\\Renderings"; // the name of the configuration you want to code-generate
17 | var treePath = "/sitecore/layout/Renderings/Feature/Maps"; // the matching path in Sitecore for the configuration
18 |
19 | var Tool = "RainbowCodeGeneration";
20 | var ToolVersion = "1.0";
21 | var items = RainbowCodeGeneration.RainbowReader.GetItems(Host.ResolvePath(physicalFileStore), treeName, treePath);
22 | #>
23 |
24 | <#
25 | Action RenderItemsRecursively = null; // null to avoid compile-time error
26 | RenderItemsRecursively = delegate(Rainbow.Model.IItemData item)
27 | {
28 | #>
29 | ///
30 | /// <#= item.Name #>
31 | /// <#= item.GetSharedField("__Short description") #>
32 | /// Path: <#= item.Path #>
33 | /// ID: <#= item.Id #>
34 | ///
35 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
36 | public struct <#= StringExtensions.AsClassName(item.Name) #>
37 | {
38 | ///
39 | /// The ID for <#= item.Path #>
40 | ///
41 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
42 | public static ID Id = new ID("{<#= item.Id #>}");
43 |
44 | ///
45 | /// The TemplateId string for <#= item.Path #>
46 | ///
47 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
48 | public const string TemplateId = "<#= item.TemplateId #>";
49 |
50 | <# foreach (var children in item.GetChildren()) {
51 | RenderItemsRecursively(children);
52 | }
53 | #>
54 | }
55 | <#
56 | };
57 | #>
58 |
59 | <#@ import namespace="RainbowCodeGeneration" #>
60 | //------------------------------------------------------------------------------
61 | //
62 | // This code was generated based on the Unicorn serialisation items
63 | //
64 | // Changes to this file may cause incorrect behavior and will be lost if
65 | // the code is regenerated.
66 | //
67 | //------------------------------------------------------------------------------
68 | // ReSharper disable InconsistentNaming
69 | namespace RainbowCodeGeneration.Test
70 | {
71 | using global::Sitecore.Data;
72 |
73 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
74 | public struct SitecoreKnownItems
75 | {
76 | <# foreach (var item in items) { #>
77 |
78 | <# RenderItemsRecursively(item); #>
79 |
80 | <# } // foreach item #>
81 | }
82 | }
83 |
84 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration.Test/SitecoreTemplates.tt:
--------------------------------------------------------------------------------
1 | <#@ template debug="false" hostspecific="true" language="C#" #>
2 | <#@ output extension=".cs" #>
3 | <#@ assembly name="System.Core" #>
4 | <# // NOTE - Reference your NuGet packages for Rainbow and RainbowCodeGeneration here #>
5 | <#@ assembly name="$(SolutionDir)packages\Rainbow.Core.2.0.0\lib\net452\Rainbow.dll" #>
6 | <#@ assembly name="$(SolutionDir)packages\Rainbow.Storage.Yaml.2.0.0\lib\net452\Rainbow.Storage.Yaml.dll" #>
7 | <#@ assembly name="$(SolutionDir)src\RainbowCodeGeneration\bin\debug\RainbowCodeGeneration.dll" #>
8 | <# // NOTE - Reference your Sitecore.Kernel.dll and Sitecore.Logging.dll here #>
9 | <#@ assembly name="$(SolutionDir)packages\Sitecore.Kernel.NoReferences.9.0.171002\lib\net462\Sitecore.Kernel.dll" #>
10 | <#@ assembly name="$(SolutionDir)packages\Sitecore.Logging.NoReferences.9.0.171002\lib\net462\Sitecore.Logging.dll" #>
11 | <#@ assembly name="$(SolutionDir)packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.0.0\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" #>
12 | <#@ assembly name="$(SolutionDir)packages\Microsoft.Extensions.DependencyInjection.1.0.0\lib\netstandard1.1\Microsoft.Extensions.DependencyInjection.dll" #>
13 | <#
14 | // CONFIGURATION
15 | var physicalFileStore = @"..\..\serialization"; // the path to your serialisation items
16 | var treeName = "Feature.Maps\\Templates"; // the name of the configuration you want to code-generate
17 | var treePath = "/sitecore/templates/Feature/Maps"; // the matching path in Sitecore for the configuration
18 |
19 | var Tool = "RainbowCodeGeneration";
20 | var ToolVersion = "1.0";
21 | var templates = RainbowCodeGeneration.RainbowReader.GetTemplates(Host.ResolvePath(physicalFileStore), treeName, treePath);
22 | #>
23 | <#@ import namespace="RainbowCodeGeneration" #>
24 | //------------------------------------------------------------------------------
25 | //
26 | // This code was generated based on the Unicorn serialisation items
27 | //
28 | // Changes to this file may cause incorrect behavior and will be lost if
29 | // the code is regenerated.
30 | //
31 | //------------------------------------------------------------------------------
32 | // ReSharper disable InconsistentNaming
33 | namespace RainbowCodeGeneration.Test
34 | {
35 | using global::Sitecore.Data;
36 |
37 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
38 | public struct SitecoreTemplates
39 | {
40 | <# foreach (var template in templates) { #>
41 |
42 | ///
43 | /// <#= template.Item.Name #>
44 | /// <#= template.Item.GetSharedField("__Short description") #>
45 | /// Path: <#= template.Item.Path #>
46 | /// ID: <#= template.Item.Id #>
47 | ///
48 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
49 | public struct <#= StringExtensions.AsClassName(template.Item.Name) #>
50 | {
51 | ///
52 | /// The ID for <#= template.Item.Path #>
53 | ///
54 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
55 | public static ID Id = new ID("{<#= template.Item.Id #>}");
56 | ///
57 | /// The TemplateId string for <#= template.Item.Path #>
58 | ///
59 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
60 | public const string TemplateId = "<#= template.Item.Id #>";
61 | <# foreach (var field in template.Fields) { #>
62 |
63 | public struct <#= StringExtensions.AsClassName(field.Name) #>
64 | {
65 | ///
66 | /// The <#=field.Name#> field.
67 | /// <#= field.GetSharedField("__Short description")#>
68 | /// Field Type: <#= field.GetSharedField("Type")#>
69 | ///
70 | public const string FieldName = "<#= field.Name #>";
71 | }
72 | <# } // foreach field #>
73 | }
74 | <# } // foreach template #>
75 | }
76 | }
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/RainbowCodeGeneration.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {CDB0BD49-C133-4282-929E-E640EC45CA2D}
8 | Library
9 | Properties
10 | RainbowCodeGeneration
11 | RainbowCodeGeneration
12 | v4.5.2
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | ..\..\packages\Rainbow.Core.2.0.0\lib\net452\Rainbow.dll
36 |
37 |
38 | ..\..\packages\Rainbow.Storage.Yaml.2.0.0\lib\net452\Rainbow.Storage.Yaml.dll
39 |
40 |
41 | ..\..\packages\Sitecore.Kernel.NoReferences.8.2.170614\lib\NET452\Sitecore.Kernel.dll
42 |
43 |
44 | ..\..\packages\Sitecore.Logging.NoReferences.8.2.170614\lib\NET452\Sitecore.Logging.dll
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | Designer
71 |
72 |
73 |
74 |
75 |
82 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/
23 | [Oo]bj/
24 |
25 | # Visual Studio 2015 cache/options directory
26 | .vs/
27 |
28 | # MSTest test Results
29 | [Tt]est[Rr]esult*/
30 | [Bb]uild[Ll]og.*
31 |
32 | # NUNIT
33 | *.VisualState.xml
34 | TestResult.xml
35 |
36 | # Build Results of an ATL Project
37 | [Dd]ebugPS/
38 | [Rr]eleasePS/
39 | dlldata.c
40 |
41 | # DNX
42 | project.lock.json
43 | artifacts/
44 |
45 | *_i.c
46 | *_p.c
47 | *_i.h
48 | *.ilk
49 | *.meta
50 | *.obj
51 | *.pch
52 | *.pdb
53 | *.pgc
54 | *.pgd
55 | *.rsp
56 | *.sbr
57 | *.tlb
58 | *.tli
59 | *.tlh
60 | *.tmp
61 | *.tmp_proj
62 | *.log
63 | *.vspscc
64 | *.vssscc
65 | .builds
66 | *.pidb
67 | *.svclog
68 | *.scc
69 |
70 | # Chutzpah Test files
71 | _Chutzpah*
72 |
73 | # Visual C++ cache files
74 | ipch/
75 | *.aps
76 | *.ncb
77 | *.opensdf
78 | *.sdf
79 | *.cachefile
80 |
81 | # Visual Studio profiler
82 | *.psess
83 | *.vsp
84 | *.vspx
85 |
86 | # TFS 2012 Local Workspace
87 | $tf/
88 |
89 | # Guidance Automation Toolkit
90 | *.gpState
91 |
92 | # ReSharper is a .NET coding add-in
93 | _ReSharper*/
94 | *.[Rr]e[Ss]harper
95 | *.DotSettings.user
96 |
97 | # JustCode is a .NET coding add-in
98 | .JustCode
99 |
100 | # TeamCity is a build add-in
101 | _TeamCity*
102 |
103 | # DotCover is a Code Coverage Tool
104 | *.dotCover
105 |
106 | # NCrunch
107 | _NCrunch_*
108 | .*crunch*.local.xml
109 |
110 | # MightyMoose
111 | *.mm.*
112 | AutoTest.Net/
113 |
114 | # Web workbench (sass)
115 | .sass-cache/
116 |
117 | # Installshield output folder
118 | [Ee]xpress/
119 |
120 | # DocProject is a documentation generator add-in
121 | DocProject/buildhelp/
122 | DocProject/Help/*.HxT
123 | DocProject/Help/*.HxC
124 | DocProject/Help/*.hhc
125 | DocProject/Help/*.hhk
126 | DocProject/Help/*.hhp
127 | DocProject/Help/Html2
128 | DocProject/Help/html
129 |
130 | # Click-Once directory
131 | publish/
132 |
133 | # Publish Web Output
134 | *.[Pp]ublish.xml
135 | *.azurePubxml
136 | ## TODO: Comment the next line if you want to checkin your
137 | ## web deploy settings but do note that will include unencrypted
138 | ## passwords
139 | #*.pubxml
140 |
141 | *.publishproj
142 |
143 | # NuGet Packages
144 | *.nupkg
145 | # The packages folder can be ignored because of Package Restore
146 | **/packages/*
147 | # except build/, which is used as an MSBuild target.
148 | !**/packages/build/
149 | # Uncomment if necessary however generally it will be regenerated when needed
150 | #!**/packages/repositories.config
151 |
152 | # Windows Azure Build Output
153 | csx/
154 | *.build.csdef
155 |
156 | # Windows Store app package directory
157 | AppPackages/
158 |
159 | # Visual Studio cache files
160 | # files ending in .cache can be ignored
161 | *.[Cc]ache
162 | # but keep track of directories ending in .cache
163 | !*.[Cc]ache/
164 |
165 | # Others
166 | ClientBin/
167 | [Ss]tyle[Cc]op.*
168 | ~$*
169 | *~
170 | *.dbmdl
171 | *.dbproj.schemaview
172 | *.pfx
173 | *.publishsettings
174 | node_modules/
175 | orleans.codegen.cs
176 |
177 | # RIA/Silverlight projects
178 | Generated_Code/
179 |
180 | # Backup & report files from converting an old project file
181 | # to a newer Visual Studio version. Backup files are not needed,
182 | # because we have git ;-)
183 | _UpgradeReport_Files/
184 | Backup*/
185 | UpgradeLog*.XML
186 | UpgradeLog*.htm
187 |
188 | # SQL Server files
189 | *.mdf
190 | *.ldf
191 |
192 | # Business Intelligence projects
193 | *.rdl.data
194 | *.bim.layout
195 | *.bim_*.settings
196 |
197 | # Microsoft Fakes
198 | FakesAssemblies/
199 |
200 | # Node.js Tools for Visual Studio
201 | .ntvs_analysis.dat
202 |
203 | # Visual Studio 6 build log
204 | *.plg
205 |
206 | # Visual Studio 6 workspace options file
207 | *.opt
208 |
209 | # LightSwitch generated files
210 | GeneratedArtifacts/
211 | _Pvt_Extensions/
212 | ModelManifest.xml
213 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/SitecoreTemplates.tt.pp:
--------------------------------------------------------------------------------
1 | <#@ template debug="false" hostspecific="true" language="C#" #>
2 | <#@ output extension=".cs" #>
3 | <#@ assembly name="System.Core" #>
4 | <# // NOTE - Reference your NuGet packages for Rainbow and RainbowCodeGeneration here #>
5 | <#@ assembly name="$(SolutionDir)packages\Rainbow.Core.2.0.0\lib\net452\Rainbow.dll" #>
6 | <#@ assembly name="$(SolutionDir)packages\Rainbow.Storage.Yaml.2.0.0\lib\net452\Rainbow.Storage.Yaml.dll" #>
7 | <#@ assembly name="$(SolutionDir)packages\RainbowCodeGeneration.0.3.0\lib\net452\RainbowCodeGeneration.dll" #>
8 | <# // NOTE - Reference your Sitecore.Kernel.dll and Sitecore.Logging.dll here - for Sitecore 9, also add Microsoft.Extensions.DependencyInjection 1.0.0 via NuGet and enable the reference below #>
9 | <#@ assembly name="$(SolutionDir)packages\Sitecore.Kernel.NoReferences.8.2.160729\lib\net452\Sitecore.Kernel.dll" #>
10 | <#@ assembly name="$(SolutionDir)packages\Sitecore.Logging.NoReferences.8.2.160729\lib\net452\Sitecore.Logging.dll" #>
11 | <# // For Sitecore 9: @ assembly name="$(SolutionDir)packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.0.0\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" #>
12 | <# // For Sitecore 9: @ assembly name="$(SolutionDir)packages\Microsoft.Extensions.DependencyInjection.1.0.0\lib\netstandard1.1\Microsoft.Extensions.DependencyInjection.dll" #>
13 | <#
14 | // CONFIGURATION
15 | var physicalFileStore = @"..\serialization"; // the path to your serialisation items
16 | var treeName = "YOUR FEATURE NAME HERE"; // the name of the configuration you want to code-generate, also add the template Sub-Folder name e.g. Feature.Sample\\Templates
17 | var treePath = "/sitecore/templates/YOUR TEMPLATE PATH HERE"; // the matching path in Sitecore for the configuration, e.g. /sitecore/templates/Sample
18 |
19 | var Tool = "RainbowCodeGeneration";
20 | var ToolVersion = "1.0";
21 | var templates = RainbowCodeGeneration.RainbowReader.GetTemplates(Host.ResolvePath(physicalFileStore), treeName, treePath);
22 | #>
23 | <#@ import namespace="RainbowCodeGeneration" #>
24 | //------------------------------------------------------------------------------
25 | //
26 | // This code was generated based on the Unicorn serialisation items
27 | //
28 | // Changes to this file may cause incorrect behavior and will be lost if
29 | // the code is regenerated.
30 | //
31 | //------------------------------------------------------------------------------
32 | // ReSharper disable InconsistentNaming
33 | namespace $rootnamespace$
34 | {
35 | using global::Sitecore.Data;
36 |
37 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
38 | public struct SitecoreTemplates
39 | {
40 | <# foreach (var template in templates) { #>
41 |
42 | ///
43 | /// <#= template.Item.Name #>
44 | /// <#= template.Item.GetSharedField("__Short description") #>
45 | /// Path: <#= template.Item.Path #>
46 | /// ID: <#= template.Item.Id #>
47 | ///
48 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
49 | public struct <#= StringExtensions.AsClassName(template.Item.Name) #>
50 | {
51 | ///
52 | /// The ID for <#= template.Item.Path #>
53 | ///
54 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
55 | public static ID Id = new ID("{<#= template.Item.Id #>}");
56 | ///
57 | /// The TemplateId string for <#= template.Item.Path #>
58 | ///
59 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("<#=Tool#>", "<#=ToolVersion#>")]
60 | public const string TemplateId = "<#= template.Item.Id #>";
61 | <# foreach (var field in template.Fields) { #>
62 |
63 | public struct <#= StringExtensions.AsClassName(field.Name) #>
64 | {
65 | ///
66 | /// The <#=field.Name#> field.
67 | /// <#= field.GetSharedField("__Short description")#>
68 | /// Field Type: <#= field.GetSharedField("Type")#>
69 | ///
70 | public const string FieldName = "<#= field.Name #>";
71 | }
72 | <# } // foreach field #>
73 | }
74 | <# } // foreach template #>
75 | }
76 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # RainbowCodeGeneration
2 |
3 | [](https://www.nuget.org/packages/RainbowCodeGeneration)
4 |
5 | A simple set of utility classes and a sample T4 template that allow easy code generation for Sitecore templates from [Rainbow](https://github.com/kamsar/Rainbow) / [Unicorn](https://github.com/kamsar/Unicorn) serialized items. Currently, only the [YAML-based serialisation format](https://github.com/kamsar/Rainbow/tree/master/src/Rainbow.Storage.Yaml) is supported.
6 |
7 | ## Using the Rainbow / Unicorn code generation
8 |
9 | You are probably already using Unicorn with the YAML serialisation format (you really should - it's awesome!). I am also assuming that you serialise your templates in a dedicated folder inside your solution, ideally in a modular fashion like in [Sitecore Habitat](https://github.com/Sitecore/Habitat). Using the Rainbow / Unicorn code generation is simple:
10 | * Install the nuget package
11 | * Configure the T4 template
12 | * Re-Run the code generation when Sitecore templates change
13 |
14 | ### Installing the nuget package
15 |
16 | Install the [RainbowCodeGeneration package](https://www.nuget.org/packages/RainbowCodeGeneration). This installs a set of simple utility classes and an example T4 template. The template will generate an empty `SitecoreTemplates` struct in your project.
17 |
18 | 
19 |
20 | ### Configuring the T4 template
21 |
22 | Adjust a few settings on the T4 template `SitecoreTemplates.tt` to make it run in your configuration.
23 |
24 | * Ensure the assembly references at the top of the file resolve correctly (e.g. the path to your Sitecore.Kernel.dll). I have added an example based on NuGet packages however it is likely that you need to update the version numbers. The code generation is compatible with Unicorn 3 and 4 (Rainbow 1 and 2).
25 | * The `physicalFileStore` setting needs to point to where you store the Unicorn / Rainbow items for your project. The out of the box setting uses the relative paths that Habitat uses.
26 | * The `treeName` setting is the name of the sub-tree in Unicorn. This is the name of the folder for your Unicorn predicate to generate code for.
27 | * The `treePath` setting is the matching path in Sitecore. The "News" feature in Habitat would use "/sitecore/templates/Feature/News"
28 |
29 | 
30 |
31 | * For Sitecore 9 you also need to install the NuGet package for Microsoft.Extensions.DependencyInjection in version 1.0.0 and reference the DLLs. The configuration then looks as follows (for Sitecore 9 using Unicorn 4):
32 |
33 | ```
34 | <#@ template debug="false" hostspecific="true" language="C#" #>
35 | <#@ output extension=".cs" #>
36 | <#@ assembly name="System.Core" #>
37 | <# // NOTE - Reference your NuGet packages for Rainbow and RainbowCodeGeneration here #>
38 | <#@ assembly name="$(SolutionDir)packages\Rainbow.Core.2.0.0\lib\net452\Rainbow.dll" #>
39 | <#@ assembly name="$(SolutionDir)packages\Rainbow.Storage.Yaml.2.0.0\lib\net452\Rainbow.Storage.Yaml.dll" #>
40 | <#@ assembly name="$(SolutionDir)packages\RainbowCodeGeneration.0.2.0\lib\net452\RainbowCodeGeneration.dll" #>
41 | <# // NOTE - Reference your Sitecore.Kernel.dll and Sitecore.Logging.dll here #>
42 | <#@ assembly name="$(SolutionDir)packages\Sitecore.Kernel.NoReferences.9.0.171002\lib\net462\Sitecore.Kernel.dll" #>
43 | <#@ assembly name="$(SolutionDir)packages\Sitecore.Logging.NoReferences.9.0.171002\lib\net462\Sitecore.Logging.dll" #>
44 | <#@ assembly name="$(SolutionDir)packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.0.0\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll" #>
45 | <#@ assembly name="$(SolutionDir)packages\Microsoft.Extensions.DependencyInjection.1.0.0\lib\netstandard1.1\Microsoft.Extensions.DependencyInjection.dll" #>
46 | <#
47 | // CONFIGURATION
48 | var physicalFileStore = @"D:\inetpub\wwwroot\sc900\Data\Unicorn"; // the path to your serialisation items
49 | var treeName = "Feature.Sample\\Templates"; // the name of the configuration you want to code-generate
50 | var treePath = "/sitecore/templates/Sample"; // the matching path in Sitecore for the configuration
51 | ```
52 |
53 | The code generation for your Sitecore templates will run when you save the T4 template.
54 |
55 | You can tweak the T4 template to your liking. The entire `IItemData` object from Rainbow for the template and its fields is available within the template.
56 |
57 | ### Re-run code generation
58 |
59 | When your Unicorn / Rainbow items update, you will have to re-run the code generation. In Visual Studio, right-click on the T4 template and select "Run Custom Tool" to re-run the code generation.
60 |
61 | 
62 |
63 | ### Generate code for any item (not just templates)
64 |
65 | Starting in version 0.3 it is possible to generate code based on any item. For an example T4 template, refer to [SitecoreKnownItems.tt](https://github.com/heikof/RainbowCodeGeneration/blob/develop/src/RainbowCodeGeneration.Test/SitecoreKnownItems.tt) in the test project of the repository.
66 |
67 | ### Known issues
68 |
69 | #### Re-serialisation fails if Visual Studio solution is open
70 | Re-serialising an entire configuration fails if Visual Studio is open and a code generation is covering the configuration. Visual Studio appears to retain a lock on the folder and Unicorn cannot remove it. Close the solution and re-open it after you re-serialised the configuration.
71 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration.Test/RainbowCodeGeneration.Test.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 | {A43DA3A0-5A7B-49B9-82B6-9F3D3842DAD8}
8 | Library
9 | Properties
10 | RainbowCodeGeneration.Test
11 | RainbowCodeGeneration.Test
12 | v4.6.2
13 | 512
14 |
15 |
16 |
17 | true
18 | full
19 | false
20 | bin\Debug\
21 | DEBUG;TRACE
22 | prompt
23 | 4
24 |
25 |
26 | pdbonly
27 | true
28 | bin\Release\
29 | TRACE
30 | prompt
31 | 4
32 |
33 |
34 |
35 | ..\..\packages\Microsoft.Extensions.DependencyInjection.1.0.0\lib\netstandard1.1\Microsoft.Extensions.DependencyInjection.dll
36 |
37 |
38 | ..\..\packages\Microsoft.Extensions.DependencyInjection.Abstractions.1.0.0\lib\netstandard1.0\Microsoft.Extensions.DependencyInjection.Abstractions.dll
39 |
40 |
41 | ..\..\packages\Rainbow.Core.2.0.0\lib\net452\Rainbow.dll
42 |
43 |
44 | ..\..\packages\Rainbow.Storage.Yaml.2.0.0\lib\net452\Rainbow.Storage.Yaml.dll
45 |
46 |
47 | ..\..\packages\Sitecore.Kernel.NoReferences.9.0.171002\lib\NET462\Sitecore.Kernel.dll
48 |
49 |
50 | ..\..\packages\Sitecore.Logging.NoReferences.9.0.171002\lib\NET462\Sitecore.Logging.dll
51 |
52 |
53 |
54 |
55 | ..\..\packages\System.Reflection.4.1.0\lib\net462\System.Reflection.dll
56 |
57 |
58 | ..\..\packages\System.Runtime.Extensions.4.1.0\lib\net462\System.Runtime.Extensions.dll
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | True
71 | True
72 | SitecoreKnownItems.tt
73 |
74 |
75 | True
76 | True
77 | SitecoreTemplates.tt
78 |
79 |
80 |
81 |
82 | TextTemplatingFileGenerator
83 | SitecoreKnownItems.cs
84 |
85 |
86 | TextTemplatingFileGenerator
87 | SitecoreTemplates.cs
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
105 |
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/Inflector.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Text.RegularExpressions;
3 |
4 | namespace RainbowCodeGeneration
5 | {
6 |
7 | ///
8 | /// The Inflector class transforms words from one
9 | /// form to another. For example, from singular to plural.
10 | ///
11 | public static class Inflector
12 | {
13 | private static readonly List plurals = new List();
14 | private static readonly List singulars = new List();
15 | private static readonly List uncountables = new List();
16 |
17 | #region Default Rules
18 |
19 | static Inflector()
20 | {
21 | AddPlural("$", "s");
22 | AddPlural("s$", "s");
23 | AddPlural("(ax|test)is$", "$1es");
24 | AddPlural("(octop|vir)us$", "$1i");
25 | AddPlural("(alias|status)$", "$1es");
26 | AddPlural("(bu)s$", "$1ses");
27 | AddPlural("(buffal|tomat)o$", "$1oes");
28 | AddPlural("([ti])um$", "$1a");
29 | AddPlural("sis$", "ses");
30 | AddPlural("(?:([^f])fe|([lr])f)$", "$1$2ves");
31 | AddPlural("(hive)$", "$1s");
32 | AddPlural("([^aeiouy]|qu)y$", "$1ies");
33 | AddPlural("(x|ch|ss|sh)$", "$1es");
34 | AddPlural("(matr|vert|ind)ix|ex$", "$1ices");
35 | AddPlural("([m|l])ouse$", "$1ice");
36 | AddPlural("^(ox)$", "$1en");
37 | AddPlural("(quiz)$", "$1zes");
38 |
39 | AddSingular("s$", "");
40 | AddSingular("(n)ews$", "$1ews");
41 | AddSingular("([ti])a$", "$1um");
42 | AddSingular("((a)naly|(b)a|(d)iagno|(p)arenthe|(p)rogno|(s)ynop|(t)he)ses$", "$1$2sis");
43 | AddSingular("(^analy)ses$", "$1sis");
44 | AddSingular("([^f])ves$", "$1fe");
45 | AddSingular("(hive)s$", "$1");
46 | AddSingular("(tive)s$", "$1");
47 | AddSingular("([lr])ves$", "$1f");
48 | AddSingular("([^aeiouy]|qu)ies$", "$1y");
49 | AddSingular("(s)eries$", "$1eries");
50 | AddSingular("(m)ovies$", "$1ovie");
51 | AddSingular("(x|ch|ss|sh)es$", "$1");
52 | AddSingular("([m|l])ice$", "$1ouse");
53 | AddSingular("(bus)es$", "$1");
54 | AddSingular("(o)es$", "$1");
55 | AddSingular("(shoe)s$", "$1");
56 | AddSingular("(cris|ax|test)es$", "$1is");
57 | AddSingular("(octop|vir)i$", "$1us");
58 | AddSingular("(alias|status)es$", "$1");
59 | AddSingular("^(ox)en", "$1");
60 | AddSingular("(vert|ind)ices$", "$1ex");
61 | AddSingular("(matr)ices$", "$1ix");
62 | AddSingular("(quiz)zes$", "$1");
63 |
64 | AddIrregular("person", "people");
65 | AddIrregular("man", "men");
66 | AddIrregular("child", "children");
67 | AddIrregular("sex", "sexes");
68 | AddIrregular("move", "moves");
69 |
70 | AddUncountable("equipment");
71 | AddUncountable("information");
72 | AddUncountable("rice");
73 | AddUncountable("money");
74 | AddUncountable("species");
75 | AddUncountable("series");
76 | AddUncountable("fish");
77 | AddUncountable("sheep");
78 | }
79 |
80 | #endregion
81 |
82 | #region Rule inner class
83 |
84 | private class Rule
85 | {
86 | private readonly Regex regex;
87 | private readonly string replacement;
88 |
89 | public Rule(string pattern, string replacement)
90 | {
91 | regex = new Regex(pattern, RegexOptions.IgnoreCase);
92 | this.replacement = replacement;
93 | }
94 |
95 | public string Apply(string word)
96 | {
97 | if (!regex.IsMatch(word))
98 | {
99 | return null;
100 | }
101 |
102 | return regex.Replace(word, replacement);
103 | }
104 | }
105 |
106 | #endregion
107 |
108 | ///
109 | /// Return the plural of a word.
110 | ///
111 | /// The singular form
112 | /// The plural form of
113 | public static string Pluralize(string word)
114 | {
115 | return ApplyRules(plurals, word);
116 | }
117 |
118 | ///
119 |
120 | /// Return the singular of a word.
121 | ///
122 | /// The plural form
123 | /// The singular form of
124 | public static string Singularize(string word)
125 | {
126 | return ApplyRules(singulars, word);
127 | }
128 |
129 | ///
130 | /// Capitalizes a word.
131 | ///
132 | /// The word to be capitalized.
133 | /// capitalized.
134 | public static string Capitalize(string word)
135 | {
136 | return word.Substring(0, 1).ToUpper() + word.Substring(1).ToLower();
137 | }
138 |
139 | private static void AddIrregular(string singular, string plural)
140 | {
141 | AddPlural("(" + singular[0] + ")" + singular.Substring(1) + "$", "$1" + plural.Substring(1));
142 | AddSingular("(" + plural[0] + ")" + plural.Substring(1) + "$", "$1" + singular.Substring(1));
143 | }
144 |
145 | private static void AddUncountable(string word)
146 | {
147 | uncountables.Add(word.ToLower());
148 | }
149 |
150 | private static void AddPlural(string rule, string replacement)
151 | {
152 | plurals.Add(new Rule(rule, replacement));
153 | }
154 |
155 | private static void AddSingular(string rule, string replacement)
156 | {
157 | singulars.Add(new Rule(rule, replacement));
158 | }
159 |
160 | private static string ApplyRules(IList rules, string word)
161 | {
162 | string result = word;
163 |
164 | if (!uncountables.Contains(word.ToLower()))
165 | {
166 | for (int i = rules.Count - 1; i >= 0; i--)
167 | {
168 | Rule rule = (Rule)rules[i];
169 |
170 | if ((result = rule.Apply(word)) != null)
171 | {
172 | break;
173 | }
174 | }
175 | }
176 |
177 | return result ?? word; // worse case, return the original word
178 | }
179 | }
180 | }
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration.Test/SitecoreTemplates.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated based on the Unicorn serialisation items
4 | //
5 | // Changes to this file may cause incorrect behavior and will be lost if
6 | // the code is regenerated.
7 | //
8 | //------------------------------------------------------------------------------
9 | // ReSharper disable InconsistentNaming
10 | namespace RainbowCodeGeneration.Test
11 | {
12 | using global::Sitecore.Data;
13 |
14 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
15 | public struct SitecoreTemplates
16 | {
17 |
18 | ///
19 | /// Map Type
20 | ///
21 | /// Path: /sitecore/templates/Feature/Maps/Map Type
22 | /// ID: 04c34cf5-b7ea-4408-88e8-5fc851173dbd
23 | ///
24 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
25 | public struct Map_Type
26 | {
27 | ///
28 | /// The ID for /sitecore/templates/Feature/Maps/Map Type
29 | ///
30 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
31 | public static ID Id = new ID("{04c34cf5-b7ea-4408-88e8-5fc851173dbd}");
32 | ///
33 | /// The TemplateId string for /sitecore/templates/Feature/Maps/Map Type
34 | ///
35 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
36 | public const string TemplateId = "04c34cf5-b7ea-4408-88e8-5fc851173dbd";
37 |
38 | public struct Name
39 | {
40 | ///
41 | /// The Name field.
42 | ///
43 | /// Field Type: Single-Line Text
44 | ///
45 | public const string FieldName = "Name";
46 | }
47 | }
48 |
49 | ///
50 | /// _MapPoint
51 | ///
52 | /// Path: /sitecore/templates/Feature/Maps/_MapPoint
53 | /// ID: 1e6a8c8c-6646-4776-8ab4-615265669633
54 | ///
55 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
56 | public struct _MapPoint
57 | {
58 | ///
59 | /// The ID for /sitecore/templates/Feature/Maps/_MapPoint
60 | ///
61 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
62 | public static ID Id = new ID("{1e6a8c8c-6646-4776-8ab4-615265669633}");
63 | ///
64 | /// The TemplateId string for /sitecore/templates/Feature/Maps/_MapPoint
65 | ///
66 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
67 | public const string TemplateId = "1e6a8c8c-6646-4776-8ab4-615265669633";
68 |
69 | public struct MapPointAddress
70 | {
71 | ///
72 | /// The MapPointAddress field.
73 | ///
74 | /// Field Type: Multi-Line Text
75 | ///
76 | public const string FieldName = "MapPointAddress";
77 | }
78 |
79 | public struct MapPointLocation
80 | {
81 | ///
82 | /// The MapPointLocation field.
83 | ///
84 | /// Field Type: Map Field
85 | ///
86 | public const string FieldName = "MapPointLocation";
87 | }
88 |
89 | public struct MapPointName
90 | {
91 | ///
92 | /// The MapPointName field.
93 | ///
94 | /// Field Type: Single-Line Text
95 | ///
96 | public const string FieldName = "MapPointName";
97 | }
98 | }
99 |
100 | ///
101 | /// _MapPoints Folder
102 | ///
103 | /// Path: /sitecore/templates/Feature/Maps/_MapPoints Folder
104 | /// ID: 31713995-c6bf-4ccb-8807-198493508afa
105 | ///
106 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
107 | public struct _MapPoints_Folder
108 | {
109 | ///
110 | /// The ID for /sitecore/templates/Feature/Maps/_MapPoints Folder
111 | ///
112 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
113 | public static ID Id = new ID("{31713995-c6bf-4ccb-8807-198493508afa}");
114 | ///
115 | /// The TemplateId string for /sitecore/templates/Feature/Maps/_MapPoints Folder
116 | ///
117 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
118 | public const string TemplateId = "31713995-c6bf-4ccb-8807-198493508afa";
119 | }
120 |
121 | ///
122 | /// _MapRenderingParameters
123 | ///
124 | /// Path: /sitecore/templates/Feature/Maps/_MapRenderingParameters
125 | /// ID: d77856c3-8a5e-452c-8854-f2965edf25e0
126 | ///
127 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
128 | public struct _MapRenderingParameters
129 | {
130 | ///
131 | /// The ID for /sitecore/templates/Feature/Maps/_MapRenderingParameters
132 | ///
133 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
134 | public static ID Id = new ID("{d77856c3-8a5e-452c-8854-f2965edf25e0}");
135 | ///
136 | /// The TemplateId string for /sitecore/templates/Feature/Maps/_MapRenderingParameters
137 | ///
138 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("RainbowCodeGeneration", "1.0")]
139 | public const string TemplateId = "d77856c3-8a5e-452c-8854-f2965edf25e0";
140 |
141 | public struct MapType
142 | {
143 | ///
144 | /// The MapType field.
145 | ///
146 | /// Field Type: Droplist
147 | ///
148 | public const string FieldName = "MapType";
149 | }
150 |
151 | public struct EnableRotateControl
152 | {
153 | ///
154 | /// The EnableRotateControl field.
155 | ///
156 | /// Field Type: Checkbox
157 | ///
158 | public const string FieldName = "EnableRotateControl";
159 | }
160 |
161 | public struct EnableStreetViewControl
162 | {
163 | ///
164 | /// The EnableStreetViewControl field.
165 | ///
166 | /// Field Type: Checkbox
167 | ///
168 | public const string FieldName = "EnableStreetViewControl";
169 | }
170 |
171 | public struct ZoomLevel
172 | {
173 | ///
174 | /// The ZoomLevel field.
175 | ///
176 | /// Field Type: Single-Line Text
177 | ///
178 | public const string FieldName = "ZoomLevel";
179 | }
180 |
181 | public struct EnableZoomControl
182 | {
183 | ///
184 | /// The EnableZoomControl field.
185 | ///
186 | /// Field Type: Checkbox
187 | ///
188 | public const string FieldName = "EnableZoomControl";
189 | }
190 |
191 | public struct EnableScaleControl
192 | {
193 | ///
194 | /// The EnableScaleControl field.
195 | ///
196 | /// Field Type: Checkbox
197 | ///
198 | public const string FieldName = "EnableScaleControl";
199 | }
200 |
201 | public struct EnableMapTypeControl
202 | {
203 | ///
204 | /// The EnableMapTypeControl field.
205 | ///
206 | /// Field Type: Checkbox
207 | ///
208 | public const string FieldName = "EnableMapTypeControl";
209 | }
210 |
211 | public struct CenterLocation
212 | {
213 | ///
214 | /// The CenterLocation field.
215 | ///
216 | /// Field Type: Single-Line Text
217 | ///
218 | public const string FieldName = "CenterLocation";
219 | }
220 |
221 | public struct EnableCenterMapControl
222 | {
223 | ///
224 | /// The EnableCenterMapControl field.
225 | ///
226 | /// Field Type: Checkbox
227 | ///
228 | public const string FieldName = "EnableCenterMapControl";
229 | }
230 | }
231 | }
232 | }
--------------------------------------------------------------------------------
/src/RainbowCodeGeneration/StringExtensions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace RainbowCodeGeneration
4 | {
5 | public static class StringExtensions
6 | {
7 | public static string TitleCase(string word)
8 | {
9 | string newWord = System.Text.RegularExpressions.Regex.Replace(word, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1+");
10 | newWord = System.Globalization.CultureInfo.InvariantCulture.TextInfo.ToTitleCase(newWord);
11 | newWord = newWord.Replace("+", "");
12 | return newWord;
13 | }
14 |
15 | public static string CamelCase(string word)
16 | {
17 | if (word == null)
18 | {
19 | return "";
20 | }
21 |
22 | // Something -> something
23 | // ISomething -> iSomething
24 | // SomethingElse -> somethingElse
25 | // ISomethingElse -> iSomethingElse
26 |
27 | string titleCase = TitleCase(word);
28 | return titleCase.Substring(0, 1).ToLower() + titleCase.Substring(1);
29 | }
30 |
31 | public static bool IsInterfaceWord(string word)
32 | {
33 | // looks like an interface if... I[A-Z]xxxx
34 | // proper definition is http://msdn.microsoft.com/en-us/library/8bc1fexb(v=VS.71).aspx
35 | return (word.Length > 2 && !word.Contains(" ") && (word[0] == 'I' && char.IsUpper(word, 1) && char.IsLower(word, 2)));
36 | }
37 |
38 | public static string AsInterfaceName(string word)
39 | {
40 | // return I[TitleCaseWord]
41 | // something -> ISomething
42 | // Something -> ISomething
43 | // ISomething -> ISomething
44 |
45 | string interfaceWord = GetFormattedWord(word, TitleCase);
46 |
47 | // Only prefix the word with a 'I' if we don't have a word that already looks like an interface.
48 | if (!IsInterfaceWord(word))
49 | {
50 | interfaceWord = string.Concat("I", interfaceWord);
51 | }
52 | return interfaceWord;
53 | }
54 |
55 | public static string AsClassName(string word)
56 | {
57 | // TitleCase the word
58 | return GetFormattedWord(word, TitleCase);
59 | }
60 |
61 | public static string AsPropertyName(string word, bool pluralize = false)
62 | {
63 | // TitleCase the word and pluralize it
64 | if (pluralize)
65 | return GetFormattedWord(word, TitleCase, Inflector.Pluralize);
66 | else
67 | return GetFormattedWord(word, TitleCase);
68 | }
69 |
70 | public static string AsFieldName(string word)
71 | {
72 | // return _someParam.
73 | // Note, this isn't MS guideline, but it easier to deal with than using this. everywhere to avoid name collisions
74 | return GetFormattedWord(word, CamelCase, (string s) => "_" + s);
75 | }
76 |
77 | ///
78 | /// Tests whether the words conflicts with reserved or language keywords, and if so, attempts to return
79 | /// valid words that do not conflict. Usually the returned words are only slightly modified to differentiate
80 | /// the identifier from the keyword; for example, the word might be preceded by the underscore ("_") character.
81 | ///
82 | /// The words.
83 | ///
84 | public static System.Collections.Generic.IEnumerable AsValidWords(System.Collections.Generic.IEnumerable words)
85 | {
86 | foreach (string word in words)
87 | {
88 | yield return AsValidWord(word);
89 | }
90 | }
91 |
92 | ///
93 | /// Tests whether the word conflicts with reserved or language keywords, and if so, attempts to return a
94 | /// valid word that does not conflict. Usually the returned word is only slightly modified to differentiate
95 | /// the identifier from the keyword; for example, the word might be preceded by the underscore ("_") character.
96 | ///
97 | /// Valid identifiers in C# are defined in the C# Language Specification, item 2.4.2. The rules are very simple:
98 | /// - An identifier must start with a letter or an underscore
99 | /// - After the first character, it may contain numbers, letters, connectors, etc
100 | /// - If the identifier is a keyword, it must be prepended with “@”
101 | ///
102 | ///
103 | /// The word.
104 | /// A valid word for the specified word.
105 | public static string AsValidWord(string word)
106 | {
107 | string identifier = word;
108 |
109 | if (identifier == "*")
110 | {
111 | identifier = "Wildcard";
112 | }
113 |
114 | //identifier = RemoveDiacritics(identifier);
115 |
116 | // C# Identifiers - http://msdn.microsoft.com/en-us/library/aa664670(VS.71).aspx
117 | // replace all illegal chars with an '_'
118 | System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"[^\p{Ll}\p{Lu}\p{Lt}\p{Lo}\p{Nd}\p{Nl}\p{Mn}\p{Mc}\p{Cf}\p{Pc}\p{Lm}]");
119 | identifier = regex.Replace(identifier, "_");
120 |
121 | //The identifier must start with a character or '_'
122 | if (!(char.IsLetter(identifier, 0) || identifier[0] == '_'))
123 | {
124 | identifier = string.Concat("_", identifier);
125 | }
126 |
127 | // fix language specific reserved words
128 | identifier = FixReservedWord(identifier);
129 |
130 | // Let's make sure we have a valid name
131 | System.Diagnostics.Debug.Assert(System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(identifier), string.Format("'{0}' is an invalid name for a Template or Field", word));
132 | return identifier;
133 | }
134 |
135 | ///
136 | /// Concatenates all of the with a '.' separator.
137 | /// Each word is passed through the AsValidWord method ensuring that it is a valid for a namespace segment.
138 | /// Leading, trailing, and more than one consecutive '.' are removed.
139 | ///
140 | ///
141 | /// This sample shows how to call the method.
142 | ///
143 | /// string[] segments = new string[5]{ ".My", "Namespace.", "For", "The...Sample..", "Project."};
144 | /// string ns = segments.AsNamespace();
145 | ///
146 | /// The ns variable would contain "My.Namespace.For.The.Sample.Project".
147 | ///
148 | /// The namespace segments.
149 | /// A valid string in valid namespace format.
150 | public static string AsNamespace(System.Collections.Generic.IEnumerable words)
151 | {
152 | System.Collections.Generic.List joinedNamespace = new System.Collections.Generic.List();
153 | foreach (string segment in words)
154 | {
155 | if (segment != null)
156 | {
157 | // split apart any strings with a '.' and remove any consecutive multiple '.'
158 | string[] segments = segment.Split(new char[1] { '.' }, StringSplitOptions.RemoveEmptyEntries);
159 |
160 | // being we are making a namespace, make sure the segments are valid
161 | System.Collections.Generic.IEnumerable validSegments = AsValidWords(segments);
162 | joinedNamespace.AddRange(validSegments);
163 | }
164 | }
165 | string ns = string.Join(".", joinedNamespace.ToArray());
166 | return ns;
167 | }
168 |
169 | ///
170 | /// Remplacement des caractères accentués
171 | ///
172 | /// The string to replace diacritics on.
173 | /// A diacritic is a glyph added to a letter, or basic glyph
174 | ///
175 | private static string RemoveDiacritics(string s)
176 | {
177 | string normalizedString = s.Normalize(System.Text.NormalizationForm.FormD);
178 | System.Text.StringBuilder stringBuilder = new System.Text.StringBuilder();
179 |
180 | foreach (char c in normalizedString)
181 | {
182 | if (System.Globalization.CharUnicodeInfo.GetUnicodeCategory(c) != System.Globalization.UnicodeCategory.NonSpacingMark)
183 | stringBuilder.Append(c);
184 | }
185 |
186 | return stringBuilder.ToString();
187 | }
188 |
189 | ///
190 | /// Tests whether the word conflicts with reserved or language keywords, and if so, attempts to return a
191 | /// valid word that does not conflict. Usually the returned word is only slightly modified to differentiate
192 | /// the identifier from the keyword; for example, the word might be preceded by the underscore ("_") character.
193 | ///
194 | /// The word.
195 | ///
196 | private static string FixReservedWord(string word)
197 | {
198 | // turns keywords into usable words.
199 | // i.e. class -> _class
200 | Microsoft.CSharp.CSharpCodeProvider codeProvider = new Microsoft.CSharp.CSharpCodeProvider();
201 | return codeProvider.CreateValidIdentifier(word);
202 | }
203 |
204 | private static string GetFormattedWord(string word, params Func[] transformations)
205 | {
206 | string newWord = word;
207 | foreach (var item in transformations)
208 | {
209 | if (item != null)
210 | {
211 | newWord = item(newWord);
212 | }
213 | }
214 | // Now that the basic transforms are done, make sure we have a valid word to use
215 | newWord = AsValidWord(newWord);
216 | return newWord;
217 | }
218 | }
219 | }
220 |
--------------------------------------------------------------------------------