Пример #1
0
 /// <summary>
 /// Sets cloud type.
 /// </summary>
 /// <param name="type">Type of cloud.</param>
 /// <param name="altitude">Altitude in hunderds of ft.</param>
 public void SetClouds(CloudType type, int altitude)
 {
     SetClouds(type, altitude, false, false);
 }
Пример #2
0
        /// <summary>
        /// Sets cloud type.
        /// </summary>
        /// <param name="type">Type of cloud (as string).</param>
        /// <param name="altitude">Altitude in hunderds of ft.</param>
        /// <param name="isCumulonimbus">True if cloud is cumulonimbus (CB).</param>
        /// <param name="isToweringCumulus">True if cloud is towering cumulus (TCU).</param>
        public void SetClouds(string type, int altitude, bool isCumulonimbus, bool isToweringCumulus)
        {
            CloudType t = (CloudType)Enum.Parse(typeof(CloudType), type, false);

            SetClouds(t, altitude, isCumulonimbus, isToweringCumulus);
        }
Пример #3
0
 /// <summary>
 /// Initializes a new Instance of ENG.Metar.Decoder.Cloud
 /// </summary>
 /// <param name="type"></param>
 /// <param name="altitude"></param>
 public Cloud(CloudType type, NonNegInt altitude) : this(type, altitude, false, false)
 {
 }
Пример #4
0
 /// <summary>
 /// Initializes a new Instance of ENG.Metar.Decoder.Cloud
 /// </summary>
 /// <param name="type"></param>
 /// <param name="altitude"></param>
 /// <param name="isCumulonimbus"></param>
 /// <param name="isToweringCumulus"></param>
 public Cloud(CloudType type, NonNegInt altitude, bool isCumulonimbus, bool isToweringCumulus)
 {
     SetClouds(type, altitude, isCumulonimbus, isToweringCumulus);
 }
Пример #5
0
 public IInputHandler NewInputHandler(CloudType type)
 {
     return(type == CloudType.Human ? new MouseHandler(window) : socketManager.GetNetworkPlayer());
 }
Пример #6
0
 /// <summary>
 /// Oauth
 /// </summary>
 /// <param name="type"></param>
 public void ShowFormOauth(CloudType type)
 {
     EventShowFormOauth(type);
 }
Пример #7
0
        public static Cloud GetCloud(DataActionEventArgs e, Database Database)
        {
            CloudType   type        = !e.Values.ContainsKey("type") ? CloudType.Function : (CloudType)Enum.Parse(typeof(CloudType), (string)e.Values["type"]);
            string      accessKeyId = !e.Values.ContainsKey("AccessKeyId") ? null : (string)e.Values["AccessKeyId"];
            string      awsRegion   = !e.Values.ContainsKey("AwsRegion") ? null : (string)e.Values["AwsRegion"];
            CloudVendor cloudVendor = !e.Values.ContainsKey("CloudVendor") ? CloudVendor.AWS : (CloudVendor)Enum.Parse(typeof(CloudVendor), (string)e.Values["CloudVendor"]);
            string      encryptedSecretAccessKey = !e.Values.ContainsKey("EncryptedSecretAccessKey") ? null : (string)e.Values["EncryptedSecretAccessKey"];
            string      name = !e.Values.ContainsKey("Name") ? null : (string)e.Values["Name"];

            switch (cloudVendor)
            {
            case CloudVendor.Azure:
            {
                string encryptedPassword = !e.Values.ContainsKey("password") ? null : (string)e.Values["password"];
                string tenant            = !e.Values.ContainsKey("tenant") ? null : (string)e.Values["tenant"];
                string appId             = !e.Values.ContainsKey("appId") ? null : (string)e.Values["appId"];
                string subscriptionId    = !e.Values.ContainsKey("subscriptionId") ? null : (string)e.Values["subscriptionId"];
                string connectionString  = !e.Values.ContainsKey("ConnectionString") ? null : (string)e.Values["ConnectionString"];

                Cloud cloud = new AzureCloud(Database)
                {
                    AppId = appId, SubscriptionId = subscriptionId, EncryptedPassword = encryptedPassword, tenant = tenant, CloudVendor = cloudVendor, Name = name, ConnectionString = connectionString, Type = type
                };


                return(cloud);
            }

            case CloudVendor.GCP:
            {
                string projectName         = !e.Values.ContainsKey("ProjectName") ? null : (string)e.Values["ProjectName"];
                string clientEmail         = !e.Values.ContainsKey("ClientEmail") ? null : (string)e.Values["ClientEmail"];
                string encryptedPrivateKey = !e.Values.ContainsKey("EncryptedPrivateKey") ? null : (string)e.Values["EncryptedPrivateKey"];

                Cloud cloud = new GoogleCloud(Database)
                {
                    EncryptedPrivateKey = encryptedPrivateKey, ClientEmail = clientEmail, ProjectName = projectName, CloudVendor = cloudVendor, Name = name, Type = type
                };


                return(cloud);
            }

            case CloudVendor.FnProject:
            {
                string connectionString = !e.Values.ContainsKey("ConnectionString") ? null : (string)e.Values["ConnectionString"];
                string gateway          = !e.Values.ContainsKey("Gateway") ? null : (string)e.Values["Gateway"];

                Cloud cloud = new FnProjectCloud(Database)
                {
                    gateway = gateway, connectionString = connectionString, CloudVendor = cloudVendor, Name = name, Type = type
                };


                return(cloud);
            }

            case CloudVendor.OpenFaas:
            {
                string projectName      = !e.Values.ContainsKey("ProjectName") ? null : (string)e.Values["ProjectName"];
                string connectionString = !e.Values.ContainsKey("ConnectionString") ? null : (string)e.Values["ConnectionString"];
                string gateway          = !e.Values.ContainsKey("Gateway") ? null : (string)e.Values["Gateway"];

                Cloud cloud = new OpenFaasCloud(Database)
                {
                    projectName = projectName, gateway = gateway, connectionString = connectionString, CloudVendor = cloudVendor, Name = name, Type = type
                };


                return(cloud);
            }

            default:
                return(new Cloud(Database)
                {
                    AccessKeyId = accessKeyId, Region = awsRegion, CloudVendor = cloudVendor, EncryptedSecretAccessKey = encryptedSecretAccessKey, Name = name, Type = type
                });
            }


            //throw new NotImplementedException();
        }
Пример #8
0
 public CloudLinePlotter(Control4NonLineairSystems c, DirectBitmap m, CloudType t) : this(c, t)
 {
     UseOwnBitmap = true;
     map          = m;
 }
Пример #9
0
    IEnumerator CheckWeather()
    {
        while (true)
        {
            // EDIT THIS TO LAT LON OF PLACE
            string weatherUrl = "http://api.openweathermap.org/data/2.5/weather?lat=17.75&lon=142.5000&appid=e72fb8413ce86ecd7c649b180210f7bb";

            //{"coord":{"lon":-0.13,"lat":51.51},"weather":[{"id":721,"main":"Haze","description":"haze","icon":"50n"},{"id":701,"main":"Mist","description":"mist","icon":"50n"}],"base":"stations","main":{"temp":2.84,"pressure":1028,"humidity":86,"temp_min":1,"temp_max":5},"visibility":4000,"wind":{"speed":3.1,"deg":240,"gust":8.2},"clouds":{"all":20},"dt":1485193800,"sys":{"type":1,"id":5091,"message":0.1948,"country":"GB","sunrise":1485157806,"sunset":1485189339},"id":2643743,"name":"London","cod":200}

            WWW weatherWWW = new WWW(weatherUrl);
            yield return(weatherWWW);

            Debug.Log(weatherWWW.text);
            JSONObject tempData = new JSONObject(weatherWWW.text);

            JSONObject weatherDetails = tempData ["weather"];
            string     WeatherType    = weatherDetails [0] ["main"].str;
            Debug.Log(WeatherType);


            string WeatherID = weatherDetails [0] ["id"].ToString();
            Debug.Log(WeatherID);

            switch (WeatherID)
            {
            case "200":
            case "201":
                //200 thunderstorm with light rain     11d
                //201 thunderstorm with rain   11d
                Debug.Log("rumble");
                Rain       = RainType.Light;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Storm;
                break;

            case "202":
                //202 thunderstorm with heavy rain     11d
                Debug.Log("rumble");
                Rain       = RainType.Heavy;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Storm;
                break;

            case "210":
            case "211":
                //210 light thunderstorm   11d
                //211 thunderstorm     11d
                Debug.Log("rumble");
                Rain       = RainType.Light;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Storm;
                break;

            case "212":
            case "221":
                //212 heavy thunderstorm   11d
                //221 ragged thunderstorm  11d
                Debug.Log("rumble");
                Rain       = RainType.Heavy;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Storm;
                break;

            case "230":
            case "231":
                //230 thunderstorm with light drizzle  11d
                //231 thunderstorm with drizzle    11d
                Debug.Log("rumble");
                Rain       = RainType.Light;
                Clouds     = CloudType.Scattered;
                Atmosphere = AtmosphereType.Storm;
                break;

            case "232":
                //232 thunderstorm with heavy drizzle  11d
                Debug.Log("rumble");
                Rain       = RainType.Light;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Storm;
                break;

            case "300":
            case "301":
            case "302":
            case "310":
            case "311":
            case "312":
            case "313":
            case "314":
            case "321":
                //300 light intensity drizzle  09d
                //301 drizzle  09d
                //302 heavy intensity drizzle  09d
                //310 light intensity drizzle rain     09d
                //311 drizzle rain     09d
                //312 heavy intensity drizzle rain     09d
                //313 shower rain and drizzle  09d
                //314 heavy shower rain and drizzle    09d
                //321 shower drizzle   09d
                Debug.Log("drizzle");
                Rain       = RainType.Light;
                Clouds     = CloudType.Broken;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "500":
            case "501":
                //500 light rain   10d
                //501 moderate rain    10d
                Debug.Log("light rain");
                Rain       = RainType.Light;
                Clouds     = CloudType.Broken;
                Atmosphere = AtmosphereType.Dust;
                break;

            case "502":
            case "503":
            case "504":
            case "511":
                //502 heavy intensity rain     10d
                //503 very heavy rain  10d
                //504 extreme rain     10d
                //511 freezing rain    13d
                Debug.Log("heavy rain");
                Rain       = RainType.Heavy;
                Clouds     = CloudType.Broken;
                Atmosphere = AtmosphereType.Dust;
                break;

            case "520":
            case "521":
                //520 light intensity shower rain  09d
                //521 shower rain  09d
                Debug.Log("light showers rain");
                Rain       = RainType.Light;
                Clouds     = CloudType.Scattered;
                Atmosphere = AtmosphereType.Dust;
                break;

            case "522":
            case "531":
                //522 heavy intensity shower rain  09d
                //531 ragged shower rain   09d
                Debug.Log("heavy showers rain");
                Rain       = RainType.Heavy;
                Clouds     = CloudType.Scattered;
                Atmosphere = AtmosphereType.Dust;
                break;

            case "600":
            case "601":
            case "602":
            case "611":
            case "612":
            case "615":
            case "616":
            case "620":
            case "621":
            case "622":
                //Group 6xx: Snow
                //600 light snow[[file:13d.png]]
                //601 snow[[file:13d.png]]
                //602 heavy snow[[file:13d.png]]
                //611 sleet[[file:13d.png]]
                //612 shower sleet[[file:13d.png]]
                //615 light rain and snow[[file:13d.png]]
                //616 rain and snow[[file:13d.png]]
                //620 light shower snow[[file:13d.png]]
                //621 shower snow[[file:13d.png]]
                //622 heavy shower snow[[file:13d.png]]
                Debug.Log("snow");
                Rain       = RainType.Light;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Fog;
                break;

            case "701":
            case "711":
            case "721":
            case "731":
            case "741":
            case "751":
            case "761":
            case "762":
            case "771":
            case "781":
                //Group 7xx: Atmosphere
                //701 mist[[file:50d.png]]
                //711 smoke[[file:50d.png]]
                //721 haze[[file:50d.png]]
                //731 sand, dust whirls[[file:50d.png]]
                //741 fog[[file:50d.png]]
                //751 sand[[file:50d.png]]
                //761 dust[[file:50d.png]]
                //762 volcanic ash[[file:50d.png]]
                //771 squalls[[file:50d.png]]
                //781 tornado[[file:50d.png]]
                Debug.Log("atmosphere");
                Rain       = RainType.None;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Dust;
                break;

            case "800":
                //Group 800: Clear
                //800 clear sky[[file:01d.png]] [[file:01n.png]]
                Debug.Log("clear sky");
                Rain       = RainType.None;
                Clouds     = CloudType.None;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "801":
                //Group 80x: Clouds
                //801	few clouds[[file:02d.png]] [[file:02n.png]]
                Debug.Log("few clouds");
                Rain       = RainType.None;
                Clouds     = CloudType.Few;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "802":
                //802	scattered clouds[[file:03d.png]] [[file:03d.png]]
                Debug.Log("scattered clouds");
                Rain       = RainType.None;
                Clouds     = CloudType.Scattered;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "803":
                //803	broken clouds[[file:04d.png]] [[file:03d.png]]
                Debug.Log("broken clouds");
                Rain       = RainType.None;
                Clouds     = CloudType.Broken;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "804":
                //804	overcast clouds[[file:04d.png]] [[file:04d.png]]
                Debug.Log("overcast clouds");
                Rain       = RainType.None;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "900":
            case "901":
            case "902":
            case "903":
            case "904":
            case "905":
            case "906":
                //Group 90x: Extreme
                //900	tornado
                //901	tropical storm
                //902	hurricane
                //903	cold
                //904	hot
                //905	windy
                //906	hail
                Debug.Log("extreme");
                Rain       = RainType.Heavy;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Storm;
                break;

            case "951":
            case "952":
            case "953":
            case "954":
            case "955":
                //Group 9xx: Additional
                //951	calm
                //952	light breeze
                //953	gentle breeze
                //954	moderate breeze
                Debug.Log("fresh breeze");
                Rain       = RainType.None;
                Clouds     = CloudType.Few;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "956":
                Debug.Log("strong breeze");
                Rain       = RainType.None;
                Clouds     = CloudType.Few;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "957":
                Debug.Log("high wind");
                Rain       = RainType.None;
                Clouds     = CloudType.Scattered;
                Atmosphere = AtmosphereType.Clear;
                break;

            case "958":
            case "959":
                Debug.Log("severe gale");
                Rain       = RainType.None;
                Clouds     = CloudType.Broken;
                Atmosphere = AtmosphereType.Dust;
                break;

            case "960":
            case "961":
                Debug.Log("storm");
                Rain       = RainType.Light;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Storm;
                break;

            case "962":
                Debug.Log("hurrican");
                Rain       = RainType.Heavy;
                Clouds     = CloudType.Overcast;
                Atmosphere = AtmosphereType.Storm;
                break;

            default:
                Debug.Log("unexpected weather id");
                Rain       = RainType.None;
                Clouds     = CloudType.Scattered;
                Atmosphere = AtmosphereType.Clear;
                break;
            }

            yield return(new WaitForSeconds(120));
        }
    }
Пример #10
0
        public static Durados.Cloud GetCloud(System.Data.DataRowView row, int id, Database Database)
        {
            CloudType   type        = row.Row.IsNull("type") ? CloudType.Function : (CloudType)Enum.Parse(typeof(CloudType), (string)row["type"]);
            string      accessKeyId = row.Row.IsNull("AccessKeyId") ? null : (string)row["AccessKeyId"];
            string      awsRegion   = row.Row.IsNull("AwsRegion") ? null : (string)row["AwsRegion"];
            CloudVendor cloudVendor = row.Row.IsNull("CloudVendor") ? CloudVendor.AWS : (CloudVendor)Enum.Parse(typeof(CloudVendor), (string)row["CloudVendor"]);
            string      encryptedSecretAccessKey = row.Row.IsNull("EncryptedSecretAccessKey") ? null : (string)row["EncryptedSecretAccessKey"];
            string      name = row.Row.IsNull("Name") ? null : (string)row["Name"];

            switch (cloudVendor)
            {
            case CloudVendor.Azure:
            {
                string encryptedPassword = row.Row.IsNull("Password") ? null : (string)row["Password"];
                string tenant            = row.Row.IsNull("tenant") ? null : (string)row["tenant"];
                string appId             = row.Row.IsNull("appId") ? null : (string)row["appId"];
                string subscriptionId    = row.Row.IsNull("subscriptionId") ? null : (string)row["subscriptionId"];
                string connectionString  = row.Row.IsNull("ConnectionString") ? null : (string)row["ConnectionString"];
                Cloud  cloud             = new AzureCloud(Database)
                {
                    Id = id, AppId = appId, SubscriptionId = subscriptionId, EncryptedPassword = encryptedPassword, tenant = tenant, CloudVendor = cloudVendor, Name = name, ConnectionString = connectionString, Type = type
                };


                return(cloud);
            }

            case CloudVendor.GCP:
            {
                string projectName         = row.Row.IsNull("ProjectName") ? null : (string)row["ProjectName"];
                string clientEmail         = row.Row.IsNull("ClientEmail") ? null : (string)row["ClientEmail"];
                string encryptedPrivateKey = row.Row.IsNull("EncryptedPrivateKey") ? null : (string)row["EncryptedPrivateKey"];

                Cloud cloud = new GoogleCloud(Database)
                {
                    Id = id, EncryptedPrivateKey = encryptedPrivateKey, ClientEmail = clientEmail, ProjectName = projectName, CloudVendor = cloudVendor, Name = name, Type = type
                };


                return(cloud);
            }

            case CloudVendor.FnProject:
            {
                string connectionString = row.Row.IsNull("ConnectionString") ? null : (string)row["ConnectionString"];
                string gateway          = row.Row.IsNull("Gateway") ? null : (string)row["Gateway"];

                Cloud cloud = new FnProjectCloud(Database)
                {
                    Id = id, gateway = gateway, connectionString = connectionString, CloudVendor = cloudVendor, Name = name, Type = type
                };


                return(cloud);
            }

            case CloudVendor.OpenFaas:
            {
                string projectName      = row.Row.IsNull("ProjectName") ? null : (string)row["ProjectName"];
                string connectionString = row.Row.IsNull("ConnectionString") ? null : (string)row["ConnectionString"];
                string gateway          = row.Row.IsNull("Gateway") ? null : (string)row["Gateway"];

                Cloud cloud = new OpenFaasCloud(Database)
                {
                    Id = id, projectName = projectName, gateway = gateway, connectionString = connectionString, CloudVendor = cloudVendor, Name = name, Type = type
                };


                return(cloud);
            }

            default:
                return(new Cloud(Database)
                {
                    Id = id, AccessKeyId = accessKeyId, Region = awsRegion, CloudVendor = cloudVendor, EncryptedSecretAccessKey = encryptedSecretAccessKey, Name = name, Type = type
                });
            }
        }
Пример #11
0
 public IInputHandler NewInputHandler(CloudType type)
 {
     return type == CloudType.Human ? new MouseHandler(window) : socketManager.GetNetworkPlayer();
 }
Пример #12
0
 public void AddThunderstorm(string name, CloudType type)
 {
     Thunderstorm thunderstorm = new Thunderstorm(this,
                                                  1000,
                                                  graphicManager,
                                                  ShapeType.ThunderStorm,
                                                  inputFactory.NewInputHandler(type))
                                     {
                                         velocity = new Vector(0, 0),
                                         position = new Vector(Random.Next(Settings.Width),
                                                               Random.Next(Settings.Height))
                                     };
     Thunderstorms.Add(thunderstorm);
 }
Пример #13
0
        public override void OnInspectorGUI()
        {
            if (PrefabUtility.GetPrefabType(target) == PrefabType.Prefab)
            {
                return;
            }

            bool isDirty = false;

            trackableBehaviour = (CloudTrackableBehaviour)target;

            EditorGUILayout.Separator();

            CloudType oldType = trackableBehaviour.CloudNameType;
            CloudType newType = (CloudType)EditorGUILayout.EnumPopup("Object of Recognition", trackableBehaviour.CloudNameType);

            if (oldType != newType)
            {
                trackableBehaviour.CloudNameType = newType;
                isDirty = true;

                if (newType == CloudType.Cloud)
                {
                    trackableBehaviour.CloudName = "_MaxstCloud_";
                }
                else
                {
                    trackableBehaviour.CloudName = "";
                }

                trackableBehaviour.OnTrackerCloudName(trackableBehaviour.CloudName);
            }

            if (newType == CloudType.User_Defined)
            {
                EditorGUILayout.Separator();

                string cloudName    = trackableBehaviour.CloudName;
                string newCloudName = EditorGUILayout.TextField("Target Image Name : ", trackableBehaviour.CloudName);

                trackableBehaviour.CloudName = newCloudName;
                isDirty = true;
            }

            EditorGUILayout.Separator();

            GUIContent content = new GUIContent("Add Cloud Target Image");

            if (GUILayout.Button(content, GUILayout.MaxWidth(Screen.width), GUILayout.MaxHeight(maxHeight)))
            {
                Application.OpenURL("https://developer.maxst.com");
            }
            EditorGUILayout.Separator();

            if (newType == CloudType.User_Defined)
            {
                string cloudName = trackableBehaviour.CloudName;
                if (cloudName == "_MaxstCloud_")
                {
                    EditorGUILayout.LabelField("Please set a different name.");
                    isDirty = true;
                }
            }
            EditorGUILayout.Separator();

            if (GUI.changed && isDirty)
            {
                EditorUtility.SetDirty(trackableBehaviour);
                EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
                SceneManager.Instance.SceneUpdated();
            }
        }
Пример #14
0
        /// <summary>
        /// Sets cloud type.
        /// </summary>
        /// <param name="type">Type of cloud (as string).</param>
        /// <param name="altitude">Altitude in hunderds of ft.</param>
        public void SetClouds(string type, int altitude)
        {
            CloudType t = (CloudType)Enum.Parse(typeof(CloudType), type, false);

            SetClouds(t, altitude);
        }
Пример #15
0
 public Cloud(Vector2 pos, CloudType type)
 {
     Type = type;
     Position = pos;
     Speed = (float)Engine.Randomizer.Next(1, 10) / 1000;
 }
Пример #16
0
        public GameObject addCloudParticle(CloudType cloudType, GameObject parent)
        {
            GameObject cloudSection;

            if (cloudType == CloudType.DENSE_NORMAL)
            {
                cloudSection = RAKUtilities.getPrefab("CloudSectionAngry");
            }
            else
            {
                cloudSection = null;
            }
            cloudSection = (GameObject)Instantiate(cloudSection, Vector3.zero, Quaternion.identity);//, 1);
            cloudSection.transform.SetParent(parent.transform);
            cloudSection.transform.localPosition = Vector3.zero;
            return(cloudSection);

            /*ParticleSystem po = parent.AddComponent<ParticleSystem>();
             * ParticleSystem.MainModule mainModule = po.main;
             *
             * ParticleSystem.ShapeModule shapeModule = po.shape;
             * ParticleSystem.MinMaxCurve emissionCurve = po.emission.rateOverTime;
             * ParticleSystem.LimitVelocityOverLifetimeModule velOverTimeModule = po.limitVelocityOverLifetime;
             * ParticleSystem.ColorOverLifetimeModule colorModule = po.colorOverLifetime;
             * ParticleSystem.ColorBySpeedModule colorBySpeed = po.colorBySpeed;
             * ParticleSystem.RotationOverLifetimeModule rotationModule = po.rotationOverLifetime;
             * ParticleSystem.NoiseModule noiseModule = po.noise;
             * po.Stop();
             * if (cloudType == CloudType.DENSE_NORMAL)
             * {
             *  ParticleSystem.MinMaxCurve startSize = new ParticleSystem.MinMaxCurve(25);
             *  mainModule.startSize = startSize;
             *  mainModule.startRotationX = 0;
             *  mainModule.startRotationY = 360;
             *  mainModule.maxParticles = 5000;
             *  mainModule.duration = 10;
             *  mainModule.loop = true;
             *  mainModule.prewarm = true;
             *  mainModule.startLifetime = 10;
             *  mainModule.gravityModifier = .4f;
             *  mainModule.simulationSpace = ParticleSystemSimulationSpace.World;
             *  mainModule.simulationSpeed = .2f;
             *  mainModule.startSpeed = 0;
             *  mainModule.scalingMode = ParticleSystemScalingMode.Shape;
             *  mainModule.emitterVelocityMode = ParticleSystemEmitterVelocityMode.Transform;
             *  ParticleSystem.MinMaxGradient startGradient = new ParticleSystem.MinMaxGradient(new Color(79, 79, 79, 255), new Color(161, 161, 161, 255));
             *  mainModule.startColor = startGradient;
             *
             *  shapeModule.shapeType = ParticleSystemShapeType.Box;
             *  shapeModule.scale = new Vector3(10, 0, 10);
             *  shapeModule.randomDirectionAmount = 0;
             *  shapeModule.randomPositionAmount = 0;
             *
             *  emissionCurve.constant = 500;
             *
             *  velOverTimeModule.limit = 50;
             *  velOverTimeModule.dampen = .1f;
             *  velOverTimeModule.enabled = true;
             *
             *  Gradient colorOverLifeGradient = new Gradient();
             *  GradientColorKey[] colorOverLifeColorKeys = new GradientColorKey[2];
             *  colorOverLifeColorKeys[0] = new GradientColorKey(new Color(128, 128, 128), 0);
             *  colorOverLifeColorKeys[1] = new GradientColorKey(new Color(45, 95, 118), 100);
             *  colorOverLifeGradient.SetKeys(colorOverLifeColorKeys, new GradientAlphaKey[] { new GradientAlphaKey(255, 0) });
             *  colorModule.color = colorOverLifeGradient;
             *  colorModule.enabled = true;
             *
             *  Gradient speedGradient = new Gradient();
             *  GradientColorKey[] speedColorKeys = new GradientColorKey[3];
             *  speedColorKeys[0] = new GradientColorKey(new Color(45, 95, 118), 0);
             *  speedColorKeys[1] = new GradientColorKey(new Color(8, 46, 63), 40);
             *  speedColorKeys[2] = new GradientColorKey(new Color(0, 0, 0), 100);
             *  speedGradient.SetKeys(speedColorKeys, new GradientAlphaKey[] { new GradientAlphaKey(255, 0) });
             *  colorBySpeed.color = speedGradient;
             *  colorBySpeed.range = new Vector2(0, 50);
             *  colorBySpeed.enabled = true;
             *
             *  rotationModule.x = 75;
             *  rotationModule.y = 75;
             *  rotationModule.z = 75;
             *  rotationModule.enabled = true;
             *
             *  noiseModule.strength = 10;
             *  noiseModule.frequency = .05f;
             *  noiseModule.scrollSpeed = 1;
             *  noiseModule.damping = true;
             *  noiseModule.octaveCount = 4;
             *  noiseModule.octaveMultiplier = .5f;
             *  noiseModule.octaveScale = 2;
             *  noiseModule.enabled = true;
             * }
             * else if (cloudType == CloudType.LIGHT_NORMAL)
             * {
             *  ParticleSystem.MinMaxCurve startSize = new ParticleSystem.MinMaxCurve(15, 25);
             *  mainModule.startSize = startSize;
             *  shapeModule.scale = new Vector3(15, 0, 15);
             *  emissionCurve.constant = 150;
             *  mainModule.maxParticles = 450;
             *  shapeModule.randomDirectionAmount = 1;
             *  shapeModule.randomPositionAmount = 1;
             * }
             * po.Play();
             * return po;*/
        }
Пример #17
0
 /// <summary>
 /// Delete Cloud Account
 /// </summary>
 /// <param name="Email"></param>
 /// <param name="type"></param>
 /// <returns></returns>
 public bool DeleteAccountCloud(string Email, CloudType type)
 {
     return(EventDeleteAccountCloud(Email, type));
 }
Пример #18
0
        /// <param name='deviceId'>
        /// Optional.
        /// </param>
        /// <param name='customRequestHeaders'>
        /// Optional.
        /// </param>
        /// <param name='cancellationToken'>
        /// Cancellation token.
        /// </param>
        /// <returns>
        /// Represents the response model for DataContainerGroups Get call
        /// </returns>
        public async Task <DataContainerGroupsGetResponse> ListDCGroupsAsync(string deviceId, CustomRequestHeaders customRequestHeaders, CancellationToken cancellationToken)
        {
            // Validate

            // Tracing
            bool   shouldTrace  = TracingAdapter.IsEnabled;
            string invocationId = null;

            if (shouldTrace)
            {
                invocationId = TracingAdapter.NextInvocationId.ToString();
                Dictionary <string, object> tracingParameters = new Dictionary <string, object>();
                tracingParameters.Add("deviceId", deviceId);
                tracingParameters.Add("customRequestHeaders", customRequestHeaders);
                TracingAdapter.Enter(invocationId, this, "ListDCGroupsAsync", tracingParameters);
            }

            // Construct URL
            string url = "";

            url = url + "/";
            if (this.Client.Credentials.SubscriptionId != null)
            {
                url = url + Uri.EscapeDataString(this.Client.Credentials.SubscriptionId);
            }
            url = url + "/cloudservices/";
            url = url + Uri.EscapeDataString(this.Client.CloudServiceName);
            url = url + "/resources/";
            url = url + Uri.EscapeDataString(this.Client.ResourceNamespace);
            url = url + "/~/";
            url = url + "CisVault";
            url = url + "/";
            url = url + Uri.EscapeDataString(this.Client.ResourceName);
            url = url + "/api/devices/";
            if (deviceId != null)
            {
                url = url + Uri.EscapeDataString(deviceId);
            }
            url = url + "/failoverdatacontainers";
            List <string> queryParameters = new List <string>();

            queryParameters.Add("api-version=2014-01-01.1.0");
            if (queryParameters.Count > 0)
            {
                url = url + "?" + string.Join("&", queryParameters);
            }
            string baseUrl = this.Client.BaseUri.AbsoluteUri;

            // Trim '/' character from the end of baseUrl and beginning of url.
            if (baseUrl[baseUrl.Length - 1] == '/')
            {
                baseUrl = baseUrl.Substring(0, baseUrl.Length - 1);
            }
            if (url[0] == '/')
            {
                url = url.Substring(1);
            }
            url = baseUrl + "/" + url;
            url = url.Replace(" ", "%20");

            // Create HTTP transport objects
            HttpRequestMessage httpRequest = null;

            try
            {
                httpRequest            = new HttpRequestMessage();
                httpRequest.Method     = HttpMethod.Get;
                httpRequest.RequestUri = new Uri(url);

                // Set Headers
                httpRequest.Headers.Add("Accept", "application/xml");
                httpRequest.Headers.Add("Accept-Language", customRequestHeaders.Language);
                httpRequest.Headers.Add("x-ms-client-request-id", customRequestHeaders.ClientRequestId);
                httpRequest.Headers.Add("x-ms-version", "2014-01-01");

                // Set Credentials
                cancellationToken.ThrowIfCancellationRequested();
                await this.Client.Credentials.ProcessHttpRequestAsync(httpRequest, cancellationToken).ConfigureAwait(false);

                // Send Request
                HttpResponseMessage httpResponse = null;
                try
                {
                    if (shouldTrace)
                    {
                        TracingAdapter.SendRequest(invocationId, httpRequest);
                    }
                    cancellationToken.ThrowIfCancellationRequested();
                    httpResponse = await this.Client.HttpClient.SendAsync(httpRequest, cancellationToken).ConfigureAwait(false);

                    if (shouldTrace)
                    {
                        TracingAdapter.ReceiveResponse(invocationId, httpResponse);
                    }
                    HttpStatusCode statusCode = httpResponse.StatusCode;
                    if (statusCode != HttpStatusCode.OK)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        CloudException ex = CloudException.Create(httpRequest, null, httpResponse, await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false));
                        if (shouldTrace)
                        {
                            TracingAdapter.Error(invocationId, ex);
                        }
                        throw ex;
                    }

                    // Create Result
                    DataContainerGroupsGetResponse result = null;
                    // Deserialize Response
                    if (statusCode == HttpStatusCode.OK)
                    {
                        cancellationToken.ThrowIfCancellationRequested();
                        string responseContent = await httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);

                        result = new DataContainerGroupsGetResponse();
                        XDocument responseDoc = XDocument.Parse(responseContent);

                        XElement dataContainerGroupResponseElement = responseDoc.Element(XName.Get("DataContainerGroupResponse", "http://windowscloudbackup.com/CiS/V2013_03"));
                        if (dataContainerGroupResponseElement != null)
                        {
                            DataContainerGroupResponse dataContainerGroupResponseInstance = new DataContainerGroupResponse();
                            result.DataContainerGroupResponse = dataContainerGroupResponseInstance;

                            XElement dCGroupsSequenceElement = dataContainerGroupResponseElement.Element(XName.Get("DCGroups", "http://windowscloudbackup.com/CiS/V2013_03"));
                            if (dCGroupsSequenceElement != null)
                            {
                                foreach (XElement dCGroupsElement in dCGroupsSequenceElement.Elements(XName.Get("DataContainerGroup", "http://windowscloudbackup.com/CiS/V2013_03")))
                                {
                                    DataContainerGroup dataContainerGroupInstance = new DataContainerGroup();
                                    dataContainerGroupResponseInstance.DCGroups.Add(dataContainerGroupInstance);

                                    XElement dCGroupSequenceElement = dCGroupsElement.Element(XName.Get("DCGroup", "http://windowscloudbackup.com/CiS/V2013_03"));
                                    if (dCGroupSequenceElement != null)
                                    {
                                        foreach (XElement dCGroupElement in dCGroupSequenceElement.Elements(XName.Get("DRDataContainer", "http://windowscloudbackup.com/CiS/V2013_03")))
                                        {
                                            DRDataContainer dRDataContainerInstance = new DRDataContainer();
                                            dataContainerGroupInstance.DCGroup.Add(dRDataContainerInstance);

                                            XElement instanceIdElement = dCGroupElement.Element(XName.Get("InstanceId", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (instanceIdElement != null)
                                            {
                                                string instanceIdInstance = instanceIdElement.Value;
                                                dRDataContainerInstance.InstanceId = instanceIdInstance;
                                            }

                                            XElement nameElement = dCGroupElement.Element(XName.Get("Name", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (nameElement != null)
                                            {
                                                string nameInstance = nameElement.Value;
                                                dRDataContainerInstance.Name = nameInstance;
                                            }

                                            XElement operationInProgressElement = dCGroupElement.Element(XName.Get("OperationInProgress", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (operationInProgressElement != null)
                                            {
                                                OperationInProgress operationInProgressInstance = ((OperationInProgress)Enum.Parse(typeof(OperationInProgress), operationInProgressElement.Value, true));
                                                dRDataContainerInstance.OperationInProgress = operationInProgressInstance;
                                            }

                                            XElement cloudTypeElement = dCGroupElement.Element(XName.Get("CloudType", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (cloudTypeElement != null)
                                            {
                                                CloudType cloudTypeInstance = StorSimpleManagementClient.ParseCloudType(cloudTypeElement.Value);
                                                dRDataContainerInstance.CloudType = cloudTypeInstance;
                                            }

                                            XElement dataContainerIdElement = dCGroupElement.Element(XName.Get("DataContainerId", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (dataContainerIdElement != null)
                                            {
                                                string dataContainerIdInstance = dataContainerIdElement.Value;
                                                dRDataContainerInstance.DataContainerId = dataContainerIdInstance;
                                            }

                                            XElement locationElement = dCGroupElement.Element(XName.Get("Location", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (locationElement != null)
                                            {
                                                string locationInstance = locationElement.Value;
                                                dRDataContainerInstance.Location = locationInstance;
                                            }

                                            XElement ownedElement = dCGroupElement.Element(XName.Get("Owned", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (ownedElement != null)
                                            {
                                                bool ownedInstance = bool.Parse(ownedElement.Value);
                                                dRDataContainerInstance.Owned = ownedInstance;
                                            }

                                            XElement ownerDeviceIdElement = dCGroupElement.Element(XName.Get("OwnerDeviceId", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (ownerDeviceIdElement != null)
                                            {
                                                string ownerDeviceIdInstance = ownerDeviceIdElement.Value;
                                                dRDataContainerInstance.OwnerDeviceId = ownerDeviceIdInstance;
                                            }

                                            XElement volumeListSequenceElement = dCGroupElement.Element(XName.Get("VolumeList", "http://windowscloudbackup.com/CiS/V2013_03"));
                                            if (volumeListSequenceElement != null)
                                            {
                                                foreach (XElement volumeListElement in volumeListSequenceElement.Elements(XName.Get("DRVolume", "http://windowscloudbackup.com/CiS/V2013_03")))
                                                {
                                                    DRVolume dRVolumeInstance = new DRVolume();
                                                    dRDataContainerInstance.VolumeList.Add(dRVolumeInstance);

                                                    XElement displayNameElement = volumeListElement.Element(XName.Get("DisplayName", "http://windowscloudbackup.com/CiS/V2013_03"));
                                                    if (displayNameElement != null)
                                                    {
                                                        string displayNameInstance = displayNameElement.Value;
                                                        dRVolumeInstance.DisplayName = displayNameInstance;
                                                    }

                                                    XElement sizeElement = volumeListElement.Element(XName.Get("Size", "http://windowscloudbackup.com/CiS/V2013_03"));
                                                    if (sizeElement != null)
                                                    {
                                                        long sizeInstance = long.Parse(sizeElement.Value, CultureInfo.InvariantCulture);
                                                        dRVolumeInstance.Size = sizeInstance;
                                                    }

                                                    XElement snapshotIdElement = volumeListElement.Element(XName.Get("SnapshotId", "http://windowscloudbackup.com/CiS/V2013_03"));
                                                    if (snapshotIdElement != null)
                                                    {
                                                        string snapshotIdInstance = snapshotIdElement.Value;
                                                        dRVolumeInstance.SnapshotId = snapshotIdInstance;
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    XElement ineligibilityMessageElement = dCGroupsElement.Element(XName.Get("IneligibilityMessage", "http://windowscloudbackup.com/CiS/V2013_03"));
                                    if (ineligibilityMessageElement != null)
                                    {
                                        string ineligibilityMessageInstance = ineligibilityMessageElement.Value;
                                        dataContainerGroupInstance.IneligibilityMessage = ineligibilityMessageInstance;
                                    }

                                    XElement isDCGroupEligibleForDRElement = dCGroupsElement.Element(XName.Get("IsDCGroupEligibleForDR", "http://windowscloudbackup.com/CiS/V2013_03"));
                                    if (isDCGroupEligibleForDRElement != null)
                                    {
                                        bool isDCGroupEligibleForDRInstance = bool.Parse(isDCGroupEligibleForDRElement.Value);
                                        dataContainerGroupInstance.IsDCGroupEligibleForDR = isDCGroupEligibleForDRInstance;
                                    }
                                }
                            }

                            XElement followUpJobIdElement = dataContainerGroupResponseElement.Element(XName.Get("FollowUpJobId", "http://windowscloudbackup.com/CiS/V2013_03"));
                            if (followUpJobIdElement != null)
                            {
                                string followUpJobIdInstance = followUpJobIdElement.Value;
                                dataContainerGroupResponseInstance.FollowUpJobId = followUpJobIdInstance;
                            }
                        }
                    }
                    result.StatusCode = statusCode;
                    if (httpResponse.Headers.Contains("x-ms-request-id"))
                    {
                        result.RequestId = httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault();
                    }

                    if (shouldTrace)
                    {
                        TracingAdapter.Exit(invocationId, result);
                    }
                    return(result);
                }
                finally
                {
                    if (httpResponse != null)
                    {
                        httpResponse.Dispose();
                    }
                }
            }
            finally
            {
                if (httpRequest != null)
                {
                    httpRequest.Dispose();
                }
            }
        }
Пример #19
0
 /// <summary>
 /// Convert an enum of type CloudType to a string.
 /// </summary>
 /// <param name='value'>
 /// The value to convert to a string.
 /// </param>
 /// <returns>
 /// The enum value as a string.
 /// </returns>
 internal static string CloudTypeToString(CloudType value)
 {
     if (value == CloudType.None)
     {
         return("None");
     }
     if (value == CloudType.Atmos)
     {
         return("Atmos");
     }
     if (value == CloudType.Azure)
     {
         return("Azure");
     }
     if (value == CloudType.S3)
     {
         return("S3");
     }
     if (value == CloudType.Synaptic)
     {
         return("Synaptic");
     }
     if (value == CloudType.AtmosOnPrem)
     {
         return("AtmosOnPrem");
     }
     if (value == CloudType.ASPDeprecated)
     {
         return("ASP_Deprecated");
     }
     if (value == CloudType.Zetta)
     {
         return("Zetta");
     }
     if (value == CloudType.RackSpace)
     {
         return("RackSpace");
     }
     if (value == CloudType.IIJ)
     {
         return("IIJ");
     }
     if (value == CloudType.NIFTY)
     {
         return("NIFTY");
     }
     if (value == CloudType.S3RRS)
     {
         return("S3_RRS");
     }
     if (value == CloudType.DellDXDeprecated)
     {
         return("DellDX_Deprecated");
     }
     if (value == CloudType.OpenStack)
     {
         return("OpenStack");
     }
     if (value == CloudType.HP)
     {
         return("HP");
     }
     if (value == CloudType.Google)
     {
         return("Google");
     }
     if (value == CloudType.Nirvanix)
     {
         return("Nirvanix");
     }
     if (value == CloudType.AzureChina)
     {
         return("Azure_China");
     }
     if (value == CloudType.Max)
     {
         return("Max");
     }
     throw new ArgumentOutOfRangeException("value");
 }