Skip to content

Commit b08ce51

Browse files
committed
add logcat args textbox (fixes #53)
1 parent 6b1cd9a commit b08ce51

File tree

6 files changed

+67
-19
lines changed

6 files changed

+67
-19
lines changed

UnityLauncherPro/App.config

+3
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@
9393
<setting name="runAutomaticallyMinimized" serializeAs="String">
9494
<value>False</value>
9595
</setting>
96+
<setting name="adbLogCatArgs" serializeAs="String">
97+
<value>-s Unity ActivityManager PackageManager dalvikvm DEBUG -v color</value>
98+
</setting>
9699
</UnityLauncherPro.Properties.Settings>
97100
</userSettings>
98101
</configuration>

UnityLauncherPro/MainWindow.xaml

+24-15
Original file line numberDiff line numberDiff line change
@@ -759,14 +759,14 @@
759759
<TabItem Header="Tools" Style="{DynamicResource TabItemStyle1}" Padding="0,0,0,0" Margin="-1,1,1,-1" BorderBrush="{x:Null}" Background="Black">
760760
<Grid>
761761
<Grid.RowDefinitions>
762-
<RowDefinition Height="15*" />
762+
<RowDefinition Height="124" />
763763
<RowDefinition Height="50*" />
764764
</Grid.RowDefinitions>
765765
<!-- 1st part -->
766766
<Grid Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Left">
767-
<StackPanel Orientation="Vertical" Margin="10">
768-
<Border HorizontalAlignment="Left" VerticalAlignment="Top">
769-
<StackPanel Orientation="Horizontal" Margin="10">
767+
<StackPanel Orientation="Vertical" Margin="10" VerticalAlignment="Top">
768+
<Border VerticalAlignment="Top" Height="50" HorizontalAlignment="Left">
769+
<StackPanel Orientation="Horizontal" Margin="0,10,10,10" VerticalAlignment="Top" Width="560">
770770
<Label Content="Folders" Foreground="{DynamicResource ThemeButtonForeground}" />
771771
<Button Style="{StaticResource CustomButton}" x:Name="btnOpenEditorLogsFolder" Margin="0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="BtnOpenEditorLogsFolder_Click" ToolTip="Browse Editor logs folder">
772772
<Label Content="_Editor Logs" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
@@ -782,17 +782,26 @@
782782
</Button>
783783
</StackPanel>
784784
</Border>
785-
<Border HorizontalAlignment="Left" VerticalAlignment="Top">
786-
<StackPanel Orientation="Horizontal" Margin="10">
787-
<Label Content="Tools" Foreground="{DynamicResource ThemeButtonForeground}" />
788-
<Button Style="{StaticResource CustomButton}" x:Name="btnOpenADBLogCat" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="BtnOpenADBLogCat_Click" ToolTip="Start ADB logcat commandline">
789-
<Label Content="_ADB logcat" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
790-
</Button>
791-
<Button Style="{StaticResource CustomButton}" x:Name="btnAdbBindWifi" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="BtnAdbBindWifi_Click" IsEnabled="False" ToolTip="Bind Android device to wireless ADB">
792-
<Label Content="_Bind Wifi" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
793-
</Button>
794-
</StackPanel>
795-
</Border>
785+
<!--adb args textbox-->
786+
<!--<Border VerticalAlignment="Top" Height="40">-->
787+
<StackPanel Orientation="Horizontal" Margin="2" VerticalAlignment="Top">
788+
<Label Content="Tools" Foreground="{DynamicResource ThemeButtonForeground}" />
789+
<Button Style="{StaticResource CustomButton}" x:Name="btnOpenADBLogCat" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" Click="BtnOpenADBLogCat_Click" ToolTip="Start ADB logcat commandline">
790+
<Label Content="_ADB logcat" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
791+
</Button>
792+
<!--<StackPanel Orientation="Horizontal">-->
793+
<Label Content="Args:" Foreground="{DynamicResource ThemeButtonForeground}" HorizontalAlignment="Left" VerticalAlignment="Top" VerticalContentAlignment="Center" Margin="0,1,0,-4" />
794+
<Grid Background="{DynamicResource ThemeTextBoxBackground}" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="0,5,0,0" Height="20" >
795+
<TextBox Width="420" Text="-s Unity ActivityManager PackageManager dalvikvm DEBUG -v color" CaretBrush="{DynamicResource ThemeSearchCaret}" x:Name="txtLogCatArgs" Background="Transparent" BorderBrush="{x:Null}" Foreground="{DynamicResource ThemeSearchForeground}" SelectionBrush="{DynamicResource ThemeSearchSelection}" BorderThickness="0" Margin="2,2,0,0" UndoLimit="32" TextChanged="TxtLogCatArgs_TextChanged" />
796+
</Grid>
797+
<!--</StackPanel>-->
798+
<Button Style="{StaticResource CustomButton}" x:Name="btnResetLogCatArgs" Margin="10,0,0,0" BorderBrush="{x:Null}" HorizontalAlignment="Left" VerticalAlignment="Top" ToolTip="Reset to default logcat args" Click="BtnResetLogCatArgs_Click">
799+
<Label Content="Reset" Foreground="{Binding Path=Foreground, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Control}}}" />
800+
</Button>
801+
</StackPanel>
802+
803+
<!--</Border>-->
804+
796805
</StackPanel>
797806
</Grid>
798807
<!-- 2nd part -->

UnityLauncherPro/MainWindow.xaml.cs

+24-3
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public partial class MainWindow : Window
5252
string defaultDateFormat = "dd/MM/yyyy HH:mm:ss";
5353
public static string currentDateFormat = null;
5454
public static bool useHumanFriendlyDateFormat = false;
55+
const string defaultAdbLogCatArgs = "-s Unity ActivityManager PackageManager dalvikvm DEBUG -v color";
56+
string adbLogCatArgs = defaultAdbLogCatArgs;
5557

5658
Dictionary<string, SolidColorBrush> origResourceColors = new Dictionary<string, SolidColorBrush>();
5759
string themefile = "theme.ini";
@@ -347,7 +349,6 @@ void LoadSettings()
347349
chkUseCustomLastModified.IsChecked = Properties.Settings.Default.useCustomLastModified;
348350
txtCustomDateTimeFormat.Text = Properties.Settings.Default.customDateFormat;
349351

350-
351352
if (Properties.Settings.Default.useCustomLastModified)
352353
{
353354
currentDateFormat = Properties.Settings.Default.customDateFormat;
@@ -392,6 +393,9 @@ void LoadSettings()
392393
}
393394
}
394395

396+
adbLogCatArgs = Properties.Settings.Default.adbLogCatArgs;
397+
txtLogCatArgs.Text = adbLogCatArgs;
398+
395399
} // LoadSettings()
396400

397401

@@ -1124,13 +1128,14 @@ private void BtnOpenPlayerLogs_Click(object sender, RoutedEventArgs e)
11241128

11251129
private void BtnOpenADBLogCat_Click(object sender, RoutedEventArgs e)
11261130
{
1131+
if (string.IsNullOrEmpty(adbLogCatArgs)) return;
1132+
11271133
try
11281134
{
11291135
Process myProcess = new Process();
11301136
var cmd = "cmd.exe";
11311137
myProcess.StartInfo.FileName = cmd;
1132-
// NOTE windows10 cmd line supports ansi colors, otherwise remove -v color
1133-
var pars = " /c adb logcat -s Unity ActivityManager PackageManager dalvikvm DEBUG -v color";
1138+
var pars = " /c adb logcat " + adbLogCatArgs;
11341139
myProcess.StartInfo.Arguments = pars;
11351140
myProcess.Start();
11361141
}
@@ -2217,5 +2222,21 @@ private void TxtSearchBoxBuildReport_TextChanged(object sender, TextChangedEvent
22172222
{
22182223
if (gridBuildReport.ItemsSource != null) FilterBuildReport();
22192224
}
2225+
2226+
private void TxtLogCatArgs_TextChanged(object sender, TextChangedEventArgs e)
2227+
{
2228+
if (this.IsActive == false) return; // dont run code on window init
2229+
Properties.Settings.Default.adbLogCatArgs = txtLogCatArgs.Text;
2230+
Properties.Settings.Default.Save();
2231+
adbLogCatArgs = txtLogCatArgs.Text;
2232+
}
2233+
2234+
private void BtnResetLogCatArgs_Click(object sender, RoutedEventArgs e)
2235+
{
2236+
adbLogCatArgs = defaultAdbLogCatArgs;
2237+
Properties.Settings.Default.adbLogCatArgs = defaultAdbLogCatArgs;
2238+
Properties.Settings.Default.Save();
2239+
txtLogCatArgs.Text = defaultAdbLogCatArgs;
2240+
}
22202241
} // class
22212242
} //namespace

UnityLauncherPro/Properties/Settings.Designer.cs

+12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

UnityLauncherPro/Properties/Settings.settings

+3
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,8 @@
9292
<Setting Name="runAutomaticallyMinimized" Type="System.Boolean" Scope="User">
9393
<Value Profile="(Default)">False</Value>
9494
</Setting>
95+
<Setting Name="adbLogCatArgs" Type="System.String" Scope="User">
96+
<Value Profile="(Default)">-s Unity ActivityManager PackageManager dalvikvm DEBUG -v color</Value>
97+
</Setting>
9598
</Settings>
9699
</SettingsFile>

UnityLauncherPro/Tools.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -808,7 +808,7 @@ static string GetTargetPlatformRaw(string projectPath)
808808
}
809809
else
810810
{
811-
Console.WriteLine("Missing csproj, cannot parse target platform: "+ projectPath);
811+
//Console.WriteLine("Missing csproj, cannot parse target platform: "+ projectPath);
812812
}
813813

814814
return results;

0 commit comments

Comments
 (0)