Skip to content

Commit

Permalink
Use SDK style project format. Target .NET 4.6.2. Update Newtonsoft.Json.
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpurcell committed Feb 26, 2022
1 parent ce2408e commit 82798cb
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 62 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RechatTool
Command line tool to download the chat log from a Twitch VOD. Saves the full JSON data and optionally processes it to produce a simple text file. Requires .NET Framework 4.6+.
Command line tool to download the chat log from a Twitch VOD. Saves the full JSON data and optionally processes it to produce a simple text file. Requires .NET Framework 4.6.2+.

Sample usage:
```
Expand Down
4 changes: 2 additions & 2 deletions RechatTool/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ public static string NullIfEmpty(this string s) {
}

public static int? TryParseInt32(this string s) {
return Int32.TryParse(s, out int n) ? n : (int?)null;
return Int32.TryParse(s, out int n) ? n : null;
}

public static long? TryParseInt64(this string s) {
return Int64.TryParse(s, out long n) ? n : (long?)null;
return Int64.TryParse(s, out long n) ? n : null;
}

public static string ToDisplayString(this Version v) {
Expand Down
2 changes: 1 addition & 1 deletion RechatTool/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ private static int Main(string[] args) {
string PeekArg() =>
iArg < args.Length ? args[iArg] : null;
string GetArg(bool optional = false) =>
iArg < args.Length ? args[iArg++] : optional ? (string)null : throw new InvalidArgumentException();
iArg < args.Length ? args[iArg++] : optional ? null : throw new InvalidArgumentException();

try {
string arg = GetArg();
Expand Down
4 changes: 2 additions & 2 deletions RechatTool/Rechat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public static void DownloadFile(long videoId, string path, bool overwrite = fals
if (File.Exists(path) && !overwrite) {
throw new Exception("Output file already exists.");
}
string baseUrl = $"{"https"}://api.twitch.tv/v5/videos/{videoId}/comments";
string baseUrl = $"https://api.twitch.tv/v5/videos/{videoId}/comments";
string nextCursor = null;
int segmentCount = 0;
JObject firstComment = null;
Expand Down Expand Up @@ -83,7 +83,7 @@ private static void AddTwitchApiHeaders(HttpWebRequest request) {

private static TimeSpan? TryGetContentOffset(JObject comment) {
try {
return comment == null ? (TimeSpan?)null : new RechatMessage(comment).ContentOffset;
return comment == null ? null : new RechatMessage(comment).ContentOffset;
}
catch {
return null;
Expand Down
58 changes: 6 additions & 52 deletions RechatTool/RechatTool.csproj
Original file line number Diff line number Diff line change
@@ -1,61 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{D1E4F04E-E71C-469A-A476-476124D2F7EC}</ProjectGuid>
<TargetFramework>net462</TargetFramework>
<OutputType>Exe</OutputType>
<RootNamespace>RechatTool</RootNamespace>
<AssemblyName>RechatTool</AssemblyName>
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<LangVersion>latest</LangVersion>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PropertyGroup Condition="'$(Platform)' == 'AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.12.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Extensions.cs" />
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rechat.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
4 changes: 0 additions & 4 deletions RechatTool/packages.config

This file was deleted.

0 comments on commit 82798cb

Please sign in to comment.