public async void ExecuteStatement(string statement)
        {
            LogProgress(string.Format("Evaluating '{0}'()...", statement));
            await Run(() => Itr.ExecuteStatement(statement));

            LogProgress(string.Format("'{0}' complete.", statement));
        }
Exemple #2
0
 /// <summary>
 ///     Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked            // Overflow is fine, just wrap
     {
         int hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Rtr != null)
         {
             hashCode = hashCode * 59 + Rtr.GetHashCode();
         }
         if (Rtd != null)
         {
             hashCode = hashCode * 59 + Rtd.GetHashCode();
         }
         if (Itr != null)
         {
             hashCode = hashCode * 59 + Itr.GetHashCode();
         }
         if (Itd != null)
         {
             hashCode = hashCode * 59 + Itd.GetHashCode();
         }
         if (Catr != null)
         {
             hashCode = hashCode * 59 + Catr.GetHashCode();
         }
         if (Tatr != null)
         {
             hashCode = hashCode * 59 + Tatr.GetHashCode();
         }
         return(hashCode);
     }
 }
        public async void EvaluateFunction(string functionName, string param1 = null,
                                           string param2 = null, string param3 = null, string param4 = null
                                           )
        {
            var result = await Run(() => Itr.EvaluateFunction(functionName, param1, param2, param3, param4));

            LogProgress(string.Format("'{0}()' returns: '{1}'", functionName, result));
        }
Exemple #4
0
        /// <summary>
        ///     Returns true if OperationalCapability instances are equal
        /// </summary>
        /// <param name="other">Instance of OperationalCapability to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(OperationalCapability other)
        {
            if (other is null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Rtr == other.Rtr ||
                     Rtr != null &&
                     Rtr.Equals(other.Rtr)
                     ) &&
                 (
                     Rtd == other.Rtd ||
                     Rtd != null &&
                     Rtd.Equals(other.Rtd)
                 ) &&
                 (
                     Itr == other.Itr ||
                     Itr != null &&
                     Itr.Equals(other.Itr)
                 ) &&
                 (
                     Itd == other.Itd ||
                     Itd != null &&
                     Itd.Equals(other.Itd)
                 ) &&
                 (
                     Catr == other.Catr ||
                     Catr != null &&
                     Catr.Equals(other.Catr)
                 ) &&
                 (
                     Tatr == other.Tatr ||
                     Tatr != null &&
                     Tatr.Equals(other.Tatr)
                 ));
        }
Exemple #5
0
    // private List<Vector2> centroidList;

    public static int[,] GenerateRegions(int width, int depth, List <Vector2> centroidList)
    {
        int[,] grid = new int[width, depth];

        foreach ((int countW, int countD) in Itr.Iteration(width, depth))
        {
            float minDistance = float.MaxValue;
            int   count       = 0;
            foreach (Vector2 centroid in centroidList)
            {
                if (Vector3.Distance(new Vector2(countW, countD), centroid) < minDistance)
                {
                    minDistance          = Vector3.Distance(new Vector2(countW, countD), centroid);
                    grid[countW, countD] = count;
                }
                count++;
            }
        }

        return(grid);
    }
Exemple #6
0
        public static bool DownloadSeriesDetails(VideoTags videoTags, bool prioritizeMatchDate, bool dontOverwriteTitle, Log jobLog)
        {
            XPathDocument     Xp;
            XPathNavigator    Nav;
            XPathExpression   Exp;
            XPathNodeIterator Itr;

            // There are no TheTVDB mirrors, so skip that step

            // ******************
            // Get the series ID
            // ******************
            try
            {
                if (!String.IsNullOrWhiteSpace(videoTags.imdbId)) // If we have a specific IMDB movieId specified, look up the movie details on TVDB
                {
                    Xp = new XPathDocument("http://www.thetvdb.com/api/GetSeriesByRemoteID.php?imdbid=" + videoTags.imdbId);
                }
                else if (!String.IsNullOrWhiteSpace(videoTags.tvdbId)) // If we have a specific TVDB seriesId specified, look up the series details
                {
                    // First match by Episode name and then by Original broadcast date (by default prioritize match date is false)
                    if (!MatchSeriesInformation(videoTags, videoTags.tvdbId, prioritizeMatchDate, dontOverwriteTitle, jobLog))
                    {
                        return(MatchSeriesInformation(videoTags, videoTags.tvdbId, !prioritizeMatchDate, dontOverwriteTitle, jobLog));
                    }
                    else
                    {
                        return(true);
                    }
                }
                else // Generic search by name
                {
                    Xp = new XPathDocument("http://www.thetvdb.com/api/GetSeries.php?seriesname=" + videoTags.Title);
                }

                Nav = Xp.CreateNavigator();
                Exp = Nav.Compile("//Data/Series");
                Itr = Nav.Select(Exp);
            }
            catch (Exception e)
            {
                jobLog.WriteEntry("Unable to connect to TVDB\r\nError -> " + e.ToString(), Log.LogEntryType.Warning);
                return(false);
            }

            while (Itr.MoveNext()) // loop through all series returned trying to find a match
            {
                string   seriesID    = XML.GetXMLTagValue("seriesid", Itr.Current.OuterXml);
                string   seriesTitle = XML.GetXMLTagValue("SeriesName", Itr.Current.OuterXml);
                string[] aliasNames  = XML.GetXMLTagValue("AliasNames", Itr.Current.OuterXml).Split('|'); // sometimes the alias matches

                // Compare the series title with the title of the recording
                if ((String.Compare(seriesTitle.Trim(), videoTags.Title.Trim(), CultureInfo.InvariantCulture, (CompareOptions.IgnoreSymbols | CompareOptions.IgnoreCase)) != 0) &&
                    (!aliasNames.Any(s => (String.Compare(s.Trim(), videoTags.Title.Trim(), CultureInfo.InvariantCulture, (CompareOptions.IgnoreSymbols | CompareOptions.IgnoreCase)) == 0))))
                {
                    continue; // Name mismatch
                }
                if (String.IsNullOrWhiteSpace(seriesID))
                {
                    continue; // can't do anything without seriesID
                }
                // First match by Episode name and then by Original broadcast date (by default prioritize match date is false)
                if (!MatchSeriesInformation(videoTags, seriesID, prioritizeMatchDate, dontOverwriteTitle, jobLog))
                {
                    if (MatchSeriesInformation(videoTags, seriesID, !prioritizeMatchDate, dontOverwriteTitle, jobLog))
                    {
                        return(true);
                    }

                    // Else we continue looping through the returned series looking for a match if nothing matches
                }
                else
                {
                    return(true);
                }
            }

            jobLog.WriteEntry("No match found on TVDB", Log.LogEntryType.Debug);

            return(false); // no match found
        }
 public string GetVar(string variable)
 {
     return(Itr.GetVar(variable));
 }