private bool TryGetGuardedPlatformsFromCondition(IOperation condition, ref PlatformList platformList) { switch (condition.Kind) { case OperationKind.BinaryOperator: { var binary = (IBinaryOperation)condition; if (binary.OperatorKind == BinaryOperatorKind.Or || binary.OperatorKind == BinaryOperatorKind.ConditionalOr) { return(TryGetGuardedPlatformsFromCondition(binary.LeftOperand, ref platformList) && TryGetGuardedPlatformsFromCondition(binary.RightOperand, ref platformList)); } break; } case OperationKind.Invocation: { var invocation = (IInvocationOperation)condition; var platform = GetCheckedPlatform(invocation); if (platform != null) { platformList.Add(platform); return(true); } break; } } return(false); }
public void PlatformListGetByIdTest() { var platformList = new PlatformList(); var guid1 = Guid.NewGuid(); var guid2 = Guid.NewGuid(); var guid3 = Guid.NewGuid(); platformList.Add(new Platform(1, "Name1", "Maker1")); platformList.Add(new Platform(2, "Name2", "Maker2")); platformList.Add(new Platform(3, "Name3", "Maker3")); var platform = platformList.GetbyId(0); Assert.AreEqual(platform, null); platform = platformList.GetbyId(-1); Assert.AreEqual(platform, null); platform = platformList.GetbyId(1); Assert.AreEqual(platform.Name, "Name1"); platform = platformList.GetbyId(2); Assert.AreEqual(platform.Name, "Name2"); platform = platformList.GetbyId(3); Assert.AreEqual(platform.Name, "Name3"); }
public void PlatformListAddandRemoveTest() { var platformList = new PlatformList(); Assert.AreEqual(platformList.List.Count, 0); platformList.Add(new Platform(1, "Name1", "Maker1")); Assert.AreEqual(platformList.List.Count, 1); platformList.Add(new Platform(2, "Name2", "Maker2")); Assert.AreEqual(platformList.List.Count, 2); platformList.Add(new Platform(3, "Name3", "Maker3")); Assert.AreEqual(platformList.List.Count, 3); platformList.Remove(1); Assert.AreEqual(platformList.List.Count, 2); platformList.Remove(3); Assert.AreEqual(platformList.List.Count, 1); platformList.Remove(2); Assert.AreEqual(platformList.List.Count, 0); }
public void PlatformListConstructerTest() { var platformList = new PlatformList(); Assert.IsNotNull(platformList); Assert.AreEqual(platformList.List.Count, 0); }
static public void UpdatePlatformInfo() { try { platformList = new PlatformList(); SettingsFileIO settingsFileIO = new SettingsFileIO(); DirectoryInfo[] dirArray = new DirectoryInfo(Application.StartupPath).GetDirectories(); foreach (DirectoryInfo directoryInfo in dirArray) { settingsFileIO.SetSettingsFilePath(Application.StartupPath + "\\Platform.ini"); platformList.studioType = (PlatformType)Enum.Parse(typeof(PlatformType), settingsFileIO.ReadValue("summary", "studio_type"), true); platformList.studioVersion = Version.Parse(settingsFileIO.ReadValue("summary", "studio_version")); platformList.platformDefault = settingsFileIO.ReadValue("summary", "platform_default"); string fileFullName = Path.GetFullPath(directoryInfo.FullName + "\\Platform.ini"); if (File.Exists(fileFullName)) { settingsFileIO.SetSettingsFilePath(fileFullName); platformList.platformVerification.Add(settingsFileIO.ReadValue("platform_define", "platform_verification")); platformList.platformNameDisplay.Add(settingsFileIO.ReadValue("platform_define", "platform_name")); platformList.platformVersion.Add(settingsFileIO.ReadValue("platform_define", "platform_version")); platformList.platformPath.Add(directoryInfo.Name); platformList.platformStudioExecute.Add(settingsFileIO.ReadValue("platform_define", "complier_excute")); platformList.platformUIMode.Add(settingsFileIO.ReadValue("platform_define", "ui_mode_args")); platformList.platformCompilerMode.Add(settingsFileIO.ReadValue("platform_define", "compile_mode_args")); platformList.platformCount++; } } } catch (Exception) { }; }
public ActionResult Index([Bind(Include = "selectedPlatforms")] PlatformList platformList) { Account account = Session["account"] as Account; if (account == null) { TempData["infoMsg"] = "You must be logged in."; return(RedirectToAction("", "Login")); } if (ModelState.IsValid) { try { foreach (PersonPlatform personPlatform in db.PersonPlatforms.Where(pp => pp.personId == account.personId)) { db.PersonPlatforms.Remove(personPlatform); } db.SaveChanges(); foreach (string platformCode in platformList.selectedPlatforms) { PersonPlatform personPlatform = new PersonPlatform(); personPlatform.personId = account.personId; personPlatform.platformCode = platformCode; db.PersonPlatforms.Add(personPlatform); } db.SaveChanges(); } catch (Exception) { TempData["errMsg"] = "An unexpected error has occurred. Please try again later."; } } ViewBag.platformCodes = new MultiSelectList(db.Platforms, "platformCode", "platformCode", platformList.selectedPlatforms); return(RedirectToAction("", "Profile", new { userName = account.userName })); }
public void PlatformListExistsTest() { var platformList = new PlatformList(); platformList.Add(new Platform(1, "Name1", "Maker1")); platformList.Add(new Platform(2, "Name2", "Maker2")); platformList.Add(new Platform(3, "Name3", "Maker3")); Assert.IsFalse(platformList.Exists(0)); Assert.IsFalse(platformList.Exists(-1)); Assert.AreEqual(platformList.Exists(1), true); Assert.AreEqual(platformList.Exists(2), true); Assert.AreEqual(platformList.Exists(3), true); }
public bool ContainsAny(PlatformList other) { if (!Any || !other.Any) { return(false); } foreach (var p in other._platforms) { if (_platforms.Contains(p)) { return(true); } } return(false); }
// GET: Platforms public ActionResult Index() { Account account = Session["account"] as Account; if (account == null) { TempData["infoMsg"] = "You must be logged in."; return(RedirectToAction("", "Login")); } PlatformList platformList = new PlatformList(); foreach (PersonPlatform personPlatform in db.PersonPlatforms.Where(pp => pp.personId == account.personId)) { platformList.selectedPlatforms.Add(personPlatform.platformCode); } ViewBag.platformCodes = new MultiSelectList(db.Platforms, "platformCode", "platformCode", platformList.selectedPlatforms); return(View(platformList)); }
private PlatformList GetRejectedPlatforms(IOperation operation) { var platformList = new PlatformList(); while (operation != null) { if (operation is IConditionalOperation conditional) { if (TryGetRejectedPlatformsFromCondition(conditional.Condition, ref platformList)) { break; } } operation = operation.Parent; } return(platformList); }
public void PlatformListXmlCloneTest() { var platformList1 = new PlatformList(); platformList1.Add(new Platform(1, "Name1", "Maker1")); platformList1.Add(new Platform(2, "Name2", "Maker2")); platformList1.Add(new Platform(3, "Name3", "Maker3")); var platformList2 = CloneUtility.XmlClone(platformList1, null); Assert.AreNotSame(platformList1, platformList2); Assert.AreEqual(platformList1.List.Count, platformList2.List.Count); for (var index = 0; index < platformList1.List.Count; index++) { Assert.AreEqual(platformList1.List[index].Id, platformList2.List[index].Id); Assert.AreEqual(platformList1.List[index].Name, platformList2.List[index].Name); Assert.AreEqual(platformList1.List[index].Maker, platformList2.List[index].Maker); } }
private bool TryGetDeclaredPlatformsDirect(ISymbol symbol, out PlatformList platforms) { platforms = new PlatformList(); var assembly = symbol is IAssemblySymbol a ? a : symbol.ContainingAssembly; var platformSpecificAttribute = LookupPlatformSpecificAttribute(assembly); foreach (var ca in symbol.GetAttributes()) { if (ca.AttributeClass == platformSpecificAttribute) { if (ca.ConstructorArguments.Length == 1 && ca.ConstructorArguments[0].Value is string platform) { platforms.Add(platform); } } } return(platforms.Any); }
private bool TryGetDeclaredPlatforms(ISymbol symbol, out PlatformList platforms) { if (TryGetDeclaredPlatformsDirect(symbol, out platforms)) { return(true); } switch (symbol.Kind) { case SymbolKind.NetModule: var module = (IModuleSymbol)symbol; return(TryGetDeclaredPlatforms(module.ContainingAssembly, out platforms)); case SymbolKind.NamedType: var type = (ITypeSymbol)symbol; if (type.ContainingType != null) { return(TryGetDeclaredPlatforms(type.ContainingType, out platforms)); } else { return(TryGetDeclaredPlatforms(type.ContainingModule, out platforms)); } case SymbolKind.Method: var method = (IMethodSymbol)symbol; return(TryGetDeclaredPlatforms(method.ContainingType, out platforms)); case SymbolKind.Property: var property = (IPropertySymbol)symbol; return(TryGetDeclaredPlatforms(property.ContainingType, out platforms)); case SymbolKind.Event: var @event = (IEventSymbol)symbol; return(TryGetDeclaredPlatforms(@event.ContainingType, out platforms)); } return(false); }
private bool TryGetRejectedPlatformsFromCondition(IOperation condition, ref PlatformList platformList) { switch (condition.Kind) { case OperationKind.BinaryOperator: { var binary = (IBinaryOperation)condition; if (binary.OperatorKind == BinaryOperatorKind.And || binary.OperatorKind == BinaryOperatorKind.ConditionalAnd) { return(TryGetRejectedPlatformsFromCondition(binary.LeftOperand, ref platformList) && TryGetRejectedPlatformsFromCondition(binary.RightOperand, ref platformList)); } break; } case OperationKind.UnaryOperator: { var unary = (IUnaryOperation)condition; if (unary.OperatorKind == UnaryOperatorKind.Not && unary.Operand is IInvocationOperation invocation) { var platform = GetCheckedPlatform(invocation); if (platform != null) { platformList.Add(platform); return(true); } } break; } } return(false); }
public void PlatformListDictionaryTest() { var platformList1 = new PlatformList(); platformList1.Add(new Platform(1, "Name1", "Maker1")); platformList1.Add(new Platform(2, "Name2", "Maker2")); platformList1.Add(new Platform(3, "Name3", "Maker3")); var DictionaryList = PlatformList.ToDictionaryList(platformList1); Assert.IsNotNull(DictionaryList); var platformList2 = PlatformList.FromDictionaryList(DictionaryList); Assert.AreNotSame(platformList1, platformList2); Assert.AreEqual(platformList1.List.Count, platformList2.List.Count); for (var index = 0; index < platformList1.List.Count; index++) { Assert.AreEqual(platformList1.List[index].Id, platformList2.List[index].Id); Assert.AreEqual(platformList1.List[index].Name, platformList2.List[index].Name); Assert.AreEqual(platformList1.List[index].Maker, platformList2.List[index].Maker); } }
public void PlatformListJsonTest() { var platformList1 = new PlatformList(); platformList1.Add(new Platform(1, "Name1", "Maker1")); platformList1.Add(new Platform(2, "Name2", "Maker2")); platformList1.Add(new Platform(3, "Name3", "Maker3")); var jsontext = CloneUtility.ToJson(platformList1); Assert.IsFalse(string.IsNullOrEmpty(jsontext)); var platformList2 = CloneUtility.FromJson <PlatformList>(jsontext); Assert.AreNotSame(platformList1, platformList2); Assert.AreEqual(platformList1.List.Count, platformList2.List.Count); for (var index = 0; index < platformList1.List.Count; index++) { Assert.AreEqual(platformList1.List[index].Id, platformList2.List[index].Id); Assert.AreEqual(platformList1.List[index].Name, platformList2.List[index].Name); Assert.AreEqual(platformList1.List[index].Maker, platformList2.List[index].Maker); } }
public void RemoveAll(PlatformList other) { RemoveAll(other._platforms); }
public PlatformGenerator(PlatformList platformList) { this.platformList = platformList; }
public BuildPanelViewModel() { Platform = PlatformList.First(); }