Giter Site home page Giter Site logo

touchportalapi's People

Contributors

jaybz avatar tlewis17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jaybz tarasare

touchportalapi's Issues

Error installing from NuGet package manager

I'm getting this error when intalling through the packages manager:

Error Could not install package 'TouchPortalApi 0.3.2'. You are trying to install this package in a project that targets '.NETFramework, Version = v4.7.2', but the package does not contain assembly references or content files that support that framework. For more information, contact the author of the package.

ArgumentOutOfRangeException in ParseAsUTF8String

Tested both from NuGet and cloned Repo (lastest master commit in picture).

I am not sure why this happens, as I cannot always reproduce it (will update if I figure out more).
When I change values on a valueChoices list in a dynamic action (inlined), some times this happens, and the choice is selected in TouchPortal, but the OnListChangeEventHandler is not called.

image

Message: Specified argument was out of the range of valid values. (Parameter 'start')

   at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument)
   at System.ReadOnlyMemory`1.Slice(Int32 start, Int32 length)
   at System.Buffers.ReadOnlySequence`1.Enumerator.MoveNext()
   at TouchPortalApi.Extensions.ReadOnlySquenceByteExtension.ParseAsUTF8String(ReadOnlySequence`1 slice, Int32 stringLengthEstimate) in C:\Users\oddbj\source\repos\TouchPortalAPI\TouchPortalApi\Extensions\ReadOnlySquenceByteExtension.cs:line 22
   at TouchPortalApi.MessageProcessor.ProcessLine(ReadOnlySequence`1 line) in C:\Users\oddbj\source\repos\TouchPortalAPI\TouchPortalApi\MessageProcessor.cs:line 87

Console Example exits premature if started by TouchPortal

This bug is happens when the plugin is started from TouchPortal with plugin_start_cmd. Not when starting from Visual Studio and connecting to TouchPortal etc.

When a Console application is started by TouchPortal, the Console.ReadLine() does not hold the application.
Therefor this plugin will just skip the ReadLine part, and close the pluigin.

It can be changed to something like:

//Console.ReadLine();
var manualResetEvent = new ManualResetEvent(false);
manualResetEvent.WaitOne();

This will work, but then there is another issue. When TouchPortal closes, the plugin is still running.
Therefor there are two options, either use Environment.Exit(0); in the OnCloseEventHandler.

This is similar to what the Java SDK does:

    @Override
    public void onDisconnect(Exception exception) {
        // Socket connection is lost or plugin has received close message
        if (exception != null) {
            exception.printStackTrace();
        }
        System.exit(0);
    }

Or, pick in the OnCloseEventHandler and do a manualResetEvent.Set().

Using a TaskCompleationSource or similar instead of a ManualResetEvent should also work.

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.