public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { string left = RegistryManager.Instance.Guest[context.VmName].GuestWidth.ToString((IFormatProvider)CultureInfo.InvariantCulture) + "x" + RegistryManager.Instance.Guest[context.VmName].GuestHeight.ToString((IFormatProvider)CultureInfo.InvariantCulture); rightOperand = rightOperand.Replace(" ", string.Empty); return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, left, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { EngineState engineState = EngineState.plus; if (RegistryManager.Instance.CurrentEngine == "raw") { engineState = EngineState.raw; } return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, engineState.ToString(), rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { int left = 1; if (RegistryManager.Instance.CurrentEngine != "raw") { left = Environment.ProcessorCount > 8 ? 8 : Environment.ProcessorCount; } return(GrmComparer <int> .Evaluate(this.EvaluatorForOperandType, grmOperator, left, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { if (!(JsonConvert.DeserializeObject(context.ContextJson, Utils.GetSerializerSettings()) is JObject jobject) || !jobject.ContainsKey("param")) { throw new ArgumentException("BootParamEvaluator requires contextjson with param key."); } string valueInBootParams = Utils.GetValueInBootParams(jobject["param"].Value <string>(), context.VmName, "", "bgp"); return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, valueInBootParams, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { if (!(JsonConvert.DeserializeObject(context.ContextJson, Utils.GetSerializerSettings()) is JObject jobject) || !jobject.ContainsKey("pkg")) { throw new ArgumentException("AppRunningCountAcrossInstancesEvaluator requires contextjson with pkg key."); } string pkg = jobject["pkg"].Value <string>(); int left = BlueStacksUIUtils.DictWindows.Values.Sum <MainWindow>((Func <MainWindow, int>)(window => !window.mTopBar.mAppTabButtons.mDictTabs.ContainsKey(pkg) ? 0 : 1)) + 1; return(GrmComparer <int> .Evaluate(this.EvaluatorForOperandType, grmOperator, left, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { if (!GpuEvaluator.mVmNameGpu.ContainsKey(context.VmName) || string.IsNullOrEmpty(GpuEvaluator.mVmNameGpu[context.VmName])) { string glVendor; string glRenderer; Utils.GetCurrentGraphicsInfo(RegistryManager.Instance.Guest[context.VmName].GlRenderMode.ToString() + " " + RegistryManager.Instance.Guest[context.VmName].GlMode.ToString(), out glVendor, out glRenderer, out string _); string str = glVendor + " " + glRenderer; GpuEvaluator.mVmNameGpu[context.VmName] = str; Logger.Info("GpuEvaluator " + str); } return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, GpuEvaluator.mVmNameGpu[context.VmName], rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { int result; int.TryParse(PhysicalRamEvaluator.RAM, out result); int left = (int)((double)result * 0.5); if (left >= 4096) { left = 4096; } if (RegistryManager.Instance.CurrentEngine == "raw" && left >= 3072) { left = 3072; } return(GrmComparer <int> .Evaluate(this.EvaluatorForOperandType, grmOperator, left, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { int left = int.Parse(new JsonParser(context.VmName).GetAppInfoFromPackageName(context.PackageName).Version, (IFormatProvider)CultureInfo.InvariantCulture); return(GrmComparer <int> .Evaluate(this.EvaluatorForOperandType, grmOperator, left, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { GlMode glModeForVm = Utils.GetGlModeForVm(context.VmName); return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, glModeForVm.ToString(), rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { int vcpUs = RegistryManager.Instance.Guest[context.VmName].VCPUs; return(GrmComparer <int> .Evaluate(this.EvaluatorForOperandType, grmOperator, vcpUs, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { string strA = "RegistryManager"; Type objType = (Type)null; TypeCode typeCode = TypeCode.String; if (!(JsonConvert.DeserializeObject(context.ContextJson, Utils.GetSerializerSettings()) is JObject jobject)) { throw new ArgumentNullException("RegistryKeyValueEvaluator requires contextjson" + context.ContextJson); } if (!jobject.ContainsKey("propertyName")) { throw new ArgumentException("propertyName required in context json for RegisryKeyValueEvaluator"); } string str = jobject["propertyName"].Value <string>(); if (jobject.ContainsKey("location") && !string.IsNullOrEmpty(jobject["location"].Value <string>())) { strA = jobject["location"].Value <string>(); } object o; if (string.Compare(strA, "registryManager", StringComparison.OrdinalIgnoreCase) == 0) { o = RegistryManager.Instance.GetPropValue(str, out objType); } else if (string.Compare(strA, "instanceManager", StringComparison.OrdinalIgnoreCase) == 0) { o = RegistryManager.Instance.Guest[context.VmName].GetPropValue(str, out objType); } else { if (!jobject.ContainsKey("propertyPath")) { throw new ArgumentException("propertyPath required in context json for RegisryKeyValueEvaluator"); } o = RegistryUtils.GetRegistryValue(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Software\\BlueStacks{0}\\{1}", (object)Strings.GetOemTag(), (object)jobject["propertyPath"].Value <string>().Replace("vmName", context.VmName)), str, (object)"", RegistryKeyKind.HKEY_LOCAL_MACHINE); typeCode = EnumHelper.Parse <TypeCode>(jobject["propertyTypeCode"].Value <string>(), TypeCode.String); } if (o == null) { throw new MissingMemberException("Cannot find " + str); } if (o.IsList()) { return(GrmComparer <List <string> > .Evaluate(this.EvaluatorForOperandType, grmOperator, (List <string>) o, rightOperand, context)); } if ((object)objType != null) { typeCode = Type.GetTypeCode(objType); } switch (typeCode) { case TypeCode.Boolean: return(GrmComparer <bool> .Evaluate(this.EvaluatorForOperandType, grmOperator, (bool)o, rightOperand, context)); case TypeCode.Int32: return(GrmComparer <int> .Evaluate(this.EvaluatorForOperandType, grmOperator, (int)o, rightOperand, context)); case TypeCode.Int64: return(GrmComparer <long> .Evaluate(this.EvaluatorForOperandType, grmOperator, (long)o, rightOperand, context)); case TypeCode.Double: return(GrmComparer <double> .Evaluate(this.EvaluatorForOperandType, grmOperator, (double)o, rightOperand, context)); case TypeCode.Decimal: return(GrmComparer <Decimal> .Evaluate(this.EvaluatorForOperandType, grmOperator, (Decimal)o, rightOperand, context)); case TypeCode.DateTime: return(GrmComparer <DateTime> .Evaluate(this.EvaluatorForOperandType, grmOperator, (DateTime)o, rightOperand, context)); case TypeCode.String: return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, (string)o, rightOperand, context)); default: throw new Exception("Type of property is not known " + str); } }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { bool bitOperatingSystem = CommonInstallUtils.Is64BitOperatingSystem; return(GrmComparer <bool> .Evaluate(this.EvaluatorForOperandType, grmOperator, bitOperatingSystem, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { List <string> installedOemList = InstalledOem.AllInstalledOemList; return(GrmComparer <List <string> > .Evaluate(this.EvaluatorForOperandType, grmOperator, installedOemList, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { GuestOS guestOs = GuestOS.Nougat; return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, guestOs.ToString(), rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { string geo = RegistryManager.Instance.Geo; return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, geo, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { ASTCOption astcOption = RegistryManager.Instance.Guest[context.VmName].ASTCOption; return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, astcOption.ToString(), rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { string fromBootParameters = Utils.GetDpiFromBootParameters(RegistryManager.Instance.Guest[context.VmName].BootParameters); return(GrmComparer <int> .Evaluate(this.EvaluatorForOperandType, grmOperator, Convert.ToInt32(fromBootParameters, (IFormatProvider)CultureInfo.InvariantCulture), rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, "bgp", rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { string valueInBootParams = Utils.GetValueInBootParams("pcode", context.VmName, "", "bgp"); return(GrmComparer <string> .Evaluate(this.EvaluatorForOperandType, grmOperator, valueInBootParams, rightOperand, context)); }
public bool Evaluate(GrmRuleSetContext context, GrmOperator grmOperator, string rightOperand) { System.Version left = new System.Version(RegistryManager.Instance.Version); return(GrmComparer <System.Version> .Evaluate(this.EvaluatorForOperandType, grmOperator, left, rightOperand, context)); }