Giter VIP home page Giter VIP logo

assparser's Introduction

AssParser · Publish to nuget Nuget Test

Parse ASS(SubStation Alpha Subtitles) file faster. No Regex. All managed code.

Basic Parse

AssSubtitleModel assfile = Lib.AssParser.ParseAssFile(@"path/to/your/assfile").Result;

# Or async way

AssSubtitleModel assfile = await Lib.AssParser.ParseAssFile(@"path/to/your/assfile");

List used fonted

AssSubtitleModel assfile = Lib.AssParser.ParseAssFile(@"path/to/your/assfile").Result;
FontDetail[] fonts = assfile.UsedFonts();

Where FontDetail is defined as

public class FontDetail : IEquatable<FontDetail?>
{
    public string FontName = "";
    public string UsedChar = "";
    public int Bold;
    public bool IsItalic;

    public override bool Equals(object? obj)
    {
        return Equals(obj as FontDetail);
    }

    public bool Equals(FontDetail? other)
    {
        return other is not null &&
               FontName == other.FontName &&
               Bold == other.Bold &&
               IsItalic == other.IsItalic;
    }

    public override int GetHashCode()
    {
        return HashCode.Combine(FontName, Bold, IsItalic);
    }

    public static bool operator ==(FontDetail? left, FontDetail? right)
    {
        return EqualityComparer<FontDetail>.Default.Equals(left, right);
    }

    public static bool operator !=(FontDetail? left, FontDetail? right)
    {
        return !(left == right);
    }
}

Get extra section

AssSubtitleModel assfile = Lib.AssParser.ParseAssFile(Path.Combine("UUEncodeTest", "1.ass")).Result;
string fontsData = assfile.UnknownSections["[Fonts]"];

Decode & Encode UUEncode

byte[] data = UUEncode.Decode(fontsData, out var crlf);
string encoded = UUEncode.Eecode(data, crlf)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.