private void addCustomPropertyCheckboxRow(string labelText, bool status, NetworkProperty networkProperty) { this.tlpProperty.RowStyles.Add(new RowStyle(SizeType.Absolute, MDIParent.PROPERTY_ROW_HEIGHT)); this.tlpProperty.Controls.Add(ControlHelper.getPropertyLabel(labelText), 0, this.tmpPropertyPanelRowCount); this.tlpProperty.Controls.Add(ControlHelper.getPropertyCheckboxPanel(status, networkProperty, new EventHandler(dynamicProperty_ValueChanged)), 1, this.tmpPropertyPanelRowCount); this.tmpPropertyPanelRowCount++; }
private void addCustomPropertyFontRow(string labelText, Font font, NetworkProperty networkProperty) { this.tlpProperty.RowStyles.Add(new RowStyle(SizeType.Absolute, MDIParent.PROPERTY_ROW_HEIGHT)); this.tlpProperty.Controls.Add(ControlHelper.getPropertyLabel(labelText), 0, this.tmpPropertyPanelRowCount); this.tlpProperty.Controls.Add(ControlHelper.getPropertyFontPanel(font, networkProperty, new EventHandler(PropertyColor_Click)), 1, this.tmpPropertyPanelRowCount); this.tmpPropertyPanelRowCount++; }
private void addCustomPropertyEdgeTypeComboBoxRow(AbstractNetwork network, string labelText, EdgeType edgeType, NetworkProperty networkProperty, bool disabled) { this.tlpProperty.RowStyles.Add(new RowStyle(SizeType.Absolute, MDIParent.PROPERTY_ROW_HEIGHT)); this.tlpProperty.Controls.Add(ControlHelper.getPropertyLabel(labelText), 0, this.tmpPropertyPanelRowCount); this.tlpProperty.Controls.Add(ControlHelper.getPropertyEdgeTypeComboBox(edgeType, new EventHandler(dynamicProperty_ValueChanged), new PropertyTag(networkProperty, network), disabled), 1, this.tmpPropertyPanelRowCount); this.tmpPropertyPanelRowCount++; }
public static CheckBox getPropertyCheckboxPanel(bool status, NetworkProperty networkProperty, EventHandler handler) { CheckBox checkbox = new CheckBox(); checkbox.Name = "pgmtCustomPropertyColorPanel" + ControlHelper.CONTROLCOUNT++; checkbox.Checked = status; checkbox.Text = ""; checkbox.CheckedChanged += handler; checkbox.Tag = networkProperty; return checkbox; }
public static Panel getPropertyColorPanel(Color color, NetworkProperty networkProperty, EventHandler handler) { Panel panel = new Panel(); panel.Name = "pgmtCustomPropertyColorPanel" + ControlHelper.CONTROLCOUNT++; panel.Width = 20; panel.Height = 20; panel.BackColor = color; panel.Click += handler; panel.Tag = networkProperty; return panel; }
public static Button getPropertyButton(string text, EventHandler handler, NetworkProperty networkProperty, bool disabled) { Button button = new Button(); button.Name = "tbCustomButton_" + ControlHelper.CONTROLCOUNT++; button.Text = text; button.Click += handler; button.Tag = networkProperty; button.Enabled = !disabled; button.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right))); return button; }
void Awake() { Debug.Log("[Enviroment] Awake"); if (_Instance == null) _Instance = GetComponent<ConstantEnviroment>(); NetworkManager.Instance.Initialize(); PrefabInkBall = Resources.Load(InkBallName); PrefabSubInkBall = Resources.Load(InkSubBallName); PrefabInkScatter = Resources.Load(InkScatterName); PrefabPlayer = Resources.Load(PlayerName); WeaponTable = new WeaponTable(); Network = new NetworkProperty(); Group = new GroupProperty(); Scene = new SceneProperty(); #if STAGING Network = new StagingNetworkProperty(); #endif }
/// <summary> /// Get Network parameters /// </summary> internal static NetworkPropertiesResponse GetNetworkProperties() { NetworkPropertiesResponse response = new NetworkPropertiesResponse(); response.NetworkPropertyCollection = new List<NetworkProperty>(); // Create management class object using the Win32_NetworkAdapterConfiguration // class to retrieve different attributes of the network adapters ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); // Create ManagementObjectCollection to retrieve the attributes ManagementObjectCollection moc = mc.GetInstances(); // Set default completion code to unknown. response.completionCode = Contracts.CompletionCode.Unknown; try { foreach (ManagementObject mo in moc) { // Physical network adapters have MAC addresses. Other Network Adapters will have null MAC addresses. if (!string.IsNullOrEmpty((string)mo["MACAddress"])) { NetworkProperty cr = new NetworkProperty(); cr.index = (uint)mo["Index"]; cr.description = (string)mo["Description"]; cr.serviceName = (string)mo["ServiceName"]; cr.macAddress = (string)mo["MACAddress"]; cr.ipEnabled = (bool)mo["IPEnabled"]; cr.ipAddress = (string[])mo["IPAddress"]; cr.subnetMask = (string[])mo["IPSubnet"]; cr.gatewayAddress = (string[])mo["DefaultIPGateway"]; cr.dhcpEnabled = (bool)mo["DHCPEnabled"]; cr.dhcpServer = (string)mo["DHCPServer"]; cr.dnsHostName = (string)mo["DNSHostName"]; cr.dnsDomain = (string)mo["DNSDomain"]; cr.dnsSearchOrder = (string[])mo["DNSServerSearchOrder"]; cr.winsPrimary = (string)mo["WINSPrimaryServer"]; cr.winsSecondary = (string)mo["WINSSecondaryServer"]; cr.completionCode = Contracts.CompletionCode.Success; response.NetworkPropertyCollection.Add(cr); } } } catch (Exception ex) { response.completionCode = Contracts.CompletionCode.Failure; Console.WriteLine("Get NIC properties failed with message " + ex.Message); return response; } response.completionCode = Contracts.CompletionCode.Success; return response; }
private void addCustomPropertyGroupMoveToolRow(string labelText, float smallStep, float longStep, AbstractNetwork network, NetworkProperty networkProperty, bool disabled) { this.tlpProperty.RowStyles.Add(new RowStyle(SizeType.Absolute, MDIParent.PROPERTY_ROW_HEIGHT_BUTTON)); this.tlpProperty.Controls.Add(ControlHelper.getPropertyLabel(labelText), 0, this.tmpPropertyPanelRowCount); this.tlpProperty.Controls.Add(ControlHelper.getPropertyGroupMoveTool(smallStep, longStep, network, new PropertyGroupMoveHandler(PropertyGroupMoveTool_valueChanged), networkProperty, disabled), 1, this.tmpPropertyPanelRowCount); this.tmpPropertyPanelRowCount++; }
public static NumericUpDown getPropertyNumericUpDown(decimal value, decimal minimumValue, decimal maximumValue, EventHandler handler, NetworkProperty networkProperty, bool disabled, int decimalPlaces) { NumericUpDown numericUpDown = new NumericUpDown(); numericUpDown.Name = "tbCustomNumericUpDown_" + ControlHelper.CONTROLCOUNT++; numericUpDown.Minimum = minimumValue; numericUpDown.Maximum = maximumValue; numericUpDown.Value = value; numericUpDown.DecimalPlaces = decimalPlaces; numericUpDown.ValueChanged += handler; numericUpDown.Tag = networkProperty; numericUpDown.Enabled = !disabled; numericUpDown.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right))); return numericUpDown; }
public static TextBox getPropertyTextBox(string text, EventHandler handler, NetworkProperty networkProperty, bool disabled) { TextBox textbox = new TextBox(); textbox.Name = "tbCustomTextBox_" + ControlHelper.CONTROLCOUNT++; textbox.Text = text; textbox.TextChanged += handler; textbox.Tag = networkProperty; textbox.ReadOnly = disabled; textbox.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right))); return textbox; }
public static Label getPropertyFontPanel(Font font, NetworkProperty networkProperty, EventHandler handler) { Label label = new Label(); label.Name = "pgmtCustomPropertyFontLabel" + ControlHelper.CONTROLCOUNT++; label.Text = font.FontFamily.Name + " (" + font.Size.ToString() + ")"; label.Font = font; label.Click += handler; label.Tag = networkProperty; label.Enabled = true; label.BorderStyle = BorderStyle.Fixed3D; label.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right))); return label; }
public static PropertyGroupMoveTool getPropertyGroupMoveTool(float smallStep, float longStep, AbstractNetwork network, PropertyGroupMoveHandler handler, NetworkProperty networkProperty, bool disabled) { PropertyGroupMoveTool tool = new PropertyGroupMoveTool(); tool.Name = "pgmtCustomPropertyGroupMoveTool" + ControlHelper.CONTROLCOUNT++; tool.Network = network; tool.Property = networkProperty; tool.valueChanged += handler; tool.SmallStep = smallStep; tool.LongStep = longStep; tool.Anchor = ((AnchorStyles)((AnchorStyles.Left | AnchorStyles.Right))); return tool; }
/// <summary> /// Change any properties of the selected items. Use this method via Property panel. /// </summary> public void modifySelectedItems(NetworkProperty property, float offset) { List<AbstractItem> changedItems = new List<AbstractItem>(); AbstractNetworkItem firstSelectedItem = getFirstSelectedNetworkItem(); foreach (AbstractItem item in this.selectedItems) { if (item is AbstractNetworkItem) { AbstractNetworkItem networkItem = (AbstractNetworkItem)item; switch (property) { case NetworkProperty.ORIGO_X: networkItem.Origo = new PointF(networkItem.Origo.X + offset, networkItem.Origo.Y); break; case NetworkProperty.ORIGO_Y: networkItem.Origo = new PointF(networkItem.Origo.X, networkItem.Origo.Y + offset); break; case NetworkProperty.RADIUS: networkItem.Radius = networkItem.Radius + offset; break; case NetworkProperty.SIZE_WIDTH: networkItem.Size = new SizeF(networkItem.Size.Width + offset, networkItem.Size.Height); break; case NetworkProperty.SIZE_HEIGHT: networkItem.Size = new SizeF(networkItem.Size.Width, networkItem.Size.Height + offset); break; case NetworkProperty.LABELOFFSET_X: networkItem.LabelOffset = new PointF(networkItem.LabelOffset.X + offset, networkItem.LabelOffset.Y); break; case NetworkProperty.LABELOFFSET_Y: networkItem.LabelOffset = new PointF(networkItem.LabelOffset.X, networkItem.LabelOffset.Y + offset); break; case NetworkProperty.SAMEORIGOX: if (firstSelectedItem != null) { networkItem.Origo = new PointF(firstSelectedItem.Origo.X, networkItem.Origo.Y); } break; case NetworkProperty.SAMEORIGOY: if (firstSelectedItem != null) { networkItem.Origo = new PointF(networkItem.Origo.X, firstSelectedItem.Origo.Y); } break; } if (item is Transition) { Transition transitionItem = (Transition)networkItem; switch (property) { case NetworkProperty.ANGLE: transitionItem.Angle += offset; break; case NetworkProperty.PRIORITY: transitionItem.Priority += (int)offset; break; case NetworkProperty.DELAY: transitionItem.Delay += (int)offset; break; case NetworkProperty.CLOCKRADIUS: transitionItem.ClockRadius = transitionItem.ClockRadius + offset; break; case NetworkProperty.CLOCKOFFSET_X: transitionItem.ClockOffset = new PointF(transitionItem.ClockOffset.X + offset, transitionItem.ClockOffset.Y); break; case NetworkProperty.CLOCKOFFSET_Y: transitionItem.ClockOffset = new PointF(transitionItem.ClockOffset.X, transitionItem.ClockOffset.Y + offset); break; } } if (item is Position) { Position positionItem = (Position)networkItem; switch (property) { case NetworkProperty.CAPACITYLIMIT: positionItem.CapacityLimit += (int)offset; break; } } } else if (item is AbstractEdge) { AbstractEdge edge = (AbstractEdge)item; switch (property) { case NetworkProperty.WEIGHT: edge.Weight += (int)offset; break; case NetworkProperty.CHANGEDIRECTION: changedItems.Add(edge); break; } } } if ((changedItems != null) && (changedItems.Count > 0)) { for (int i = 0; i < changedItems.Count; i++) { if (changedItems[i] is AbstractEdge) { this.changeEdgeDirection((AbstractEdge)changedItems[i], true); } } } }
public PropertyTag(AbstractItem parent, AbstractItem item, NetworkProperty property) { this.parent = parent; this.item = item; this.property = property; }
public void Load(AsgardBase Base, TiledMap map) { Width = map.Width; Height = map.Height; TileWidth = map.TileWidth; TileHeight = map.TileHeight; FirstId = 1; var layers = map.Layers.ToList(); if (layers.Count < 5) return; Layer1 = new LayerData(layers[0] as TiledTileLayer); Layer2 = new LayerData(layers[1] as TiledTileLayer); Layer3 = new LayerData(layers[2] as TiledTileLayer); Layer4 = new LayerData(layers[3] as TiledTileLayer); Layer5 = new LayerData(layers[4] as TiledTileLayer); LoadCollisions(Base, map); }
private void addCustomPropertyTextRow(string labelText, string textBoxText, NetworkProperty networkProperty, bool disabled) { this.tlpProperty.RowStyles.Add(new RowStyle(SizeType.Absolute, MDIParent.PROPERTY_ROW_HEIGHT)); this.tlpProperty.Controls.Add(ControlHelper.getPropertyLabel(labelText), 0, this.tmpPropertyPanelRowCount); this.tlpProperty.Controls.Add(ControlHelper.getPropertyTextBox(textBoxText, new EventHandler(dynamicProperty_ValueChanged), networkProperty, disabled), 1, this.tmpPropertyPanelRowCount); this.tmpPropertyPanelRowCount++; }
private void PropertyGroupMoveTool_valueChanged(AbstractNetwork network, NetworkProperty networkProperty, float value) { if ((this.tlpProperty != null) && (this.tlpProperty.Tag != null)) { if (this.tlpProperty.Tag is NetworkPropertyGroup) { NetworkPropertyGroup npg = (NetworkPropertyGroup)this.tlpProperty.Tag; network.modifySelectedItems(networkProperty, value); this.reDrawActivePetriNetwork(); } } }
/// <summary> /// Get Network parameters /// </summary> static internal NetworkPropertiesResponse GetNetworkProperties() { string[] ipAddresses = null; string[] subnets = null; string[] gateways = null; string dnsHostName = null; string dhcpServer = null; string dnsDomain = null; string macAddress = null; bool dhcpEnabled = true; string primary = null; string secondary = null; string[] DNSServerAddress = null; NetworkPropertiesResponse response = new NetworkPropertiesResponse(); response.NetworkPropertyCollection = new List<NetworkProperty>(); // Create management class object using the Win32_NetworkAdapterConfiguration // class to retrieve different attributes of the network adapters ManagementClass mc = new ManagementClass("Win32_NetworkAdapterConfiguration"); // Create ManagementObjectCollection to retrieve the attributes ManagementObjectCollection moc = mc.GetInstances(); // Set default completion code to unknown. response.completionCode = 0; try { foreach (ManagementObject mo in moc) { // If interface has IP enabled if ((bool)mo["ipEnabled"]) { ipAddresses = (string[])mo["IPAddress"]; subnets = (string[])mo["IPSubnet"]; gateways = (string[])mo["DefaultIPGateway"]; dnsHostName = (string)mo["DNSHostName"]; dhcpServer = (string)mo["DHCPServer"]; dnsDomain = (string)mo["DNSDomain"]; macAddress = (string)mo["MACAddress"]; dhcpEnabled = (bool)mo["DHCPEnabled"]; primary = (string)mo["WINSPrimaryServer"]; secondary = (string)mo["WINSSecondaryServer"]; DNSServerAddress = (string[])mo["DNSServerSearchOrder"]; int index = 0; foreach (string ip in ipAddresses) { if (NetworkInterfaces.checkIpFormat(ip)) { NetworkProperty cr = new NetworkProperty(); cr.ipAddress = ipAddresses.ToArray()[index]; if (subnets != null) { cr.subnetMask = subnets.ToArray()[index]; } if (gateways != null) { cr.gatewayAddress = gateways.ToArray()[index]; } if (DNSServerAddress != null) { cr.dnsAddress = DNSServerAddress.ToArray()[index]; } cr.dhcpServer = dhcpServer; cr.dnsDomain = dnsDomain; cr.dnsHostName = dnsHostName; cr.macAddress = macAddress; cr.dhcpEnabled = dhcpEnabled; cr.primary = primary; cr.secondary = secondary; cr.completionCode = 1; response.NetworkPropertyCollection.Add(cr); } index++; } } else // all other interfaces (with ip not enables) { macAddress = (string)mo["MACAddress"]; // Populating interfaces only with valid mac addresses - ignoring loopback and other virtual interfaces if (macAddress != null) { NetworkProperty cr = new NetworkProperty(); cr.macAddress = macAddress; cr.completionCode = 1; response.NetworkPropertyCollection.Add(cr); } } } } catch (Exception ex) { response.completionCode = 0; Console.WriteLine("Get NIC properties failed with message " + ex.Message); return response; } response.completionCode = 1; return response; }
private void addCustomPropertyNumberRow(string labelText, float value, float minimumValue, float maximumValue, NetworkProperty networkProperty, bool disabled, int decimalPlaces) { this.tlpProperty.RowStyles.Add(new RowStyle(SizeType.Absolute, MDIParent.PROPERTY_ROW_HEIGHT)); this.tlpProperty.Controls.Add(ControlHelper.getPropertyLabel(labelText), 0, this.tmpPropertyPanelRowCount); this.tlpProperty.Controls.Add(ControlHelper.getPropertyNumericUpDown((decimal)value, (decimal)minimumValue, (decimal)maximumValue, new EventHandler(dynamicProperty_ValueChanged), networkProperty, disabled, decimalPlaces), 1, this.tmpPropertyPanelRowCount); this.tmpPropertyPanelRowCount++; }
public PropertyTag(NetworkProperty property, AbstractNetwork network) : this(null, null, property) { this.network = network; }
/// <summary> /// Change the Origo of the selected items. Use this method via move tool. /// </summary> public void modifySelectedItems(NetworkProperty property, PointF origoOffset) { foreach (AbstractItem item in this.selectedItems) { if (item is AbstractNetworkItem) { AbstractNetworkItem networkItem = (AbstractNetworkItem)item; switch (property) { case NetworkProperty.ORIGO: networkItem.Origo = new PointF(networkItem.Origo.X + origoOffset.X, networkItem.Origo.Y + origoOffset.Y); break; } } } }