Skip to content

Instantly share code, notes, and snippets.

View Anteccq's full-sized avatar
🙃
Yeah!

Anteccq Anteccq

🙃
Yeah!
  • Japan, Nagano => Ishikawa => Tokyo => Kanagawa
  • X @Anteccq
View GitHub Profile
@Anteccq
Anteccq / TimeParser.cs
Last active August 4, 2021 00:15
10 => 10s, 10:10 => 10m 10s などに変換するための Parser
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class TimeParser
{
private const int MaxArrayLength = 4;
public static bool TryParse(string timeString, out TimeSpan time)
@Anteccq
Anteccq / PathInfo.cs
Created March 9, 2021 13:38
パスからディレクトリ名やファイル名を一括で取得する構造体 / struct for get directory and file names from a path
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.IO.Path;
using static System.IO.Directory;
public struct PathInfo
public class IPEndPointFormatter : IJsonFormatter<IPEndPoint>
{
public void Serialize(ref JsonWriter writer, IPEndPoint value, IJsonFormatterResolver formatterResolver)
{
if (value == null) { writer.WriteNull(); return; }
formatterResolver.GetFormatterWithVerify<string>().Serialize(ref writer, $"{value}", formatterResolver);
}
public IPEndPoint Deserialize(ref JsonReader reader, IJsonFormatterResolver formatterResolver)