Browse Source

Before revert commit

pull/17/head
oZ-Zo 6 years ago
parent
commit
635d799f2d
  1. BIN
      ToggleAndTextGenerator.txt
  2. 168
      ToggleObjectsGenerator.ps1
  3. 1060
      VS/Script_Gui/Script_Gui_3/MainWindow.xaml
  4. 4432
      Win-10-Setup-Script-GUI.ps1

BIN
ToggleAndTextGenerator.txt

Binary file not shown.

168
ToggleAndTextGenerator.ps1 → ToggleObjectsGenerator.ps1

@ -3,7 +3,7 @@
#region Toggles Text Eng
[Array]$Text_Eng_Privacy =
$Text_Eng_Privacy =
"Turn off `"Connected User Experiences and Telemetry`" service",
"Turn off per-user services",
"Turn off the SQMLogger session at the next computer restart",
@ -22,7 +22,7 @@
"Turn off automatic installing suggested apps",
"Do not let track app launches to improve Start menu and search results"
[Array]$Text_Eng_UI =
$Text_Eng_UI =
"Show `"This PC`" on Desktop",
"Set File Explorer to open to This PC by default",
"Show Hidden Files, Folders, and Drives",
@ -61,9 +61,9 @@
"Use the PrtScn button to open screen snipping",
"Automatically adjust active hours for me based on daily usage"
[Array]$Text_Eng_OneDrive = "Uninstall OneDrive"
$Text_Eng_OneDrive = "Uninstall OneDrive", ""
[Array]$Text_Eng_System =
$Text_Eng_System =
"Turn on Storage Sense to automatically free up space",
"Run Storage Sense every month",
"Delete temporary files that apps aren't using",
@ -109,35 +109,35 @@
"Turn off thumbnail cache removal",
"Turn On automatically save my restartable apps when sign out and restart them after sign in"
[Array]$Text_Eng_StartMenu =
$Text_Eng_StartMenu =
"Do not show recently added apps on Start menu",
"Open shortcut to the Command Prompt from Start menu as Administrator",
"Add old style shortcut for `"Devices and Printers`" to the Start menu",
"Import Start menu layout from pre-saved reg file",
"Unpin all Start menu tiles"
[Array]$Text_Eng_Edge =
$Text_Eng_Edge =
"Turn off Windows Defender SmartScreen for Microsoft Edge",
"Do not allow Microsoft Edge to start and load the Start and New Tab page at Windows startup and each time Microsoft Edge is closed",
"Do not allow Microsoft Edge to pre-launch at Windows startup, when the system is idle, and each time Microsoft Edge is closed",
"Turn off creation of an Edge shortcut on the desktop for each user profile"
#$Text_Eng_UWP =
# "Uninstall all UWP apps from all accounts, except the followings...",
# "Uninstall all provisioned UWP apps from System account, except the followings..."
$Text_Eng_UWP =
"Uninstall all UWP apps from all accounts, except the followings...",
"Uninstall all provisioned UWP apps from System account, except the followings..."
[Array]$Text_Eng_WindowsGameRecording =
$Text_Eng_WindowsGameRecording =
"Turn off Windows Game Recording and Broadcasting",
"Turn off Game Bar",
"Turn off Game Mode",
"Turn off Game Bar tips"
[Array]$Text_Eng_ScheduledTasks =
$Text_Eng_ScheduledTasks =
"Create a task in the Task Scheduler to start Windows cleaning up",
"Create a task in the Task Scheduler to clear the $env:SystemRoot\SoftwareDistribution\Download folder",
"Create a task in the Task Scheduler to clear the $env:TEMP folder"
[Array]$Text_Eng_MicrosoftDefender =
$Text_Eng_MicrosoftDefender =
"Add folder to exclude from Windows Defender Antivirus scan",
"Turn on Controlled folder access and add protected folders",
"Allow an app through Controlled folder access",
@ -147,7 +147,7 @@
"Hide notification about sign in with Microsoft in the Windows Security",
"Hide notification about disabled SmartScreen for Microsoft Edge"
[Array]$Text_Eng_ContextMenu =
$Text_Eng_ContextMenu =
"Add `"Extract`" to MSI file type context menu",
"Add `"Run as different user`" from context menu for .exe file type",
"Add `"Install`" to CAB file type context menu",
@ -169,7 +169,7 @@
#endregion Toggles Text Eng
#region Toggles Text Ru
[Array]$Text_Ru_Privacy =
$Text_Ru_Privacy =
"Отключить службу `"Функциональные возможности для подключенных пользователей и телеметрия`"",
"Отключить пользовательские службы",
"Отключить сборщик SQMLogger при следующем запуске ПК",
@ -188,7 +188,7 @@
"Отключить автоматическую установку рекомендованных приложений",
"Не разрешать Windows отслеживать запуски приложений для улучшения меню `"Пуск`" и результатов поиска и не показывать недавно добавленные приложения"
[Array]$Text_Ru_UI =
$Text_Ru_UI =
"Отобразить `"Этот компьютер`" на рабочем столе",
"Открывать `"Этот компьютер`" в Проводнике",
"Показывать скрытые файлы, папки и диски",
@ -227,9 +227,9 @@
"Использовать клавишу Print Screen, чтобы запустить функцию создания фрагмента экрана",
"Автоматически изменять период активности для этого устройства на основе действий"
[Array]$Text_Ru_OneDrive = "Удалить OneDrive"
$Text_Ru_OneDrive = "Удалить OneDrive", ""
[Array]$Text_Ru_System =
$Text_Ru_System =
"Включить Память устройства для автоматического освобождения места",
"Запускать контроль памяти каждый месяц",
"Удалять временные файлы, не используемые в приложениях",
@ -275,35 +275,35 @@
"Отключить удаление кэша миниатюр",
"Автоматически сохранять мои перезапускаемые приложения при выходе из системы и перезапустить их после выхода"
[Array]$Text_Ru_StartMenu =
$Text_Ru_StartMenu =
"Не показывать недавно добавленные приложения в меню `"Пуск`"",
"Запускать ярлык к командной строке в меню `"Пуск`" от имени Администратора",
"Добавить ярлык старого формата для `"Устройства и принтеры`" в меню Пуск",
"Импорт настроенного макета меню `"Пуск`" из заготовленного reg-файла",
"Открепить все ярлыки от начального экрана"
[Array]$Text_Ru_Edge =
$Text_Ru_Edge =
"Отключить Windows Defender SmartScreen в Microsoft Edge",
"Не разрешать Edge запускать и загружать страницу при загрузке Windows и каждый раз при закрытии Edge",
"Не разрешать предварительный запуск Edge при загрузке Windows, когда система простаивает, и каждый раз при закрытии Edge",
"Отключить создание ярлыка Edge на рабочем столе для каждого профиля пользователя пользователя"
#$Text_Ru_UWP =
# "Удалить все UWP-приложения из всех учетных записей, кроме следующих...",
# "Удалить все UWP-приложения из системной учетной записи, кроме следующих..."
$Text_Ru_UWP =
"Удалить все UWP-приложения из всех учетных записей, кроме следующих...",
"Удалить все UWP-приложения из системной учетной записи, кроме следующих..."
[Array]$Text_Ru_WindowsGameRecording =
$Text_Ru_WindowsGameRecording =
"Отключить Запись и трансляции игр Windows",
"Отключить игровую панель",
"Отключить игровой режим",
"Отключить подсказки игровой панели"
[Array]$Text_Ru_ScheduledTasks =
$Text_Ru_ScheduledTasks =
"Создать задачу в Планировщике задач по очистке обновлений Windows",
"Создать задачу в Планировщике задач по очистке папки %SystemRoot%\SoftwareDistribution\Download",
"Создать задачу в Планировщике задач по очистке папки %TEMP%"
[Array]$Text_Ru_MicrosoftDefender =
$Text_Ru_MicrosoftDefender =
"Добавить папку в список исключений сканирования Защитника Windows",
"Включить контролируемый доступ к папкам и добавить защищенные папки",
"Разрешить работу приложения через контролируемый доступ к папкам",
@ -313,7 +313,7 @@
"Скрыть уведомление Защитника Windows об использовании аккаунта Microsoft",
"Скрыть уведомление Защитника Windows об отключенном фильтре SmartScreen для Microsoft Edge"
[Array]$Text_Ru_ContextMenu =
$Text_Ru_ContextMenu =
"Добавить пункт `"Extract`" для MSI в контекстное меню",
"Добавить `"Запуск от имени друго пользователя`" в контекстное меню для .exe файлов",
"Добавить пункт `"Установить`" для CAB-файлов в контекстном меню",
@ -336,75 +336,57 @@
#endregion Toggles Text
$curDir = $MyInvocation.MyCommand.Definition | Split-Path -Parent
$resultFile = "{0}\ToggleAndTextGenerator.txt"-f $curDir
$toggles = New-Object System.Collections.ArrayList($null)
$textE = New-Object System.Collections.ArrayList($null)
$textR = New-Object System.Collections.ArrayList($null)
$textBlockUid = 0
$toggleUid = 1000
$category = "ContextMenu", "Edge", "MicrosoftDefender", "OneDrive", "Privacy", "ScheduledTasks",
"StartMenu", "System", "UI", "WindowsGameRecording"
if (Test-Path -Path $resultFile)
{
Remove-Item -Path $resultFile -Confirm:$false -Force
Write-Warning -Message "Файл ""$resultFile"" удален!"
}
$categoryArray = "Text_Eng_ContextMenu", "Text_Eng_Edge", "Text_Eng_MicrosoftDefender", "Text_Eng_OneDrive",
"Text_Eng_Privacy", "Text_Eng_ScheduledTasks", "Text_Eng_StartMenu", "Text_Eng_System", "Text_Eng_UI", "Text_Eng_WindowsGameRecording"
$category | %{
$catName = "$_"
$textEng = Get-Variable -Name ("Text_Eng_$catName")
$textRu = Get-Variable -Name ("Text_Ru_$catName")
if ($textEng.Value.Count -eq $textRu.Value.Count)
$textblockuid = 0
$toggleuid = 999
for ($j=0;$j -lt $categoryArray.Count; $j++)
{
$categoryName = $categoryArray[$j].Split("_")[2]
$categoryEng = Get-Variable -Name $categoryArray[$j]
$categoryRu = Get-Variable -Name ($categoryArray[$j] -replace "Eng", "Ru")
for ($i=0; $i -lt $categoryEng.Value.Length; $i++)
{
[Void]$toggles.Add("------------ $catName ------------")
for ($i=0;$i -lt $textEng.Value.Count;$i++)
$name = "Toggle_{0}_{1}"-f $categoryName, $i
$textblock = "Text{0}"-f $name
$toggleuid++
$eng = $categoryEng.Value[$i]
$ru = $categoryRu.Value[$i]
if ($eng.Contains('"'))
{
$strE = $textEng.Value[$i]
$strR = $textRu.Value[$i]
if ($strE.Contains('"')) {$strE = $strE.Replace('"', '""')}
if ($strR.Contains('"')) {$strR = $strR.Replace('"', '""')}
[Void]$textE.Add("""{0}"","-f $strE)
[Void]$textR.Add("""{0}"","-f $strR)
$toggleName = "Toggle_{0}_{1}"-f $catName, $toggleUid
$textblockName = "Text_{0}_{1}"-f $catName, $textBlockUid
$template = @"
<Border Style="{StaticResource ToggleBorder}">
<DockPanel Margin="0 10 0 10">
<Grid HorizontalAlignment="Left">
<ToggleButton Name="$toggleName" Uid="$toggleUid" Style="{StaticResource ToggleSwitchLeftStyle}" IsChecked="False"/>
<TextBlock Name="$textblockName" Uid="$textBlockUid" Text="" Margin="65 0 10 0" VerticalAlignment="Center" TextWrapping="Wrap" IsHitTestVisible="False">
<TextBlock.Style>
<Style TargetType="{x:Type TextBlock}">
<Style.Triggers>
<DataTrigger Binding="{Binding ElementName=$toggleName, Path=IsChecked}" Value="True">
<Setter Property="Foreground" Value="#3F51B5"/>
</DataTrigger>
</Style.Triggers>
</Style>
</TextBlock.Style>
</TextBlock>
</Grid>
</DockPanel>
</Border>
"@
[Void]$toggles.Add($template)
$toggleUid++
$textBlockUid++
$eng = $eng.Replace('"', '&quot;')
}
[Void]$toggles.Add("------------ $catName ------------")
}
else
{
Write-Warning -Message "Количество строк в массивах ""$textEng"" и ""$textRu"" не совпадает!"
}
if ($eng.Contains('&'))
{
$eng = $eng.Replace('&', '&amp;')
}
if ($ru.Contains('"'))
{
$ru = $ru.Replace('"', '&quot;')
}
if ($ru.Contains('&'))
{
$ru = $ru.Replace('&', '&amp;')
}
@"
@{
Category = "$categoryName"
Checked = "0"
ToggleName = "$name"
TextBlockName = "$textblock"
TextEng = "$eng"
TextRu = "$ru"
TextblockUid = "$textblockuid"
ToggleUid = "$toggleuid"
},
"@
$textblockuid++
}
}
$toggles | Out-File -FilePath $resultFile -Force -Confirm:$false

1060
VS/Script_Gui/Script_Gui_3/MainWindow.xaml

File diff suppressed because it is too large

4432
Win-10-Setup-Script-GUI.ps1

File diff suppressed because it is too large
Loading…
Cancel
Save