зеркало из https://github.com/dotnet/docs-desktop.git
Родитель
b0376d820a
Коммит
09d28345c2
|
@ -0,0 +1 @@
|
|||
redirects_generator/readme.md
|
|
@ -0,0 +1,399 @@
|
|||
{
|
||||
"Moniker1": "netframeworkdesktop-4.8",
|
||||
"RepoPath1": "dotnet-desktop-guide/framework/",
|
||||
"Moniker2": "netdesktop-5.0",
|
||||
"RepoPath2": "dotnet-desktop-guide/net/",
|
||||
"PublishRoot": "/dotnet/desktop/",
|
||||
"Entries": [
|
||||
|
||||
// ========
|
||||
// WinForms
|
||||
// ========
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-create-a-windows-forms-application-from-the-command-line?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/get-started/create-app-visual-studio?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/windows-forms-overview?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/overview/?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// Events
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/events-overview-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/forms/events?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/creating-event-handlers-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/forms/events?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/automatic-scaling-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/forms/autoscale?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-resize-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/forms/how-to-position-and-resize?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// Controls
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/index?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/overview?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/layout-in-windows-forms-controls?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/layout?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/autosize-property-overview?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/layout?view=netdesktop-5.0#automatic-sizing"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/label-control-overview-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/labels?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/how-to-set-the-tab-order-on-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-set-the-tab-order?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/how-to-anchor-controls-on-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-dock-and-anchor?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/how-to-dock-controls-on-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-dock-and-anchor?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-create-event-handlers-at-run-time-for-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-add-an-event-handler?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-connect-multiple-events-to-a-single-event-handler-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-add-an-event-handler?view=netdesktop-5.0#how-to-use-multiple-events-with-the-same-handler"
|
||||
},
|
||||
|
||||
// Custom controls
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/varieties-of-custom-controls?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/custom?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/control-type-recommendations?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/custom?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// Custom painting and drawing
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/custom-control-painting-and-rendering?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/custom-painting-drawing?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/rendering-a-windows-forms-control?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/custom-painting-drawing?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/user-drawn-controls?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/custom-painting-drawing?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/how-to-add-controls-to-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-add-to-a-form?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/how-to-create-access-keys-for-windows-forms-controls?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-create-access-keys?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/how-to-set-the-text-displayed-by-a-windows-forms-control?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-set-the-display-text?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/controls/how-to-set-the-image-displayed-by-a-windows-forms-control?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/controls/how-to-add-a-picture-to-a-control?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// Keyboard overview
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/keyboard-input-in-a-windows-forms-application?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-keyboard/overview?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-keyboard-input-works?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-keyboard/overview?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/using-keyboard-events?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-keyboard/events?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/user-input-validation-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-keyboard/validation?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-modify-keyboard-input-to-a-standard-control?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-keyboard/how-to-change-key-press?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-determine-which-modifier-key-was-pressed?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-keyboard/how-to-check-modifier-key?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-handle-keyboard-input-at-the-form-level?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-keyboard/how-to-handle-forms?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/input-keyboard/how-to-simulate-events?view=netdesktop-5.0",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/how-to-simulate-mouse-and-keyboard-events-in-code?view=netframeworkdesktop-4.8"
|
||||
},
|
||||
|
||||
// Mouse overview
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/mouse-input-in-a-windows-forms-application?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-mouse/overview?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-mouse-input-works-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-mouse/overview?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/mouse-events-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-mouse/events?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/drag-and-drop-functionality-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-mouse/drag-and-drop?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/mouse-pointers-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-mouse/how-to-manage-cursor-pointer?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-simulate-mouse-and-keyboard-events-in-code?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-mouse/how-to-simulate-events?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-distinguish-between-clicks-and-double-clicks?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/input-mouse/how-to-distinguish-between-clicks-and-double-clicks?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
|
||||
// ========
|
||||
// WPF 4.0 -> 5/6
|
||||
// ========
|
||||
|
||||
// Main
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/introduction-to-wpf?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/overview/?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/getting-started/walkthrough-my-first-wpf-desktop-application?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/get-started/create-app-visual-studio?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// Windows
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/app-development/wpf-windows-overview?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/windows/index?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/app-development/dialog-boxes-overview?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/windows/dialog-boxes-overview?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/app-development/how-to-open-a-window?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/windows/how-to-open-window-dialog-box?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/app-development/how-to-open-a-dialog-box?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/windows/how-to-open-window-dialog-box?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/how-to-return-a-dialog-box-result?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/windows/how-to-open-window-dialog-box?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/app-development/how-to-open-a-message-box?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/windows/how-to-open-message-box?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/app-development/how-to-get-and-set-the-main-application-window?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/windows/how-to-get-set-main-application-window?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// Data
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/data/data-binding-overview?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/data/index?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/data/how-to-specify-the-direction-of-the-binding?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/data/binding-declarations-overview?view=netdesktop-5.0#binding-direction"
|
||||
},
|
||||
|
||||
// Systems - XAML
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/xaml-resources-define?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-overview?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/resources-and-code?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-and-code?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/merged-resource-dictionaries?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-merged-dictionaries?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/how-to-define-and-reference-a-resource?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-how-to-define-and-reference?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/how-to-use-application-resources?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-how-to-use-application?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/how-to-use-systemfonts?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-how-to-use-system?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/how-to-use-system-fonts-keys?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-how-to-use-system?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/how-to-use-systemparameters?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-how-to-use-system?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/how-to-use-system-parameters-keys?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-how-to-use-system?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// XAML
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/advanced/xaml-in-wpf?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/xaml/index?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// section?
|
||||
//{
|
||||
// "Redirect": "TwoWay",
|
||||
// "SourceUrl": "/dotnet/desktop/wpf/aaaaaa?view=netframeworkdesktop-4.8",
|
||||
// "TargetUrl": "/dotnet/desktop/wpf/aaaaaa?view=netdesktop-5.0"
|
||||
//},
|
||||
|
||||
// ========
|
||||
// WPF 3.1 -> 5/6
|
||||
// ========
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/fundamentals/xaml?view=netdesktop-5.0",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/xaml/index?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/fundamentals/xaml-resources-define?view=netdesktop-5.0",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/systems/xaml-resources-overview?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/fundamentals/styles-templates-overview?view=netdesktop-5.0",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/controls/styles-templates-overview?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/fundamentals/styles-templates-create-apply-style?view=netdesktop-5.0",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/controls/how-to-create-apply-style?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/themes/how-to-create-apply-template?view=netdesktop-5.0",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/controls/how-to-create-apply-template?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "NormalDocId",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/data/data-binding-overview?view=netdesktop-5.0",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/data/index?view=netdesktop-5.0"
|
||||
},
|
||||
|
||||
// ========
|
||||
// WPF Index mappings
|
||||
// ========
|
||||
{
|
||||
"Redirect": "Normal",
|
||||
"SourceUrl": "/dotnet/desktop/wpf/migration/index?view=netdesktop-5.0",
|
||||
"TargetUrl": "/dotnet/desktop/wpf/migration/differences-from-net-framework?view=netdesktop-5.0"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
|
@ -0,0 +1,117 @@
|
|||
This tool uses the _definitions.json_ file to generate a _.openpublishing.redirection_ file. If a _.openpublishing.redirection_ file exists in the folder, it's updated and appended to.
|
||||
|
||||
The definitions generate two-way redirects between versioned content. The definition file is a json file that has some config at the start:
|
||||
|
||||
```json
|
||||
{
|
||||
"Moniker1": "netframeworkdesktop-4.8",
|
||||
"RepoPath1": "dotnet-desktop-guide/framework/",
|
||||
"Moniker2": "netdesktop-5.0",
|
||||
"RepoPath2": "dotnet-desktop-guide/net/",
|
||||
"PublishRoot": "/dotnet/desktop/",
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
There are three settings:
|
||||
|
||||
- `Moniker`
|
||||
|
||||
A moniker represents the `?view=` query string value.
|
||||
|
||||
- `RepoPath`
|
||||
|
||||
The repo path represents the folder path to this content in the repo for the Moniker.
|
||||
|
||||
- `PublishRoot`
|
||||
|
||||
This is the root on ms.docs where the content is published to.
|
||||
|
||||
`Moniker1` and `RepoPath1` work together to define a repo path and version. `Moniker2` and `RepoPath2` work together to define another repo path and version. Redirects between monikers require that the path of article `Moniker1` be rewritten in the path as if it exists in the repo where `Moniker2` is.
|
||||
|
||||
When you use the version switcher to move from moniker `netdesktop-5.0` to `netframeworkdesktop-4.8`, it replaces the `?view=` query string, but keeps the same URL file path:
|
||||
|
||||
| Moniker | URL |
|
||||
| - | - |
|
||||
| `Moniker1` | `https://docs.microsoft.com/dotnet/desktop/winforms/creating-event-handlers-in-windows-forms?view=netframeworkdesktop-4.8` |
|
||||
| `Moniker2` | `https://docs.microsoft.com/dotnet/desktop/winforms/creating-event-handlers-in-windows-forms?view=netdesktop-5.0` |
|
||||
|
||||
Based on the publishing path and repo paths of the monikers registered with the build system, you can reverse engineer the path to the source file by continually transforming the URL:
|
||||
|
||||
01. Remove the website:
|
||||
|
||||
```
|
||||
/dotnet/desktop/winforms/creating-event-handlers-in-windows-forms?view=netframeworkdesktop-4.8
|
||||
```
|
||||
|
||||
01. Remove the `PublishRoot`:
|
||||
|
||||
```
|
||||
winforms/creating-event-handlers-in-windows-forms?view=netframeworkdesktop-4.8
|
||||
```
|
||||
|
||||
01. Remove the moniker and append `.md`
|
||||
|
||||
```
|
||||
winforms/creating-event-handlers-in-windows-forms.md
|
||||
```
|
||||
|
||||
01. Add the RepoPath for both monikers to come up with where the file should exist in the repo:
|
||||
|
||||
| Moniker | URL |
|
||||
| - | - |
|
||||
| `RepoPath1` | `dotnet-desktop-guide/framework/winforms/creating-event-handlers-in-windows-forms.md` |
|
||||
| `RepoPath2` | `dotnet-desktop-guide/net/winforms/creating-event-handlers-in-windows-forms.md` |
|
||||
|
||||
If a file exists in both versioned areas of a repo, redirects happen automatically. If a file doesn't exist in one of the versioned folders, say 5.0, you must create a redirect for where the 4.8 version of the file would exist in the 5.0 area. If you then want to be able to redirect in the opposite direction, back from 5.0 to 4.8, you must create another redirect for that scenario too.
|
||||
|
||||
There are more examples in the next section.
|
||||
|
||||
## Entries
|
||||
|
||||
The final part of the config file are all the entries for redirection. A redirect entry looks like the following:
|
||||
|
||||
```json
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/creating-event-handlers-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/forms/events?view=netdesktop-5.0"
|
||||
},
|
||||
```
|
||||
|
||||
The `Redirect` field represents the type of redirect and can be one of the following:
|
||||
|
||||
- `OneWay`
|
||||
|
||||
This generates a redirect from the `SourceUrl` to the `TargetUrl`. The `SourceUrl` is regenerated based moniker and opposite-moniker's url. For example, if the `SourceUrl` contained `Moniker1` (`netframeworkdesktop-4.8`), then the URL has `?view=netframeworkdesktop-4.8` stripped from it and it's rewritten in the #2 repo path, `RepoPath2`:
|
||||
|
||||
```json
|
||||
{
|
||||
"source_path": "dotnet-desktop-guide/net/winforms/creating-event-handlers-in-windows-forms.md",
|
||||
"redirect_url": "/dotnet/desktop/winforms/forms/events?view=netdesktop-5.0"
|
||||
},
|
||||
```
|
||||
|
||||
- `TwoWay`
|
||||
|
||||
This mode works the same as `OneWay` except it creates a redirect, then it swaps the `SourceUrl` and `TargetUrl` paths and creates another redirect. This effectively maps two URLs to each other.
|
||||
|
||||
```json
|
||||
{
|
||||
"source_path": "dotnet-desktop-guide/net/winforms/creating-event-handlers-in-windows-forms.md",
|
||||
"redirect_url": "/dotnet/desktop/winforms/forms/events?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"source_path": "dotnet-desktop-guide/framework/forms/events.md",
|
||||
"redirect_url": "/dotnet/desktop/winforms/winforms/creating-event-handlers-in-windows-forms?view=netdesktop-5.0"
|
||||
},
|
||||
```
|
||||
|
||||
- `Normal`
|
||||
|
||||
This is similar to `OneWay` but it doesn't use any reverse-moniker logic processing. As a convenience, this **will** translate the source url into the source markdown file for you so you don't need to figure out what it is. This is mostly processed just like a normal redirect you create in the redirection file.
|
||||
|
||||
- `NormalDocId`
|
||||
|
||||
This is the same as `Normal` but it adds the `redirect_document_id: true` entry to the redirect.
|
||||
|
|
@ -0,0 +1,169 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
const string OutputFile = ".openpublishing.redirection.json";
|
||||
|
||||
JsonSerializerOptions options = new JsonSerializerOptions
|
||||
{
|
||||
Converters = { new System.Text.Json.Serialization.JsonStringEnumConverter() },
|
||||
ReadCommentHandling = JsonCommentHandling.Skip
|
||||
};
|
||||
|
||||
Document document = JsonSerializer.Deserialize<Document>(System.IO.File.ReadAllText("definitions.json"), options);
|
||||
RedirectsFile redirects = new RedirectsFile();
|
||||
|
||||
if (System.IO.File.Exists(OutputFile))
|
||||
redirects = JsonSerializer.Deserialize<RedirectsFile>(System.IO.File.ReadAllText(OutputFile), options);
|
||||
|
||||
foreach (Entry item in document.Entries)
|
||||
{
|
||||
if (item.Redirect == RedirectType.Normal)
|
||||
CreateNormalEntry(item.SourceUrl, item.TargetUrl, false);
|
||||
|
||||
else if (item.Redirect == RedirectType.NormalDocId)
|
||||
CreateNormalEntry(item.SourceUrl, item.TargetUrl, true);
|
||||
|
||||
else
|
||||
{
|
||||
string sourceMoniker = item.SourceUrl.Contains(document.Moniker1, StringComparison.OrdinalIgnoreCase) ? document.Moniker1 : document.Moniker2;
|
||||
string targetMoniker = sourceMoniker == document.Moniker1 ? document.Moniker2 : document.Moniker1;
|
||||
|
||||
if (item.Redirect == RedirectType.TwoWay)
|
||||
{
|
||||
CreateEntry(sourceMoniker, item.SourceUrl, item.TargetUrl);
|
||||
CreateEntry(targetMoniker, item.TargetUrl, item.SourceUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateEntry(sourceMoniker, item.SourceUrl, item.TargetUrl);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (System.IO.File.Exists(OutputFile))
|
||||
System.IO.File.Delete(OutputFile);
|
||||
|
||||
System.IO.File.WriteAllText(OutputFile, JsonSerializer.Serialize(redirects));
|
||||
|
||||
void CreateEntry(string sourceMoniker, string sourceUrl, string targetUrl)
|
||||
{
|
||||
// Opposite repo paths are used here according to moniker
|
||||
string sourceFile = NormalizeMarkdownIndex(document.MonikerToMarkdown(sourceUrl, sourceMoniker, document.Moniker1 == sourceMoniker ? document.RepoPath2 : document.RepoPath1));
|
||||
redirects.AddRedirect(sourceFile, targetUrl, false);
|
||||
}
|
||||
|
||||
void CreateNormalEntry(string sourceUrl, string targetUrl, bool redirectDocId)
|
||||
{
|
||||
if (sourceUrl.Contains(document.Moniker1, StringComparison.OrdinalIgnoreCase))
|
||||
sourceUrl = document.MonikerToMarkdown(sourceUrl, document.Moniker1, document.RepoPath1);
|
||||
|
||||
else if (sourceUrl.Contains(document.Moniker2, StringComparison.OrdinalIgnoreCase))
|
||||
sourceUrl = document.MonikerToMarkdown(sourceUrl, document.Moniker2, document.RepoPath2);
|
||||
|
||||
redirects.AddRedirect(sourceUrl, targetUrl, redirectDocId);
|
||||
}
|
||||
|
||||
string NormalizeMarkdownIndex(string path) =>
|
||||
path.EndsWith("/.md", StringComparison.OrdinalIgnoreCase) ? path.Replace("/.md", "/index.md", StringComparison.OrdinalIgnoreCase) : path;
|
||||
|
||||
|
||||
enum RedirectType
|
||||
{
|
||||
OneWay,
|
||||
TwoWay,
|
||||
Normal,
|
||||
NormalDocId
|
||||
}
|
||||
|
||||
class Document
|
||||
{
|
||||
public string PublishRoot {get;set;}
|
||||
public string Moniker1 { get; set; }
|
||||
public string RepoPath1 { get; set; }
|
||||
|
||||
public string Moniker2 { get; set; }
|
||||
public string RepoPath2 { get; set; }
|
||||
public Entry[] Entries { get; set; }
|
||||
|
||||
public string MonikerToMarkdown(string input, string moniker, string repoPath) =>
|
||||
input.Replace($"?view={moniker}", "", StringComparison.OrdinalIgnoreCase)
|
||||
.Replace(PublishRoot, repoPath, StringComparison.OrdinalIgnoreCase) + ".md";
|
||||
}
|
||||
|
||||
class Entry
|
||||
{
|
||||
public RedirectType Redirect { get; set; }
|
||||
public string SourceUrl { get; set; }
|
||||
public string TargetUrl { get; set; }
|
||||
}
|
||||
|
||||
class RedirectsFile
|
||||
{
|
||||
private List<RedirectEntry> _redirects = new List<RedirectEntry>();
|
||||
|
||||
public RedirectEntry[] redirections { get => _redirects.ToArray(); set => _redirects = new List<RedirectEntry>(value); }
|
||||
|
||||
public void AddRedirect(string source, string targetUrl, bool redirectDocId)
|
||||
{
|
||||
source = source.Trim();
|
||||
targetUrl = targetUrl.Trim();
|
||||
|
||||
foreach (var item in _redirects)
|
||||
{
|
||||
if (string.Equals(item.source_path, source, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
item.redirect_url = targetUrl;
|
||||
item.redirect_document_id = redirectDocId;
|
||||
return;
|
||||
}
|
||||
}
|
||||
_redirects.Add(new(source, targetUrl, redirectDocId));
|
||||
}
|
||||
}
|
||||
|
||||
class RedirectEntry
|
||||
{
|
||||
public string source_path { get; set; }
|
||||
public string redirect_url { get; set; }
|
||||
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
|
||||
public bool redirect_document_id { get; set; }
|
||||
|
||||
public RedirectEntry() { }
|
||||
|
||||
public RedirectEntry(string source, string targetUrl) =>
|
||||
(source_path, redirect_url) = (source, targetUrl);
|
||||
|
||||
public RedirectEntry(string source, string targetUrl, bool redirectId) =>
|
||||
(source_path, redirect_url, redirect_document_id) = (source, targetUrl, redirectId ? true : default);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
EXAMPLE DEFINITIONS.JSON
|
||||
|
||||
{
|
||||
"Moniker1": "netframeworkdesktop-4.8",
|
||||
"RepoPath1": "dotnet-desktop-guide/framework/",
|
||||
"Moniker2": "netdesktop-5.0",
|
||||
"RepoPath2": "dotnet-desktop-guide/net/",
|
||||
"PublishRoot": "/dotnet/desktop/",
|
||||
"Entries": [
|
||||
|
||||
// ========
|
||||
// WinForms
|
||||
// ========
|
||||
{
|
||||
"Redirect": "TwoWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/how-to-create-a-windows-forms-application-from-the-command-line?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/get-started/create-app-visual-studio?view=netdesktop-5.0"
|
||||
},
|
||||
{
|
||||
"Redirect": "OneWay",
|
||||
"SourceUrl": "/dotnet/desktop/winforms/creating-event-handlers-in-windows-forms?view=netframeworkdesktop-4.8",
|
||||
"TargetUrl": "/dotnet/desktop/winforms/forms/events?view=netdesktop-5.0"
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
|
@ -0,0 +1,14 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="definitions.json">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
Загрузка…
Ссылка в новой задаче