void Start()
 {
     settings = LoadManager.LoadTargetSettingsXML(SceneManager.GetActiveScene().name);
     settings.TargetsInLevel = FindObjectsOfType<Target>().Length;
     running = true;
     medal.color = platinum;
 }
Exemple #2
0
 ///
 ///<summary>
 /// Adds a target and it's settings to the project.
 ///</summary>
 ///<param name="_tSettings">
 ///  Information concerning the target server/device 
 ///</param>
 public void addTarget(TargetSettings targetInfo)
 {
     if(_lstTargets.Contains(targetInfo) == false)
       {
     _lstTargets.Add(targetInfo);
       }
 }
        ///
        /// <summary>
        /// Adds new columns/target to the list view when called.
        /// </summary>
        /// <param name="_ts">The new target's settings</param>
        public void addSingleTarget(TargetSettings ts)
        {
            ListViewItem lviNewRow = new ListViewItem(ts.TargetServer);
              lviNewRow.Name = ts.TargetServer;                           //Sets ListItem a name as target value
              lviNewRow.SubItems.Add("");                                 //Progress bar goes here
              lviNewRow.SubItems.Add("");                                 //%
              lviNewRow.SubItems.Add("");                                 //Status Column
              lviNewRow.SubItems.Add("");                                 //Speed Column
              lviNewRow.SubItems.Add(ts.DestinationFolder);

              if(ts.UploadRate == 0)
              {
            lviNewRow.SubItems.Add("Maximum");
              }
              else
              {
            lviNewRow.SubItems.Add(ts.UploadRate.ToString() + "KiB/S"); //Maximum Upload Speed
              }

              this.targetList.Items.Add(lviNewRow);             //Adds Item to List
              ProgressBar pb = new ProgressBar();               //Creates progress bar
              pb.Name = ts.TargetServer;                        //Progress bar identifier
              int row = targetList.Items.IndexOf(lviNewRow);    //Gets row of current item being added
              this.targetList.AddEmbeddedControl(pb, 1, row);   //'Paints' the control over the desired location
        }
        private TargetSettings _ts; //Settings to be copied to every new IP

        #endregion Fields

        #region Constructors

        ///
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="tsettings">Settings to be copied to every new IP</param>
        /// <param name="strFilePath">File path</param>
        /// <param name="lstAllIPs">IP address already used by the project</param>
        public ImportIPs(TargetSettings tsettings, string strFilePath, List<string> lstAllIPs)
        {
            _ts = tsettings;
              _strFilePath = strFilePath;
              _lstAllIPs = lstAllIPs;
              _lstTargets = new List<TargetSettings>();
        }
        /// 
        /// <summary>
        /// Executes the installation process on the SNMP agent.
        /// </summary>
        /// <param name="ts">Target's settings</param>
        /// <param name="uploadFolder">Path of folder with exe update within it</param>
        /// <returns>True if installation was executed successfully</returns>
        public static bool setExecute(TargetSettings ts, string uploadFolder)
        {
            SimpleSnmp snmp = new SimpleSnmp(ts.TargetServer, ts.Community);

              if(!snmp.Valid)
              {
            return false;
              }

              string d = ts.DestinationFolder.Substring(1);
              int i = uploadFolder.LastIndexOf("\\") + 1;
              string relativePath = uploadFolder.Substring(i);
              string destination = d.Replace("/", "\\");
              string batFile = ts.RootPath + destination + relativePath + "\\UpdateVersion.bat";

              Dictionary<Oid, AsnType> result = snmp.Set(SnmpVersion.Ver2,
                                                    new Vb[] {
                                                    new Vb(new Oid("1.3.6.1.4.1.2566.127.1.1.157.3.1.1.10.0"),
                                                           new OctetString(batFile))});

              if(result != null)
              {
            return true;
              }
              return false;
        }
 /// 
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="proSettings">Project's settings</param>
 /// <param name="ts">Target's settings</param>
 /// <param name="tabInt">Reference to TabPage Interface</param>
 public TargetUpload(ProjectSettings proSettings, TargetSettings ts, TabPageInterface tabInt)
 {
     _proSettings = proSettings;
       _strProName = proSettings.ProjectName;
       _tSettings = ts;
       DirectoryInfo d = new DirectoryInfo(proSettings.SourcePath);
       _numDirectorySize = this.dirSize(d);                        //Finds size of the directory
       WputOutput += new WputOutputHandler(tabInt.OnUpdateProgress);
       ProcessStop += new ProcessStoppedHandler(tabInt.OnProcessStopEvent);
       ProcessError += new ProcessErrorHandler(tabInt.OnProcessErrorEvent);
       _strTargetServer = _tSettings.TargetServer;
 }
        private TargetSettings _tSettings; //Upload's target settings

        #endregion Fields

        #region Constructors

        ///
        /// <summary>
        /// Target constructor.  Called when new target is being added.
        /// </summary>
        /// <param name="currentTargetList">Current IP addresses in use</param>
        public frmAddTarget(List<TargetSettings> currentTargetList)
        {
            _tSettings = new TargetSettings();
              _lstCurTargets = currentTargetList;
              InitializeComponent();
              txtCommunity.Text = "management";
              txtRootPath.Text = @"D:\";
              txtDestPath.Text = "/Transfer/Nathan/";             //Delete
              txtTargetServer.Text = "172.29.200.96";             //Delete
              txtUserName.Text = "dvm_user";                      //Delete
              txtPassword.Text = "dvm";                           //Delete
        }
 ///
 /// <summary>
 /// Constructor.  Called when editing an existing.
 /// </summary>
 /// <param name="currentTargetList">Current IP addresses in use</param>
 /// <param name="oldTs">Target settings of the target being edited</param>
 public frmAddTarget(List<TargetSettings> currentTargetList, TargetSettings oldTs)
 {
     _tSettings = oldTs;
       _oldIP = oldTs.TargetServer;
       _lstCurTargets = currentTargetList;
       InitializeComponent();
       this.Text = "Edit Target";
       txtTargetServer.Text = oldTs.TargetServer; //!!
       txtDestPath.Text = oldTs.DestinationFolder;
       txtRootPath.Text = oldTs.RootPath;
       txtUserName.Text = oldTs.UserName;
       txtPassword.Text = oldTs.UserPassword;
       txtCommunity.Text = oldTs.Community;
       numUploadRate.Value = oldTs.UploadRate;
 }
Exemple #9
0
        public AvailabilitySet(Arm.AvailabilitySet availabilitySet, TargetSettings targetSettings)
        {
            _SourceAvailabilitySet = availabilitySet;

            this.SetTargetName(_SourceAvailabilitySet.Name, targetSettings);

            if (availabilitySet.PlatformFaultDomainCount < Constants.AvailabilitySetMinPlatformFaultDomain)
            {
                // todo future, track object translation alerts
                this.PlatformFaultDomainCount = Constants.AvailabilitySetMinPlatformFaultDomain;
            }
            else if (availabilitySet.PlatformFaultDomainCount > Constants.AvailabilitySetMaxPlatformFaultDomain)
            {
                // todo future, track object translation alerts
                this.PlatformFaultDomainCount = Constants.AvailabilitySetMaxPlatformFaultDomain;
            }
            else
            {
                this.PlatformFaultDomainCount = availabilitySet.PlatformFaultDomainCount;
            }

            if (availabilitySet.PlatformUpdateDomainCount < Constants.AvailabilitySetMinPlatformUpdateDomain)
            {
                // todo future, track object translation alerts
                this.PlatformUpdateDomainCount = Constants.AvailabilitySetMinPlatformUpdateDomain;
            }
            else if (availabilitySet.PlatformUpdateDomainCount > Constants.AvailabilitySetMaxPlatformUpdateDomain)
            {
                // todo future, track object translation alerts
                this.PlatformUpdateDomainCount = Constants.AvailabilitySetMaxPlatformUpdateDomain;
            }
            else
            {
                this.PlatformUpdateDomainCount = availabilitySet.PlatformUpdateDomainCount;
            }
        }
Exemple #10
0
        public AvailabilitySet(Arm.AvailabilitySet availabilitySet, TargetSettings targetSettings, ILogProvider logProvider) : base(ArmConst.MicrosoftCompute, ArmConst.AvailabilitySets, logProvider)
        {
            _SourceAvailabilitySet = availabilitySet;

            this.SetTargetName(_SourceAvailabilitySet.Name, targetSettings);

            if (availabilitySet.PlatformFaultDomainCount < Constants.AvailabilitySetMinPlatformFaultDomain)
            {
                // todo future, track object translation alerts
                this.PlatformFaultDomainCount = Constants.AvailabilitySetMinPlatformFaultDomain;
            }
            else if (availabilitySet.PlatformFaultDomainCount > Constants.AvailabilitySetMaxPlatformFaultDomain)
            {
                // todo future, track object translation alerts
                this.PlatformFaultDomainCount = Constants.AvailabilitySetMaxPlatformFaultDomain;
            }
            else
            {
                this.PlatformFaultDomainCount = availabilitySet.PlatformFaultDomainCount;
            }

            if (availabilitySet.PlatformUpdateDomainCount < Constants.AvailabilitySetMinPlatformUpdateDomain)
            {
                // todo future, track object translation alerts
                this.PlatformUpdateDomainCount = Constants.AvailabilitySetMinPlatformUpdateDomain;
            }
            else if (availabilitySet.PlatformUpdateDomainCount > Constants.AvailabilitySetMaxPlatformUpdateDomain)
            {
                // todo future, track object translation alerts
                this.PlatformUpdateDomainCount = Constants.AvailabilitySetMaxPlatformUpdateDomain;
            }
            else
            {
                this.PlatformUpdateDomainCount = availabilitySet.PlatformUpdateDomainCount;
            }
        }
Exemple #11
0
        public VirtualNetwork(Arm.VirtualNetwork virtualNetwork, List <NetworkSecurityGroup> networkSecurityGroups, List <RouteTable> routeTables, TargetSettings targetSettings) : base(ArmConst.MicrosoftNetwork, ArmConst.VirtualNetworks)
        {
            this.SourceVirtualNetwork = virtualNetwork;
            this.SetTargetName(virtualNetwork.Name, targetSettings);

            foreach (Arm.VirtualNetworkGateway virtualNetworkGateway in virtualNetwork.VirtualNetworkGateways)
            {
                TargetVirtualNetworkGateways.Add(new VirtualNetworkGateway(virtualNetworkGateway, targetSettings));
            }

            foreach (Arm.Subnet subnet in virtualNetwork.Subnets)
            {
                this.TargetSubnets.Add(new Subnet(this, subnet, networkSecurityGroups, routeTables, targetSettings));
            }

            foreach (String addressPrefix in virtualNetwork.AddressPrefixes)
            {
                this.AddressPrefixes.Add(addressPrefix);
            }

            foreach (String dnsServer in virtualNetwork.DnsServers)
            {
                this.DnsServers.Add(dnsServer);
            }
        }
Exemple #12
0
 public StorageAccount(IStorageAccount source, TargetSettings targetSettings, ILogProvider logProvider) : base(ArmConst.MicrosoftStorage, ArmConst.StorageAccounts, logProvider)
 {
     _Source = source;
     this.SetTargetName(source.Name, targetSettings);
     this.StorageAccountType = MigrationTarget.StorageAccount.GetStorageAccountType(source.AccountType);
 }
Exemple #13
0
 public static int MaximumTargetNameLength(TargetSettings targetSettings)
 {
     return(24 - targetSettings.StorageAccountSuffix.Length);
 }
Exemple #14
0
 public LoadBalancer(string targetName, TargetSettings targetSettings, ILogProvider logProvider) : base(ArmConst.MicrosoftNetwork, ArmConst.LoadBalancers, logProvider)
 {
     this.SetTargetName(targetName, targetSettings);
     new FrontEndIpConfiguration(this);
 }
        ///
        /// <summary>
        /// Reads the text file, creates new targets from IP address
        /// and adds them to the list.
        /// </summary>
        /// <param name="strFpath">File path</param>
        private void importFile(string strFpath)
        {
            try
              {
            StreamReader stream = new StreamReader(strFpath);
            string strLine;

            while((strLine = stream.ReadLine()) != null)              //Read line from file
            {
              bool result = checkValidity(strLine);

              if(result == true)
              {
            if(_lstAllIPs.Contains(strLine) == false)              //Checks to see if imported IP is already in use
            {
              TargetSettings temp = new TargetSettings();
              temp.TargetServer = strLine;
              temp.Community = _ts.Community;
              temp.DestinationFolder = _ts.DestinationFolder;
              temp.RootPath = _ts.RootPath;
              temp.UploadRate = _ts.UploadRate;
              temp.UserName = _ts.UserName;
              temp.UserPassword = _ts.UserPassword;
              this._lstTargets.Add(temp);                          //Add to target list
              this._lstAllIPs.Add(strLine);                        //Add to 'IP in use' list
            }
              }
            }
            stream.Close();
              }
              catch
              {
            throw new Exception();
              }
        }
Exemple #16
0
 public override void SetTargetName(string targetName, TargetSettings targetSettings)
 {
     this.TargetName       = targetName.Trim().Replace(" ", String.Empty);
     this.TargetNameResult = this.TargetName + targetSettings.AvailabilitySetSuffix;
 }
 ///
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="_ts">Target Settings to test</param>
 public CheckConnection(TargetSettings ts)
 {
     this.ts = ts;
 }
        /// <summary>
        /// Initializes the match when one is started
        /// </summary>
        private void InitializeMatch()
        {
            // Find all the players
            Controller[] findControllers = FindObjectsOfType<Controller>();
            for (int i = 0; i < findControllers.Length; i++)
            {
                controllers.Add(findControllers[i]);
            }
			// Load the last settings used
			if(settingsName.Contains("Target"))
				currentTargetGameSettings = LoadManager.LoadTargetSettingsXML(settingsName);
			else
				currentGameSettings = LoadManager.LoadGameSettings(settingsName);

			//Find the spawnpoints
			spawnPoints.AddRange(GameObject.FindGameObjectsWithTag("Respawn"));

			StatisticManager.instance.statistics = new Dictionary<PlayerID, Statistic>();

			//If there aren't already players in this scene, we need to create them
			if(controllers.Count == 0) {
				PlayerID currentID = PlayerID.None;
				for (int i = 0; i < ControllerManager.instance.NumPlayers; i++) {
					currentID = (PlayerID)(i + 1);
					GameObject spawnPrefab = ControllerManager.instance.IsAIController(currentID) ? aiPlayerPrefab : playerPrefab;
					GameObject temp = (GameObject)GameObject.Instantiate(spawnPrefab, spawnPoints[i].transform.position, Quaternion.Euler(0,90,0));
					Controller tempController = temp.GetComponent<Controller>();
					controllers.Add(tempController);
					tempController.ProfileComponent = ProfileManager.instance.GetProfile(currentID);
					tempController.ID = currentID;
					StatisticManager.instance.statistics.Add(currentID, new Statistic());
				}
			}

			for (int i = 0; i < ControllerManager.instance.NumPlayers; i++) {
				for (int j = 0; j < ControllerManager.instance.NumPlayers; j++) {
					if(i != j) {
						StatisticManager.instance.statistics[(PlayerID)(i+1)].killedPlayer.Add((PlayerID)(j+1),0);
						StatisticManager.instance.statistics[(PlayerID)(i+1)].killedByPlayer.Add((PlayerID)(j+1),0);
					}
				}
			}

            // Initialize the tokens
            TokenSpawner.instance.Init(currentGameSettings.EnabledTokens);

            for (int i = 0; i < controllers.Count; i++)
            {
                controllers[i].LifeComponent.Lives = currentGameSettings.StockLimit;
            }

            // Set up a timer that counts up for targets
			if (currentTargetGameSettings != null)
            {
				currentTargetGameSettings.TargetsInLevel = FindObjectsOfType<Target>().Length;
                matchTimer = gameObject.AddComponent<Timer>();
                matchTimer.Initialize(Mathf.Infinity, "Match Timer");
            }
            // All other games will have a countdown timer
            else
            {
                // If the timer is enabled in that game type
				if (currentGameSettings.TimeLimit > 0)
                {
					float timeLimit = currentGameSettings.TimeLimit == 0 ? Mathf.Infinity : currentGameSettings.TimeLimit;
					matchTimer = CountdownTimer.CreateTimer(gameObject, timeLimit, "Match Timer", TimeUp);
                }
            }
        }
 ///
 /// <summary>
 /// Adds upload target to project.
 /// </summary>
 /// <param name="_strProName">Project's name</param>
 /// <param name="ts">Target settings</param>
 public void addTarget(string strProName, TargetSettings ts)
 {
     _dicProjectList[strProName].addTarget(ts);
       _tabInterface.addSingleTarget(strProName, ts);
 }
Exemple #20
0
    protected virtual void ResetActionSkill()
    {
        overlayColor = new Color(0.6f, 0.3f, 0.2f, 0.7f);
        highlightColor = new Color(0.9f, 0.6f, 0.4f, 0.85f);

        if(!HasParam("hitType")) {
            SetParam("hitType", Formula.Constant(0));
        }
        targetSettings = new TargetSettings[]{new TargetSettings()};
        targetSettings[0].Owner = this;

        // if(targetEffects == null || targetEffects.Length == 0) {
        // 	StatEffect healthDamage = new StatEffect();
        // 	healthDamage.statName = "health";
        // 	healthDamage.effectType = StatEffectType.Augment;
        // 	healthDamage.reactableTypes = new[]{"attack"};
        // 	healthDamage.value = Formula.Lookup("damage", LookupType.ActorSkillParam);
        // 	targetEffects = new StatEffectGroup[]{new StatEffectGroup{effects=new StatEffect[]{healthDamage}}};
        // }
    }
 public override void SetTargetName(string targetName, TargetSettings targetSettings)
 {
     this.TargetName       = targetName.Trim().Replace(" ", String.Empty);
     this.TargetNameResult = this.TargetName;
 }
 public StorageAccount(string name, TargetSettings targetSettings)
 {
     this.SetTargetName(name, targetSettings);
 }
 public ThreadObject(string strProName, TargetSettings ts)
 {
     this.strProName = strProName;
       this.ts = ts;
 }
Exemple #24
0
        public NetworkInterface(Asm.VirtualMachine virtualMachine, Asm.NetworkInterface networkInterface, List <VirtualNetwork> virtualNetworks, List <NetworkSecurityGroup> networkSecurityGroups, TargetSettings targetSettings)
        {
            _SourceNetworkInterface = networkInterface;
            this.SetTargetName(networkInterface.Name, targetSettings);
            this.IsPrimary          = networkInterface.IsPrimary;
            this.EnableIPForwarding = networkInterface.EnableIpForwarding;

            foreach (Asm.NetworkInterfaceIpConfiguration asmNetworkInterfaceIpConfiguration in networkInterface.NetworkInterfaceIpConfigurations)
            {
                NetworkInterfaceIpConfiguration migrationNetworkInterfaceIpConfiguration = new NetworkInterfaceIpConfiguration(asmNetworkInterfaceIpConfiguration, virtualNetworks, targetSettings);
                this.TargetNetworkInterfaceIpConfigurations.Add(migrationNetworkInterfaceIpConfiguration);
            }

            if (virtualMachine.NetworkSecurityGroup != null)
            {
                this.NetworkSecurityGroup = NetworkSecurityGroup.SeekNetworkSecurityGroup(networkSecurityGroups, virtualMachine.NetworkSecurityGroup.ToString());
            }
        }
Exemple #25
0
    protected virtual void SetArgsFromTarget(
		Target t,
		TargetSettings ts,
		string prefix,
		Vector3? start = null
	)
    {
        TargetingMode tm = TargetingMode.Custom;
        if(ts != null) {
            tm = ts.targetingMode;
        } else {
            if(t.path != null) { tm = TargetingMode.Pick; }
            else if(t.character != null) { tm = TargetingMode.Pick; }
            else if(t.facing != null) { tm = TargetingMode.Radial; }
            else if(t.subregion != -1) { tm = TargetingMode.SelectRegion; }
        }
        Vector3 pos = character.TilePosition;
        switch(tm) {
            case TargetingMode.Self:
            case TargetingMode.Pick:
            case TargetingMode.Path:
                pos = t.Position;
                SetArgsFrom(pos, t.facing, prefix, start);
                break;
            case TargetingMode.Cardinal:
            case TargetingMode.Radial:
            //FIXME: wrong for selectRegion
            case TargetingMode.SelectRegion:
                if(t.character != null) {
                    pos = t.character.TilePosition;
                } else if(t.path != null) {
                    pos = t.Position;
                }
                SetArgsFrom(pos, t.facing, prefix, start);
                break;
            default:
                Debug.LogError("Unrecognized targeting mode");
                break;
        }
    }
Exemple #26
0
        /// <summary>
        /// Gets a file of target settings from the file name
        /// </summary>
        /// <param name="extension">Where the file is located</param>
        /// <returns>The game settings from resources</returns>
        public static TargetSettings LoadTargetSettingsXML(string extension)
        {
            // Get a default settings in case none exists
            TargetSettings data = new TargetSettings();
            Debug.Log(xmlSettingsDataPath + extension);
            TextAsset xmlFile = (TextAsset)Resources.Load(xmlSettingsDataPath + extension);
            MemoryStream assetStream = new MemoryStream(xmlFile.bytes);
            XmlReader reader = XmlReader.Create(assetStream);

            bool endofSettings = false;
            while (reader.Read() && !endofSettings)
            {
                if (reader.IsStartElement())
                {
                    switch (reader.LocalName)
                    {
                        case "Platinum":
                            data.PlatinumTime = reader.ReadElementContentAsFloat();
                            break;
                        case "Gold":
                            data.GoldTime = reader.ReadElementContentAsFloat();
                            break;
                        case "Silver":
                            data.SilverTime = reader.ReadElementContentAsFloat();
                            break;
                        case "Bronze":
                            data.BronzeTime = reader.ReadElementContentAsFloat();
                            break;
                        case "TargetSettings":
                            break;
                        default:
                            endofSettings = true;
                            break;
                    }
                }
            }
            reader.Close();
            return data;
        }
Exemple #27
0
 public RouteTable(IRouteTable source, TargetSettings targetSettings) : base(ArmConst.MicrosoftNetwork, ArmConst.RouteTables)
 {
     _SourceRouteTable = source;
     this.SetTargetName(source.Name, targetSettings);
 }
Exemple #28
0
        public VirtualMachine(Arm.VirtualMachine virtualMachine, TargetSettings targetSettings) : base(ArmConst.MicrosoftCompute, ArmConst.VirtualMachines)
        {
            this.Source = virtualMachine;
            this.SetTargetName(virtualMachine.Name, targetSettings);
            this.TargetSize          = virtualMachine.VmSize;
            this.OSVirtualHardDiskOS = virtualMachine.OSVirtualHardDiskOS;

            if (virtualMachine.OSVirtualHardDisk != null && virtualMachine.OSVirtualHardDisk.GetType() == typeof(Azure.Arm.ManagedDisk))
            {
                Azure.Arm.ManagedDisk sourceManagedDisk = (Azure.Arm.ManagedDisk)virtualMachine.OSVirtualHardDisk;

                foreach (Disk targetDisk in virtualMachine.AzureSubscription.ArmTargetManagedDisks)
                {
                    if ((targetDisk.SourceDisk != null) && (targetDisk.SourceDisk.GetType() == typeof(Azure.Arm.ManagedDisk)))
                    {
                        Azure.Arm.ManagedDisk targetDiskSourceDisk = (Azure.Arm.ManagedDisk)targetDisk.SourceDisk;
                        if (String.Compare(targetDiskSourceDisk.Name, sourceManagedDisk.Name, true) == 0)
                        {
                            this.OSVirtualHardDisk          = targetDisk;
                            targetDisk.ParentVirtualMachine = this;
                            targetDisk.HostCaching          = sourceManagedDisk.HostCaching;
                            break;
                        }
                    }
                }
            }
            else
            {
                if (virtualMachine.OSVirtualHardDisk != null)
                {
                    this.OSVirtualHardDisk = new Disk(virtualMachine.OSVirtualHardDisk, this, targetSettings);
                }
            }

            if (virtualMachine.OSVirtualHardDisk != null && virtualMachine.OSVirtualHardDisk.GetType() == typeof(Arm.ClassicDisk))
            {
                Arm.ClassicDisk armDisk = (Arm.ClassicDisk)virtualMachine.OSVirtualHardDisk;
                if (targetSettings.DefaultTargetDiskType == ArmDiskType.ClassicDisk)
                {
                    this.OSVirtualHardDisk.TargetStorage = SeekTargetStorageAccount(virtualMachine.AzureSubscription.ArmTargetStorageAccounts, armDisk.StorageAccountName);
                }
            }

            foreach (IArmDisk dataDisk in virtualMachine.DataDisks)
            {
                if (dataDisk.GetType() == typeof(Azure.Arm.ManagedDisk))
                {
                    Azure.Arm.ManagedDisk sourceManagedDisk = (Azure.Arm.ManagedDisk)dataDisk;
                    MigrationTarget.Disk  targetDataDisk    = null;

                    foreach (Disk targetDisk in virtualMachine.AzureSubscription.ArmTargetManagedDisks)
                    {
                        if ((targetDisk.SourceDisk != null) && (targetDisk.SourceDisk.GetType() == typeof(Azure.Arm.ManagedDisk)))
                        {
                            Azure.Arm.ManagedDisk targetDiskSourceDisk = (Azure.Arm.ManagedDisk)targetDisk.SourceDisk;
                            if (String.Compare(targetDiskSourceDisk.Name, sourceManagedDisk.Name, true) == 0)
                            {
                                targetDataDisk = targetDisk;
                                break;
                            }
                        }
                    }

                    if (targetDataDisk != null)
                    {
                        EnsureDataDiskTargetLunIsNotNull(ref targetDataDisk);
                        targetDataDisk.ParentVirtualMachine = this;
                        targetDataDisk.Lun         = sourceManagedDisk.Lun;
                        targetDataDisk.HostCaching = sourceManagedDisk.HostCaching;

                        this.DataDisks.Add(targetDataDisk);
                    }
                }
                else if (dataDisk.GetType() == typeof(Arm.ClassicDisk))
                {
                    Disk targetDataDisk = new Disk(dataDisk, this, targetSettings);

                    Arm.ClassicDisk armDisk = (Arm.ClassicDisk)dataDisk;
                    if (targetSettings.DefaultTargetDiskType == ArmDiskType.ClassicDisk)
                    {
                        targetDataDisk.TargetStorage = SeekTargetStorageAccount(virtualMachine.AzureSubscription.ArmTargetStorageAccounts, armDisk.StorageAccountName);
                    }

                    EnsureDataDiskTargetLunIsNotNull(ref targetDataDisk);

                    this.DataDisks.Add(targetDataDisk);
                }
            }

            foreach (Arm.NetworkInterface armNetworkInterface in virtualMachine.NetworkInterfaces)
            {
                foreach (NetworkInterface targetNetworkInterface in virtualMachine.AzureSubscription.ArmTargetNetworkInterfaces)
                {
                    if ((targetNetworkInterface.SourceNetworkInterface != null) && (targetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Arm.NetworkInterface)))
                    {
                        Azure.Arm.NetworkInterface targetNetworkInterfaceSourceInterface = (Azure.Arm.NetworkInterface)targetNetworkInterface.SourceNetworkInterface;
                        if (String.Compare(targetNetworkInterfaceSourceInterface.Name, armNetworkInterface.Name, true) == 0)
                        {
                            this.NetworkInterfaces.Add(targetNetworkInterface);
                            targetNetworkInterface.ParentVirtualMachine = this;
                            break;
                        }
                    }
                }
            }

            if (virtualMachine.HasPlan)
            {
                _PlanAttributes = new Dictionary <string, string>();

                foreach (JProperty planAttribute in virtualMachine.ResourceToken["plan"])
                {
                    _PlanAttributes.Add(planAttribute.Name, planAttribute.Value.ToString());
                }
            }
        }
Exemple #29
0
 public StorageAccount(string name, TargetSettings targetSettings) : base(ArmConst.MicrosoftStorage, ArmConst.StorageAccounts)
 {
     this.SetTargetName(name, targetSettings);
 }
Exemple #30
0
 protected virtual void TemporaryApplyTarget(Target t, TargetSettings ts)
 {
     if(ts == null) {
         if(t.path != null) {
             TemporaryExecutePathTo(t.path);
         }
         if(t.facing != null) {
             TentativePickFacing(t.facing.Value);
         }
         if(t.subregion != -1) {
             TentativePickSubregion(t.subregion);
         }
     } else {
         switch(ts.targetingMode) {
             case TargetingMode.Self:
             case TargetingMode.Pick:
             case TargetingMode.Path:
                 TemporaryExecutePathTo(t.path);
                 break;
             case TargetingMode.SelectRegion:
                 TentativePickSubregion(t.subregion);
                 break;
             case TargetingMode.Cardinal:
             case TargetingMode.Radial:
                 // Debug.Log("temp apply; tentative pick facing "+t.facing.Value);
                 TentativePickFacing(t.facing.Value);
                 break;
         }
     }
 }
 public StorageAccount(IStorageAccount source, TargetSettings targetSettings)
 {
     _Source = source;
     this.SetTargetName(source.Name, targetSettings);
     this.StorageAccountType = MigrationTarget.StorageAccount.GetStorageAccountType(source.AccountType);
 }
Exemple #32
0
        /// <summary>
        /// Initializes the match when one is started
        /// </summary>
        private void InitializeMatch()
        {
            // Find all the players
            Controller[] findControllers = FindObjectsOfType <Controller>();
            for (int i = 0; i < findControllers.Length; i++)
            {
                controllers.Add(findControllers[i]);
            }
            // Load the last settings used
            if (settingsName.Contains("Target"))
            {
                currentTargetGameSettings = LoadManager.LoadTargetSettingsXML(settingsName);
            }
            else
            {
                currentGameSettings = LoadManager.LoadGameSettings(settingsName);
            }

            //Find the spawnpoints
            spawnPoints.AddRange(GameObject.FindGameObjectsWithTag("Respawn"));

            StatisticManager.instance.statistics = new Dictionary <PlayerID, Statistic>();

            //If there aren't already players in this scene, we need to create them
            if (controllers.Count == 0)
            {
                PlayerID currentID = PlayerID.None;
                for (int i = 0; i < ControllerManager.instance.NumPlayers; i++)
                {
                    currentID = (PlayerID)(i + 1);
                    GameObject spawnPrefab    = ControllerManager.instance.IsAIController(currentID) ? aiPlayerPrefab : playerPrefab;
                    GameObject temp           = (GameObject)GameObject.Instantiate(spawnPrefab, spawnPoints[i].transform.position, Quaternion.Euler(0, 90, 0));
                    Controller tempController = temp.GetComponent <Controller>();
                    controllers.Add(tempController);
                    tempController.ProfileComponent = ProfileManager.instance.GetProfile(currentID);
                    tempController.ID = currentID;
                    StatisticManager.instance.statistics.Add(currentID, new Statistic());
                }
            }

            for (int i = 0; i < ControllerManager.instance.NumPlayers; i++)
            {
                for (int j = 0; j < ControllerManager.instance.NumPlayers; j++)
                {
                    if (i != j)
                    {
                        StatisticManager.instance.statistics[(PlayerID)(i + 1)].killedPlayer.Add((PlayerID)(j + 1), 0);
                        StatisticManager.instance.statistics[(PlayerID)(i + 1)].killedByPlayer.Add((PlayerID)(j + 1), 0);
                    }
                }
            }

            // Initialize the tokens
            TokenSpawner.instance.Init(currentGameSettings.EnabledTokens);

            for (int i = 0; i < controllers.Count; i++)
            {
                controllers[i].LifeComponent.Lives = currentGameSettings.StockLimit;
            }

            // Set up a timer that counts up for targets
            if (currentTargetGameSettings != null)
            {
                currentTargetGameSettings.TargetsInLevel = FindObjectsOfType <Target>().Length;
                matchTimer = gameObject.AddComponent <Timer>();
                matchTimer.Initialize(Mathf.Infinity, "Match Timer");
            }
            // All other games will have a countdown timer
            else
            {
                // If the timer is enabled in that game type
                if (currentGameSettings.TimeLimit > 0)
                {
                    float timeLimit = currentGameSettings.TimeLimit == 0 ? Mathf.Infinity : currentGameSettings.TimeLimit;
                    matchTimer = CountdownTimer.CreateTimer(gameObject, timeLimit, "Match Timer", TimeUp);
                }
            }
        }
Exemple #33
0
        public NetworkInterface(Arm.NetworkInterface networkInterface, List <MigrationTarget.VirtualNetwork> armVirtualNetworks, List <MigrationTarget.NetworkSecurityGroup> armNetworkSecurityGroups, TargetSettings targetSettings)
        {
            _SourceNetworkInterface = networkInterface;
            this.SetTargetName(networkInterface.Name, targetSettings);
            this.IsPrimary                   = networkInterface.IsPrimary;
            this.EnableIPForwarding          = networkInterface.EnableIPForwarding;
            this.EnableAcceleratedNetworking = networkInterface.EnableAcceleratedNetworking;

            foreach (Arm.NetworkInterfaceIpConfiguration armNetworkInterfaceIpConfiguration in networkInterface.NetworkInterfaceIpConfigurations)
            {
                NetworkInterfaceIpConfiguration targetNetworkInterfaceIpConfiguration = new NetworkInterfaceIpConfiguration(armNetworkInterfaceIpConfiguration, armVirtualNetworks, targetSettings);
                this.TargetNetworkInterfaceIpConfigurations.Add(targetNetworkInterfaceIpConfiguration);
            }

            if (networkInterface.NetworkSecurityGroup != null)
            {
                this.NetworkSecurityGroup = NetworkSecurityGroup.SeekNetworkSecurityGroup(armNetworkSecurityGroups, networkInterface.NetworkSecurityGroup.ToString());
            }
        }
        public async Task Read(Guid subscriptionId, AzureRetriever sourceAzureRetreiver, AzureRetriever targetAzureRetreiver, TreeView treeView, TargetSettings targetSettings)
        {
            try
            {
                StreamReader saveSelectionReader = new StreamReader(filePath);
                string       jsontext            = saveSelectionReader.ReadToEnd();
                saveSelectionReader.Close();

                saveSelections = JsonConvert.DeserializeObject <List <SaveSelection> >(jsontext);
            }
            catch
            {
                // If file does not exist, or invalid, starts a new object
                saveSelections = new List <SaveSelection>();
            }

            if (saveSelections.Exists(x => x.SubscriptionId == subscriptionId))
            {
                SaveSelection saveSelection = saveSelections.Find(x => x.SubscriptionId == subscriptionId);

                foreach (SaveSelectionVirtualNetwork saveSelectionVirtualNetwork in saveSelection.VirtualNetworks)
                {
                    foreach (TreeNode treeNode in treeView.Nodes.Find(saveSelectionVirtualNetwork.VirtualNetworkName, true))
                    {
                        if (treeNode.Tag.GetType() == typeof(Azure.Asm.VirtualNetwork))
                        {
                            Azure.Asm.VirtualNetwork asmVirtualNetwork = (Azure.Asm.VirtualNetwork)treeNode.Tag;

                            treeNode.Checked = true;
                        }
                    }
                }

                foreach (SaveSelectioStorageAccount saveSelectionStorageAccount in saveSelection.StorageAccounts)
                {
                    foreach (TreeNode treeNode in treeView.Nodes.Find(saveSelectionStorageAccount.StorageAccountName, true))
                    {
                        if (treeNode.Tag.GetType() == typeof(Azure.Asm.StorageAccount))
                        {
                            Azure.MigrationTarget.StorageAccount storageAccount = (Azure.MigrationTarget.StorageAccount)treeNode.Tag;
                            if (saveSelectionStorageAccount.TargetStorageAccountName.Length > 0) // We aren't going to reload a blank name, should it occur, as a name is required
                            {
                                storageAccount.SetTargetName(saveSelectionStorageAccount.TargetStorageAccountName, targetSettings);
                            }
                            treeNode.Checked = true;
                        }
                    }
                }

                foreach (SaveSelectionVirtualMachine saveSelectionVirtualMachine in saveSelection.VirtualMachines)
                {
                    foreach (TreeNode virtualMachineNode in treeView.Nodes.Find(saveSelectionVirtualMachine.VirtualMachine, true))
                    {
                        if (virtualMachineNode.Tag != null)
                        {
                            if (virtualMachineNode.Tag.GetType() == typeof(Azure.Asm.VirtualMachine))
                            {
                                Azure.Asm.VirtualMachine asmVirtualMachine = (Azure.Asm.VirtualMachine)virtualMachineNode.Tag;

                                if (asmVirtualMachine.CloudServiceName == saveSelectionVirtualMachine.CloudService && asmVirtualMachine.RoleName == saveSelectionVirtualMachine.VirtualMachine)
                                {
                                    // todo now asap
                                    //asmVirtualMachine.TargetVirtualNetwork = SeekVirtualNetwork(saveSelectionVirtualMachine.TargetVirtualNetwork, await sourceAzureRetreiver.GetAzureAsmVirtualNetworks(), await targetAzureRetreiver.GetAzureARMVirtualNetworks());
                                    //asmVirtualMachine.TargetSubnet = SeekSubnet(saveSelectionVirtualMachine.TargetSubnet, asmVirtualMachine.TargetVirtualNetwork);

                                    //if (saveSelectionVirtualMachine.TargetDiskStorageAccounts.ContainsKey(asmVirtualMachine.OSVirtualHardDisk.DiskName))
                                    //    asmVirtualMachine.OSVirtualHardDisk.TargetStorageAccount = SeekStorageAccount(saveSelectionVirtualMachine.TargetDiskStorageAccounts[asmVirtualMachine.OSVirtualHardDisk.DiskName].ToString(), await sourceAzureRetreiver.GetAzureAsmStorageAccounts(), await targetAzureRetreiver.GetAzureARMStorageAccounts());

                                    //foreach (Azure.Asm.Disk asmDataDisk in asmVirtualMachine.DataDisks)
                                    //{
                                    //    if (saveSelectionVirtualMachine.TargetDiskStorageAccounts.ContainsKey(asmDataDisk.DiskName))
                                    //        asmDataDisk.TargetStorageAccount = SeekStorageAccount(saveSelectionVirtualMachine.TargetDiskStorageAccounts[asmDataDisk.DiskName].ToString(), await sourceAzureRetreiver.GetAzureAsmStorageAccounts(), await targetAzureRetreiver.GetAzureARMStorageAccounts());
                                    //}

                                    virtualMachineNode.Checked = true;
                                }
                            }
                        }
                    }
                }
            }
        }
Exemple #35
0
 public override void SetTargetName(string targetName, TargetSettings targetSettings)
 {
     this.TargetName       = targetName.Trim().Replace(" ", String.Empty);
     this.TargetNameResult = this.TargetName + targetSettings.NetworkSecurityGroupSuffix;
 }
Exemple #36
0
        public void Bind(AzureRetriever azureRetriever, IStatusProvider statusProvider, ILogProvider logProvider, TargetSettings targetSettings, ImageList imageList, PromptBehavior promptBehavior, List <AzureEnvironment> azureEnvironments, ref List <AzureEnvironment> userDefinedAzureEnvironments)
        {
            _TargetSettings = targetSettings;
            _LogProvider    = logProvider;
            _StatusProvider = statusProvider;
            _ImageList      = imageList;

            _AzureContextSource = new AzureContext(azureRetriever, targetSettings, promptBehavior);
            _AzureContextSource.AzureEnvironmentChanged       += _AzureContext_AzureEnvironmentChanged;
            _AzureContextSource.UserAuthenticated             += _AzureContext_UserAuthenticated;
            _AzureContextSource.BeforeAzureSubscriptionChange += _AzureContext_BeforeAzureSubscriptionChange;
            _AzureContextSource.AfterAzureSubscriptionChange  += _AzureContext_AfterAzureSubscriptionChange;
            _AzureContextSource.BeforeUserSignOut             += _AzureContext_BeforeUserSignOut;
            _AzureContextSource.AfterUserSignOut              += _AzureContext_AfterUserSignOut;
            _AzureContextSource.AfterAzureTenantChange        += _AzureContext_AfterAzureTenantChange;
            _AzureContextSource.BeforeAzureTenantChange       += _AzureContextSource_BeforeAzureTenantChange;
            azureLoginContextViewerSource.AfterContextChanged += AzureLoginContextViewerSource_AfterContextChanged;

            azureLoginContextViewerSource.Bind(_AzureContextSource, azureRetriever, azureEnvironments, ref userDefinedAzureEnvironments);
            treeViewSourceResourceManager1.Bind(logProvider, statusProvider, targetSettings, imageList, promptBehavior);
        }
Exemple #37
0
        public VirtualMachine(Asm.VirtualMachine virtualMachine, TargetSettings targetSettings) : base(ArmConst.MicrosoftCompute, ArmConst.VirtualMachines)
        {
            this.Source = virtualMachine;
            this.SetTargetName(virtualMachine.RoleName, targetSettings);
            this.OSVirtualHardDisk   = new Disk(virtualMachine.OSVirtualHardDisk, this, targetSettings);
            this.OSVirtualHardDiskOS = virtualMachine.OSVirtualHardDiskOS;

            if (targetSettings.DefaultTargetDiskType == ArmDiskType.ClassicDisk)
            {
                this.OSVirtualHardDisk.TargetStorage = SeekTargetStorageAccount(virtualMachine.AzureSubscription.AsmTargetStorageAccounts, virtualMachine.OSVirtualHardDisk.StorageAccountName);
            }

            foreach (Asm.Disk asmDataDisk in virtualMachine.DataDisks)
            {
                Disk targetDataDisk = new Disk(asmDataDisk, this, targetSettings);

                EnsureDataDiskTargetLunIsNotNull(ref targetDataDisk);

                if (targetSettings.DefaultTargetDiskType == ArmDiskType.ClassicDisk)
                {
                    targetDataDisk.TargetStorage = SeekTargetStorageAccount(virtualMachine.AzureSubscription.AsmTargetStorageAccounts, asmDataDisk.StorageAccountName);
                }

                this.DataDisks.Add(targetDataDisk);
            }

            foreach (Asm.NetworkInterface asmNetworkInterface in virtualMachine.NetworkInterfaces)
            {
                NetworkInterface migrationNetworkInterface = new NetworkInterface(virtualMachine, asmNetworkInterface, virtualMachine.AzureSubscription.AsmTargetVirtualNetworks, virtualMachine.AzureSubscription.AsmTargetNetworkSecurityGroups, targetSettings);
                migrationNetworkInterface.ParentVirtualMachine = this;
                this.NetworkInterfaces.Add(migrationNetworkInterface);
            }

            #region Seek ARM Target Size

            // Get ARM Based Location (that matches location of Source ASM VM
            Arm.Location armLocation = virtualMachine.AzureSubscription.GetAzureARMLocation(virtualMachine.Location);
            if (armLocation != null)
            {
                this.TargetSize = armLocation.SeekVmSize(virtualMachine.RoleSize.Name);

                if (this.TargetSize == null)
                {
                    // if not found, defer to alternate matching options

                    Dictionary <string, string> VMSizeTable = new Dictionary <string, string>();
                    VMSizeTable.Add("ExtraSmall", "Standard_A0");
                    VMSizeTable.Add("Small", "Standard_A1");
                    VMSizeTable.Add("Medium", "Standard_A2");
                    VMSizeTable.Add("Large", "Standard_A3");
                    VMSizeTable.Add("ExtraLarge", "Standard_A4");
                    VMSizeTable.Add("A5", "Standard_A5");
                    VMSizeTable.Add("A6", "Standard_A6");
                    VMSizeTable.Add("A7", "Standard_A7");
                    VMSizeTable.Add("A8", "Standard_A8");
                    VMSizeTable.Add("A9", "Standard_A9");
                    VMSizeTable.Add("A10", "Standard_A10");
                    VMSizeTable.Add("A11", "Standard_A11");

                    if (VMSizeTable.ContainsKey(virtualMachine.RoleSize.Name))
                    {
                        this.TargetSize = armLocation.SeekVmSize(VMSizeTable[virtualMachine.RoleSize.Name]);
                    }
                }
            }

            #endregion
        }
Exemple #38
0
        private async Task BindAsmResources(AzureContext azureContext, TargetSettings targetSettings)
        {
            treeAzureASM.Nodes.Clear();

            try
            {
                if (_AzureContextSource != null && _AzureContextSource.AzureSubscription != null)
                {
                    await _AzureContextSource.AzureSubscription.BindAsmResources(targetSettings);

                    if (_AzureContextSource != null && _AzureContextSource.AzureSubscription != null)
                    {
                        TreeNode subscriptionNodeASM = new TreeNode(_AzureContextSource.AzureSubscription.Name);
                        treeAzureASM.Nodes.Add(subscriptionNodeASM);
                        subscriptionNodeASM.Expand();

                        foreach (Azure.MigrationTarget.NetworkSecurityGroup targetNetworkSecurityGroup in _AzureContextSource.AzureSubscription.AsmTargetNetworkSecurityGroups)
                        {
                            Azure.Asm.NetworkSecurityGroup asmNetworkSecurityGroup = (Azure.Asm.NetworkSecurityGroup)targetNetworkSecurityGroup.SourceNetworkSecurityGroup;
                            TreeNode parentNode = GetDataCenterTreeViewNode(subscriptionNodeASM, asmNetworkSecurityGroup.Location, "Network Security Groups");

                            TreeNode tnNetworkSecurityGroup = new TreeNode(targetNetworkSecurityGroup.SourceName);
                            tnNetworkSecurityGroup.Name = targetNetworkSecurityGroup.SourceName;
                            tnNetworkSecurityGroup.Tag  = targetNetworkSecurityGroup;
                            parentNode.Nodes.Add(tnNetworkSecurityGroup);
                            parentNode.Expand();
                        }

                        foreach (Azure.MigrationTarget.VirtualNetwork targetVirtualNetwork in _AzureContextSource.AzureSubscription.AsmTargetVirtualNetworks)
                        {
                            Azure.Asm.VirtualNetwork asmVirtualNetwork = (Azure.Asm.VirtualNetwork)targetVirtualNetwork.SourceVirtualNetwork;
                            TreeNode parentNode = GetDataCenterTreeViewNode(subscriptionNodeASM, asmVirtualNetwork.Location, "Virtual Networks");

                            TreeNode tnVirtualNetwork = new TreeNode(targetVirtualNetwork.SourceName);
                            tnVirtualNetwork.Name = targetVirtualNetwork.SourceName;
                            tnVirtualNetwork.Text = targetVirtualNetwork.SourceName;
                            tnVirtualNetwork.Tag  = targetVirtualNetwork;
                            parentNode.Nodes.Add(tnVirtualNetwork);
                            parentNode.Expand();
                        }

                        foreach (Azure.MigrationTarget.StorageAccount targetStorageAccount in _AzureContextSource.AzureSubscription.AsmTargetStorageAccounts)
                        {
                            TreeNode parentNode = GetDataCenterTreeViewNode(subscriptionNodeASM, targetStorageAccount.SourceAccount.PrimaryLocation, "Storage Accounts");

                            TreeNode tnStorageAccount = new TreeNode(targetStorageAccount.SourceName);
                            tnStorageAccount.Name = targetStorageAccount.SourceName;
                            tnStorageAccount.Tag  = targetStorageAccount;
                            parentNode.Nodes.Add(tnStorageAccount);
                            parentNode.Expand();
                        }

                        foreach (Azure.MigrationTarget.VirtualMachine targetVirtualMachine in _AzureContextSource.AzureSubscription.AsmTargetVirtualMachines)
                        {
                            Azure.Asm.VirtualMachine asmVirtualMachine = (Azure.Asm.VirtualMachine)targetVirtualMachine.Source;
                            TreeNode   parentNode             = GetDataCenterTreeViewNode(subscriptionNodeASM, asmVirtualMachine.Location, "Cloud Services");
                            TreeNode[] cloudServiceNodeSearch = parentNode.Nodes.Find(targetVirtualMachine.TargetAvailabilitySet.TargetName, false);
                            TreeNode   cloudServiceNode       = null;
                            if (cloudServiceNodeSearch.Count() == 1)
                            {
                                cloudServiceNode = cloudServiceNodeSearch[0];
                            }

                            cloudServiceNode      = new TreeNode(targetVirtualMachine.TargetAvailabilitySet.TargetName);
                            cloudServiceNode.Name = targetVirtualMachine.TargetAvailabilitySet.TargetName;
                            cloudServiceNode.Tag  = targetVirtualMachine.TargetAvailabilitySet;
                            parentNode.Nodes.Add(cloudServiceNode);
                            parentNode.Expand();

                            TreeNode virtualMachineNode = new TreeNode(targetVirtualMachine.SourceName);
                            virtualMachineNode.Name = targetVirtualMachine.SourceName;
                            virtualMachineNode.Tag  = targetVirtualMachine;
                            cloudServiceNode.Nodes.Add(virtualMachineNode);
                            cloudServiceNode.Expand();

                            foreach (Azure.MigrationTarget.NetworkInterface targetNetworkInterface in targetVirtualMachine.NetworkInterfaces)
                            {
                                if (targetNetworkInterface.BackEndAddressPool != null && targetNetworkInterface.BackEndAddressPool.LoadBalancer != null)
                                {
                                    TreeNode loadBalancerNode = new TreeNode(targetNetworkInterface.BackEndAddressPool.LoadBalancer.SourceName);
                                    loadBalancerNode.Name = targetNetworkInterface.BackEndAddressPool.LoadBalancer.SourceName;
                                    loadBalancerNode.Tag  = targetNetworkInterface.BackEndAddressPool.LoadBalancer;
                                    cloudServiceNode.Nodes.Add(loadBalancerNode);
                                    cloudServiceNode.Expand();

                                    foreach (Azure.MigrationTarget.FrontEndIpConfiguration frontEnd in targetNetworkInterface.BackEndAddressPool.LoadBalancer.FrontEndIpConfigurations)
                                    {
                                        if (frontEnd.PublicIp != null) // if external load balancer
                                        {
                                            TreeNode publicIPAddressNode = new TreeNode(frontEnd.PublicIp.SourceName);
                                            publicIPAddressNode.Name = frontEnd.PublicIp.SourceName;
                                            publicIPAddressNode.Tag  = frontEnd.PublicIp;
                                            cloudServiceNode.Nodes.Add(publicIPAddressNode);
                                            cloudServiceNode.Expand();
                                        }
                                    }
                                }
                            }
                        }

                        subscriptionNodeASM.Expand();
                        treeAzureASM.Enabled = true;
                    }
                }
            }
            catch (Exception exc)
            {
                if (exc.GetType() == typeof(System.Net.WebException))
                {
                    System.Net.WebException webException = (System.Net.WebException)exc;
                    if (webException.Response != null)
                    {
                        HttpWebResponse exceptionResponse = (HttpWebResponse)webException.Response;
                        if (exceptionResponse.StatusCode == HttpStatusCode.Forbidden)
                        {
                            ASM403ForbiddenExceptionDialog forbiddenDialog = new ASM403ForbiddenExceptionDialog(_AzureContextSource.LogProvider, exc);
                            return;
                        }
                    }
                }

                UnhandledExceptionDialog exceptionDialog = new UnhandledExceptionDialog(_AzureContextSource.LogProvider, exc);
                exceptionDialog.ShowDialog();
            }

            _AzureContextSource.StatusProvider.UpdateStatus("Ready");
        }
Exemple #39
0
 public StorageAccount(string name, TargetSettings targetSettings, ILogProvider logProvider) : base(ArmConst.MicrosoftStorage, ArmConst.StorageAccounts, logProvider)
 {
     this.SetTargetName(name, targetSettings);
 }
 public VirtualNetworkGateway(IVirtualNetworkGateway virtualNetworkGateway, TargetSettings targetSettings, ILogProvider logProvider) : base(ArmConst.MicrosoftNetwork, ArmConst.VirtualNetworkGateways, logProvider)
 {
     this._SourceVirtualNetworkGateway = virtualNetworkGateway;
     this.SetTargetName(this.SourceName, targetSettings);
 }
Exemple #41
0
 public override void SetTargetName(string targetName, TargetSettings targetSettings)
 {
     this.TargetName       = targetName.Trim().Replace(" ", String.Empty).Replace("-", String.Empty);
     this.TargetNameResult = this.TargetName + targetSettings.VirtualNetworkSuffix;
 }
        public VirtualNetworkGateway(Arm.VirtualNetworkGateway virtualNetworkGateway, TargetSettings targetSettings, ILogProvider logProvider) : base(ArmConst.MicrosoftNetwork, ArmConst.VirtualNetworkGateways, logProvider)
        {
            this._SourceVirtualNetworkGateway = virtualNetworkGateway;
            this.SetTargetName(this.SourceName, targetSettings);
            this.EnableBgp    = virtualNetworkGateway.EnableBgp;
            this.ActiveActive = virtualNetworkGateway.ActiveActive;

            try
            {
                switch (virtualNetworkGateway.GatewayType)
                {
                case "ExpressRoute":
                    this.GatewayType = VirtualNetworkGatewayType.ExpressRoute;
                    break;

                case "Vpn":
                default:
                    this.GatewayType = VirtualNetworkGatewayType.Vpn;
                    break;
                }
            }
            catch (Exception exc)
            {
                this.LogProvider.WriteLog("VirtualNetworkGateway Constructor (GatewayType)", exc.Message);
            }

            try
            {
                switch (virtualNetworkGateway.VpnType)
                {
                case "PolicyBased":
                    this.VpnType = VirtualNetworkGatewayVpnType.PolicyBased;
                    break;

                case "RouteBased":
                default:
                    this.VpnType = VirtualNetworkGatewayVpnType.RouteBased;
                    break;
                }
            }
            catch (Exception exc)
            {
                this.LogProvider.WriteLog("VirtualNetworkGateway Constructor (VpnType)", exc.Message);
            }

            try
            {
                switch (virtualNetworkGateway.SkuName)
                {
                case "VpnGw1":
                    this.SkuName = VirtualNetworkGatewaySkuType.VpnGw1;
                    break;

                case "VpnGw2":
                    this.SkuName = VirtualNetworkGatewaySkuType.VpnGw2;
                    break;

                case "VpnGw3":
                    this.SkuName = VirtualNetworkGatewaySkuType.VpnGw3;
                    break;

                case "Basic":
                default:
                    this.SkuName = VirtualNetworkGatewaySkuType.Basic;
                    break;
                }
            }
            catch (Exception exc)
            {
                this.LogProvider.WriteLog("VirtualNetworkGateway Constructor (SkuName)", exc.Message);
            }

            try
            {
                switch (virtualNetworkGateway.SkuName)
                {
                case "VpnGw1":
                    this.SkuTier = VirtualNetworkGatewaySkuType.VpnGw1;
                    break;

                case "VpnGw2":
                    this.SkuTier = VirtualNetworkGatewaySkuType.VpnGw2;
                    break;

                case "VpnGw3":
                    this.SkuTier = VirtualNetworkGatewaySkuType.VpnGw3;
                    break;

                case "Basic":
                default:
                    this.SkuTier = VirtualNetworkGatewaySkuType.Basic;
                    break;
                }
            }
            catch (Exception exc)
            {
                this.LogProvider.WriteLog("VirtualNetworkGateway Constructor (SkuTier)", exc.Message);
            }

            try
            {
                this.SkuCapacity = virtualNetworkGateway.SkuCapacity;
            }
            catch (Exception exc)
            {
                this.LogProvider.WriteLog("VirtualNetworkGateway Constructor (SkuCapacity)", exc.Message);
            }

            try
            {
                foreach (IpConfiguration gatewayIpConfiguration in virtualNetworkGateway.IpConfigurations)
                {
                    // todo, we aren't doing anything here yet
                }
            }
            catch (Exception exc)
            {
                this.LogProvider.WriteLog("VirtualNetworkGateway Constructor (IpConfigurations)", exc.Message);
            }
        }
Exemple #43
0
 protected override void ResetActionSkill()
 {
     if(waitArrows == null) {
         waitArrows = Resources.LoadAssetAtPath("Assets/SRPGKit/Prefabs/Wait Arrows.prefab", typeof(GameObject)) as GameObject;
     }
     TargetSettings ts = new TargetSettings();
     targetSettings = new TargetSettings[]{ts};
     overlayColor = Color.clear;
     highlightColor = Color.clear;
     ts.targetingMode = TargetingMode.Cardinal;
     ts.targetRegion = new Region();
     ts.targetRegion.type = RegionType.Self;
     ts.targetRegion.interveningSpaceType = InterveningSpaceType.Pick;
     ts.effectRegion = new Region();
     ts.effectRegion.type = RegionType.Self;
     ts.effectRegion.interveningSpaceType = InterveningSpaceType.Pick;
     StatEffect facingEffect = new StatEffect();
     facingEffect.effectType = StatEffectType.ChangeFacing;
     facingEffect.target = StatEffectTarget.Applier;
     facingEffect.triggerF = Formula.True();
     facingEffect.value = Formula.Lookup("arg.angle.xy", LookupType.SkillParam);
     StatEffect endTurnEffect = new StatEffect();
     endTurnEffect.effectType = StatEffectType.EndTurn;
     endTurnEffect.target = StatEffectTarget.Applier;
     endTurnEffect.triggerF = Formula.True();
     applicationEffects = new StatEffectGroup{effects=new StatEffect[]{
         facingEffect, endTurnEffect
     }};
 }
Exemple #44
0
 protected override void TargetedSkillGUI()
 {
     if ((patk.mergeTurnToFaceTarget = MergeChoiceGUI("Face Target", patk.mergeTurnToFaceTarget)) != MergeMode.UseOriginal)
     {
         atk.turnToFaceTarget = EditorGUILayout.Toggle("Face Target", atk.turnToFaceTarget);
     }
     if ((patk.mergeDelay = MergeChoiceGUI("Scheduled Delay", patk.mergeDelay)) != MergeMode.UseOriginal)
     {
         atk.delay = EditorGUIExt.FormulaField("Scheduled Delay", atk.delay, atk.GetInstanceID() + "." + atk.name + ".delay", formulaOptions, lastFocusedControl);
     }
     if ((patk.mergeDelayedApplicationUsesOriginalPosition = MergeChoiceGUI("Trigger from Original Position", patk.mergeDelayedApplicationUsesOriginalPosition)) != MergeMode.UseOriginal)
     {
         atk.delayedApplicationUsesOriginalPosition = EditorGUILayout.Toggle("Trigger from Original Position", atk.delayedApplicationUsesOriginalPosition);
     }
     if ((patk.mergeMultiTargetMode = MergeChoiceGUI("Multi-Target Mode", patk.mergeMultiTargetMode)) != MergeMode.UseOriginal)
     {
         atk.multiTargetMode = (MultiTargetMode)EditorGUILayout.EnumPopup("Multi-Target Mode", atk.multiTargetMode);
     }
     if ((patk.mergeMaxWaypointDistanceF = MergeChoiceGUI("Max Waypoint Distance", patk.mergeMaxWaypointDistanceF)) != MergeMode.UseOriginal)
     {
         atk.maxWaypointDistanceF = EditorGUIExt.FormulaField("Max Waypoint Distance", atk.maxWaypointDistanceF, atk.GetInstanceID() + "." + atk.name + ".targeting.maxWaypointDistance", formulaOptions, lastFocusedControl);
     }
     if ((patk.mergeWaypointsAreIncremental = MergeChoiceGUI("Instantly Apply Waypoints", patk.mergeWaypointsAreIncremental)) != MergeMode.UseOriginal)
     {
         atk.waypointsAreIncremental = EditorGUILayout.Toggle("Instantly Apply Waypoints", atk.waypointsAreIncremental);
     }
     if ((patk.mergeCanCancelWaypoints = MergeChoiceGUI("Cancellable Waypoints", patk.mergeCanCancelWaypoints)) != MergeMode.UseOriginal)
     {
         atk.canCancelWaypoints = EditorGUILayout.Toggle("Cancellable Waypoints", atk.canCancelWaypoints);
     }
     if ((patk.mergeTargetSettings = MergeChoiceGUI("Target Settings", patk.mergeTargetSettings)) != MergeMode.UseOriginal)
     {
         if (atk.targetSettings == null)
         {
             atk.targetSettings = new TargetSettings[] { new TargetSettings() };
         }
         EditorGUILayout.BeginVertical();
         EditorGUILayout.BeginHorizontal();
         EditorGUILayout.Space();
         int arraySize = EditorGUILayout.IntField(atk.targetSettings.Length, GUILayout.Width(32));
         GUILayout.Label(" " + "Target" + (atk.targetSettings.Length == 1 ? "" : "s"));
         GUILayout.FlexibleSpace();
         EditorGUILayout.EndHorizontal();
         var oldSettings = atk.targetSettings;
         if (arraySize != atk.targetSettings.Length)
         {
             TargetSettings[] newSettings = atk.targetSettings;
             Array.Resize(ref newSettings, arraySize);
             atk.targetSettings = newSettings;
         }
         EditorGUILayout.BeginHorizontal();
         EditorGUILayout.Space();
         EditorGUILayout.BeginVertical();
         for (int i = 0; i < atk.targetSettings.Length; i++)
         {
             TargetSettings ts = i < oldSettings.Length ? oldSettings[i] : atk.targetSettings[i];
             if (ts == null)
             {
                 atk.targetSettings[i] = new TargetSettings();
                 ts = atk.targetSettings[i];
             }
             atk.targetSettings[i] = EditorGUIExt.TargetSettingsGUI("Target " + i, atk.targetSettings[i], atk, formulaOptions, lastFocusedControl, i);
         }
         EditorGUILayout.EndVertical();
         EditorGUILayout.EndHorizontal();
         EditorGUILayout.EndVertical();
     }
 }
        public NetworkInterfaceIpConfiguration(Azure.Arm.NetworkInterfaceIpConfiguration ipConfiguration, List <VirtualNetwork> virtualNetworks, TargetSettings targetSettings) : base(String.Empty, String.Empty)
        {
            _SourceIpConfiguration = ipConfiguration;

            #region Attempt to default Target Virtual Network and Target Subnet objects from source names

            this.SetTargetName(ipConfiguration.Name, targetSettings);
            if (ipConfiguration.PrivateIpAllocationMethod.Trim().ToLower() == "static")
            {
                this.TargetPrivateIPAllocationMethod = IPAllocationMethodEnum.Static;
            }
            else
            {
                this.TargetPrivateIPAllocationMethod = IPAllocationMethodEnum.Dynamic;
            }

            this.TargetPrivateIpAddress = ipConfiguration.PrivateIpAddress;
            this.TargetVirtualNetwork   = SeekVirtualNetwork(virtualNetworks, ipConfiguration.VirtualNetworkName);
            if (this.TargetVirtualNetwork != null && this.TargetVirtualNetwork.GetType() == typeof(Azure.MigrationTarget.VirtualNetwork)) // Should only be of this type, as we don't default to another existing ARM VNet (which would be of the base interface type also)
            {
                Azure.MigrationTarget.VirtualNetwork targetVirtualNetwork = (Azure.MigrationTarget.VirtualNetwork) this.TargetVirtualNetwork;
                foreach (Subnet targetSubnet in targetVirtualNetwork.TargetSubnets)
                {
                    if (targetSubnet.SourceName == ipConfiguration.SubnetName)
                    {
                        this.TargetSubnet = targetSubnet;
                        break;
                    }
                }
            }

            #endregion
        }
Exemple #46
0
 public ResourceGroup(TargetSettings targetSettings) : base(String.Empty, String.Empty)
 {
     this.SetTargetName("NewResourceGroup", targetSettings);
 }
Exemple #47
0
 public RouteTable(IRouteTable source, TargetSettings targetSettings)
 {
     _SourceRouteTable = source;
     this.SetTargetName(source.Name, targetSettings);
 }
Exemple #48
0
        ///
        /// <summary>
        /// Imports IP addresses from file
        /// </summary>
        /// <param name="filePath">File path of IP txt file</param>
        /// <param name="usedTarget">Target that contains the settings that will be used by the imported addresses</param>
        /// <returns></returns>
        public List<TargetSettings> importIPFile(string filePath, string usedTarget)
        {
            TargetSettings tsToUse = new TargetSettings();
              List<string> lstAllIPs = new List<string>();

              foreach(TargetSettings ts in _lstTargets)
              {
            if(ts.TargetServer == usedTarget)
            {
              tsToUse = ts;                                               //Settings that will be used
            }
            lstAllIPs.Add(ts.TargetServer);
              }
              ImportIPs impIPs = new ImportIPs(tsToUse, filePath, lstAllIPs); //Reads file and creates a list of new targets
              List<TargetSettings> newIPs = impIPs.getTargets();             //Retreives new target list

              try
              {
            foreach(TargetSettings ts in newIPs)
            {
              addTarget(ts);
            }
            return newIPs;    //Only want the new targets
              }
              catch
              {
            return null;
              }
        }
Exemple #49
0
    protected virtual void SetArgsFromTarget(
        Target t,
        TargetSettings ts,
        string prefix,
        Vector3?start = null
        )
    {
        TargetingMode tm = TargetingMode.Custom;

        if (ts != null)
        {
            tm = ts.targetingMode;
        }
        else
        {
            if (t.path != null)
            {
                tm = TargetingMode.Pick;
            }
            else if (t.character != null)
            {
                tm = TargetingMode.Pick;
            }
            else if (t.facing != null)
            {
                tm = TargetingMode.Radial;
            }
            else if (t.subregion != -1)
            {
                tm = TargetingMode.SelectRegion;
            }
        }
        Vector3 pos = character.TilePosition;

        switch (tm)
        {
        case TargetingMode.Self:
        case TargetingMode.Pick:
        case TargetingMode.Path:
            pos = t.Position;
            SetArgsFrom(pos, t.facing, prefix, start);
            break;

        case TargetingMode.Cardinal:
        case TargetingMode.Radial:
        //FIXME: wrong for selectRegion
        case TargetingMode.SelectRegion:
            if (t.character != null)
            {
                pos = t.character.TilePosition;
            }
            else if (t.path != null)
            {
                pos = t.Position;
            }
            SetArgsFrom(pos, t.facing, prefix, start);
            break;

        default:
            Debug.LogError("Unrecognized targeting mode");
            break;
        }
    }
Exemple #50
0
    protected virtual void ApplyEffectsTo(
		Target t,
		TargetSettings ts,
		StatEffectGroup[] effectGroups,
		List<Character> targs,
		string htp,
		Vector3 start
	)
    {
        foreach(Character c in targs) {
            currentTargetCharacter = c;
            Debug.Log("current target "+c);
            int hitType = (int)GetParam(htp, 0);
            Debug.Log("hitType "+hitType);
            currentHitType = hitType;
            SetParam("arg.currentHitType", currentHitType);
            StatEffect[] effects = effectGroups[Mathf.Min(hitType, effectGroups.Length-1)].effects;
            Quaternion? oldFacing = t.facing;
            //FIXME: feels a little (i.e. a lot) hacky
          Vector3 ep = c.TilePosition;
            Vector3 tp = start;
         		if(!(Mathf.Approximately(ep.y,tp.y) &&
         		   	 Mathf.Approximately(ep.x,tp.x))) {
         			t.facing = Quaternion.Euler(
                    0,
                    Mathf.Atan2(ep.y-tp.y, ep.x-tp.x)*Mathf.Rad2Deg,
                    0
                );
            }
            SetArgsFromTarget(t, ts, "", start);
            t.facing = oldFacing;
            foreach(StatEffect se in effects) {
                var rec = se.Apply(
                    this,
                    character,
                    currentTargetCharacter
                );
                if(rec != null) {
                    lastEffects.Add(rec);
                }
            }
        }
    }