Beispiel #1
0
        public override bool AllowDateParsing(RecordProperty prop)
        {
            Property  p  = prop.Property as Property;
            Hashtable ht = prop.Property as Hashtable;

            return(((p != null) && ("date".Equals(p.Type, StringComparison.InvariantCultureIgnoreCase) || "datenoyear".Equals(p.Type, StringComparison.InvariantCultureIgnoreCase))) || ((ht != null) && ("12".Equals(ht ["DataTypeID"] + string.Empty) || "14".Equals(ht ["DataTypeID"] + string.Empty))) || base.AllowDateParsing(prop));
        }
Beispiel #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="EpicsServerChannel"/> class.
        /// </summary>
        /// <param name="server">
        /// The server.
        /// </param>
        /// <param name="serverId">
        /// The server id.
        /// </param>
        /// <param name="clientId">
        /// The client id.
        /// </param>
        /// <param name="channelName">
        /// The channel name.
        /// </param>
        /// <param name="conn">
        /// The conn.
        /// </param>
        internal EpicsServerChannel(
            EpicsServer server, int serverId, int clientId, string channelName, EpicsServerTCPConnection conn)
        {
            this.NotDisposing = true;
            this.ServerId     = serverId;
            this.ClientId     = clientId;
            this.ChannelName  = channelName;
            this.Server       = server;
            this.Conn         = conn;
            this.Conn.ConnectionStateChanged += this.Conn_ConnectionStateChanged;

            try
            {
                if (channelName.Contains("."))
                {
                    var splitted = channelName.Split('.');
                    this.Record   = this.Server.recordList[splitted[0]];
                    this.Property = (RecordProperty)Enum.Parse(typeof(RecordProperty), splitted[1]);
                }
                else
                {
                    this.Record = this.Server.recordList[this.ChannelName];
                }

                this.Conn.Send(
                    this.Server.Codec.channelCreatedMessage(
                        this.ClientId, this.ServerId, this.Record.TYPE, this.Record.dataCount, this.Access));
            }
            catch (Exception e)
            {
                this.Conn.Send(this.Server.Codec.channelCreationFailMessage(this.ClientId));
                this.Dispose();
            }
        }
Beispiel #3
0
        public override string GetPropertyDisplayName(RecordProperty prop)
        {
            string      locName = null;
            SPContext   ctx;
            SPWeb       web = null;
            CultureInfo culture;
            Property    up = prop.Property as Property;
            Hashtable   ht = prop.Property as Hashtable;

            if (ht != null)
            {
                ctx = ProductPage.GetContext();
                if (ctx != null)
                {
                    web = ctx.Web;
                }
                if ((web != null) && (web.CurrentUser != null) && (web.CurrentUser.RegionalSettings != null))
                {
                    locName = ht ["c_" + web.CurrentUser.RegionalSettings.LocaleId] + string.Empty;
                }
                if (string.IsNullOrEmpty(locName) && (web != null) && (web.RegionalSettings != null))
                {
                    locName = ht ["c_" + web.RegionalSettings.LocaleId] + string.Empty;
                }
                if (string.IsNullOrEmpty(locName) && (web != null) && (web.Locale != null))
                {
                    locName = ht ["c_" + web.Locale.LCID] + string.Empty;
                }
                if (string.IsNullOrEmpty(locName))
                {
                    foreach (int lcid in ProductPage.TryEach <object> (ProductPage.WssInstalledCultures))
                    {
                        if (!string.IsNullOrEmpty(locName = ht ["c_" + lcid] + string.Empty))
                        {
                            break;
                        }
                    }
                }
                if (string.IsNullOrEmpty(locName) && ((culture = ProductPage.GetFarmCulture(ctx)) != null))
                {
                    locName = ht ["c_" + culture.LCID] + string.Empty;
                }
                if (!string.IsNullOrEmpty(locName))
                {
                    return(locName);
                }
                else
                {
                    foreach (string k in ht.Keys)
                    {
                        if (k.StartsWith("c_"))
                        {
                            return(ht [k] + string.Empty);
                        }
                    }
                }
            }
            return((up != null) ? up.DisplayName : base.GetPropertyDisplayName(prop));
        }
Beispiel #4
0
        public override string GetPropertyDisplayName(RecordProperty prop)
        {
            string    str       = null;
            SPWeb     web       = null;
            Property  property  = prop.Property as Property;
            Hashtable hashtable = prop.Property as Hashtable;

            if (hashtable != null)
            {
                CultureInfo info;
                SPContext   context = ProductPage.GetContext();
                if (context != null)
                {
                    web = context.Web;
                }
                if (((web != null) && (web.CurrentUser != null)) && (web.CurrentUser.RegionalSettings != null))
                {
                    str = hashtable["c_" + web.CurrentUser.RegionalSettings.LocaleId] + string.Empty;
                }
                if ((string.IsNullOrEmpty(str) && (web != null)) && (web.RegionalSettings != null))
                {
                    str = hashtable["c_" + web.RegionalSettings.LocaleId] + string.Empty;
                }
                if ((string.IsNullOrEmpty(str) && (web != null)) && (web.Locale != null))
                {
                    str = hashtable["c_" + web.Locale.LCID] + string.Empty;
                }
                if (string.IsNullOrEmpty(str))
                {
                    foreach (int num in ProductPage.TryEach <object>(ProductPage.WssInstalledCultures))
                    {
                        if (!string.IsNullOrEmpty(str = hashtable["c_" + num] + string.Empty))
                        {
                            break;
                        }
                    }
                }
                if (string.IsNullOrEmpty(str) && ((info = ProductPage.GetFarmCulture(context)) != null))
                {
                    str = hashtable["c_" + info.LCID] + string.Empty;
                }
                if (!string.IsNullOrEmpty(str))
                {
                    return(str);
                }
                foreach (string str2 in hashtable.Keys)
                {
                    if (str2.StartsWith("c_"))
                    {
                        return(hashtable[str2] + string.Empty);
                    }
                }
            }
            if (property == null)
            {
                return(base.GetPropertyDisplayName(prop));
            }
            return(property.DisplayName);
        }
        public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop)
        {
            SPFieldUrl url;
            SPListItem relItem  = rec.RelItem as SPListItem;
            SPField    property = prop.Property as SPField;
            SPUser     mainItem = rec.MainItem as SPUser;

            if (prop.Name == "roxVcardExport")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { UserDataSource.GetVcardExport(rec) }, null, null, null));
            }
            if ((prop.Name == "roxSiteGroups") && (mainItem != null))
            {
                List <object> list = new List <object>();
                foreach (SPGroup group in ProductPage.TryEach <SPGroup>(mainItem.Groups))
                {
                    try
                    {
                        list.Add(group.Name);
                    }
                    catch
                    {
                    }
                }
                return(new RecordPropertyValueCollection(this, rec, prop, list.ToArray(), null, null, null));
            }
            if (prop.Name == "roxUserPersonalUrl")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPersonalUrl(rec) }, null, null, null));
            }
            if (prop.Name == "roxUserPublicUrl")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPublicUrl(rec) }, null, null, null));
            }
            if ((relItem == null) || (property == null))
            {
                return(null);
            }
            object obj2 = relItem[property.Id];

            if (obj2 is DateTime)
            {
                obj2 = ((DateTime)obj2).ToUniversalTime();
            }
            if (((url = property as SPFieldUrl) != null) && (obj2 is string))
            {
                if (url.DisplayFormat == SPUrlFieldFormatType.Image)
                {
                    obj2 = new SPFieldUrlValue(obj2 as string).Url;
                }
                else
                {
                    obj2 = new SPFieldUrlValue(obj2 as string);
                }
            }
            return(new RecordPropertyValueCollection(this, rec, prop, (obj2 is object[]) ? (obj2 as object[]) : ((obj2 == null) ? new object[0] : new object[] { ((url != null) ? obj2 : property.GetFieldValueAsHtml(obj2)) }), null, null, null));
        }
Beispiel #6
0
    //public float[] Face;

    public static RecordProperty NewFrame(Animator anim)
    {
        var frame = new RecordProperty()
        {
            Hips  = NewHipsPosition(anim),
            Joint = NewJointRotation(anim)
        };

        return(frame);
    }
        public override string GetPropertyDisplayName(RecordProperty prop)
        {
            SPField property = prop.Property as SPField;

            if (property == null)
            {
                return(base.GetPropertyDisplayName(prop));
            }
            return(property.Title);
        }
        public override bool AllowDateParsing(RecordProperty prop)
        {
            SPFieldCalculated property = prop.Property as SPFieldCalculated;

            if (property != null)
            {
                return(property.OutputType == SPFieldType.DateTime);
            }
            return(true);
        }
        public override string GetPropertyDisplayName(RecordProperty prop)
        {
            string str = prop.Property + string.Empty;

            string[] strArray = str.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
            if (strArray.Length <= 1)
            {
                return(str);
            }
            return(string.Join(":", strArray, 1, strArray.Length - 1));
        }
Beispiel #10
0
        public override bool AllowDateParsing(RecordProperty prop)
        {
            Property  property  = prop.Property as Property;
            Hashtable hashtable = prop.Property as Hashtable;

            if (((property == null) || (!"date".Equals(property.Type, StringComparison.InvariantCultureIgnoreCase) && !"datenoyear".Equals(property.Type, StringComparison.InvariantCultureIgnoreCase))) && ((hashtable == null) || (!"12".Equals(hashtable["DataTypeID"] + string.Empty) && !"14".Equals(hashtable["DataTypeID"] + string.Empty))))
            {
                return(base.AllowDateParsing(prop));
            }
            return(true);
        }
Beispiel #11
0
        private void RecordPropertyChanged(EpicsRecord sender, RecordProperty prop, object val, Setter setter)
        {
            if (prop == this.property)
            {
                var toUpdate = true;
                if (val is short || val is int || val is float || val is double)
                {
                    var v = Convert.ToDouble(val);
                    var l = Convert.ToDouble(this.lastValue);
                    if (Math.Abs(v - l) > sender.MDEL)
                    {
                        this.lastValue = val;
                    }
                    else
                    {
                        toUpdate = false;
                    }
                }
                else if (val is string)
                {
                    if ((string)val == (string)this.lastValue)
                    {
                        toUpdate = false;
                    }
                    else
                    {
                        this.lastValue = val;
                    }
                }
                else
                {
                    if (val.ToString() == this.lastValue.ToString())
                    {
                        toUpdate = false;
                    }
                    else
                    {
                        this.lastValue = val;
                    }
                }

                if (toUpdate)
                {
                    this.channel.sendMonitorChange(
                        this.subscriptionId,
                        this.type,
                        this.dataCount,
                        EpicsTransitionStatus.ECA_NORMAL,
                        NetworkByteConverter.objectToByte(val, this.type, this.record));
                }
            }
        }
		private void RecordPropertyChanged(EpicsRecord sender, RecordProperty prop, object val, Setter setter)
		{
			if (prop == this.property)
			{
				var toUpdate = true;
				if (val is short || val is int || val is float || val is double)
				{
					var v = Convert.ToDouble(val);
					var l = Convert.ToDouble(this.lastValue);
					if (Math.Abs(v - l) > sender.MDEL)
					{
						this.lastValue = val;
					}
					else
					{
						toUpdate = false;
					}
				}
				else if (val is string)
				{
					if ((string)val == (string)this.lastValue)
					{
						toUpdate = false;
					}
					else
					{
						this.lastValue = val;
					}
				}
				else
				{
					if (val.ToString() == this.lastValue.ToString())
					{
						toUpdate = false;
					}
					else
					{
						this.lastValue = val;
					}
				}

				if (toUpdate)
				{
					this.channel.sendMonitorChange(
						this.subscriptionId, 
						this.type, 
						this.dataCount, 
						EpicsTransitionStatus.ECA_NORMAL, 
						NetworkByteConverter.objectToByte(val, this.type, this.record));
				}
			}
		}
Beispiel #13
0
        /// <summary>
        /// The handle change.
        /// </summary>
        /// <param name="prop">
        /// The prop.
        /// </param>
        /// <param name="newVal">
        /// The new val.
        /// </param>
        protected void handleChange(RecordProperty prop, object newVal)
        {
            this.TIME = DateTime.Now;

            // no listeners no handling
            if (this.PrivPropertyChanged != null)
            {
                if (prop == RecordProperty.VAL)
                {
                    // filter defined
                    if (this.filter > 0)
                    {
                        var tmpVal = Convert.ToDouble(newVal);
                        if (Math.Abs(tmpVal - this.lastMonitoredValue) > this.filter)
                        {
                            this.lastMonitoredValue = tmpVal;
                        }
                        else
                        {
                            return;
                        }
                    }
                }

                if (this.scanInterval == 0)
                {
                    this.PrivPropertyChanged(this, prop, newVal, this.SetMode);
                }
                else
                {
                    // scan triggered
                    lock (this.changeList)
                    {
                        if (this.changeList.ContainsKey(prop))
                        {
                            this.changeList[prop] = new KeyValuePair <object, Setter>(newVal, this.SetMode);
                        }
                        else
                        {
                            this.changeList.Add(prop, new KeyValuePair <object, Setter>(newVal, this.SetMode));
                        }
                    }
                }
            }
        }
        public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop)
        {
            string str = rec.Tags[prop.Name] + string.Empty;

            if (string.IsNullOrEmpty(str))
            {
                if ((this.StaticRecs != null) && (this.StaticRecs.Count >= rec.RecordID))
                {
                    IDictionary dictionary = this.StaticRecs[((int)rec.RecordID) - 1] as IDictionary;
                    rec.Tags[prop.Name] = str = (dictionary == null) ? null : (dictionary[prop.Name] as string);
                }
                else
                {
                    int num = 0;
                    if (!"Title".Equals(prop.Name))
                    {
                        num = 1;
                    }
                    rec.Tags[prop.Name] = str = num.Equals(DataSource.rnd.Next(0, 2)) ? (ProductPage.GetResource("PC_DataSources_t_" + base.GetType().Name, new object[0]) + " #" + rec.RecordID) : DataSource.rnd.Next(0x3e8, 0xf4240).ToString();
                }
            }
            return(new RecordPropertyValueCollection(this, rec, prop, new object[] { str }, null, null, null));
        }
Beispiel #15
0
 private void SetRecordProperty(Animator anim, RecordProperty recordProperty, bool lerp = true)
 {
     foreach (HumanBodyBones bone in Enum.GetValues(typeof(HumanBodyBones)))
     {
         if (bone < 0 || bone == HumanBodyBones.LastBone)
         {
             continue;
         }
         if (anim.GetBoneTransform(bone) != null)
         {
             anim.GetBoneTransform(bone).localRotation =
                 Quaternion.Lerp(
                     anim.GetBoneTransform(bone).localRotation,
                     new Quaternion()
             {
                 x = recordProperty.Joint[(int)bone, 0],
                 y = recordProperty.Joint[(int)bone, 1],
                 z = recordProperty.Joint[(int)bone, 2],
                 w = recordProperty.Joint[(int)bone, 3]
             },
                     lerp ? lerpSpeed * Time.deltaTime : 1);
             if (bone == HumanBodyBones.Hips)
             {
                 anim.GetBoneTransform(bone).localPosition =
                     Vector3.Lerp(
                         anim.GetBoneTransform(bone).localPosition,
                         new Vector3()
                 {
                     x = recordProperty.Hips[0],
                     y = recordProperty.Hips[1],
                     z = recordProperty.Hips[2]
                 },
                         lerp ? lerpSpeed * Time.deltaTime : 1);
             }
         }
     }
 }
Beispiel #16
0
        internal EpicsServerMonitor(
            EpicsRecord record,
            RecordProperty property,
            EpicsServerChannel channel,
            EpicsType type,
            int dataCount,
            MonitorMask monitorMask,
            int subscriptionId)
        {
            this.record         = record;
            this.property       = property;
            this.channel        = channel;
            this.type           = type;
            this.dataCount      = dataCount;
            this.monitorMask    = monitorMask;
            this.subscriptionId = subscriptionId;

            try
            {
                var val = this.record[this.property.ToString()];
                if (val == null)
                {
                    val = 0;
                }

                var realData = NetworkByteConverter.objectToByte(val, this.type, this.record);
                this.channel.sendMonitorChange(
                    this.subscriptionId, this.type, this.dataCount, EpicsTransitionStatus.ECA_NORMAL, realData);

                this.StartMonitor();
            }
            catch (Exception e)
            {
                this.channel.sendMonitorChange(
                    this.subscriptionId, this.type, this.dataCount, EpicsTransitionStatus.ECA_ADDFAIL, new byte[0]);
            }
        }
		internal EpicsServerMonitor(
			EpicsRecord record, 
			RecordProperty property, 
			EpicsServerChannel channel, 
			EpicsType type, 
			int dataCount, 
			MonitorMask monitorMask, 
			int subscriptionId)
		{
			this.record = record;
			this.property = property;
			this.channel = channel;
			this.type = type;
			this.dataCount = dataCount;
			this.monitorMask = monitorMask;
			this.subscriptionId = subscriptionId;

			try
			{
				var val = this.record[this.property.ToString()];
				if (val == null)
				{
					val = 0;
				}

				var realData = NetworkByteConverter.objectToByte(val, this.type, this.record);
				this.channel.sendMonitorChange(
					this.subscriptionId, this.type, this.dataCount, EpicsTransitionStatus.ECA_NORMAL, realData);

				this.StartMonitor();
			}
			catch (Exception e)
			{
				this.channel.sendMonitorChange(
					this.subscriptionId, this.type, this.dataCount, EpicsTransitionStatus.ECA_ADDFAIL, new byte[0]);
			}
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="EpicsServerChannel"/> class.
		/// </summary>
		/// <param name="server">
		/// The server.
		/// </param>
		/// <param name="serverId">
		/// The server id.
		/// </param>
		/// <param name="clientId">
		/// The client id.
		/// </param>
		/// <param name="channelName">
		/// The channel name.
		/// </param>
		/// <param name="conn">
		/// The conn.
		/// </param>
		internal EpicsServerChannel(
			EpicsServer server, int serverId, int clientId, string channelName, EpicsServerTCPConnection conn)
		{
			this.NotDisposing = true;
			this.ServerId = serverId;
			this.ClientId = clientId;
			this.ChannelName = channelName;
			this.Server = server;
			this.Conn = conn;
			this.Conn.ConnectionStateChanged += this.Conn_ConnectionStateChanged;

			try
			{
				if (channelName.Contains("."))
				{
					var splitted = channelName.Split('.');
					this.Record = this.Server.recordList[splitted[0]];
					this.Property = (RecordProperty)Enum.Parse(typeof(RecordProperty), splitted[1]);
				}
				else
				{
					this.Record = this.Server.recordList[this.ChannelName];
				}

				this.Conn.Send(
					this.Server.Codec.channelCreatedMessage(
						this.ClientId, this.ServerId, this.Record.TYPE, this.Record.dataCount, this.Access));
			}
			catch (Exception e)
			{
				this.Conn.Send(this.Server.Codec.channelCreationFailMessage(this.ClientId));
				this.Dispose();
			}
		}
Beispiel #19
0
        public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop)
        {
            string      name;
            bool        isHtml = false;
            UserProfile prof   = rec.MainItem as UserProfile;
            UserProfileValueCollection vals;
            List <object>  groups = null;
            SPUser         user   = null;
            RecordProperty nameProp;
            RecordPropertyValueCollection nameVal;
            Property origProp = prop.Property as Property;

            if (origProp != null)
            {
                isHtml = (origProp.Type == "HTML");
            }
            if (prop.Name == FIELDNAME_VCARDEXPORT)
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object [] { GetVcardExport(rec) }, null, null, null));
            }
            else if (prop.Name == FIELDNAME_SITEGROUPS)
            {
                groups = new List <object> ();
                if (((nameProp = rec.DataSource.Properties.GetPropertyByName("AccountName")) != null) && ((nameVal = GetPropertyValues(rec, nameProp)) != null) && (!string.IsNullOrEmpty(name = nameVal.Value + string.Empty)))
                {
                    try {
                        user = SPContext.Current.Web.AllUsers [name];
                    } catch {
                    }
                    if (user != null)
                    {
                        foreach (SPGroup group in ProductPage.TryEach <SPGroup> (user.Groups))
                        {
                            try {
                                groups.Add(group.Name);
                            } catch {
                            }
                        }
                    }
                }
                return(new RecordPropertyValueCollection(this, rec, prop, groups.ToArray(), null, null, null));
            }
            else if (prop.Name == "roxUserPersonalUrl")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object [] { GetPersonalUrl(rec) }, null, null, null));
            }
            else if (prop.Name == "roxUserPublicUrl")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object [] { GetPublicUrl(rec) }, null, null, null));
            }
            else
            {
                vals = prof [prop.Name];
                return(new RecordPropertyValueCollection(this, rec, prop, null, isHtml ? Array.ConvertAll <object, string> (new ArrayList(vals).ToArray(), delegate(object o) {
                    return Record.HTML_PREFIX + o;
                }).GetEnumerator() : vals.GetEnumerator(), delegate() {
                    return vals.Count;
                }, delegate() {
                    if (isHtml)
                    {
                        return Record.HTML_PREFIX + vals.Value;
                    }
                    else
                    {
                        return vals.Value;
                    }
                }));
            }
        }
 set => SetValue(RecordProperty, value);
        public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop)
        {
            IDictionary mainItem = rec.MainItem as IDictionary;

            return(new RecordPropertyValueCollection(this, rec, prop, (mainItem == null) ? new object[0] : new object[] { mainItem[prop.Name] }, null, null, null));
        }
Beispiel #22
0
        public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop)
        {
            roxority.Shared.Func <int>    getCount = null;
            roxority.Shared.Func <object> getValue = null;
            bool          isHtml    = false;
            UserProfile   mainItem  = rec.MainItem as UserProfile;
            List <object> list      = null;
            SPUser        user      = null;
            Property      property2 = prop.Property as Property;

            if (property2 != null)
            {
                isHtml = property2.Type == "HTML";
            }
            if (prop.Name == "roxVcardExport")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { UserDataSource.GetVcardExport(rec) }, null, null, null));
            }
            if (prop.Name == "roxSiteGroups")
            {
                string         str;
                RecordProperty property;
                RecordPropertyValueCollection values;
                list = new List <object>();
                if ((((property = rec.DataSource.Properties.GetPropertyByName("AccountName")) != null) && ((values = this.GetPropertyValues(rec, property)) != null)) && !string.IsNullOrEmpty(str = values.Value + string.Empty))
                {
                    try
                    {
                        user = SPContext.Current.Web.AllUsers[str];
                    }
                    catch
                    {
                    }
                    if (user != null)
                    {
                        foreach (SPGroup group in ProductPage.TryEach <SPGroup>(user.Groups))
                        {
                            try
                            {
                                list.Add(group.Name);
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                return(new RecordPropertyValueCollection(this, rec, prop, list.ToArray(), null, null, null));
            }
            if (prop.Name == "roxUserPersonalUrl")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPersonalUrl(rec) }, null, null, null));
            }
            if (prop.Name == "roxUserPublicUrl")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { base.GetPublicUrl(rec) }, null, null, null));
            }
            UserProfileValueCollection vals = mainItem[prop.Name];

            if (getCount == null)
            {
                getCount = () => vals.Count;
            }
            if (getValue == null)
            {
                getValue = delegate {
                    if (isHtml)
                    {
                        return("<roxhtml/>" + vals.Value);
                    }
                    return(vals.Value);
                };
            }
            return(new RecordPropertyValueCollection(this, rec, prop, null, isHtml ? Array.ConvertAll <object, string>(new ArrayList(vals).ToArray(), o => "<roxhtml/>" + o).GetEnumerator() : vals.GetEnumerator(), getCount, getValue));
        }
Beispiel #23
0
 public void AddFrame()
 {
     records.Add(RecordProperty.NewFrame(anim));
 }
        public override RecordPropertyValueCollection GetPropertyValues(Record rec, RecordProperty prop)
        {
            Converter <string, string> getSourceValue = null;
            DirectoryEntry             mainItem       = rec.MainItem as DirectoryEntry;
            SearchResult relItem = rec.RelItem as SearchResult;
            ResultPropertyValueCollection rvals = (relItem == null) ? null : relItem.Properties[prop.Name];
            PropertyValueCollection       pvals = (mainItem == null) ? null : mainItem.Properties[prop.Name];
            object obj1 = rec.MainItem;
            SPUser user = null;

            if (prop.Name == "roxVcardExport")
            {
                return(new RecordPropertyValueCollection(this, rec, prop, new object[] { UserDataSource.GetVcardExport(rec) }, null, null, null));
            }
            if (prop.Name == "roxSiteGroups")
            {
                string        str;
                List <object> list = new List <object>();
                if (getSourceValue == null)
                {
                    getSourceValue = pn => rec[pn, string.Empty];
                }
                if (!string.IsNullOrEmpty(str = Record.GetSpecialFieldValue(this, "rox___pl", getSourceValue)))
                {
                    try
                    {
                        user = SPContext.Current.Web.AllUsers[str];
                    }
                    catch
                    {
                    }
                    if (user != null)
                    {
                        foreach (SPGroup group in ProductPage.TryEach <SPGroup>(user.Groups))
                        {
                            try
                            {
                                list.Add(group.Name);
                            }
                            catch
                            {
                            }
                        }
                    }
                }
                return(new RecordPropertyValueCollection(this, rec, prop, list.ToArray(), null, null, null));
            }
            if (rvals != null)
            {
                return(new RecordPropertyValueCollection(this, rec, prop, null, rvals.GetEnumerator(), () => rvals.Count, delegate {
                    IEnumerator enumerator = rvals.GetEnumerator();
                    {
                        while (enumerator.MoveNext())
                        {
                            return enumerator.Current;
                        }
                    }
                    return null;
                }));
            }
            if (pvals != null)
            {
                return(new RecordPropertyValueCollection(this, rec, prop, null, pvals.GetEnumerator(), () => pvals.Count, () => pvals.Value));
            }
            return(null);
        }
Beispiel #25
0
		/// <summary>
		/// The handle change.
		/// </summary>
		/// <param name="prop">
		/// The prop.
		/// </param>
		/// <param name="newVal">
		/// The new val.
		/// </param>
		protected void handleChange(RecordProperty prop, object newVal)
		{
			this.TIME = DateTime.Now;

			// no listeners no handling
			if (this.PrivPropertyChanged != null)
			{
				if (prop == RecordProperty.VAL)
				{
					// filter defined
					if (this.filter > 0)
					{
						var tmpVal = Convert.ToDouble(newVal);
						if (Math.Abs(tmpVal - this.lastMonitoredValue) > this.filter)
						{
							this.lastMonitoredValue = tmpVal;
						}
						else
						{
							return;
						}
					}
				}

				if (this.scanInterval == 0)
				{
					this.PrivPropertyChanged(this, prop, newVal, this.SetMode);
				}
				else
				{
					// scan triggered
					lock (this.changeList)
					{
						if (this.changeList.ContainsKey(prop))
						{
							this.changeList[prop] = new KeyValuePair<object, Setter>(newVal, this.SetMode);
						}
						else
						{
							this.changeList.Add(prop, new KeyValuePair<object, Setter>(newVal, this.SetMode));
						}
					}
				}
			}
		}