Example #1
0
        public bool IsJump()
        {
            var firstCoord  = (Coord)PublicAPI.pdnBoardCoords(Variant.AmericanCheckers.ToGameVariant().pdnMembers)[Move[0]];
            var secondCoord = (Coord)PublicAPI.pdnBoardCoords(Variant.AmericanCheckers.ToGameVariant().pdnMembers)[Move[1]];

            return(Math.Abs(firstCoord.Row - secondCoord.Row) == 2);
        }
Example #2
0
        public void Test_Track_Info()
        {
            PublicAPI deezer = new PublicAPI();
            var       data   = deezer.Search(new Query("Two Door Cinema Club", "What You Know", Type.Track)).GetAwaiter().GetResult();

            Assert.NotNull(data);
        }
Example #3
0
 public Bitso(string key, string secret, bool production = false)
 {
     BITSO_KEY            = key;
     BITSO_SECRET         = secret;
     BITSO_API_URL        = production ? "https://api.bitso.com" : "https://api-dev.bitso.com";
     BITSO_VERSION_PREFIX = "/api/v3/";
     PrivateAPI           = new PrivateAPI(this);
     PublicAPI            = new PublicAPI(this);
     AccountCreationAPI   = new AccountCreationAPI(this);
 }
Example #4
0
        public bool StopResource(string resourceName, Resource[] resourceParent = null)
        {
            Resource ourRes;

            lock (RunningResources)
            {
                ourRes = RunningResources.FirstOrDefault(r => r.DirectoryName == resourceName);
                if (ourRes == null)
                {
                    return(false);
                }

                Program.Output("Stopping " + resourceName);

                RunningResources.Remove(ourRes);
            }

            ourRes.Engines.ForEach(en => en.InvokeResourceStop());

            var msg = Server.CreateMessage();

            msg.Write((byte)PacketType.StopResource);
            msg.Write(resourceName);
            Server.SendToAll(msg, NetDeliveryMethod.ReliableOrdered);

            if (Gamemode == ourRes)
            {
                if (CurrentMap != null && CurrentMap != ourRes)
                {
                    StopResource(CurrentMap.DirectoryName);
                    CurrentMap = null;
                }

                Gamemode = null;
            }

            if (ourRes.MapEntities != null)
            {
                foreach (var entity in ourRes.MapEntities)
                {
                    PublicAPI.deleteEntity(entity);
                }
            }

            if (CurrentMap == ourRes)
            {
                CurrentMap = null;
            }

            var gPool = ExportedFunctions as IDictionary <string, object>;

            if (gPool != null && gPool.ContainsKey(ourRes.DirectoryName))
            {
                gPool.Remove(ourRes.DirectoryName);
            }
            CommandHandler.Unregister(ourRes.DirectoryName);
            FileModule.ExportedFiles.Remove(resourceName);
            lock (RunningResources)
            {
                foreach (var resource in RunningResources)
                {
                    resource.Engines.ForEach(en => en.InvokeServerResourceStop(ourRes.DirectoryName));
                }
            }

            Program.Output("Stopped " + resourceName + "!");
            return(true);
        }