Skip to content

Commit 8387152

Browse files
committed
Fixed Scaling Issue
- Fixed Scaling Issue with ChatPromptLabels - Added toggle to disable multi-line chats
1 parent 559671c commit 8387152

37 files changed

+234
-98
lines changed
28.5 KB
Binary file not shown.

SyncPlayWPF/SyncPlayWPF/Common/Settings.cs

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class Settings {
1111

1212

1313
private static XElement basics = new XElement("Basics",
14-
new XElement("Address", ""),
14+
new XElement("Address", "SyncPlay.pl:8995"),
1515
new XElement("Username", ""),
1616
new XElement("Password", ""),
1717
new XElement("RoomName", ""),
@@ -25,16 +25,20 @@ public class Settings {
2525
new XElement("PauseWhenAUserLeavesOrGetDisconnected", "True"),
2626
new XElement("SyncMyReadyToWatchStatusWithPlayState", "True"),
2727
new XElement("NeverSlowDownOrRewindOther", "False"),
28-
new XElement("FastForwardIfLaggingBehind", "True")
28+
new XElement("FastForwardIfLaggingBehind", "True"),
29+
new XElement("DisableUnsyncModeAfterRemoteFileChange", "True"),
30+
new XElement("ResyncWithOthersAfterDisablingUnsyncMode", "True"),
31+
new XElement("ChangeLocalStateToReSyncWithOthers", "True")
2932
);
3033

3134
private static XElement chatbehaviour = new XElement("Chat",
3235
new XElement("ShowMessagesInPlayerWindow", "True"),
36+
new XElement("AllowMultiLineMessages", "False"),
3337
new XElement("PlayNotificationSound", "False"),
3438
new XElement("DisableAnimations", "False"),
3539
new XElement("AutoplayGifs", "False"),
3640
new XElement("PreviewLinks", "False"),
37-
new XElement("EnableOSDMessages", ""),
41+
new XElement("EnableOSDMessages", "True"),
3842
new XElement("ShowEventsInYourRoom", "True"),
3943
new XElement("ShowEventsFromNonOperatorsInManagedRooms", "False"),
4044
new XElement("ShowEventsInOtherRooms", "False"),
@@ -62,14 +66,21 @@ public class Settings {
6266
);
6367

6468
public static void DefineSharedSettings() {
69+
6570
Common.Shared.CurrentConfig = XDocument.Parse(System.IO.File.ReadAllText("SyncPlayConfig.xml"));
71+
6672
}
6773

6874
public static void RestoreDefaultConfiguration() {
6975
if (System.IO.File.Exists("SyncPlayConfig.xml")) {
7076
XDocument doc = XDocument.Parse(System.IO.File.ReadAllText("SyncPlayConfig.xml"));
7177
foreach (var sectiontag in NewConfig.Element("Config").Elements()) {
7278
foreach (var proptag in sectiontag.Elements()) {
79+
80+
if (!doc.Element("Config").Element(sectiontag.Name).Elements().Any(t => t.Name == proptag.Name)) {
81+
doc.Element("Config").Element(sectiontag.Name).Add(new XElement(proptag.Name));
82+
}
83+
7384
doc.Element("Config").Element(sectiontag.Name).Element(proptag.Name).Value = proptag.Value;
7485
}
7586
}
@@ -116,8 +127,20 @@ public static string GetCurrentConfigStringValue(string section, string attribut
116127
}
117128

118129
public static void WriteConfigurationToView(Pages.SettingsPage Page) {
119-
XDocument doc = XDocument.Parse(System.IO.File.ReadAllText("SyncPlayConfig.xml"));
130+
XDocument doc = null;
131+
doc = XDocument.Parse(System.IO.File.ReadAllText("SyncPlayConfig.xml"));
132+
try {
133+
WriteConfig(Page, doc);
134+
} catch (Exception) {
135+
RestoreDefaultConfiguration();
136+
DefineSharedSettings();
137+
WriteConfig(Page, doc);
138+
}
120139

140+
141+
}
142+
143+
private static void WriteConfig(Pages.SettingsPage Page, XDocument doc) {
121144
Page.ServerAddressField.Text = GetStringValue(doc, "Basics", "Address");
122145
Page.UsernameField.Text = GetStringValue(doc, "Basics", "Username");
123146
Page.RoomNameField.Text = GetStringValue(doc, "Basics", "RoomName");
@@ -130,8 +153,13 @@ public static void WriteConfigurationToView(Pages.SettingsPage Page) {
130153
Page.SyncReadyToPlayWithPauseState.IsChecked = GetBooleanValue(doc, "Behaviour", "SyncMyReadyToWatchStatusWithPlayState");
131154
Page.NeverSlowDownOrRewindOthers.IsChecked = GetBooleanValue(doc, "Behaviour", "NeverSlowDownOrRewindOther");
132155
Page.FastForwardIfLagginingBehind.IsChecked = GetBooleanValue(doc, "Behaviour", "FastForwardIfLaggingBehind");
156+
Page.DisableUnsyncModeAfterRemoteFileChange.IsChecked = GetBooleanValue(doc, "Behaviour", "DisableUnsyncModeAfterRemoteFileChange");
157+
Page.ResyncWithOthersAfterDisablingUnsyncMode.IsChecked = GetBooleanValue(doc, "Behaviour", "ResyncWithOthersAfterDisablingUnsyncMode");
158+
Page.ChangeLocalStateToReSyncWithOthers.IsChecked = GetBooleanValue(doc, "Behaviour", "DisableUnsyncModeAfterRemoteFileChange");
159+
133160

134161
Page.ShowMessagesInPlayerWindow.IsChecked = GetBooleanValue(doc, "Chat", "ShowMessagesInPlayerWindow");
162+
Page.AllowMultiLineMessages.IsChecked = GetBooleanValue(doc, "Chat", "AllowMultiLineMessages");
135163
Page.PlayNotificationSound.IsChecked = GetBooleanValue(doc, "Chat", "PlayNotificationSound");
136164
Page.DisableAnimations.IsChecked = GetBooleanValue(doc, "Chat", "DisableAnimations");
137165
Page.AutoPlayGIFs.IsChecked = GetBooleanValue(doc, "Chat", "AutoplayGifs");

SyncPlayWPF/SyncPlayWPF/Pages/SessionPages/ChatSession.xaml.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,9 +167,14 @@ private void SendMessageEnterClick(object sender, KeyEventArgs e) {
167167
return;
168168
};
169169
if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) {
170-
MessageBlockField.Text += "\n";
171-
MessageBlockField.MoveToEndPosition();
172-
return;
170+
if (Common.Settings.GetCurrentConfigBoolValue("Chat", "AllowMultiLineMessages")) {
171+
MessageBlockField.Text += "\n";
172+
MessageBlockField.MoveToEndPosition();
173+
return;
174+
} else {
175+
Common.Shared.NotificationLayer.CreateNotification("Multi-line Chat", "Multi-line chat messages have been disabled. Enable it and try again");
176+
return;
177+
}
173178
}
174179
SendMessage();
175180
}

SyncPlayWPF/SyncPlayWPF/Pages/SettingsPage.xaml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,13 @@
7070

7171
<Label Grid.Row="6" Margin="0,15,0,0" Content="Unsync Mode" Foreground="{StaticResource DarkMode_TextColorE}" FontWeight="DemiBold"/>
7272
<StackPanel Grid.Row="7">
73-
<CheckBox Margin="20,0,0,0" Content="Disable unsync after remote file change" Style="{StaticResource GenericCheckboxLowFidelity}"/>
73+
<CheckBox x:Name="DisableUnsyncModeAfterRemoteFileChange" Margin="20,0,0,0" Content="Disable unsync after remote file change" Style="{StaticResource GenericCheckboxLowFidelity}"/>
7474
</StackPanel>
7575

7676
<Label Grid.Row="4" Margin="0,15,0,0" Content="After disabling unsync mode... " Foreground="{StaticResource DarkMode_TextColorE}" FontWeight="DemiBold"/>
7777
<StackPanel Grid.Row="5">
78-
<CheckBox Margin="20,0,0,0" Content="Resync with others" Style="{StaticResource GenericCheckboxLowFidelity}"/>
79-
<CheckBox Margin="20,0,0,0" Content="Change local state to re-sync with others" Style="{StaticResource GenericCheckboxLowFidelity}"/>
78+
<CheckBox x:Name="ResyncWithOthersAfterDisablingUnsyncMode" Margin="20,0,0,0" Content="Resync with others" Style="{StaticResource GenericCheckboxLowFidelity}"/>
79+
<CheckBox x:Name="ChangeLocalStateToReSyncWithOthers" Margin="20,0,0,0" Content="Change local state to re-sync with others" Style="{StaticResource GenericCheckboxLowFidelity}"/>
8080
</StackPanel>
8181

8282

@@ -94,6 +94,7 @@
9494
<Label Margin="0,0,0,0" Content="Chat settings" Foreground="{StaticResource DarkMode_TextColorE}" FontWeight="DemiBold"/>
9595
<StackPanel Grid.Row="1">
9696
<CheckBox x:Name="ShowMessagesInPlayerWindow" Margin="20,0,0,0" Content="Show messages in player window" IsChecked="True" Style="{StaticResource GenericCheckboxLowFidelity}"/>
97+
<CheckBox x:Name="AllowMultiLineMessages" Margin="20,0,0,0" Content="Allow sending multi-line messages" IsChecked="False" Style="{StaticResource GenericCheckboxLowFidelity}"/>
9798
<CheckBox x:Name="PlayNotificationSound" Margin="20,0,0,0" Content="Play notification sound" Style="{StaticResource GenericCheckboxLowFidelity}"/>
9899
<CheckBox x:Name="DisableAnimations" Margin="20,0,0,0" Content="Disable animations" Style="{StaticResource GenericCheckboxLowFidelity}"/>
99100
<CheckBox x:Name="AutoPlayGIFs" Margin="20,0,0,0" Content="Autoplay GIFs" Style="{StaticResource GenericCheckboxLowFidelity}"/>

SyncPlayWPF/SyncPlayWPF/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// You can specify all the values or you can default the Build and Revision Numbers
5252
// by using the '*' as shown below:
5353
// [assembly: AssemblyVersion("1.0.*")]
54-
[assembly: AssemblyVersion("2021.256.15.0")]
55-
[assembly: AssemblyFileVersion("2021.256.15.0")]
54+
[assembly: AssemblyVersion("2021.256.28.0")]
55+
[assembly: AssemblyFileVersion("2021.256.28.0")]

SyncPlayWPF/SyncPlayWPF/SyncPlay/NetworkClient.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,12 @@ public bool Connect() {
4646

4747

4848
public void Disconnect() {
49-
this.client.GetStream().Close();
50-
this.client.Close();
49+
try {
50+
this.client.GetStream().Close();
51+
this.client.Close();
52+
} catch (Exception _) {
53+
54+
}
5155
}
5256

5357
public void ActivateTLS() {

SyncPlayWPF/SyncPlayWPF/SyncPlayWPF.csproj.user

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,7 @@
1010
<FallbackCulture>en-US</FallbackCulture>
1111
<VerifyUploadedFiles>false</VerifyUploadedFiles>
1212
</PropertyGroup>
13+
<PropertyGroup>
14+
<EnableSecurityDebugging>false</EnableSecurityDebugging>
15+
</PropertyGroup>
1316
</Project>

SyncPlayWPF/SyncPlayWPF/Themes/Generic.xaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,7 @@
800800
Name="UserInputBox"
801801
TextWrapping="Wrap"
802802
Background="Transparent"
803+
HorizontalAlignment="Left"
803804
CaretBrush="{StaticResource DarkMode_TextColorF}"
804805
Foreground="{StaticResource DarkMode_TextColorF}"
805806
Text="{Binding RelativeSource={RelativeSource Mode=TemplatedParent}, Path=Text,Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
@@ -815,6 +816,8 @@
815816
Focusable="False"
816817
FontStyle="Italic"
817818
FontWeight="Normal"
819+
HorizontalAlignment="Left"
820+
Width="{Binding Path=ActualWidth, ElementName=ContainerGrid, Converter={StaticResource PercentageConverter}, ConverterParameter='0.9'}"
818821
Foreground="{StaticResource DarkMode_TextColorC}"
819822
Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=PromptingText}">
820823
<TextBlock.Style>

SyncPlayWPF/SyncPlayWPF/bin/Release/SyncPlayConfig.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<Config>
22
<!--Basics and Stuff-->
33
<Basics>
4-
<Address>localhost:5005</Address>
5-
<Username>User 2</Username>
4+
<Address>SyncPlay.pl:8995</Address>
5+
<Username>Sam</Username>
66
<Password></Password>
77
<RoomName>ck</RoomName>
88
<PathToMediaPlayer>C:\Program Files\mpv.net\mpvnet.exe</PathToMediaPlayer>
@@ -16,24 +16,28 @@
1616
<SyncMyReadyToWatchStatusWithPlayState>True</SyncMyReadyToWatchStatusWithPlayState>
1717
<NeverSlowDownOrRewindOther>False</NeverSlowDownOrRewindOther>
1818
<FastForwardIfLaggingBehind>True</FastForwardIfLaggingBehind>
19+
<DisableUnsyncModeAfterRemoteFileChange>True</DisableUnsyncModeAfterRemoteFileChange>
20+
<ResyncWithOthersAfterDisablingUnsyncMode>True</ResyncWithOthersAfterDisablingUnsyncMode>
21+
<ChangeLocalStateToReSyncWithOthers>True</ChangeLocalStateToReSyncWithOthers>
1922
</Behaviour>
2023
<!--Chat Behaviour Settings-->
2124
<Chat>
2225
<ShowMessagesInPlayerWindow>True</ShowMessagesInPlayerWindow>
2326
<PlayNotificationSound>False</PlayNotificationSound>
2427
<DisableAnimations>False</DisableAnimations>
2528
<AutoplayGifs>False</AutoplayGifs>
26-
<PreviewLinks>False</PreviewLinks>
27-
<EnableOSDMessages>False</EnableOSDMessages>
28-
<ShowEventsInYourRoom>False</ShowEventsInYourRoom>
2929
<ShowEventsFromNonOperatorsInManagedRooms>False</ShowEventsFromNonOperatorsInManagedRooms>
3030
<ShowEventsInOtherRooms>False</ShowEventsInOtherRooms>
3131
<ShowSlowingDownRevertingNotifications>True</ShowSlowingDownRevertingNotifications>
3232
<ShowWarnings>True</ShowWarnings>
33+
<AllowMultiLineMessages>False</AllowMultiLineMessages>
34+
<PreviewLinks>False</PreviewLinks>
35+
<EnableOSDMessages>True</EnableOSDMessages>
36+
<ShowEventsInYourRoom>False</ShowEventsInYourRoom>
3337
</Chat>
3438
<!--Security Settings. Sekuriti-->
3539
<Security>
36-
<EnableTLS>False</EnableTLS>
40+
<EnableTLS>True</EnableTLS>
3741
<HashFileNamesBeforeSending>False</HashFileNamesBeforeSending>
3842
<HashPasswords>True</HashPasswords>
3943
</Security>

SyncPlayWPF/SyncPlayWPF/bin/Release/SyncPlayWPF.application

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<dsig:Transform Algorithm="urn:schemas-microsoft-com:HashTransforms.Identity" />
1515
</dsig:Transforms>
1616
<dsig:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha256" />
17-
<dsig:DigestValue>2rjljIIfncTyvMlOIGQUEs376h+b2JPbryFked+HKWI=</dsig:DigestValue>
17+
<dsig:DigestValue>58LGdpjmUToOBOaVdWbmcl5ocLQjNSxYy4P6vqe53to=</dsig:DigestValue>
1818
</hash>
1919
</dependentAssembly>
2020
</dependency>

0 commit comments

Comments
 (0)