//////////////////////////////////////// ///////////GUI AND EDITOR STUFF///////// //////////////////////////////////////// #if UNITY_EDITOR protected override void OnTaskInspectorGUI(){ if (!Application.isPlaying && GUILayout.Button("Select Property")){ System.Action<MethodInfo> MethodSelected = (method)=> { functionWrapper = ReflectedFunctionWrapper.Create(method, blackboard); checkValue = BBParameter.CreateInstance( method.ReturnType, blackboard); comparison = CompareMethod.EqualTo; }; if (agent != null){ EditorUtils.ShowGameObjectMethodSelectionMenu(agent.gameObject, typeof(object), typeof(object), MethodSelected, 0, true, true); } else { var menu = new UnityEditor.GenericMenu(); foreach (var t in UserTypePrefs.GetPreferedTypesList(typeof(Component), true)) menu = EditorUtils.GetMethodSelectionMenu(t, typeof(object), typeof(object), MethodSelected, 0, true, true, menu); menu.ShowAsContext(); Event.current.Use(); } } if (targetMethod != null){ GUILayout.BeginVertical("box"); UnityEditor.EditorGUILayout.LabelField("Type", agentType.FriendlyName()); UnityEditor.EditorGUILayout.LabelField("Property", targetMethod.Name); GUILayout.EndVertical(); GUI.enabled = checkValue.varType == typeof(float) || checkValue.varType == typeof(int); comparison = (CompareMethod)UnityEditor.EditorGUILayout.EnumPopup("Comparison", comparison); GUI.enabled = true; EditorUtils.BBParameterField("Value", checkValue); } }
//////////////////////////////////////// ///////////GUI AND EDITOR STUFF///////// //////////////////////////////////////// protected override void OnTaskInspectorGUI() { if (!Application.isPlaying && GUILayout.Button("Select Field")){ System.Action<FieldInfo> FieldSelected = (field)=> { targetType = field.DeclaringType; fieldName = field.Name; checkValue = BBParameter.CreateInstance(field.FieldType, blackboard); comparison = CompareMethod.EqualTo; }; if (agent != null){ EditorUtils.ShowGameObjectFieldSelectionMenu(agent.gameObject, typeof(object), FieldSelected); } else { var menu = new UnityEditor.GenericMenu(); foreach (var t in UserTypePrefs.GetPreferedTypesList(typeof(Component), true)) menu = EditorUtils.GetFieldSelectionMenu(t, typeof(object), FieldSelected, menu); menu.ShowAsContext(); Event.current.Use(); } } if (agentType != null && !string.IsNullOrEmpty(fieldName)){ GUILayout.BeginVertical("box"); UnityEditor.EditorGUILayout.LabelField("Type", agentType.FriendlyName()); UnityEditor.EditorGUILayout.LabelField("Field", fieldName); GUILayout.EndVertical(); GUI.enabled = checkValue.varType == typeof(float) || checkValue.varType == typeof(int); comparison = (CompareMethod)UnityEditor.EditorGUILayout.EnumPopup("Comparison", comparison); GUI.enabled = true; EditorUtils.BBParameterField("Value", checkValue); } }
public static List<float> BinaryFilter(List<float> list, CompareMethod compareMethod, float value) { int direction = (compareMethod == CompareMethod.smallerThan) ? -1 : 1; int middleIndex = 0, offset = 0; bool done = false; int firstIndex = 0; int lastIndex = list.Count - 1; while (!done) { middleIndex = GetMiddleIndex(firstIndex, lastIndex); float indexVal = list[middleIndex]; if (indexVal == value) { done = true; } else if (indexVal > value) { if (lastIndex - firstIndex <= 1) { done = true; offset = 1; } else { lastIndex = middleIndex; } } else if (indexVal < value) { if (lastIndex - firstIndex <= 1) { done = true; offset = -1; } else { firstIndex = middleIndex; } } } if (direction == -1 && (offset <= 0)) return list.GetRange(0, middleIndex + 1); else if (direction == 1 && (offset >= 0)) return list.GetRange(middleIndex, list.Count - middleIndex); else if (direction == 1 && offset == -1) return list.GetRange(middleIndex + 1, list.Count - (middleIndex + 1)); else if (direction == -1 && offset == 1) return list.GetRange(0, middleIndex); return null; }
public static bool Compare(float a, float b, CompareMethod cm, float floatingPoint) { if (cm == CompareMethod.EqualTo) return Mathf.Abs(a - b) <= floatingPoint; if (cm == CompareMethod.GreaterThan) return a > b; if (cm == CompareMethod.LessThan) return a < b; return true; }
public static bool Compare(int a, int b, CompareMethod cm) { if (cm == CompareMethod.EqualTo) return a == b; if (cm == CompareMethod.GreaterThan) return a > b; if (cm == CompareMethod.LessThan) return a < b; return true; }
public static string GetCompareString(CompareMethod cm) { if (cm == CompareMethod.EqualTo) return " == "; if (cm == CompareMethod.GreaterThan) return " > "; if (cm == CompareMethod.LessThan) return " < "; return string.Empty; }
public static string[] Split(string s, string sDelimiter, int nLimit, CompareMethod Compare) { ArrayList lst = new ArrayList(); int nOffset = 0; if ( sDelimiter == String.Empty ) sDelimiter = " "; while ( (nOffset = s.IndexOf(sDelimiter)) >= 0 ) { if ( nLimit > 0 && lst.Count == nLimit-1 ) break; lst.Add(s.Substring(0, nOffset)); s = s.Substring(nOffset + sDelimiter.Length); } if ( lst.Count == 0 || s.Length > 0 ) lst.Add(s); return lst.ToArray(typeof(System.String)) as string[]; }
public int CompareTo(TotalEntry y, CompareMethod method) { switch (method) { case CompareMethod.recvBytes: return RecvBytes.CompareTo(y.RecvBytes); case CompareMethod.recvTime: return RecvTime.CompareTo(y.RecvTime); case CompareMethod.sentBytes: return SentBytes.CompareTo(y.SentBytes); case CompareMethod.sentTime: return SentBytes.CompareTo(y.SentTime); case CompareMethod.proc: return ProcTime.CompareTo(y.ProcTime); case CompareMethod.method: return Method.CompareTo(y.Method); case CompareMethod.call: return CallCount.CompareTo(y.CallCount); case CompareMethod.deserTime: return DeserTime.CompareTo(y.DeserTime); case CompareMethod.methodTime: return MethodTime.CompareTo(y.MethodTime); case CompareMethod.serTime: return SerTime.CompareTo(y.SerTime); case CompareMethod.zipTime: return ZipTime.CompareTo(y.ZipTime); } return 0; }
/// <summary> /// Gets the comparison format string. /// </summary> /// <param name="compare">The compare.</param> /// <returns>System.String.</returns> /// <exception cref="ArgumentOutOfRangeException">CompareMethod is not mapped to an action.</exception> public static string GetComparisonFormat(CompareMethod compare) { var comparisonString = ""; switch (compare) { case CompareMethod.Equal: comparisonString = "\r\n AND {1} = @{0}"; break; case CompareMethod.NotEqual: comparisonString = "\r\n AND {1} <> @{0}"; break; case CompareMethod.LessThan: comparisonString = "\r\n AND {1} < @{0}"; break; case CompareMethod.LessThanOrEqual: comparisonString = "\r\n AND {1} <= @{0}"; break; case CompareMethod.GreaterThan: comparisonString = "\r\n AND {1} > @{0}"; break; case CompareMethod.GreaterThanOrEqual: comparisonString = "\r\n AND {1} >= @{0}"; break; case CompareMethod.StartsWith: comparisonString = "\r\n AND {1} LIKE @{0} + '%'"; break; case CompareMethod.EndsWith: comparisonString = "\r\n AND {1} LIKE '%' + @{0}"; break; case CompareMethod.Contains: comparisonString = "\r\n AND {1} LIKE '%' + @{0} + '%'"; break; case CompareMethod.Ignore: break; case CompareMethod.Override: break; default: throw new ArgumentOutOfRangeException(nameof(compare), compare, null); } return comparisonString; }
private static int FilterInternal (String[] source, String Match, bool Include, CompareMethod Compare, String[] result) { int count = 0; CompareInfo compare = CultureInfo.CurrentCulture.CompareInfo; foreach(String value in source) { if(value == null) { continue; } if(Include) { if(Compare == CompareMethod.Binary) { if(value.IndexOf(Match) != -1) { if(result != null) { result[count] = value; } ++count; } } else if(compare.IndexOf (value, Match, CompareOptions.IgnoreCase) != -1) { if(result != null) { result[count] = value; } ++count; } } else if(Compare == CompareMethod.Binary) { if(value == Match) { if(result != null) { result[count] = value; } ++count; } } else if(compare.Compare (value, Match, CompareOptions.IgnoreCase) == 0) { if(result != null) { result[count] = value; } ++count; } } return count; }
/// <summary> /// Create a new instance of ConditionCompare. /// </summary> /// <param name="compareTo">The value that will be compared with facts.</param> /// <param name="method">The CompareMethod to use. It will always compare the fact with the value specified in this instance. So, for example, if the method is LessThan, it will evaluate fact < compareTo.</param> public ConditionCompare(Fact compareTo, CompareMethod method) { this.compareTo = compareTo; this.method = method; }
public static int InStr(int Start, string String1, string String2, CompareMethod Compare) { }
private static int MultipleAsteriskSkip(string Pattern, string Source, int Count, CompareMethod CompareOption) { int num = Strings.Len(Source); while (Count < num) { string Source1 = Source.Substring(checked (num - Count)); bool flag; try { flag = StringType.StrLike(Source1, Pattern, CompareOption); } catch (StackOverflowException ex) { throw ex; } catch (OutOfMemoryException ex) { throw ex; } catch (ThreadAbortException ex) { throw ex; } catch (Exception ex) { flag = false; } if (!flag) { checked { ++Count; } } else { break; } } return(Count); }
public static int InStrRev(string StringCheck, string StringMatch, int Start, CompareMethod Compare) { }
public static string[] Split(string Expression, string Delimiter, int Limit, CompareMethod Compare) { }
public void Filter (CompareMethod compareMethod, double compareValue, string inputSeriesNames, string outputSeriesNames, string usingValue) { throw new NotImplementedException (); }
public static string[] Filter(string[] Source, string Match, bool Include = true, [Microsoft.VisualBasic.CompilerServices.OptionCompareAttribute] CompareMethod Compare = CompareMethod.Binary) { throw null; }
void SetMethod(MethodInfo method) { this.method = new SerializedMethodInfo(method); this.parameters.Clear(); foreach(var p in method.GetParameters()){ var newParam = new BBObjectParameter(p.ParameterType){bb = blackboard}; if (p.IsOptional){ newParam.value = p.DefaultValue; } parameters.Add(newParam); } this.checkValue = new BBObjectParameter(method.ReturnType){bb = blackboard}; comparison = CompareMethod.EqualTo; }
//////////////////////////////////////// ///////////GUI AND EDITOR STUFF///////// //////////////////////////////////////// protected override void OnTaskInspectorGUI() { if (!Application.isPlaying && GUILayout.Button("Select Method")){ if (agent != null){ EditorUtils.ShowGameObjectMethodSelectionMenu(agent.gameObject, typeof(object), typeof(object), SetMethod, 3, false, true); } else { var menu = new UnityEditor.GenericMenu(); foreach (var t in UserTypePrefs.GetPreferedTypesList(typeof(Component), true)) menu = EditorUtils.GetMethodSelectionMenu(t, typeof(object), typeof(object), SetMethod, 3, false, true, menu); menu.ShowAsContext(); Event.current.Use(); } } if (targetMethod != null){ GUILayout.BeginVertical("box"); UnityEditor.EditorGUILayout.LabelField("Type", agentType.FriendlyName()); UnityEditor.EditorGUILayout.LabelField("Method", targetMethod.Name); GUILayout.EndVertical(); var paramNames = targetMethod.GetParameters().Select(p => p.Name.SplitCamelCase() ).ToArray(); for (var i = 0; i < paramNames.Length; i++){ EditorUtils.BBParameterField(paramNames[i], parameters[i]); } GUI.enabled = checkValue.varType == typeof(float) || checkValue.varType == typeof(int); comparison = (CompareMethod)UnityEditor.EditorGUILayout.EnumPopup("Comparison", comparison); GUI.enabled = true; EditorUtils.BBParameterField("Check Value", checkValue); } }
private static int MultipleAsteriskSkip(string Pattern, string Source, int Count, CompareMethod CompareOption) { int num2 = Strings.Len(Source); while (Count < num2) { bool flag; string source = Source.Substring(num2 - Count); try { flag = StrLike(source, Pattern, CompareOption); } catch (StackOverflowException exception) { throw exception; } catch (OutOfMemoryException exception2) { throw exception2; } catch (ThreadAbortException exception3) { throw exception3; } catch (Exception) { flag = false; } if (flag) { return(Count); } Count++; } return(Count); }
public void SetCompareMethod(CompareMethod compareMethod) { this.compareMethod = compareMethod; }
public void Filter (CompareMethod compareMethod, double compareValue, Series inputSeries) { throw new NotImplementedException (); }
public TBinarySTree(CompareMethod <K> compareMethod) { comparator = compareMethod; root = null; _count = 0; }
private async void btnGetData_Click(object sender, EventArgs e) { ResetStatus(); dgvFiles.DataSource = null; dgvFiles.Rows.Clear(); string[,] fileList; try { fileList = FolderPairReader.GetFiles(txtWinFiles.Text, txtOriginalFiles.Text, Settings.Default.IgnoreSystemFiles); } catch (Exception exception) { ExceptionHandler( btnGetData.Parent.Text, "An error occured while obtaining WIN files list!", exception.GetType().Name, exception.Message, exception.StackTrace); return; } try { if (fileList == null) { return; } EnableControlsAndManageTaskbar(false); pbMain.Maximum = fileList.Length / 2; CompareMethod compareMethod = rbBinary.Checked ? CompareMethod.Binary : CompareMethod.ModifyDate; Progress <int> progress = new Progress <int>(fileNumber => { pbMain.Value = fileNumber; tbManager.SetProgressValue(fileNumber, pbMain.Maximum); sslblMain.Text = $"[{btnGetData.Parent.Text}] Reading file set {fileNumber} of {pbMain.Maximum}"; }); await Task.Run(() => ReadResultsList.Generate(fileList, compareMethod, progress)).ContinueWith(t => { SortableBindingList <ReportPair> sbl = new SortableBindingList <ReportPair>(t.Result); dgvFiles.DataSource = sbl; }, TaskScheduler.FromCurrentSynchronizationContext()); sslblMain.Text = $"[{btnGetData.Parent.Text}] Finished - {dgvFiles.RowCount} file(s) processed!"; } catch (Exception ex) { ExceptionHandler( btnGetData.Parent.Text, "An error occured while processing your request!", ex.GetType().Name, ex.Message, ex.StackTrace); } finally { EnableControlsAndManageTaskbar(true); } }
public static string[] Filter(string[] Source, string Match, bool Include, CompareMethod Compare) { }
internal ArrayList SortBy(CompareMethod method) { mCurrentMethod = method; mValues.Sort(this); return mValues; }
public int ShotIDByName(string name, CompareMethod compareMethod = CompareMethod.ExactMatch) { return((int)Invoke("ShotIDByName", name, (int)compareMethod)); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean testValue(int index, Object value, CompareMethod compareMethod) throws InvalidTypeException public override bool testValue(int index, object value, CompareMethod compareMethod) { // do a quick easy check on the type. if (index == 0) { if ((value is string) == false) { throw new InvalidTypeException(); } } else if ((value is long?) == false) { throw new InvalidTypeException(); } switch (compareMethod.Method) { case EventContainer.CompareMethods.EQUAL_TO: if (index == 0) { return processId.Equals(value); } else { return getValueAsLong(index) == (long)((long?)value); } case EventContainer.CompareMethods.LESSER_THAN: return getValueAsLong(index) <= (long)((long?)value); case EventContainer.CompareMethods.LESSER_THAN_STRICT: return getValueAsLong(index) < (long)((long?)value); case EventContainer.CompareMethods.GREATER_THAN: return getValueAsLong(index) >= (long)((long?)value); case EventContainer.CompareMethods.GREATER_THAN_STRICT: return getValueAsLong(index) > (long) ((long?)value); case EventContainer.CompareMethods.BIT_CHECK: return (getValueAsLong(index) & (long)((long?)value)) != 0; } throw new System.IndexOutOfRangeException(); }
private static int AsteriskSkip(string Pattern, string Source, int SourceEndIndex, CompareMethod CompareOption, CompareInfo ci) { int num2; int num4; int num3 = Strings.Len(Pattern); while (num4 < num3) { bool flag; bool flag2; bool flag3; switch (Pattern[num4]) { case '-': if (Pattern[num4 + 1] == ']') { flag2 = true; } break; case '!': if (Pattern[num4 + 1] == ']') { flag2 = true; } else { flag3 = true; } break; case '[': if (flag) { flag2 = true; } else { flag = true; } break; case ']': if (flag2 || !flag) { num2++; flag3 = true; } flag2 = false; flag = false; break; case '*': if (num2 > 0) { CompareOptions ordinal; if (flag3) { num2 = MultipleAsteriskSkip(Pattern, Source, num2, CompareOption); return(SourceEndIndex - num2); } string str = Pattern.Substring(0, num4); if (CompareOption == CompareMethod.Binary) { ordinal = CompareOptions.Ordinal; } else { ordinal = CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreCase; } return(ci.LastIndexOf(Source, str, ordinal)); } break; case '?': case '#': if (flag) { flag2 = true; } else { num2++; flag3 = true; } break; default: if (flag) { flag2 = true; } else { num2++; } break; } num4++; } return(SourceEndIndex - num2); }
/// <summary> /// Specify options as enum. /// </summary> /// <param name="namingConvention"></param> /// <param name="compareMethod"></param> public NotifyAttribute(NamingConvention namingConvention = default(NamingConvention), CompareMethod compareMethod = default(CompareMethod)) { }
extern public static object LikeObject(object Source, object Pattern, CompareMethod CompareOption);
extern public static bool LikeString(string Source, string Pattern, CompareMethod CompareOption);
public static string[] Split(string value, string s, int i, CompareMethod binary) { throw new NotImplementedException(); }
/// <summary> /// Checks that the <code>index</code>-th value of this event against a provided value. </summary> /// <param name="index"> the index of the value to test </param> /// <param name="value"> the value to test against </param> /// <param name="compareMethod"> the method of testing </param> /// <returns> true if the test passed. </returns> /// <exception cref="InvalidTypeException"> in case of type mismatch between the value to test and the value /// to test against, or if the compare method is incompatible with the type of the values. </exception> /// <seealso cref= CompareMethod </seealso> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public boolean testValue(int index, Object value, CompareMethod compareMethod) throws InvalidTypeException public virtual bool testValue(int index, object value, CompareMethod compareMethod) { var type = getType(mData); if (index > 0 && type != EventValueTypes.LIST) { throw new InvalidTypeException(); } object data = mData; if (type == EventValueTypes.LIST) { data = ((object[])mData)[index]; } if (data.GetType().Equals(data.GetType()) == false) { throw new InvalidTypeException(); } switch (compareMethod.Method) { case EventContainer.CompareMethods.EQUAL_TO: return(data.Equals(value)); case EventContainer.CompareMethods.LESSER_THAN: if (data is int) { return(((int)data).CompareTo((int)value) <= 0); } else if (data is long?) { return(((long)data).CompareTo((long)value) <= 0); } // other types can't use this compare method. throw new InvalidTypeException(); case EventContainer.CompareMethods.LESSER_THAN_STRICT: if (data is int) { return(((int)data).CompareTo((int)value) < 0); } else if (data is long) { return(((long)data).CompareTo((long)value) < 0); } // other types can't use this compare method. throw new InvalidTypeException(); case EventContainer.CompareMethods.GREATER_THAN: if (data is int) { return(((int)data).CompareTo((int)value) >= 0); } else if (data is long?) { return(((long)data).CompareTo((long)value) >= 0); } // other types can't use this compare method. throw new InvalidTypeException(); case EventContainer.CompareMethods.GREATER_THAN_STRICT: if (data is int) { return(((int)data).CompareTo((int)value) > 0); } else if (data is long?) { return(((long)data).CompareTo((long)value) > 0); } // other types can't use this compare method. throw new InvalidTypeException(); case EventContainer.CompareMethods.BIT_CHECK: if (data is int) { return(((int)((int)data) & (int)((int)value)) != 0); } else if (data is long?) { return(((long)((long)data) & (long)((long)value)) != 0); } // other types can't use this compare method. throw new InvalidTypeException(); default: throw new InvalidTypeException(); } }
public SortEventArgs(IAVLTreeSort <T> aTree, CompareMethod <T> aMethod, DuplicateHandlingType aDuplicates) { tree = aTree; method = aMethod; duplicateHandling = aDuplicates; }
public static object LikeObject(object Source, object Pattern, CompareMethod CompareOption) { TypeCode empty; TypeCode typeCode; IConvertible convertible = Source as IConvertible; if (convertible == null) { if (Source == null) { empty = TypeCode.Empty; } else { empty = TypeCode.Object; } } else { empty = convertible.GetTypeCode(); } IConvertible convertible2 = Pattern as IConvertible; if (convertible2 == null) { if (Pattern == null) { typeCode = TypeCode.Empty; } else { typeCode = TypeCode.Object; } } else { typeCode = convertible2.GetTypeCode(); } if ((empty == TypeCode.Object) && (Source is char[])) { empty = TypeCode.String; } if ((typeCode == TypeCode.Object) && (Pattern is char[])) { typeCode = TypeCode.String; } if ((empty != TypeCode.Object) && (typeCode != TypeCode.Object)) { return LikeString(Conversions.ToString(Source), Conversions.ToString(Pattern), CompareOption); } return Operators.InvokeUserDefinedOperator(Symbols.UserDefinedOperator.Like, new object[] { Source, Pattern }); }
//Public Function FilterLike(ByRef vInput As Object, ByRef sLike As String, Optional ByRef fInclude As Boolean = True) As Object // 'Const EntryName As String = "FilterLike" // 'Filter in or out strings that match a pattern based on those recognized by the Like operator // Dim asRet() As String = {} // Dim c, i As Integer // Dim s As String // FilterLike = Nothing // 'Try // ' RecordEntry(EntryName, "vInput:={" & vInput.GetType.ToString & "}, sLike:=""" & sLike & ", fInclude:=" & fInclude.ToString, trcOption.trcSupport) // While True // Try // For i = 0 To UBound(vInput) // s = vInput(i) // If s Like sLike Then // If fInclude Then // asRet(c) = s // c = c + 1 // End If // Else // If Not fInclude Then // asRet(c) = s // c = c + 1 // End If // End If // Next // ReDim Preserve asRet(c - 1) // FilterLike = VB6.CopyArray(asRet) // Exit While // Catch ex As ArgumentException // Const cChunk As Integer = 20 // ReDim Preserve asRet(c + cChunk) // End Try // End While // 'Catch ex As Exception // ' RaiseError(EntryName, ex) // 'End Try // 'RecordExit(EntryName, False, FilterLike) //End Function private int FindString(ref string sTarget, ref string sFind, int iPos = 0, ESearchOptions esoOptions = 0) { int functionReturnValue = 0; CompareMethod ordComp = CompareMethod.Binary; int cFind = 0; bool fBack = false; //Get the compare method if (esoOptions.HasFlag(ESearchOptions.esoCaseSense)) { ordComp = CompareMethod.Binary; } else { ordComp = CompareMethod.Text; } //Set up first search cFind = Strings.Len(sFind); //If Len(sFind) = 1 Then iPos = iPos + 1 'cml if (iPos == 0) { iPos = 1; } if (esoOptions.HasFlag(ESearchOptions.esoBackward)) { fBack = true; } bool continueLoop = true; do { //Find the string if (fBack) { iPos = Strings.InStrRev(sTarget, sFind, iPos, ordComp); } else { iPos = Strings.InStr(iPos, sTarget, sFind, ordComp); } //If not found, we're done if (iPos == 0) { return(functionReturnValue); } //Try if (esoOptions.HasFlag(ESearchOptions.esoWholeWord)) { //If it's supposed to be whole word and is, we're done if (IsWholeWord(ref sTarget, iPos, Strings.Len(sFind))) { continueLoop = false; } //Otherwise, set up next search else if (fBack) { iPos = iPos - cFind; if (iPos < 1) { return(functionReturnValue); } //Try } else { iPos = iPos + cFind; if (iPos > Strings.Len(sTarget)) { return(functionReturnValue); } //Try } } else { //If it wasn't a whole word search, we're done continueLoop = false; } } while (continueLoop); functionReturnValue = iPos; return(functionReturnValue); }
public static bool LikeString(string Source, string Pattern, CompareMethod CompareOption) { CompareInfo compareInfo; CompareOptions ordinal; char ch; int num; int length; LigatureInfo[] inputLigatureInfo = null; int num3; int num4; LigatureInfo[] infoArray2 = null; bool flag7; if (Pattern == null) { length = 0; } else { length = Pattern.Length; } if (Source == null) { num4 = 0; } else { num4 = Source.Length; } if (CompareOption == CompareMethod.Binary) { ordinal = CompareOptions.Ordinal; compareInfo = null; } else { compareInfo = Utils.GetCultureInfo().CompareInfo; ordinal = CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreCase; byte[] localeSpecificLigatureTable = new byte[(LigatureExpansions.Length - 1) + 1]; flag7 = false; ExpandString(ref Source, ref num4, ref infoArray2, localeSpecificLigatureTable, compareInfo, ordinal, ref flag7, false); flag7 = false; ExpandString(ref Pattern, ref length, ref inputLigatureInfo, localeSpecificLigatureTable, compareInfo, ordinal, ref flag7, false); } while ((num < length) && (num3 < num4)) { ch = Pattern[num]; switch (ch) { case '?': case 0xff1f: SkipToEndOfExpandedChar(infoArray2, num4, ref num3); break; case '#': case 0xff03: if (!char.IsDigit(Source[num3])) { return false; } break; case '[': case 0xff3b: { bool flag2; bool flag3; bool flag4; flag7 = false; MatchRange(Source, num4, ref num3, infoArray2, Pattern, length, ref num, inputLigatureInfo, ref flag3, ref flag2, ref flag4, compareInfo, ordinal, ref flag7, null, false); if (flag4) { throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "Pattern" })); } if (flag2) { return false; } if (!flag3) { break; } num++; continue; } case '*': case 0xff0a: bool flag5; bool flag6; MatchAsterisk(Source, num4, num3, infoArray2, Pattern, length, num, inputLigatureInfo, ref flag5, ref flag6, compareInfo, ordinal); if (flag6) { throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "Pattern" })); } return !flag5; default: if (CompareChars(Source, num4, num3, ref num3, infoArray2, Pattern, length, num, ref num, inputLigatureInfo, compareInfo, ordinal, false, false) != 0) { return false; } break; } num++; num3++; } while (num < length) { ch = Pattern[num]; if ((ch == '*') || (ch == 0xff0a)) { num++; } else { if (((num + 1) >= length) || (((ch != '[') || (Pattern[num + 1] != ']')) && ((ch != 0xff3b) || (Pattern[num + 1] != 0xff3d)))) { break; } num += 2; } } return ((num >= length) && (num3 >= num4)); }
public static string Replace(string Expression, string Find, string Replacement, int Start, int Count, CompareMethod Compare) { }
public static int StrComp(string String1, string String2, CompareMethod Compare) { }
public void Replace_ArgumentException(string expression, string find, string replacement, int start, int length, CompareMethod compare) { Assert.Throws <ArgumentException>(() => Strings.Replace(expression, find, replacement, start, length, compare)); }
public void Split_IndexOutOfRangeException(string expression, string delimiter, int limit, CompareMethod compare) { Assert.Throws <IndexOutOfRangeException>(() => Strings.Split(expression, delimiter, limit, compare)); }
public WirecastShot GetShotByName(string name, CompareMethod compareMethod = CompareMethod.ExactMatch) { int shot_id = ShotIDByName(name, compareMethod); return(_wirecastDocument.ShotByShotID(shot_id)); }
public void Replace(string expression, string find, string replacement, int start, int n, CompareMethod compare, string expected) { Assert.Equal(expected, Strings.Replace(expression, find, replacement, start, n, compare)); }
private static int AsteriskSkip(string Pattern, string Source, int SourceEndIndex, CompareMethod CompareOption, CompareInfo ci) { int num1 = Strings.Len(Pattern); int length = 0; int Count = 0; while (length < num1) { bool flag1 = false; bool flag2 = false; bool flag3 = false; switch (Pattern[length]) { case '!': if (Pattern[checked (length + 1)] == ']') { flag2 = true; break; } flag1 = true; break; case '#': case '?': if (flag3) { flag2 = true; break; } checked { ++Count; } flag1 = true; break; case '*': if (Count > 0) { if (flag1) { int num2 = StringType.MultipleAsteriskSkip(Pattern, Source, Count, CompareOption); return(checked (SourceEndIndex - num2)); } string str = Pattern.Substring(0, length); CompareOptions options = CompareOption != CompareMethod.Binary ? CompareOptions.IgnoreCase | CompareOptions.IgnoreNonSpace | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreWidth : CompareOptions.Ordinal; return(ci.LastIndexOf(Source, str, options)); } break; case '-': if (Pattern[checked (length + 1)] == ']') { flag2 = true; break; } break; case '[': if (flag3) { flag2 = true; break; } flag3 = true; break; case ']': if (flag2 || !flag3) { checked { ++Count; } flag1 = true; } flag2 = false; flag3 = false; break; default: if (flag3) { flag2 = true; break; } checked { ++Count; } break; } checked { ++length; } } return(checked (SourceEndIndex - Count)); }
public WirecastDocument DocumentByName(string name, CompareMethod compareMethod) { return new WirecastDocument(Late.Invoke(oWirecast, "DocumentByName", new object[] { name, (int)compareMethod })); }
public ObservableSortListView(IList aParentList, CompareMethod <object> aSortMethod, DuplicateHandlingType aDuplicateHandling) : base(aParentList) { items = new AVLTreeSort <object> (aSortMethod, aDuplicateHandling); }
public ObservableSortListView (IList aParentList, CompareMethod<object> aSortMethod, DuplicateHandlingType aDuplicateHandling) : base (aParentList) { items = new AVLTreeSort<object> (aSortMethod, aDuplicateHandling); }
public void Split(string expression, string delimiter, int limit, CompareMethod compare, string[] expected) { Assert.Equal(expected, Strings.Split(expression, delimiter, limit, compare)); }
public WirecastShot ShotByName(string name, CompareMethod compare_method) { int shot_id = (int)this.Invoke("ShotIDByName", name, (int)compare_method); return(ShotByShotID(shot_id)); }
public static bool LikeString(string Source, string Pattern, CompareMethod CompareOption) { CompareInfo compareInfo; CompareOptions ordinal; char ch; int num; int length; LigatureInfo[] inputLigatureInfo = null; int num3; int num4; LigatureInfo[] infoArray2 = null; bool flag7; if (Pattern == null) { length = 0; } else { length = Pattern.Length; } if (Source == null) { num4 = 0; } else { num4 = Source.Length; } if (CompareOption == CompareMethod.Binary) { ordinal = CompareOptions.Ordinal; compareInfo = null; } else { compareInfo = Utils.GetCultureInfo().CompareInfo; ordinal = CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.IgnoreCase; byte[] localeSpecificLigatureTable = new byte[(LigatureExpansions.Length - 1) + 1]; flag7 = false; ExpandString(ref Source, ref num4, ref infoArray2, localeSpecificLigatureTable, compareInfo, ordinal, ref flag7, false); flag7 = false; ExpandString(ref Pattern, ref length, ref inputLigatureInfo, localeSpecificLigatureTable, compareInfo, ordinal, ref flag7, false); } while ((num < length) && (num3 < num4)) { ch = Pattern[num]; switch (ch) { case '?': case 0xff1f: SkipToEndOfExpandedChar(infoArray2, num4, ref num3); break; case '#': case 0xff03: if (!char.IsDigit(Source[num3])) { return(false); } break; case '[': case 0xff3b: { bool flag2; bool flag3; bool flag4; flag7 = false; MatchRange(Source, num4, ref num3, infoArray2, Pattern, length, ref num, inputLigatureInfo, ref flag3, ref flag2, ref flag4, compareInfo, ordinal, ref flag7, null, false); if (flag4) { throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "Pattern" })); } if (flag2) { return(false); } if (!flag3) { break; } num++; continue; } case '*': case 0xff0a: bool flag5; bool flag6; MatchAsterisk(Source, num4, num3, infoArray2, Pattern, length, num, inputLigatureInfo, ref flag5, ref flag6, compareInfo, ordinal); if (flag6) { throw new ArgumentException(Utils.GetResourceString("Argument_InvalidValue1", new string[] { "Pattern" })); } return(!flag5); default: if (CompareChars(Source, num4, num3, ref num3, infoArray2, Pattern, length, num, ref num, inputLigatureInfo, compareInfo, ordinal, false, false) != 0) { return(false); } break; } num++; num3++; } while (num < length) { ch = Pattern[num]; if ((ch == '*') || (ch == 0xff0a)) { num++; } else { if (((num + 1) >= length) || (((ch != '[') || (Pattern[num + 1] != ']')) && ((ch != 0xff3b) || (Pattern[num + 1] != 0xff3d)))) { break; } num += 2; } } return((num >= length) && (num3 >= num4)); }
//////////////////////////////////////// ///////////GUI AND EDITOR STUFF///////// //////////////////////////////////////// protected override void OnTaskInspectorGUI() { if (!Application.isPlaying && GUILayout.Button("Select Method")){ System.Action<MethodInfo> MethodSelected = (method)=> { this.method = new SerializedMethodInfo(method); this.parameters.Clear(); foreach(var p in method.GetParameters()){ var newParam = new BBObjectParameter{bb = blackboard}; newParam.SetType(p.ParameterType); if (p.IsOptional){ newParam.value = p.DefaultValue; } parameters.Add(newParam); } this.checkValue = new BBObjectParameter{bb = blackboard}; this.checkValue.SetType(method.ReturnType); comparison = CompareMethod.EqualTo; }; if (agent != null){ EditorUtils.ShowGameObjectMethodSelectionMenu(agent.gameObject, typeof(object), typeof(object), MethodSelected, 3, false, true); } else { var menu = new UnityEditor.GenericMenu(); foreach (var t in UserTypePrefs.GetPreferedTypesList(typeof(Component), true)) menu = EditorUtils.GetMethodSelectionMenu(t, typeof(object), typeof(object), MethodSelected, 3, false, true, menu); menu.ShowAsContext(); Event.current.Use(); } } if (targetMethod != null){ GUILayout.BeginVertical("box"); UnityEditor.EditorGUILayout.LabelField("Type", agentType.FriendlyName()); UnityEditor.EditorGUILayout.LabelField("Method", targetMethod.Name); GUILayout.EndVertical(); var paramNames = targetMethod.GetParameters().Select(p => p.Name.SplitCamelCase() ).ToArray(); for (var i = 0; i < paramNames.Length; i++){ EditorUtils.BBParameterField(paramNames[i], parameters[i]); } GUI.enabled = checkValue.varType == typeof(float) || checkValue.varType == typeof(int); comparison = (CompareMethod)UnityEditor.EditorGUILayout.EnumPopup("Comparison", comparison); GUI.enabled = true; EditorUtils.BBParameterField("Check Value", checkValue); } }
// Determine if two objects are alike. public static bool LikeObj(Object vLeft, Object vRight, CompareMethod CompareOption) { return StringType.StrLike(StringType.FromObject(vLeft), StringType.FromObject(vRight), CompareOption); }