Skip to content

Commit

Permalink
Merge branch 'debug'
Browse files Browse the repository at this point in the history
  • Loading branch information
nenohi committed Nov 23, 2022
2 parents d122f1a + 7076181 commit 527dbea
Show file tree
Hide file tree
Showing 7 changed files with 174 additions and 12 deletions.
27 changes: 27 additions & 0 deletions MisskeyLiveCommentViewer/App.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="MisskeyLiveCommentViewer.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
Expand All @@ -15,4 +20,26 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
<userSettings>
<MisskeyLiveCommentViewer.Properties.Settings>
<setting name="i" serializeAs="String">
<value />
</setting>
<setting name="server" serializeAs="String">
<value />
</setting>
<setting name="appSecret" serializeAs="String">
<value />
</setting>
<setting name="livetag" serializeAs="String">
<value />
</setting>
<setting name="token" serializeAs="String">
<value />
</setting>
<setting name="instanceurl" serializeAs="String">
<value />
</setting>
</MisskeyLiveCommentViewer.Properties.Settings>
</userSettings>
</configuration>
13 changes: 13 additions & 0 deletions MisskeyLiveCommentViewer/Misskey.cs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,19 @@ public async Task PostNote(string Text)
var response = await client.PostAsync(instanceurl + "/api/notes/create", content);
}
}
public void Setting(string AppSecret,string i,string token,string instanceurl,string livetag)
{
this.appSecret = AppSecret;
this.i = i;
this.token = token;
this.instanceurl = instanceurl;
this.livetag = livetag;
}
public string AppSecret { get => appSecret; }
public string I { get => i; }
public string Token { get => token; }
public string Instanceurl { get => instanceurl; }
public string Livetag { get => livetag; }
}
public class MisskeyConnectObj
{
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 35 additions & 4 deletions MisskeyLiveCommentViewer/MisskeyLiveCommentViewer.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -399,18 +399,49 @@ private async void SendButton_Click(object sender, EventArgs e)
}
}

private async void SendTextBox_KeyUp(object sender, KeyEventArgs e)
private async void MisskeyLiveCommentViewer_Load(object sender, EventArgs e)
{
if(e.KeyCode == Keys.Enter&&!LoginButton.Enabled)
misskey.Setting(Properties.Settings.Default.appSecret,
Properties.Settings.Default.i,
Properties.Settings.Default.token,
Properties.Settings.Default.instanceurl,
Properties.Settings.Default.livetag);
MisskeyID.Text = Properties.Settings.Default.livetag;
if (misskey.I == String.Empty) return;
if (await misskey.CheckToken(misskey.I))
{
LoginButton.Enabled = false;
SendTextBox.Enabled = true;
SendButton.Enabled = true;
ConnectButton_Click(sender, e);
}
}

private void MisskeyLiveCommentViewer_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.i = misskey.I;
Properties.Settings.Default.appSecret = misskey.AppSecret;
Properties.Settings.Default.token = misskey.Token;
Properties.Settings.Default.instanceurl = misskey.Instanceurl;
Properties.Settings.Default.livetag = misskey.Livetag;
Properties.Settings.Default.Save();
}

private async void SendTextBox_KeyDown(object sender, KeyEventArgs e)
{
TextBox textBox = sender as TextBox;
System.Diagnostics.Debug.WriteLine(textBox.ImeMode);
if(textBox.Text == String.Empty) return;
if (e.KeyCode == Keys.Enter && !LoginButton.Enabled)
{
SendTextBox.Enabled = false;
SendButton.Enabled = false;
await misskey.PostNote(SendTextBox.Text);
SendTextBox.Text = "";
SendTextBox.Enabled = true;
SendButton.Enabled = true;
}
}
}
}
public class MisskeyComment
{
Expand Down
2 changes: 1 addition & 1 deletion MisskeyLiveCommentViewer/MisskeyLiveCommentViewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
<IsWebBootstrapper>false</IsWebBootstrapper>
<PublishUrl>publish\</PublishUrl>
<Install>false</Install>
<InstallFrom>Disk</InstallFrom>
Expand All @@ -25,7 +26,6 @@
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>3</ApplicationRevision>
<ApplicationVersion>0.0.0.%2a</ApplicationVersion>
<IsWebBootstrapper>false</IsWebBootstrapper>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
Expand Down
72 changes: 72 additions & 0 deletions MisskeyLiveCommentViewer/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 23 additions & 6 deletions MisskeyLiveCommentViewer/Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -1,7 +1,24 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
<Settings />
</SettingsFile>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="MisskeyLiveCommentViewer.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="i" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="server" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="appSecret" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="livetag" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="token" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="instanceurl" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

0 comments on commit 527dbea

Please sign in to comment.