Ejemplo n.º 1
0
 /// <summary>
 /// Add new entity to bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// New entity
 /// </param>
 /// <param name='prefer'>
 /// Required in order for the service to return a JSON representation of the
 /// object.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <MicrosoftDynamicsCRMbcgovLocation> CreateAsync(this ILocations operations, MicrosoftDynamicsCRMbcgovLocation body, string prefer = "return=representation", CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.CreateWithHttpMessagesAsync(body, prefer, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 2
0
        public override string ManageLocations()
        {
            try
            {
                ILocationsData locationsData = dataFactory.CreateLocationsData();
                ILocations     locations     = locationsData.GetLocationsAll();

                IFlagImageData flagImageData = dataFactory.CreateFlagImageData();
                flagImageData.AddFlagsToCountries(locations.countries);

                IBackupData backupData = dataFactory.CreateBackupData();
                backupData.SetBackup(locations);

                List <IEntity> entities = entityFactory.CreateEntities();
                entities.Add(locations);

                return(responseFactory.CreateResponse("", entities));
            }
            catch (Exception ex)
            {
                string message = String.Format("Exception caught: {0}", ex);
                logger.LogMessage(message);
                return(responseFactory.CreateResponse(message, null));
            }
        }
 /// <summary>
 /// Get entities from bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='top'>
 /// </param>
 /// <param name='skip'>
 /// </param>
 /// <param name='search'>
 /// </param>
 /// <param name='filter'>
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='orderby'>
 /// Order items by property values
 /// </param>
 /// <param name='select'>
 /// Select properties to be returned
 /// </param>
 /// <param name='expand'>
 /// Expand related entities
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <LocationsGetResponseModel> GetAsync(this ILocations operations, int?top = default(int?), int?skip = default(int?), string search = default(string), string filter = default(string), bool?count = default(bool?), IList <string> orderby = default(IList <string>), IList <string> select = default(IList <string>), IList <string> expand = default(IList <string>), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(top, skip, search, filter, count, orderby, select, expand, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Get entity from bcgov_locations by key
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bcgovLocationid'>
 /// key: bcgov_locationid
 /// </param>
 /// <param name='select'>
 /// Select properties to be returned
 /// </param>
 /// <param name='expand'>
 /// Expand related entities
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <MicrosoftDynamicsCRMbcgovLocation> GetByKeyAsync(this ILocations operations, string bcgovLocationid, IList <string> select = default(IList <string>), IList <string> expand = default(IList <string>), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetByKeyWithHttpMessagesAsync(bcgovLocationid, select, expand, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 5
0
 public void AddNeighbor(ILocations to, Directions direction)
 {
     if (FindNeighbor(to, direction) == false)
     {
         _neighbors.Add(direction,to);
     }
     throw new Exception();
 }
Ejemplo n.º 6
0
        public bool Explore(IActor player, ILocations locations, int count)
        {
            var j = locations.GetEnumerator();

            if (locations as ExitLocations != null)
            {
                if (count > 0)
                {
                    while (j.MoveNext())
                    {
                        Explore(player, j.Current as ILocations, count--);

                    }

                }
                else
                {
                    locations.EnterLocation(player);
                    locations.ExitLocation(player);
                    return false;
                }

            }

            var t =  (locations as ContainerLocation).GetPlayerMarker(player);

            if (t.Equals(null))
            {

                locations.EnterLocation(player);
                locations.ExitLocation(player);
                while (j.MoveNext())
                {

                    Explore(player, j.Current as ILocations, count--);

                }

            }
            if(t.Equals(Marker._green))
            {
                locations.EnterLocation(player);
                locations.ExitLocation(player);
                while (j.MoveNext())
                {

                    Explore(player, j.Current as ILocations, count);

                }

            }

            return false;
        }
Ejemplo n.º 7
0
        public void GameStart()
        {
            _game1.BuildTerrian();
            _start = _game1.Start;
            (log as TripRecorder).Subscribe(_start as LocationDecorator);
            (_first as Algorithm1).Explore(player, _start, count);

            (_start as LocationDecorator).EndUpdate();

            Console.WriteLine(log.GetRecordLog());
        }
 static LocationHelper()
 {
     if (PlatformDetection.IsWindows)
     {
         locations = new LocationHelperWindows();
     }
     else
     {
         locations = new LocationHelperUnix();
     }
 }
Ejemplo n.º 9
0
 public ClashOfClansDIClient(IClans clans,
                             ILocations locations,
                             ILeagues leagues,
                             IPlayers players,
                             ILabels labels,
                             IGoldPass goldPass)
 {
     Clans     = clans;
     Locations = locations;
     Leagues   = leagues;
     Players   = players;
     Labels    = labels;
     GoldPass  = goldPass;
 }
Ejemplo n.º 10
0
        ///<summary>
        /// Builds the logs
        ///</summary>
        private void BuildLog(ILocations location)
        {
            var j = (location as ILocationDecorator).GetNeighbors;

            _log.Append(location.ToString());
            _log.Append(":");
             GetValue(location);
            _log.AppendLine();
            foreach (KeyValuePair<Directions,ILocations> p in j)
            {
                _log.Append("  ");
                _log.Append(p.Key.ToString());
                _log.Append("-->");
                _log.Append(p.Value.ToString());
                 GetValue(p.Value);
                _log.AppendLine();
            }
        }
Ejemplo n.º 11
0
        ///<summary>
        /// allows the exploration and adds to the build log
        ///</summary>
        private void Explore(ILocations location)
        {
            if((_set.Contains(location) ) == false)
            {
                BuildLog(location);
                _set.Add(location);

                var j = location.GetEnumerator();
                while (j.MoveNext())
                {
                    if (j.Current != null)
                    {
                        Explore(j.Current as ILocations);
                    }

                }

            }
            return;
        }
Ejemplo n.º 12
0
 /// <summary>
 /// Update entity in bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bcgovLocationid'>
 /// key: bcgov_locationid
 /// </param>
 /// <param name='body'>
 /// New property values
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task UpdateAsync(this ILocations operations, string bcgovLocationid, MicrosoftDynamicsCRMbcgovLocation body, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.UpdateWithHttpMessagesAsync(bcgovLocationid, body, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Ejemplo n.º 13
0
 /// <summary>
 /// Update entity in bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bcgovLocationid'>
 /// key: bcgov_locationid
 /// </param>
 /// <param name='body'>
 /// New property values
 /// </param>
 public static void Update(this ILocations operations, string bcgovLocationid, MicrosoftDynamicsCRMbcgovLocation body)
 {
     operations.UpdateAsync(bcgovLocationid, body).GetAwaiter().GetResult();
 }
Ejemplo n.º 14
0
 private bool FindNeighbor(ILocations from, Directions to)
 {
     foreach (KeyValuePair<Directions,ILocations> loc in _neighbors)
     {
         if (loc.Value.Equals(from.Name) && loc.Key.Equals(to))
             return true;
     }
     return false;
 }
Ejemplo n.º 15
0
 /// <summary>
 /// Add reference to adoxio_workers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='locationId'>
 /// key: locationId
 /// </param>
 /// <param name='fieldname'>
 /// key: fieldname
 /// </param>
 /// <param name='odataid'>
 /// reference value
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task AddReferenceAsync(this ILocations operations, string locationId, string fieldname, OdataId odataid = default(OdataId), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.AddReferenceWithHttpMessagesAsync(locationId, fieldname, odataid, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Ejemplo n.º 16
0
 public ContainerLocation(ILocations location)
 {
     _location = location;
     _saveState = new Dictionary<IActor,Marker>();
     _check = new Flag();
 }
Ejemplo n.º 17
0
 /// <summary>
 /// checks if it is a deadend
 /// </summary>
 public bool DeadEndCheck(ILocations location)
 {
     return (_location as ContainerLocation).DeadEndCheck(location);
 }
Ejemplo n.º 18
0
 public abstract void ExploreTerrain(ILocations startingLocations);
Ejemplo n.º 19
0
 /// <summary>
 /// checks to see see if its a dead end.
 /// </summary>
 public bool DeadEndCheck(ILocations location)
 {
     if (location != null)
        return DeadEnd(location);
        else
        return false;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Get entities from bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='top'>
 /// </param>
 /// <param name='skip'>
 /// </param>
 /// <param name='search'>
 /// </param>
 /// <param name='filter'>
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='orderby'>
 /// Order items by property values
 /// </param>
 /// <param name='select'>
 /// Select properties to be returned
 /// </param>
 /// <param name='expand'>
 /// Expand related entities
 /// </param>
 public static GetOKResponseModelModelModelModelModelModelModelModelModelModelModel Get(this ILocations operations, int?top = default(int?), int?skip = default(int?), string search = default(string), string filter = default(string), bool?count = default(bool?), IList <string> orderby = default(IList <string>), IList <string> select = default(IList <string>), IList <string> expand = default(IList <string>))
 {
     return(operations.GetAsync(top, skip, search, filter, count, orderby, select, expand).GetAwaiter().GetResult());
 }
Ejemplo n.º 21
0
 public void RemoveMember(ILocations location)
 {
     _bucket.Remove(location.Name);
 }
Ejemplo n.º 22
0
 public void AddMember(ILocations location)
 {
     _bucket.Add(location.Name,location);
 }
 public MyController(ILocations myLocations)
 {
     this.myLocations = myLocations;
 }
Ejemplo n.º 24
0
        public void Explore(IActor player, ILocations locations, Control flag)
        {
            if (flag.Flag == true)
            {
                var j = locations.GetEnumerator();

                var t = ((ILocationDecorator) locations).GetPlayerMarker(player);

                if (locations as IExit != null && flag.Flag == true)
                {

                    locations.EnterLocation(player);
                     locations.ExitLocation(player);
                    flag.Flag = false;

                    //if ((flag.Count > 0 && t == null))
                   // {
                       // locations.EnterLocation(player);
                       // locations.ExitLocation(player);
                       // var i = flag.Count;
                       // flag.Count = (i - 1);
                       // return;
                        /*

                        while (j.MoveNext())
                        {
                            if (j.Current != null)
                            {
                                if (((LocationDecorator) j.Current).GetPlayerMarker(player) != null)
                                {
                                    if (!((LocationDecorator) j.Current).GetPlayerMarker(player).Equals(Marker._red))
                                    {
                                        Explore(player, j.Current as ILocations, flag);
                                    }

                                }
                                else if (((LocationDecorator) j.Current).GetPlayerMarker(player) == null)
                                {
                                    Explore(player, j.Current as ILocations, flag);

                                }
                            }
                        */
                    }

                  //  if (t != null && flag.Count < 1)
                   // {
                        //locations.EnterLocation(player);
                       // locations.ExitLocation(player);
                       // flag.Flag = false;
                       // return;

                        /*
                            while (j.MoveNext())
                            {
                                if (j.Current != null)
                                {
                                    if (((LocationDecorator) j.Current).GetPlayerMarker(player) != null)
                                    {
                                        if (!((LocationDecorator) j.Current).GetPlayerMarker(player).Equals(Marker._red))
                                        {
                                            Explore(player, j.Current as ILocations, count, flag);
                                        }

                                    }
                                    else if (((LocationDecorator) j.Current).GetPlayerMarker(player) == null)
                                    {
                                        Explore(player, j.Current as ILocations, count, flag);

                                    }
                                }

                            }
                            */
                   // }

               // }

                if (t == null && flag.Flag == true)
                {

                       goto Loop;

                }
                else if (((ILocationDecorator) locations).GetPlayerMarker(player).Equals(Marker._green) &&
                         flag.Flag == true)
                {
                     goto Loop;

                }

               //Goto comes here
               Loop:

                locations.EnterLocation(player);
                locations.ExitLocation(player);

                while (j.MoveNext())
                {
                    if (j.Current != null)
                    {
                        if (((ILocationDecorator)j.Current).GetPlayerMarker(player) != null)
                        {
                            if (((ILocationDecorator)j.Current).GetPlayerMarker(player).Equals(Marker._green))
                            {
                                Explore(player, j.Current as ILocations, flag);
                            }
                        }
                        else if (((ILocationDecorator)j.Current).GetPlayerMarker(player) == null)
                        {
                            Explore(player, j.Current as ILocations, flag);
                        }
                    }

                }

                return;

            }
        }
Ejemplo n.º 25
0
 /// <summary>
 /// Add new entity to bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='body'>
 /// New entity
 /// </param>
 /// <param name='prefer'>
 /// Required in order for the service to return a JSON representation of the
 /// object.
 /// </param>
 public static MicrosoftDynamicsCRMbcgovLocation Create(this ILocations operations, MicrosoftDynamicsCRMbcgovLocation body, string prefer = "return=representation")
 {
     return(operations.CreateAsync(body, prefer).GetAwaiter().GetResult());
 }
Ejemplo n.º 26
0
 /// <summary>
 /// Get entities from bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='top'>
 /// </param>
 /// <param name='filter'>
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='orderby'>
 /// Order items by property values
 /// </param>
 /// <param name='select'>
 /// Select properties to be returned
 /// </param>
 /// <param name='expand'>
 /// Expand related entities
 /// </param>
 public static MicrosoftDynamicsCRMbcgovLocationCollection Get(this ILocations operations, int?top = default(int?), string filter = default(string), bool?count = default(bool?), IList <string> orderby = default(IList <string>), IList <string> select = default(IList <string>), IList <string> expand = default(IList <string>))
 {
     return(operations.GetAsync(top, filter, count, orderby, select, expand).GetAwaiter().GetResult());
 }
Ejemplo n.º 27
0
 //returns true if there is a neighbor in a particular direction for a given location
 private bool FindNeighbor(ILocations from, Directions to)
 {
     return _neighbors.Any(loc => loc.Value.Equals(from.Name) && loc.Key.Equals(to));
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Get entities from bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='top'>
 /// </param>
 /// <param name='filter'>
 /// </param>
 /// <param name='count'>
 /// </param>
 /// <param name='orderby'>
 /// Order items by property values
 /// </param>
 /// <param name='select'>
 /// Select properties to be returned
 /// </param>
 /// <param name='expand'>
 /// Expand related entities
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <MicrosoftDynamicsCRMbcgovLocationCollection> GetAsync(this ILocations operations, int?top = default(int?), string filter = default(string), bool?count = default(bool?), IList <string> orderby = default(IList <string>), IList <string> select = default(IList <string>), IList <string> expand = default(IList <string>), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.GetWithHttpMessagesAsync(top, filter, count, orderby, select, expand, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
Ejemplo n.º 29
0
        private bool DeadEnd(ILocations location)
        {
            if(_check.GreenFlag == true)
               {
               if (location.Count < 1)
               {
                   _check.GreenFlag = false;
                   _check.RedFlag = true;
                   return true;
               }

               }
               else
               {
               _check.GreenFlag = true;

               }
               return false;
        }
Ejemplo n.º 30
0
 public UpdateRequest(IActor player, ILocations location, Flag flag)
 {
     _player = player;
     _location = location;
     _flag = flag;
 }
Ejemplo n.º 31
0
 public bool DeadEndCheck(ILocations location)
 {
     if(location != null)
        return DeadEnd(location);
     throw new ArgumentNullException();
 }
Ejemplo n.º 32
0
 /// <summary>
 /// Add reference to adoxio_workers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='locationId'>
 /// key: adoxio_workerid
 /// </param>
 /// <param name='fieldname'>
 /// key: fieldname
 /// </param>
 /// <param name='odataid'>
 /// reference value
 /// </param>
 public static void AddReference(this ILocations operations, string locationId, string fieldname, OdataId odataid = default(OdataId))
 {
     operations.AddReferenceAsync(locationId, fieldname, odataid).GetAwaiter().GetResult();
 }
Ejemplo n.º 33
0
 public override void AddNeighbor(ILocations to, Directions direction)
 {
     _location.AddNeighbor(to, direction);
 }
Ejemplo n.º 34
0
        ///<summary>
        /// appends the markers to the log
        ///</summary>
        private void GetValue(ILocations location)
        {
            if (location as IExit != null)
            {
                _log.Append(" Exit ");
            }

            var t = (location as ILocationDecorator).GetPlayerMarker(_player);
            if (t != null)
            {
                if (t.Equals(Marker._green))
                {
                    _log.Append(" Green Marker");
                }
                else
                {
                    _log.Append(" Red Marker");
                }
            }
        }
Ejemplo n.º 35
0
 public ExitLocations(ILocations location)
 {
     _location = location;
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Get entity from bcgov_locations by key
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bcgovLocationid'>
 /// key: bcgov_locationid
 /// </param>
 /// <param name='select'>
 /// Select properties to be returned
 /// </param>
 /// <param name='expand'>
 /// Expand related entities
 /// </param>
 public static MicrosoftDynamicsCRMbcgovLocation GetByKey(this ILocations operations, string bcgovLocationid, IList <string> select = default(IList <string>), IList <string> expand = default(IList <string>))
 {
     return(operations.GetByKeyAsync(bcgovLocationid, select, expand).GetAwaiter().GetResult());
 }
Ejemplo n.º 37
0
 /// <summary>
 /// Do not need this
 /// </summary>
 public override void ExploreTerrain(ILocations startingLocations)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Delete entity from bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bcgovLocationid'>
 /// key: bcgov_locationid
 /// </param>
 /// <param name='ifMatch'>
 /// ETag
 /// </param>
 public static void Delete(this ILocations operations, string bcgovLocationid, string ifMatch = default(string))
 {
     operations.DeleteAsync(bcgovLocationid, ifMatch).GetAwaiter().GetResult();
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Remove reference to adoxio_workers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='locationId'>
 /// key: adoxio_workerid
 /// </param>
 /// <param name='fieldname'>
 /// key: fieldname
 /// </param>
 /// <param name='odataid'>
 /// reference value
 /// </param>
 public static void RemoveReference(this ILocations operations, string locationId, string fieldname, string removeId)
 {
     operations.RemoveReferenceAsync(locationId, fieldname, removeId).GetAwaiter().GetResult();
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Delete entity from bcgov_locations
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='bcgovLocationid'>
 /// key: bcgov_locationid
 /// </param>
 /// <param name='ifMatch'>
 /// ETag
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task DeleteAsync(this ILocations operations, string bcgovLocationid, string ifMatch = default(string), CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.DeleteWithHttpMessagesAsync(bcgovLocationid, ifMatch, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Remove reference to adoxio_workers
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='locationId'>
 /// key: locationId
 /// </param>
 /// <param name='fieldname'>
 /// key: fieldname
 /// </param>
 /// <param name='odataid'>
 /// reference value
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task RemoveReferenceAsync(this ILocations operations, string locationId, string fieldname, string removeId, CancellationToken cancellationToken = default(CancellationToken))
 {
     (await operations.RemoveReferenceWithHttpMessagesAsync(locationId, fieldname, removeId, null, cancellationToken).ConfigureAwait(false)).Dispose();
 }
Ejemplo n.º 42
0
 public JsonArticlesService(ILocations locations)
 {
     this.locations = locations;
 }