public void SaveModuleOrder() { string folder = ConfigurationManagement.Instance.ConfigurationPath; folder = folder + Path.DirectorySeparatorChar + "Adapters"; if (!Directory.Exists(folder)) Directory.CreateDirectory(folder); folder = folder + Path.DirectorySeparatorChar + na.GetAdapterInformation().Id; if (!Directory.Exists(folder)) Directory.CreateDirectory(folder); string file = folder + Path.DirectorySeparatorChar + "modules.cfg"; List<ModuleOrder.ModulePair> pairs = new List<ModuleOrder.ModulePair>(); foreach(KeyValuePair<bool, string> p in moduleOrder) { pairs.Add(new ModuleOrder.ModulePair() { Enabled = p.Key, Name = p.Value }); } ModuleOrder mo = new ModuleOrder() { Order = pairs.ToArray() }; try { XmlSerializer serializer = new XmlSerializer(typeof(ModuleOrder)); TextWriter writer = new StreamWriter(file); serializer.Serialize(writer, mo); writer.Close(); } catch (Exception e) { LogCenter.Instance.LogException(e); } }
public void Run(RegressionEnvironment env) { // Circular 3 Module moduleB = GetModule("B", "C"); Module moduleC = GetModule("C", "D"); Module moduleD = GetModule("D", "B"); try { ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleC, moduleD, moduleB}), EmptySet<string>.Instance, new ModuleOrderOptions()); Assert.Fail(); } catch (ModuleOrderException ex) { Assert.AreEqual( "Circular dependency detected in module uses-relationships: module 'C' uses (depends on) module 'D' uses (depends on) module 'B'", ex.Message); } // Circular 1 - this is allowed moduleB = GetModule("B", "B"); ModuleOrder order = null; try { order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleC, moduleD, moduleB}), EmptySet<string>.Instance, new ModuleOrderOptions()); } catch (ModuleOrderException e) { throw new EPRuntimeException(e); } AssertOrder(new Module[] {moduleB, moduleD, moduleC}, order); // Circular 2 moduleB = GetModule("B", "C"); moduleC = GetModule("C", "B"); try { ModuleOrderUtil.GetModuleOrder(Arrays.AsList(new Module[] {moduleC, moduleB}), EmptySet<string>.Instance, new ModuleOrderOptions()); Assert.Fail(); } catch (ModuleOrderException ex) { Assert.AreEqual("Circular dependency detected in module uses-relationships: module 'C' uses (depends on) module 'B'", ex.Message); } // turn off circular check ModuleOrderOptions options = new ModuleOrderOptions(); options.IsCheckCircularDependency = false; try { order = ModuleOrderUtil.GetModuleOrder(Arrays.AsList(new Module[] {moduleC, moduleB}), EmptySet<string>.Instance, options); } catch (ModuleOrderException e) { throw new EPRuntimeException(e); } AssertOrder(new Module[] {moduleB, moduleC}, order); }
private void orderList_SelectedIndexChanged(object sender, EventArgs e) { ComboBox box = (ComboBox)sender; ModuleOrder newOrder = (ModuleOrder)Reflection.CreateObjectByName(orderNames[box.SelectedIndex]); newOrder.SetBlock(writerReader.GetBlock()); writerReader.GetPosition().SetOrder(newOrder); SetGUI(newOrder, orderParameter, orderHint); showSpaceValues(); }
public void SaveModuleOrder() { string folder = ConfigurationManagement.Instance.ConfigurationPath; folder = folder + Path.DirectorySeparatorChar + "Adapters"; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } folder = folder + Path.DirectorySeparatorChar + na.GetAdapterInformation().Id; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string file = folder + Path.DirectorySeparatorChar + "modules.cfg"; List <ModuleOrder.ModulePair> pairs = new List <ModuleOrder.ModulePair>(); foreach (KeyValuePair <bool, string> p in moduleOrder) { pairs.Add(new ModuleOrder.ModulePair() { Enabled = p.Key, Name = p.Value }); } ModuleOrder mo = new ModuleOrder() { Order = pairs.ToArray() }; try { XmlSerializer serializer = new XmlSerializer(typeof(ModuleOrder)); TextWriter writer = new StreamWriter(file); serializer.Serialize(writer, mo); writer.Close(); } catch (Exception e) { LogCenter.Instance.LogException(e); } }
public void LoadModuleOrder() { string folder = ConfigurationManagement.Instance.ConfigurationPath; folder = folder + Path.DirectorySeparatorChar + "Adapters"; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } folder = folder + Path.DirectorySeparatorChar + na.GetAdapterInformation().Id; if (!Directory.Exists(folder)) { Directory.CreateDirectory(folder); } string file = folder + Path.DirectorySeparatorChar + "modules.cfg"; if (!File.Exists(file)) { moduleOrder = new List <KeyValuePair <bool, string> >(); return; } try { XmlSerializer serializer = new XmlSerializer(typeof(ModuleOrder)); TextReader reader = new StreamReader(file); ModuleOrder mo = (ModuleOrder)serializer.Deserialize(reader); reader.Close(); moduleOrder = new List <KeyValuePair <bool, string> >(); foreach (ModuleOrder.ModulePair p in mo.Order) { moduleOrder.Add(new KeyValuePair <bool, string>(p.Enabled, p.Name)); } } catch (Exception e) { LogCenter.Instance.LogException(e); moduleOrder = new List <KeyValuePair <bool, string> >(); } }
public void SetOrder(Order.ModuleOrder order) { this.order = order; }
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope currentScope, ref bool propertyNotFound) { string outputFormat = string.Empty; if (format == string.Empty) { outputFormat = "g"; } if (currentScope == Scope.NoSettings) { propertyNotFound = true; return(PropertyAccess.ContentLocked); } propertyNotFound = true; string result = string.Empty; bool isPublic = true; switch (propertyName.ToLowerInvariant()) { case "portalid": propertyNotFound = false; result = (PortalID.ToString(outputFormat, formatProvider)); break; case "displayportalid": propertyNotFound = false; result = (OwnerPortalID.ToString(outputFormat, formatProvider)); break; case "tabid": propertyNotFound = false; result = (TabID.ToString(outputFormat, formatProvider)); break; case "tabmoduleid": propertyNotFound = false; result = (TabModuleID.ToString(outputFormat, formatProvider)); break; case "moduleid": propertyNotFound = false; result = (ModuleID.ToString(outputFormat, formatProvider)); break; case "moduledefid": isPublic = false; propertyNotFound = false; result = (ModuleDefID.ToString(outputFormat, formatProvider)); break; case "moduleorder": isPublic = false; propertyNotFound = false; result = (ModuleOrder.ToString(outputFormat, formatProvider)); break; case "panename": propertyNotFound = false; result = PropertyAccess.FormatString(PaneName, format); break; case "moduletitle": propertyNotFound = false; result = PropertyAccess.FormatString(ModuleTitle, format); break; case "cachetime": isPublic = false; propertyNotFound = false; result = (CacheTime.ToString(outputFormat, formatProvider)); break; case "cachemethod": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(CacheMethod, format); break; case "alignment": propertyNotFound = false; result = PropertyAccess.FormatString(Alignment, format); break; case "color": propertyNotFound = false; result = PropertyAccess.FormatString(Color, format); break; case "border": propertyNotFound = false; result = PropertyAccess.FormatString(Border, format); break; case "iconfile": propertyNotFound = false; result = PropertyAccess.FormatString(IconFile, format); break; case "alltabs": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(AllTabs, formatProvider)); break; case "isdeleted": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsDeleted, formatProvider)); break; case "header": propertyNotFound = false; result = PropertyAccess.FormatString(Header, format); break; case "footer": propertyNotFound = false; result = PropertyAccess.FormatString(Footer, format); break; case "startdate": isPublic = false; propertyNotFound = false; result = (StartDate.ToString(outputFormat, formatProvider)); break; case "enddate": isPublic = false; propertyNotFound = false; result = (EndDate.ToString(outputFormat, formatProvider)); break; case "containersrc": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(ContainerSrc, format); break; case "displaytitle": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DisplayTitle, formatProvider)); break; case "displayprint": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DisplayPrint, formatProvider)); break; case "displaysyndicate": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DisplaySyndicate, formatProvider)); break; case "iswebslice": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsWebSlice, formatProvider)); break; case "webslicetitle": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(WebSliceTitle, format); break; case "websliceexpirydate": isPublic = false; propertyNotFound = false; result = (WebSliceExpiryDate.ToString(outputFormat, formatProvider)); break; case "webslicettl": isPublic = false; propertyNotFound = false; result = (WebSliceTTL.ToString(outputFormat, formatProvider)); break; case "inheritviewpermissions": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(InheritViewPermissions, formatProvider)); break; case "isshareable": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsShareable, formatProvider)); break; case "isshareableviewonly": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsShareableViewOnly, formatProvider)); break; case "desktopmoduleid": isPublic = false; propertyNotFound = false; result = (DesktopModuleID.ToString(outputFormat, formatProvider)); break; case "friendlyname": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.FriendlyName, format); break; case "foldername": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.FolderName, format); break; case "description": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.Description, format); break; case "version": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.Version, format); break; case "ispremium": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsPremium, formatProvider)); break; case "isadmin": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsAdmin, formatProvider)); break; case "businesscontrollerclass": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.BusinessControllerClass, format); break; case "modulename": propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.ModuleName, format); break; case "supportedfeatures": isPublic = false; propertyNotFound = false; result = (DesktopModule.SupportedFeatures.ToString(outputFormat, formatProvider)); break; case "compatibleversions": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.CompatibleVersions, format); break; case "dependencies": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.Dependencies, format); break; case "permissions": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.Permissions, format); break; case "defaultcachetime": isPublic = false; propertyNotFound = false; result = (ModuleDefinition.DefaultCacheTime.ToString(outputFormat, formatProvider)); break; case "modulecontrolid": isPublic = false; propertyNotFound = false; result = (ModuleControlId.ToString(outputFormat, formatProvider)); break; case "controlsrc": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(ModuleControl.ControlSrc, format); break; case "controltitle": propertyNotFound = false; result = PropertyAccess.FormatString(ModuleControl.ControlTitle, format); break; case "helpurl": propertyNotFound = false; result = PropertyAccess.FormatString(ModuleControl.HelpURL, format); break; case "supportspartialrendering": propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(ModuleControl.SupportsPartialRendering, formatProvider)); break; case "containerpath": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(ContainerPath, format); break; case "panemoduleindex": isPublic = false; propertyNotFound = false; result = (PaneModuleIndex.ToString(outputFormat, formatProvider)); break; case "panemodulecount": isPublic = false; propertyNotFound = false; result = (PaneModuleCount.ToString(outputFormat, formatProvider)); break; case "isdefaultmodule": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(IsDefaultModule, formatProvider)); break; case "allmodules": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(AllModules, formatProvider)); break; case "isportable": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsPortable, formatProvider)); break; case "issearchable": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsSearchable, formatProvider)); break; case "isupgradeable": isPublic = false; propertyNotFound = false; result = (PropertyAccess.Boolean2LocalizedYesNo(DesktopModule.IsUpgradeable, formatProvider)); break; case "adminpage": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.AdminPage, format); break; case "hostpage": isPublic = false; propertyNotFound = false; result = PropertyAccess.FormatString(DesktopModule.HostPage, format); break; } if (!isPublic && currentScope != Scope.Debug) { propertyNotFound = true; result = PropertyAccess.ContentLocked; } return(result); }
public void Run(RegressionEnvironment env) { try { Module moduleA = null; Module moduleB = null; Module moduleC = null; Module moduleD = null; Module moduleE = null; ModuleOrder order = null; // Tree of 4 deep moduleA = GetModule("A"); moduleB = GetModule("B", "A"); moduleC = GetModule("C", "A", "B", "D"); moduleD = GetModule("D", "A", "B"); order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleC, moduleD, moduleB, moduleA}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleA, moduleB, moduleD, moduleC}, order); // Zero items order = ModuleOrderUtil.GetModuleOrder(Arrays.AsList(new Module[] { }), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] { }, order); // 1 item moduleA = GetModule("A"); order = ModuleOrderUtil.GetModuleOrder(Arrays.AsList(new Module[] {moduleA}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleA}, order); // 2 item moduleA = GetModule("A", "B"); moduleB = GetModule("B"); order = ModuleOrderUtil.GetModuleOrder(Arrays.AsList(new Module[] {moduleB, moduleA}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleB, moduleA}, order); // 3 item moduleB = GetModule("B"); moduleC = GetModule("C", "B"); moduleD = GetModule("D"); order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleB, moduleC, moduleD}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleB, moduleC, moduleD}, order); order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleD, moduleC, moduleB}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleB, moduleD, moduleC}, order); // 2 trees of 2 deep moduleA = GetModule("A", "B"); moduleB = GetModule("B"); moduleC = GetModule("C", "D"); moduleD = GetModule("D"); order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleC, moduleB, moduleA, moduleD}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleB, moduleD, moduleC, moduleA}, order); // Tree of 5 deep moduleA = GetModule("A", "C"); moduleB = GetModule("B"); moduleC = GetModule("C", "B"); moduleD = GetModule("D", "C", "E"); moduleE = GetModule("E"); order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleA, moduleB, moduleC, moduleD, moduleE}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleB, moduleC, moduleE, moduleA, moduleD}, order); order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleB, moduleE, moduleC, moduleA, moduleD}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleB, moduleE, moduleC, moduleA, moduleD}, order); order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleA, moduleD, moduleE, moduleC, moduleB}), EmptySet<string>.Instance, new ModuleOrderOptions()); AssertOrder(new Module[] {moduleB, moduleE, moduleC, moduleA, moduleD}, order); // Tree with null names moduleA = GetModule(null, "C", "A", "B", "D"); moduleB = GetModule(null, "C"); moduleC = GetModule("A"); moduleD = GetModule("B", "A", "C"); moduleE = GetModule("C"); ModuleOrderOptions options = new ModuleOrderOptions(); options.IsCheckUses = false; order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleA, moduleB, moduleC, moduleD, moduleE}), EmptySet<string>.Instance, options); AssertOrder(new Module[] {moduleC, moduleE, moduleD, moduleA, moduleB}, order); // Tree with duplicate names moduleA = GetModule("A", "C"); moduleB = GetModule("B", "C"); moduleC = GetModule("A", "B"); moduleD = GetModule("D", "A"); moduleE = GetModule("C"); order = ModuleOrderUtil.GetModuleOrder( Arrays.AsList(new Module[] {moduleA, moduleB, moduleC, moduleD, moduleE}), EmptySet<string>.Instance, options); AssertOrder(new Module[] {moduleE, moduleB, moduleA, moduleC, moduleD}, order); } catch (Exception ex) { throw new EPRuntimeException(ex); } }
private static void AssertOrder( Module[] ordered, ModuleOrder order) { EPAssertionUtil.AssertEqualsExactOrder(ordered, order.Ordered.ToArray()); }