Example #1
0
 public static ExtendedProperty CreateProperty(string defName, string value, BXC_MasterControlEntities entity, int userId)
 {
     var prop = new ExtendedProperty {User_Id = userId};
     var name = (from n in entity.PropertyNames where n.Name == defName select n).FirstOrDefault();
     if (name != null)
     {
         prop.PropertyNames_Id = name.Id;
     }
     else
     {
         var n = new PropertyName {Name = defName};
         entity.AddObject("PropertyNames", n);
         entity.SaveChanges();
         prop.PropertyNames_Id = n.Id;
     }
     var propValue = (from v in entity.PropertyValues where v.Value == value select v).FirstOrDefault();
     if (propValue != null)
     {
         prop.PropertyValues_Id = propValue.Id;
     }
     else
     {
         var v = new PropertyValue {Value = value};
         entity.AddObject("Propertyvalues", v);
         entity.SaveChanges();
         prop.PropertyValues_Id = v.Id;
     }
     return prop;
 }
Example #2
0
		public string Resolve(PropertyName property)
		{
			if (property.IsConditionless()) return null;
			if (!property.Name.IsNullOrEmpty())
				return property.Name;

			string propertyName;
			if (this.Properties.TryGetValue(property, out propertyName))
				return propertyName;
			propertyName = this.Resolve(property.Expression, property.Property, true);
			this.Properties.TryAdd(property, propertyName);
			return propertyName;
		}
		internal string Resolve(PropertyName property)
		{

			if (property.IsConditionless()) return null;
			if (!property.Name.IsNullOrEmpty())
				return property.Name;
			string f;
			if (this.Properties.TryGetValue(property, out f))
				return f;
			f = this.Resolve(property.Expression, property.Property);
			this.Properties.TryAdd(property, f);
			return f;
		}
		public string Resolve(PropertyName property)
		{
			if (property.IsConditionless()) return null;
			if (!property.Name.IsNullOrEmpty())
			{
				if (property.Name.Contains("."))
					throw new ArgumentException("Property names cannot contain dots.");
				return property.Name;
			}
			string f;
			if (this.Properties.TryGetValue(property, out f))
				return f;
			f = this.Resolve(property.Expression, property.Property, true);
			this.Properties.TryAdd(property, f);
			return f;
		}
        static XunitTestFrameworkMetadata()
        {
            Assembly_XunitAssert = ShortAssemblyName.FromName("xunit.assert");
            Assembly_XunitCore = ShortAssemblyName.FromName("xunit.core");

            Type_Assert = MakeTypeName("Assert");
            Type_AssertException = MakeTypeName("XunitException", Namespace_XunitSdk, Assembly_XunitAssert);
            Type_FactAttribute = MakeTypeName("FactAttribute");
            Type_TheoryAttribute = MakeTypeName("TheoryAttribute");
            Type_TraitAttribute = MakeTypeName("TraitAttribute");

            Ctor_FactAttribute = MetadataBuilderHelper.Attributes.ConstructorName(Type_FactAttribute.Definition);
            Ctor_TraitAttribute = MetadataBuilderHelper.Attributes.ConstructorName(Type_TraitAttribute.Definition);

            Method_PexAssertInconclusive = new Lazy<Method>(() => MakePexAssertInconclusive());

            MethodDefinition_AssertEqual = MakeAssertEqual();
            MethodDefinition_AssertNotEqual = MakeAssertNotEqual();
            MethodDefinition_AssertNotNull = MakeAssertNotNull();
            MethodDefinition_AssertNull = MakeAssertNull();
            MethodDefinition_AssertTrue = MakeAssertTrue();

            Property_Skip = new PropertyDefinitionName(Assembly_XunitCore, -1, Type_FactAttribute.Definition, "Skip", SystemTypes.String.SerializableName).SelfInstantiation;
        }
Example #6
0
 public void SetReferenceValue(PropertyName id, Object value)
 {
     m_ReferenceTable[id] = value;
 }
		private void ShowSelectedFolderContent() {
			listViewFiles.Items.Clear();

			IFolder folder = null;
			try {
				string path = this.GetSelectedFolder();
				WebDavSession session = new WebDavSession();
				session.Credentials = new NetworkCredential(this._username, this._password);
				string url = this._protocol + "://" + this._domain + "/";
				if (path != String.Empty) {
					url += path + "/";
				}
				folder = session.OpenFolder(url);
			} catch(Exception) {

			}

			if (folder != null) {
				IHierarchyItem[] items = folder.GetChildren();
				foreach(IHierarchyItem item in items) {
					if (item.ItemType == ItemType.Resource) {
						PropertyName[] propNames = new PropertyName[] { new PropertyName("getcontentlength", "DAV:") };
						Property[] properties = item.GetPropertyValues(propNames);

						string contentLength = "";
						if (properties.Length > 0) {
							try {
								Int64 content_length = Convert.ToInt64(properties.First().StringValue);
								if (content_length > 1000000000000) {
									contentLength = (content_length / 1099511627776.0).ToString("f") + " TB";
								} else if (content_length > 1000000000) {
									contentLength = (content_length / (1024.0 * 1024.0 * 1024.0)).ToString("f") + " GB";
								} else if (content_length > 1000000) {
									contentLength = (content_length / (1024.0 * 1024.0)).ToString("f") + " MB";
								} else if (content_length > 1000) {
									contentLength = (content_length / 1024.0).ToString("f") + " KB";
								} else {
									contentLength = content_length.ToString() + " B";
								}
							} catch(Exception) {
								contentLength = properties.First().StringValue;
							}
						}
						string[] test = new string[] { item.DisplayName, contentLength };
						ListViewItem lvItem = new ListViewItem(test);
						listViewFiles.Items.Add(lvItem);
					} else if (item.ItemType == ItemType.Folder) {
						if (item.DisplayName != String.Empty) {
							bool nodeExists = false;
							foreach(TreeNode currentNode in treeViewServer.SelectedNode.Nodes) {
								if (currentNode.Text == item.DisplayName) {
									nodeExists = true;
									break;
								}
							}
							if (!nodeExists) {
								TreeNode currentNode = new TreeNode(item.DisplayName);
								treeViewServer.SelectedNode.Nodes.Add(currentNode);
							}
						}
					}
				}
			}
		}
Example #8
0
 public PropertyValue(PropertyName name)
 {
     _propertyName = name;
     PropertyStatus = Status.NotFound;
 }
Example #9
0
 public AllowProperytyEventArgs(PropertyName name)
 {
     _Name = name;
 }
Example #10
0
        /// <summary>
        /// Create the template output
        /// </summary>
        public virtual string TransformText()
        {
            this.Write("import { Pipe, PipeTransform } from \'@angular/core\';\r\nimport { ");

            #line 7 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Service } from \"app/");

            #line 7 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(Module.ModuleName));

            #line default
            #line hidden
            this.Write("/");

            #line 7 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName.ToLower(new System.Globalization.CultureInfo("en-EN", false))));

            #line default
            #line hidden
            this.Write("/");

            #line 7 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName.ToLower(new System.Globalization.CultureInfo("en-EN", false))));

            #line default
            #line hidden
            this.Write(".service\";\r\n\r\n@Pipe({\r\n  name: \'");

            #line 10 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Pipe\',\r\n  pure: false\r\n})\r\nexport class ");

            #line 13 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Pipe implements PipeTransform {\r\n\r\n  transform(key: number): string {\r\n    if (ke" +
                       "y == null)\r\n      return \"\";\r\n\r\n      var ");

            #line 19 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName.ToLower(new System.Globalization.CultureInfo("en-EN", false))));

            #line default
            #line hidden
            this.Write("Service: ");

            #line 19 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Service = new ");

            #line 19 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName));

            #line default
            #line hidden
            this.Write("Service();\r\n      var arr = ");

            #line 20 "C:\Projects\focus\Generator\UIGenerator\Templates\EnumPipeTemplate.tt"
            this.Write(this.ToStringHelper.ToStringWithCulture(PropertyName.ToLower(new System.Globalization.CultureInfo("en-EN", false))));

            #line default
            #line hidden
            this.Write("Service.getList();\r\n      var res = arr.filter(t => t.value === key);\r\n      if (" +
                       "res != null)\r\n        return res[0].key;\r\n      return \"\";\r\n  }\r\n}\r\n");
            return(this.GenerationEnvironment.ToString());
        }
Example #11
0
        //Edit a property from Excel data
        internal void EditAPropertyFromExcelData()
        {
            try
            {
                // Populating the data from Excel
                ExcelLib.PopulateInCollection(Base.ExcelPath, "PropertyDetails");

                //Edit name textbox
                PropertyName.Clear();
                Thread.Sleep(1000);
                PropertyName.SendKeys(ExcelLib.ReadData(2, "Property Name"));

                //Edit description textbox
                Description.Clear();
                Thread.Sleep(1000);
                Description.SendKeys(ExcelLib.ReadData(2, "Description"));

                //Edit Number textbox
                StreetNumber.Clear();
                Thread.Sleep(1000);
                StreetNumber.SendKeys(ExcelLib.ReadData(2, "Number"));

                //Edit Street textbox
                Street.Clear();
                Thread.Sleep(1000);
                Street.SendKeys(ExcelLib.ReadData(2, "Street"));

                //Edit Suburb  textbox
                Suburb.Clear();
                Thread.Sleep(1000);
                Suburb.SendKeys(ExcelLib.ReadData(2, "Suburb"));

                //Edit City textbox
                City.Clear();
                Thread.Sleep(1000);
                City.SendKeys(ExcelLib.ReadData(2, "City"));

                //Edit Postcode  textbox
                Postcode.Clear();
                Thread.Sleep(1000);
                Postcode.SendKeys(ExcelLib.ReadData(2, "Postcode"));

                //Edit Region   textbox
                Region.Clear();
                Thread.Sleep(1000);
                Region.SendKeys(ExcelLib.ReadData(2, "Region"));


                //Select Year in Year Built
                YearBuilt.Click();
                Thread.Sleep(1000);
                var selectElement = new SelectElement(YearBuilt);

                //select by text
                string sYear = ExcelLib.ReadData(2, "YearBuilt");
                //Debug.Assert(sYear == "1977");
                selectElement.SelectByText(sYear);
                Thread.Sleep(1000);


                //Edit Target Rent  textbox
                TargetRent.Clear();
                Thread.Sleep(1000);
                TargetRent.SendKeys(ExcelLib.ReadData(2, "Target Rent"));

                //Edit Bed rooms textbox
                Bedrooms.Clear();
                Thread.Sleep(1000);
                Bedrooms.SendKeys(ExcelLib.ReadData(2, "Bedrooms"));

                //Edit Bath rooms textbox
                Bathrooms.Clear();
                Thread.Sleep(1000);
                Bathrooms.SendKeys(ExcelLib.ReadData(2, "Bathrooms"));


                //Edit Carparks textbox
                Carparks.Clear();
                Thread.Sleep(1000);
                Carparks.SendKeys(ExcelLib.ReadData(2, "Carparks"));


                //Click on the "Save" button
                SaveButton.Click();
                Thread.Sleep(2000);
            }
            catch (Exception e)
            {
                Base.test.Log(RelevantCodes.ExtentReports.LogStatus.Fail, "Test Failed, Edit Unsuccessfull", e.Message);
            }
        }
Example #12
0
        public void IsIndexer_should_be_implied_by_parameters(string name, bool expected)
        {
            var pn = PropertyName.Parse(name);

            Assert.Equal(expected, pn.IsIndexer);
        }
Example #13
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override int GetHashCode() => PropertyName.GetHashCode();
Example #14
0
        public void IsIndexer_should_be_true_for_indexer(string name)
        {
            var pn = PropertyName.Parse(name);

            Assert.True(pn.IsIndexer);
        }
Example #15
0
        public void IsIndexer_should_be_false_for_simple_names(string name)
        {
            var pn = PropertyName.Parse(name);

            Assert.False(pn.IsIndexer);
        }
Example #16
0
 public void Components(string text, PropertyNameComponents expected)
 {
     Assert.Equal(expected, PropertyName.Parse(text).Components);
 }
Example #17
0
 /// <summary>
 ///     Retrieves values of specific properties.
 /// </summary>
 /// <param name="names"></param>
 /// <returns>Array of requested properties with values.</returns>
 public Property[] GetPropertyValues(PropertyName[] names)
 {
     return (from p in _properties from pn in names where pn.Equals(p.Name) select p).ToArray();
 }
Example #18
0
			public Property (PropertyName name, string value) {
				this.Name = name;
				this.StringValue = value;
			}
Example #19
0
 internal static bool IsConditionless(PropertyName property)
 {
     return(property == null || (string.IsNullOrEmpty(property.Name) && property.Expression == null && property.Property == null));
 }
Example #20
0
 public void EqualsReturnFalseWhenCallsWithOtherValueObject()
 {
     PropertyName otherValue = new PropertyName(Exp.Namespace + "OtherName");
     Assert.False(basicValue == otherValue);
     Assert.False(basicValue.Equals(otherValue));
 }
Example #21
0
 internal static bool IsConditionless(this PropertyName property) =>
 property == null || property.Name.IsNullOrEmpty() && property.Expression == null && property.Property == null;
Example #22
0
 public void ClearReferenceValue(PropertyName id)
 {
     m_ReferenceTable.Remove(id);
 }
Example #23
0
			public Property (string name, string nameSpace, string value) {
				this.Name = new PropertyName(name, nameSpace);
				this.StringValue = value;
			}
Example #24
0
        string ToSubQuerySql(SqlConversionContext context)
        {
            var parts = PropertyName.Split('.');

            return(ToNestedSubQuerySql(context, parts));
        }
Example #25
0
 public void EqualsReturnTrueWhenCallsWithSameValueObject()
 {
     PropertyName sameValue = new PropertyName(Exp.Namespace + "SomeName");
     Assert.True(basicValue == sameValue);
     Assert.True(basicValue.Equals(sameValue));
 }
Example #26
0
        public Func <Track, object> GetTrackOrderByFunction(PropertyName propertyName)
        {
            switch (propertyName)
            {
            case PropertyName.TrackTitle:
                return(t => t.Title);

            case PropertyName.Lyrics:
                return(t => t.Lyrics);

            case PropertyName.Tags:
                return(t => t.Tags);

            case PropertyName.Duration:
                return(t => t.Duration);

            case PropertyName.DateAdded:
                return(t => t.File.DateCreated);

            case PropertyName.DateModified:
                return(t => t.File.DateModified);

            case PropertyName.TrackNo:
                return(t => t.TrackNo);

            case PropertyName.TrackYear:
                return(t => t.Year);

            case PropertyName.DiscNo:
                return(t => t.Disc.DiscNo);

            case PropertyName.DiscTrackCount:
                return(t => t.Disc.Tracks.Count);

            case PropertyName.Artist:
                return(t => t.Artist.Sort);

            case PropertyName.City:
                return(t => t.Artist.City.Name);

            case PropertyName.State:
                return(t => t.Artist.City.State);

            case PropertyName.Country:
                return(t => t.Artist.City.Country);

            case PropertyName.Grouping:
                return(t => t.Artist.Grouping);

            case PropertyName.Genre:
                return(t => t.Artist.Genre);

            case PropertyName.DiscCount:
                return(t => t.Disc.Album.Discs.Count);

            case PropertyName.AlbumArtist:
                return(t => t.Disc.Album.Artist.Sort);

            case PropertyName.AlbumTitle:
                return(t => t.Disc.Album.Title);

            case PropertyName.AlbumTrackCount:
                return(t => t.Disc.Album.Discs.Sum(d => d.Tracks.Count));

            case PropertyName.ReleaseType:
                return(t => t.Disc.Album.ReleaseType);

            case PropertyName.ReleaseYear:
                return(t => t.Disc.Album.Year);

            case PropertyName.Instrumental:
                return(t => t.Instrumental ? 0 : 1);

            default:
                throw new InvalidOperationException();
            }
        }
Example #27
0
 public PropertyValue()
 {
     _propertyName = new PropertyName();
     _value = null;
 }
Example #28
0
 public static bool SetFocus(this IViewAware screen, Expression <Func <object> > propertyExpression)
 {
     return(SetFocus(screen, PropertyName.For(propertyExpression)));
 }
Example #29
0
 public PropertyValue(PropertyName name, object value)
 {
     _propertyName = name;
     _value = value;
     PropertyStatus = Status.OK;
 }
Example #30
0
 public override void OnInspectorGUI()
 {
     AudioSourceInspector.InitStyles();
     base.serializedObject.Update();
     if (this.m_LowpassObject != null)
     {
         this.m_LowpassObject.Update();
     }
     this.HandleLowPassFilter();
     AudioSourceInspector.AudioCurveWrapper[] audioCurves = this.m_AudioCurves;
     for (int i = 0; i < audioCurves.Length; i++)
     {
         AudioSourceInspector.AudioCurveWrapper audioCurveWrapper = audioCurves[i];
         CurveWrapper curveWrapperFromID = this.m_CurveEditor.GetCurveWrapperFromID(audioCurveWrapper.id);
         if (audioCurveWrapper.curveProp != null)
         {
             AnimationCurve animationCurveValue = audioCurveWrapper.curveProp.animationCurveValue;
             if (curveWrapperFromID == null != audioCurveWrapper.curveProp.hasMultipleDifferentValues)
             {
                 this.m_RefreshCurveEditor = true;
             }
             else if (curveWrapperFromID != null)
             {
                 if (curveWrapperFromID.curve.length == 0)
                 {
                     this.m_RefreshCurveEditor = true;
                 }
                 else if (animationCurveValue.length >= 1 && animationCurveValue.keys[0].value != curveWrapperFromID.curve.keys[0].value)
                 {
                     this.m_RefreshCurveEditor = true;
                 }
             }
         }
         else if (curveWrapperFromID != null)
         {
             this.m_RefreshCurveEditor = true;
         }
     }
     this.UpdateWrappersAndLegend();
     EditorGUILayout.PropertyField(this.m_AudioClip, AudioSourceInspector.ms_Styles.audioClipLabel, new GUILayoutOption[0]);
     EditorGUILayout.Space();
     EditorGUILayout.PropertyField(this.m_OutputAudioMixerGroup, AudioSourceInspector.ms_Styles.outputMixerGroupLabel, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_Mute, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_BypassEffects, new GUILayoutOption[0]);
     if (base.targets.Any((UnityEngine.Object t) => (t as AudioSource).outputAudioMixerGroup != null))
     {
         using (new EditorGUI.DisabledScope(true))
         {
             EditorGUILayout.PropertyField(this.m_BypassListenerEffects, new GUILayoutOption[0]);
         }
     }
     else
     {
         EditorGUILayout.PropertyField(this.m_BypassListenerEffects, new GUILayoutOption[0]);
     }
     EditorGUILayout.PropertyField(this.m_BypassReverbZones, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_PlayOnAwake, new GUILayoutOption[0]);
     EditorGUILayout.PropertyField(this.m_Loop, new GUILayoutOption[0]);
     EditorGUILayout.Space();
     EditorGUIUtility.sliderLabels.SetLabels(AudioSourceInspector.ms_Styles.priorityLeftLabel, AudioSourceInspector.ms_Styles.priorityRightLabel);
     EditorGUILayout.IntSlider(this.m_Priority, 0, 256, AudioSourceInspector.ms_Styles.priorityLabel, new GUILayoutOption[0]);
     EditorGUIUtility.sliderLabels.SetLabels(null, null);
     EditorGUILayout.Space();
     EditorGUILayout.Slider(this.m_Volume, 0f, 1f, AudioSourceInspector.ms_Styles.volumeLabel, new GUILayoutOption[0]);
     EditorGUILayout.Space();
     EditorGUILayout.Slider(this.m_Pitch, -3f, 3f, AudioSourceInspector.ms_Styles.pitchLabel, new GUILayoutOption[0]);
     EditorGUILayout.Space();
     EditorGUIUtility.sliderLabels.SetLabels(AudioSourceInspector.ms_Styles.panLeftLabel, AudioSourceInspector.ms_Styles.panRightLabel);
     EditorGUILayout.Slider(this.m_Pan2D, -1f, 1f, AudioSourceInspector.ms_Styles.panStereoLabel, new GUILayoutOption[0]);
     EditorGUIUtility.sliderLabels.SetLabels(null, null);
     EditorGUILayout.Space();
     EditorGUIUtility.sliderLabels.SetLabels(AudioSourceInspector.ms_Styles.spatialLeftLabel, AudioSourceInspector.ms_Styles.spatialRightLabel);
     AudioSourceInspector.AnimProp(AudioSourceInspector.ms_Styles.spatialBlendLabel, this.m_AudioCurves[1].curveProp, 0f, 1f, false);
     EditorGUIUtility.sliderLabels.SetLabels(null, null);
     EditorGUILayout.Space();
     AudioSourceInspector.AnimProp(AudioSourceInspector.ms_Styles.reverbZoneMixLabel, this.m_AudioCurves[4].curveProp, 0f, 1.1f, false);
     EditorGUILayout.Space();
     this.m_Expanded3D = EditorGUILayout.Foldout(this.m_Expanded3D, "3D Sound Settings", true);
     if (this.m_Expanded3D)
     {
         EditorGUI.indentLevel++;
         this.Audio3DGUI();
         EditorGUI.indentLevel--;
     }
     if (AudioUtil.canUseSpatializerEffect)
     {
         EditorGUILayout.PropertyField(this.m_Spatialize, AudioSourceInspector.ms_Styles.spatializeLabel, new GUILayoutOption[0]);
         if (this.m_Spatialize.boolValue && !this.m_Spatialize.hasMultipleDifferentValues)
         {
             for (int j = 0; j < base.targets.Length; j++)
             {
                 AudioSource          audioSource          = base.targets[j] as AudioSource;
                 AudioSourceExtension audioSourceExtension = (!(audioSource != null)) ? null : AudioExtensionManager.GetSpatializerExtension(audioSource);
                 if (audioSource != null && audioSource.spatialize && audioSource.isPlaying)
                 {
                     if (audioSourceExtension == null)
                     {
                         audioSourceExtension = AudioExtensionManager.AddSpatializerExtension(audioSource);
                     }
                     AudioExtensionManager.GetReadyToPlay(audioSourceExtension);
                 }
             }
             EditorGUI.indentLevel++;
             EditorGUILayout.PropertyField(this.m_SpatializePostEffects, AudioSourceInspector.ms_Styles.spatializePostEffectsLabel, new GUILayoutOption[0]);
             bool flag = (this.m_AddSpatializerExtension && !this.m_AddSpatializerExtensionMixedValues) || !base.serializedObject.isEditingMultipleObjects;
             if (AudioExtensionManager.IsSourceSpatializerExtensionRegistered() && flag)
             {
                 EditorGUI.showMixedValue = this.m_AddSpatializerExtensionMixedValues;
                 bool flag2 = EditorGUILayout.Toggle(AudioSourceInspector.ms_Styles.addSpatializerExtensionLabel, this.m_AddSpatializerExtension, new GUILayoutOption[0]);
                 EditorGUI.showMixedValue = false;
                 bool flag3 = false;
                 if (this.m_AddSpatializerExtension != flag2)
                 {
                     this.m_AddSpatializerExtension = flag2;
                     if (this.m_AddSpatializerExtension)
                     {
                         this.CreateExtensionEditors();
                         if (this.m_SpatializerEditor != null)
                         {
                             flag3 = this.m_SpatializerEditor.FindAudioExtensionProperties(base.serializedObject);
                         }
                     }
                     else
                     {
                         this.ClearExtensionProperties();
                         this.DestroyExtensionEditors();
                         flag3 = false;
                     }
                 }
                 else if (this.m_SpatializerEditor != null)
                 {
                     flag3 = this.m_SpatializerEditor.FindAudioExtensionProperties(base.serializedObject);
                     if (!flag3)
                     {
                         this.m_AddSpatializerExtension = false;
                         this.ClearExtensionProperties();
                         this.DestroyExtensionEditors();
                     }
                 }
                 if (this.m_SpatializerEditor != null && flag3)
                 {
                     EditorGUI.indentLevel++;
                     this.m_SpatializerEditor.OnAudioSourceGUI();
                     EditorGUI.indentLevel--;
                     for (int k = 0; k < base.targets.Length; k++)
                     {
                         AudioSource          audioSource2          = base.targets[k] as AudioSource;
                         AudioSourceExtension audioSourceExtension2 = (!(audioSource2 != null)) ? null : AudioExtensionManager.GetSpatializerExtension(audioSource2);
                         if (audioSource2 != null && audioSourceExtension2 != null && audioSource2.isPlaying)
                         {
                             string name = AudioExtensionManager.GetSourceSpatializerExtensionType().Name;
                             for (int l = 0; l < this.m_SpatializerEditor.GetNumExtensionProperties(); l++)
                             {
                                 PropertyName extensionPropertyName = this.m_SpatializerEditor.GetExtensionPropertyName(l);
                                 float        propertyValue         = 0f;
                                 if (audioSource2.ReadExtensionProperty(name, extensionPropertyName, ref propertyValue))
                                 {
                                     audioSourceExtension2.WriteExtensionProperty(extensionPropertyName, propertyValue);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     base.serializedObject.ApplyModifiedProperties();
     if (this.m_LowpassObject != null)
     {
         this.m_LowpassObject.ApplyModifiedProperties();
     }
 }
Example #31
0
 private Expression PrimaryExpression()
 {
     switch (Current.Tag)
     {
     case InputElementTag.This:
         {
             var loc = Current.Loc;
             Consume();
             return new ThisExpression(loc);
         }
     case InputElementTag.Debugger:
         {
             var loc = Current.Loc;
             Consume();
             return new DebuggerExpression(loc);
         }
     case InputElementTag.Identifier:
         {
             var id = new Identifier(Current.Loc, Current.Value);
             Consume();
             return new IdentifierExpression(id.Loc, id);
         }
     case InputElementTag.Number:
         {
             var nl = NumericLiteral.FromJavaScript(Current.Loc, Current.Value);
             Consume();
             return nl;
         }
     case InputElementTag.String:
         {
             var sl = new StringLiteral(Current.Loc, Current.Value);
             // lexer has already converted to underlying value
             Consume();
             return sl;
         }
     case InputElementTag.Null:
         {
             var loc = Current.Loc;
             Consume();
             return new NullExpression(Current.Loc);
         }
     case InputElementTag.True:
     case InputElementTag.False:
         {
             var bl = BooleanLiteral.FromJavaScript(Current.Loc, Current.Value);
             Consume();
             return bl;
         }
     case InputElementTag.Regexp:
         {
             // lexer has NOT already converted to underlying value
             var rl = RegularExpressionLiteral.FromJavaScript(Current.Loc, Current.Value);
             Consume();
             return rl;
         }
     case InputElementTag.LSquare:
         {
             var loc = Current.Loc;
             var elems = new Seq<Expression>();
             Consume();
             while (Current.Tag != InputElementTag.RSquare)
             {
                 if (Current.Tag == InputElementTag.Comma)
                 {
                     var elem = new IdentifierExpression
                         (Current.Loc, new Identifier(Current.Loc, Identifier.Undefined.Value));
                     elems.Add(elem);
                     Consume();
                 }
                 else
                 {
                     var elem = AssignmentExpression(false);
                     elems.Add(elem);
                     if (Current.Tag == InputElementTag.Comma)
                         Consume();
                     else if (Current.Tag != InputElementTag.RSquare)
                         throw IEError("array literal", "',' or ']'");
                 }
             }
             loc = loc.Union(Current.Loc);
             Consume();
             return new ArrayLiteral(loc, elems);
         }
     case InputElementTag.LBrace:
         {
             var bindings = new OrdMap<PropertyName, Expression>();
             var loc = DelimitedList
                 ("object literal",
                  "',' or '}'",
                  InputElementTag.Comma,
                  InputElementTag.RBrace,
                  () =>
                      {
                          var propName = default(PropertyName);
                          switch (Current.Tag)
                          {
                          case InputElementTag.Identifier:
                              propName = new PropertyName(Current.Loc, Current.Value);
                              break;
                          case InputElementTag.String:
                              propName = new PropertyName(Current.Loc, Current.Value);
                              break;
                          case InputElementTag.Number:
                              propName = PropertyName.FromJavaScriptNumber(Current.Loc, Current.Value);
                              break;
                          default:
                              throw IEError("object literal", "identifier, string or number");
                          }
                          Consume();
                          Only("object literal", "':'", InputElementTag.Colon);
                          var value = AssignmentExpression(false);
                          // This will silently ignore repeat bindings
                          bindings.Add(propName, value);
                      });
             LastWasInExpressionContext();
             return new ObjectLiteral(loc, bindings);
         }
     case InputElementTag.LParen:
         {
             Consume();
             var e = Expression(false);
             Only("expression", "')'", InputElementTag.RParen);
             LastWasInExpressionContext();
             return e;
         }
     case InputElementTag.Function:
         {
             var loc = Current.Loc;
             Consume();
             var name = default(Identifier);
             if (Current.Tag == InputElementTag.Identifier)
             {
                 name = new Identifier(Current.Loc, Current.Value);
                 Consume();
             }
             if (Current.Tag != InputElementTag.LParen)
                 throw IEError("function expression", "'('");
             var parameters = new Seq<Identifier>();
             DelimitedList
                 ("function expression parameters",
                  "',' or ')'",
                  InputElementTag.Comma,
                  InputElementTag.RParen,
                  () =>
                      {
                          if (Current.Tag != InputElementTag.Identifier)
                              throw IEError("function expression parameters", "identifier");
                          parameters.Add(new Identifier(Current.Loc, Current.Value));
                          Consume();
                      });
             var body = new Seq<Statement>();
             loc = loc.Union(BlockStatements("function expression", true, body));
             return new FunctionExpression(loc, name, parameters, new Statements(body));
         }
     default:
         throw IEError("expression", "primary expression");
     }
 }
Example #32
0
 public void ReturnPropertyName()
 {
     PropertyName <Foo> .GetPropertyName(p => p.Prop1).Should().Be("Prop1");
 }
Example #33
0
        public override void OnInspectorGUI()
        {
            InitStyles();

            //Bug fix: 1018456 Moved the HandleLowPassFilter method before updating the serializedObjects
            HandleLowPassFilter();

            serializedObject.Update();

            if (m_LowpassObject != null)
            {
                m_LowpassObject.Update();
            }


            UpdateWrappersAndLegend();

            EditorGUILayout.PropertyField(m_AudioClip, ms_Styles.audioClipLabel);
            EditorGUILayout.Space();
            EditorGUILayout.PropertyField(m_OutputAudioMixerGroup, ms_Styles.outputMixerGroupLabel);
            EditorGUILayout.PropertyField(m_Mute);
            EditorGUILayout.PropertyField(m_BypassEffects);
            if (targets.Any(t => (t as AudioSource).outputAudioMixerGroup != null))
            {
                using (new EditorGUI.DisabledScope(true))
                {
                    EditorGUILayout.PropertyField(m_BypassListenerEffects);
                }
            }
            else
            {
                EditorGUILayout.PropertyField(m_BypassListenerEffects);
            }
            EditorGUILayout.PropertyField(m_BypassReverbZones);

            EditorGUILayout.PropertyField(m_PlayOnAwake);
            EditorGUILayout.PropertyField(m_Loop);

            EditorGUILayout.Space();
            EditorGUIUtility.sliderLabels.SetLabels(ms_Styles.priorityLeftLabel, ms_Styles.priorityRightLabel);
            EditorGUILayout.IntSlider(m_Priority, 0, 256, ms_Styles.priorityLabel);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();
            EditorGUILayout.Slider(m_Volume, 0f, 1.0f, ms_Styles.volumeLabel);
            EditorGUILayout.Space();
            EditorGUILayout.Slider(m_Pitch, -3.0f, 3.0f, ms_Styles.pitchLabel);

            EditorGUILayout.Space();

            EditorGUIUtility.sliderLabels.SetLabels(ms_Styles.panLeftLabel, ms_Styles.panRightLabel);
            EditorGUILayout.Slider(m_Pan2D, -1f, 1f, ms_Styles.panStereoLabel);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();

            // 3D Level control
            EditorGUIUtility.sliderLabels.SetLabels(ms_Styles.spatialLeftLabel, ms_Styles.spatialRightLabel);
            AnimProp(ms_Styles.spatialBlendLabel, m_AudioCurves[kSpatialBlendCurveID].curveProp, 0.0f, 1.0f, false);
            EditorGUIUtility.sliderLabels.SetLabels(null, null);
            EditorGUILayout.Space();

            // 3D Level control
            AnimProp(ms_Styles.reverbZoneMixLabel, m_AudioCurves[kReverbZoneMixCurveID].curveProp, 0.0f, 1.1f, false);
            EditorGUILayout.Space();

            m_Expanded3D = EditorGUILayout.Foldout(m_Expanded3D, "3D Sound Settings", true);
            if (m_Expanded3D)
            {
                EditorGUI.indentLevel++;
                Audio3DGUI();
                EditorGUI.indentLevel--;
            }

            if (AudioUtil.canUseSpatializerEffect)
            {
                EditorGUILayout.PropertyField(m_Spatialize, ms_Styles.spatializeLabel);
                if (m_Spatialize.boolValue && !m_Spatialize.hasMultipleDifferentValues)
                {
                    for (int i = 0; i < targets.Length; i++)
                    {
                        AudioSource          source    = targets[i] as AudioSource;
                        AudioSourceExtension extension = (source != null) ? AudioExtensionManager.GetSpatializerExtension(source) : null;

                        // If we are playing in Editor or previewing in the scene view, spatialize is true, and we do not have a spatializer extension, try to add one.
                        // We may have just toggled spatialize here in the Editor.
                        if ((source != null) && source.spatialize && source.isPlaying)
                        {
                            if (extension == null)
                            {
                                extension = AudioExtensionManager.AddSpatializerExtension(source);
                            }

                            AudioExtensionManager.GetReadyToPlay(extension);
                        }
                    }

                    EditorGUI.indentLevel++;
                    EditorGUILayout.PropertyField(m_SpatializePostEffects, ms_Styles.spatializePostEffectsLabel);

                    bool allowExtensionEditing = (m_AddSpatializerExtension && !m_AddSpatializerExtensionMixedValues) || !serializedObject.isEditingMultipleObjects;
                    if (AudioExtensionManager.IsSourceSpatializerExtensionRegistered() && allowExtensionEditing)
                    {
                        EditorGUI.showMixedValue = m_AddSpatializerExtensionMixedValues;
                        bool addSpatializerExtensionNew = EditorGUILayout.Toggle(ms_Styles.addSpatializerExtensionLabel, m_AddSpatializerExtension);
                        EditorGUI.showMixedValue = false;

                        bool showExtensionProperties = false;
                        if (m_AddSpatializerExtension != addSpatializerExtensionNew)
                        {
                            m_AddSpatializerExtension = addSpatializerExtensionNew;
                            if (m_AddSpatializerExtension)
                            {
                                CreateExtensionEditors();

                                if (m_SpatializerEditor != null)
                                {
                                    showExtensionProperties = m_SpatializerEditor.FindAudioExtensionProperties(serializedObject);
                                }
                            }
                            else
                            {
                                ClearExtensionProperties();
                                DestroyExtensionEditors();
                                showExtensionProperties = false;
                            }
                        }
                        else if (m_SpatializerEditor != null)
                        {
                            showExtensionProperties = m_SpatializerEditor.FindAudioExtensionProperties(serializedObject);
                            if (!showExtensionProperties)
                            {
                                m_AddSpatializerExtension = false;
                                ClearExtensionProperties();
                                DestroyExtensionEditors();
                            }
                        }

                        if ((m_SpatializerEditor != null) && showExtensionProperties)
                        {
                            EditorGUI.indentLevel++;
                            m_SpatializerEditor.OnAudioSourceGUI();
                            EditorGUI.indentLevel--;

                            // Push any AudioSource extension property changes to the AudioSourceExtension properties. We always attempt to do this
                            // because we may be playing in Editor or previewing sound in the scene view.
                            for (int i = 0; i < targets.Length; i++)
                            {
                                AudioSource          source    = targets[i] as AudioSource;
                                AudioSourceExtension extension = (source != null) ? AudioExtensionManager.GetSpatializerExtension(source) : null;

                                if ((source != null) && (extension != null) && source.isPlaying)
                                {
                                    string extensionName = AudioExtensionManager.GetSourceSpatializerExtensionType().Name;
                                    for (int j = 0; j < m_SpatializerEditor.GetNumExtensionProperties(); j++)
                                    {
                                        PropertyName propertyName = m_SpatializerEditor.GetExtensionPropertyName(j);
                                        float        value        = 0.0f;
                                        if (source.ReadExtensionProperty(extensionName, propertyName, ref value))
                                        {
                                            extension.WriteExtensionProperty(propertyName, value);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }

            serializedObject.ApplyModifiedProperties();
            if (m_LowpassObject != null)
            {
                m_LowpassObject.ApplyModifiedProperties();
            }
        }
Example #34
0
 public override int GetHashCode()
 {
     return(PropertyName != null ? PropertyName.GetHashCode() : 0);
 }
Example #35
0
 public PrintSchemaProperty(PropertyName name)
 {
     _name = name;
 }
Example #36
0
 public Property(PropertyName name, string value)
 {
     Name = name;
     StringValue = value;
 }
Example #37
0
 /// <summary>
 ///     For internal use only.
 /// </summary>
 /// <param name="comment"></param>
 public void SetProperty(PropertyName propertyName, string value)
 {
     SetProperty(new Property(propertyName, value));
 }
Example #38
0
 public override int GetHashCode()
 {
     return(PropertyName.GetHashCode());
 }