Ejemplo n.º 1
0
        /// <summary>
        /// Remove all elements of the table.
        /// </summary>
        public static void Clear <TKey, TValue>(SimpleTable <TKey, TValue> table)
        {
            for (int i = 0; i < table.Capacity; i++)
            {
                var entry = table.Entries[i];
                if (entry == null)
                {
                    continue;
                }

                table.Entries[i] = null;

                entry.Key      = default(TKey);
                entry.Value    = default(TValue);
                entry.HashCode = -1;

                SList.Add(table.EntryPool, entry);
                while (entry.Next != null)
                {
                    entry = entry.Next;

                    entry.Key      = default(TKey);
                    entry.Value    = default(TValue);
                    entry.HashCode = -1;

                    SList.Add(table.EntryPool, entry);
                }
            }

            table.Count = 0;
        }
Ejemplo n.º 2
0
        private static Window CreateWindow(WindowState defaultState)
        {
            var references = DataHolder.GUIReferences;

            var windowObj = NGUITools.AddChild(DataHolder.GUIReferences.WindowsParent, references.WindowPrefab);

            var windowComponent = windowObj.GetComponent <WindowComponent>();

            windowComponent.ControlBar.DragObject.contentRect = windowComponent.WindowWidget;
            windowComponent.ControlBar.DragObject.panelRegion = DataHolder.GUIReferences.MainPanel;

            var window = new Window();

            window.WindowId    = WindowIds++;
            window.SceneWindow = windowComponent;

            SetWindowState(window, defaultState);

            windowObj.SetActive(true);

            SList.Add(CurrentlyOpenWindows, window);

            windowComponent.Widgets = SList.Create <UIWidget>(3);
            windowComponent.Panels  = SList.Create <UIPanel>(3);

            Focus(windowComponent);

            return(window);
        }
Ejemplo n.º 3
0
        public static HashDir CreateDir(HashDir parent, string name)
        {
            var hashDir = new HashDir();

            hashDir.DirId       = MathUtil.GetStringHash(name);
            hashDir.Name        = name;
            hashDir.Childs      = SList.Create <HashDir>(1);
            hashDir.ChildsDirId = SList.Create <int>(1);
            hashDir.Files       = SList.Create <HashFile>(1);
            hashDir.FilesId     = SList.Create <int>(1);
            hashDir.ParentDir   = parent;
            if (parent != null)
            {
                hashDir.ParentDirId = parent.DirId;
                SList.Add(parent.Childs, hashDir);
                SList.Add(parent.ChildsDirId, hashDir.DirId);
            }
            else
            {
                hashDir.ParentDirId = -1;
            }

            CacheDirFullPath(hashDir);

            return(hashDir);
        }
Ejemplo n.º 4
0
        public int AddBlock()
        {
            var t  = new DataBlock <T>();
            int id = list.Add(t);

            return(id);
        }
Ejemplo n.º 5
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            if (!Check())
            {
                MessageBox.Show("Не все поля заполнены");
                return;
            }
            string min = "", max = "";

            min = alist[acomboBox.SelectedIndex].Born.Split('.')[2];
            max = alist[acomboBox.SelectedIndex].Die.Split('.')[2];
            if (Convert.ToInt32(ytextBox.Text) < Convert.ToInt32(min) || Convert.ToInt32(ytextBox.Text) > Convert.ToInt32(max))
            {
                MessageBox.Show("Год не входит в рамки жизни автора");
                return;
            }
            double id = 0;

            slist.Read();
            if (slist.Length == 0)
            {
                temp = new Source(slist.RemoveSpaces(ntextBox.Text), alist[acomboBox.SelectedIndex], ytextBox.Text, slist.RemoveSpaces(inftextBox.Text), id);
            }
            else
            {
                id   = slist[slist.Length - 1].Id + 1;
                temp = new Source(slist.RemoveSpaces(ntextBox.Text), alist[acomboBox.SelectedIndex], ytextBox.Text, slist.RemoveSpaces(inftextBox.Text), id);
            }
            slist.Add(temp);
            DialogResult = DialogResult.OK;
            slist.Write();
            Clear();
            Close();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Creates and returns a file from the given serialized data.
        /// </summary>
        public static HashFile GetFileFromSerializedData(SerializedHashFile serializedFile)
        {
            var file = new HashFile();

            file.FileId      = serializedFile.FileId;
            file.Name        = serializedFile.Name;
            file.ParentDirId = serializedFile.ParentDirId;
            file.Status      = serializedFile.Status;
            file.Password    = serializedFile.Password;
            file.Condition   = serializedFile.Condition;

            file.UserPermission = SList.Create <ClassPair <string, AccessPermission> >(serializedFile.UserPermission.Length);
            for (int i = 0; i < serializedFile.UserPermission.Length; i++)
            {
                var permission = serializedFile.UserPermission[i];
                var user       = permission.Key;

                var pair = new ClassPair <string, AccessPermission>();
                pair.Key   = user.UserName;
                pair.Value = permission.Value;

                SList.Add(file.UserPermission, pair);
            }

            return(file);
        }
Ejemplo n.º 7
0
        public static TextTableLine CreateLine(
            string nameColumnText,
            string typeColumnText,
            string statusColumnText,
            Color color,
            int textModifiers)
        {
            var nameColumnItem   = CreateColumn(nameColumnText, .6f, color, textModifiers);
            var typeColumnItem   = CreateColumn(typeColumnText, .2f, color, textModifiers);
            var statusColumnItem = CreateColumn(statusColumnText, .2f, color, textModifiers);

            var items = SList.Create <TextTableColumn>(2);

            SList.Add(items, nameColumnItem);
            SList.Add(items, typeColumnItem);
            SList.Add(items, statusColumnItem);

            var line = new TextTableLine();

            line.Items               = items;
            line.ItemsSeparator      = string.Empty;
            line.MaxLineSize         = DataHolder.TerminalData.MaxLineWidthInChars;
            line.MaxLineSizeIsForced = true;

            line.ItemsSeparator              = " | ";
            line.SeparatorModifier.Color     = color;
            line.SeparatorModifier.Modifiers = TextModifiers.Bold;

            TextUtil.FormatLineConsideringWeightsAndSize(line);

            return(line);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Remove all elements of the set.
        /// </summary>
        public static void Clear <TKey>(SimpleSet <TKey> set)
        {
            for (int i = 0; i < set.Capacity; i++)
            {
                var entry = set.Entries[i];
                if (entry == null)
                {
                    continue;
                }

                set.Entries[i] = null;

                entry.Key      = default(TKey);
                entry.HashCode = -1;

                SList.Add(set.EntryPool, entry);
                while (entry.Next != null)
                {
                    entry = entry.Next;

                    entry.Key      = default(TKey);
                    entry.HashCode = -1;

                    SList.Add(set.EntryPool, entry);
                }
            }

            set.Count = 0;
        }
Ejemplo n.º 9
0
        public static HashDevice GetDeviceFromSerializedData(SerializedHashDevice serializedDevice)
        {
            var device = new HashDevice();

            device.DeviceName = serializedDevice.DeviceName;
            device.Condition  = serializedDevice.Condition;
            device.IpAddress  = serializedDevice.IpAddress;

            device.AllPrograms = ProgramUtil.GetAllProgramsFromSerializedData(serializedDevice.Programs);
            device.AllUsers    = SList.Create <HashUser>(serializedDevice.Users.Length);

            for (int i = 0; i < serializedDevice.Users.Length; i++)
            {
                var user = GetUserFromSerializedData(serializedDevice.Users[i]);
                SList.Add(device.AllUsers, user);
            }

            var defaultUser = new HashUser();

            defaultUser.Username = DEFAULT_USER_NAME;
            defaultUser.Password = DEFAULT_PASSWORD;

            SList.Add(device.AllUsers, defaultUser);

            device.FileSystem = FileSystem.GetFileSystemFromSerializedData(serializedDevice.FileSystem);

            return(device);
        }
Ejemplo n.º 10
0
        public static void AddFileToDir(HashDir dir, HashFile file)
        {
            file.ParentDir   = dir;
            file.ParentDirId = dir.DirId;

            SList.Add(dir.Files, file);
            SList.Add(dir.FilesId, file.FileId);

            CacheFile(file);
        }
Ejemplo n.º 11
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Value"></param>
 /// <param name="SList"></param>
 protected virtual void SetAndObjectValue(List <object> SList, object Value)
 {
     if (SList == null)
     {
         SList = new List <object>();
     }
     else
     {
         SList.Add(Value);
     }
 }
Ejemplo n.º 12
0
        /// <summary>
        /// Returns a list of all the programs deserialized from the given serialized data.
        /// </summary>
        public static SimpleList <Program> GetAllProgramsFromSerializedData(SerializedProgram[] programs)
        {
            var result = SList.Create <Program>(programs.Length);

            for (int i = 0; i < programs.Length; i++)
            {
                var program = GetProgramFromSerializedData(programs[i]);
                SList.Add(result, program);
            }

            return(result);
        }
Ejemplo n.º 13
0
        public static void CachePanels(WindowComponent windowComponent)
        {
            SList.Clear(windowComponent.Panels);

            var panels = windowComponent.gameObject.GetComponentsInChildren <UIPanel>(true);

            for (int i = 0; i < panels.Length; i++)
            {
                var panel = panels[i];
                SList.Add(windowComponent.Panels, panel);
            }
        }
Ejemplo n.º 14
0
        public static void CacheWidgets(WindowComponent windowComponent)
        {
            SList.Clear(windowComponent.Widgets);

            var widgets = windowComponent.gameObject.GetComponentsInChildren <UIWidget>(true);

            for (int i = 0; i < widgets.Length; i++)
            {
                var widget = widgets[i];
                SList.Add(windowComponent.Widgets, widget);
            }
        }
Ejemplo n.º 15
0
        public static int CreateDevice(DeviceData deviceData)
        {
            Device newDevice = new Device();

            newDevice.Id        = new Random().Next(); // TODO: Real id
            newDevice.Name      = "NEW_DEVICE";
            newDevice.StorageId = CreateStorage(deviceData);
            newDevice.IP        = "192.168.0.1";

            SList.Add(deviceData.AllDevices, newDevice);

            return(newDevice.Id);
        }
Ejemplo n.º 16
0
        public void Add(int goodsId, int num)
        {
            TestGoods goods = Get(goodsId);

            if (goods == null)
            {
                goods = new TestGoods();
                goods.goodsId.Value = goodsId;
                m_goods.Add(goods);
            }

            goods.num.Value = goods.num + num;
        }
Ejemplo n.º 17
0
        public static int CreateDirectory(DeviceData deviceData, string name)
        {
            Directory dir = new Directory();

            dir.Id = new Random().Next(); // TODO: Real id
            dir.ChildrenDirectoriesIds = new SimpleList <int>();
            dir.FilesIds = new SimpleList <int>();
            dir.Name     = name;

            SList.Add(deviceData.AllDirectories, dir);

            return(dir.Id);
        }
Ejemplo n.º 18
0
        public static SimpleList <HashDir> GetAllAvailableChild(HashDir dir)
        {
            var result = SList.Create <HashDir>(dir.Childs.Count);

            for (int i = 0; i < dir.Childs.Count; i++)
            {
                var child = dir.Childs[i];
                if (IsDirAvaibale(child))
                {
                    SList.Add(result, child);
                }
            }

            return(result);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// Returns a list containing all the files of the given dir that are available for use.
        /// See IsFileAvailable.
        /// </summary>
        public static SimpleList <HashFile> GetAvailableFilesFromDir(HashDir dir)
        {
            var result = SList.Create <HashFile>(1);

            for (int i = 0; i < dir.Files.Count; i++)
            {
                var file = dir.Files[i];
                if (IsFileAvaibale(file))
                {
                    SList.Add(result, file);
                }
            }

            return(result);
        }
Ejemplo n.º 20
0
        public static SimpleList <Program> GetAvailablePrograms(HashDevice device)
        {
            var programs = SList.Create <Program>(device.AllPrograms.Count);

            for (int i = 0; i < device.AllPrograms.Count; i++)
            {
                var program = device.AllPrograms[i];
                if (IsProgramAvailable(program))
                {
                    SList.Add(programs, program);
                }
            }

            return(programs);
        }
Ejemplo n.º 21
0
        /// <summary>
        /// Returns a list containing all of the dir files.
        /// </summary>
        public static void CacheDirFiles(HashDir dir)
        {
            SList.Clear(dir.Files);
            for (int i = 0; i < dir.FilesId.Count; i++)
            {
                var fileId = dir.FilesId[i];
                var file   = FindFileById(fileId);
                DebugUtil.Assert(file == null, string.Format("THE DIR {0} HAS A INVALID FILE {1}", dir.Name, fileId));

                file.ParentDirId = dir.DirId;
                file.ParentDir   = dir;

                SList.Add(dir.Files, file);
            }
        }
Ejemplo n.º 22
0
        /// <summary>
        /// Cache the dirs children based on the ChildsDirid values.
        /// </summary>
        public static void CacheDirChildren(HashDir dir)
        {
            SList.Clear(dir.Childs);
            for (int i = 0; i < dir.ChildsDirId.Count; i++)
            {
                var childId = dir.ChildsDirId[i];
                var child   = FindDirById(childId);

                DebugUtil.Assert(child == null, string.Format("THE DIR {0} HAS A INVALID CHILD {1}", dir.Name, childId));

                child.ParentDirId = dir.DirId;
                child.ParentDir   = dir;

                SList.Add(dir.Childs, child);
            }
        }
Ejemplo n.º 23
0
        public static int CreateStorage(DeviceData deviceData)
        {
            Storage storage = new Storage();

            storage.Id = new Random().Next(); // TODO: Real id
            storage.AllDirectoriesIds = new SimpleList <int>();
            storage.AllFilesIds       = new SimpleList <int>();

            int root = CreateDirectory(deviceData, ROOT_DIR_NAME);

            SList.Add(storage.AllDirectoriesIds, root);

            SList.Add(deviceData.AllStorages, storage);

            return(storage.Id);
        }
Ejemplo n.º 24
0
        public static DeviceData GetDeviceDataFromSerializedData(SerializedHashDevices devices)
        {
            var result = new DeviceData();

            result.AllDevices = SList.Create <HashDevice>(devices.Devices.Length);
            for (int i = 0; i < devices.Devices.Length; i++)
            {
                var serializedDevice = devices.Devices[i];
                var device           = GetDeviceFromSerializedData(serializedDevice);
                SList.Add(result.AllDevices, device);
            }

            result.PlayerDevice = InternalFindDeviceByName(result, devices.PlayerDeviceName);
            result.CurrentUser  = FindUserByName(result.PlayerDevice, devices.PlayerUserName);

            result.CurrentDevice = result.PlayerDevice;

            return(result);
        }
Ejemplo n.º 25
0
        /// <summary>
        /// Removes the given item that corresponds to the given key.
        /// </summary>
        public static void Remove <TKey, TValue>(SimpleTable <TKey, TValue> table, TKey key)
        {
            var hash  = table.Comparer.GetHashCode(key);
            var index = (hash & int.MaxValue) % table.Capacity;

            var entry = table.Entries[index];

            if (entry == null)
            {
                return;
            }

            if (entry.HashCode == hash && table.Comparer.Equals(entry.Key, key))
            {
                table.Entries[index] = null;
                table.Count--;

                entry.Key      = default(TKey);
                entry.Value    = default(TValue);
                entry.HashCode = -1;
                SList.Add(table.EntryPool, entry);
            }
            else
            {
                while (entry.Next != null)
                {
                    if (entry.Next.HashCode == hash && table.Comparer.Equals(entry.Next.Key, key))
                    {
                        var removed = entry.Next;
                        entry.Next = entry.Next.Next;

                        removed.Key      = default(TKey);
                        removed.Value    = default(TValue);
                        removed.HashCode = -1;
                        SList.Add(table.EntryPool, removed);

                        table.Count--;
                    }
                    entry = entry.Next;
                }
            }
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Returns a list of all unknown arguments.
        /// An argument is unknown when it's present on the arguments list but not on the knownArguments list.
        /// </summary>
        public static SimpleList <Pair <string, string> > GetUnknownArguments(SimpleList <Pair <string, string> > arguments, string[] knownArguments)
        {
            var result = SList.Create <Pair <string, string> >(1);

            if (AreAllArgumentsKnown(arguments, knownArguments))
            {
                return(result);
            }

            for (int i = 0; i < arguments.Count; i++)
            {
                var arg     = arguments[i];
                var indexOf = Array.IndexOf(knownArguments, arg.Key);
                if (indexOf == -1)
                {
                    SList.Add(result, arg);
                }
            }

            return(result);
        }
Ejemplo n.º 27
0
        /// <summary>
        /// Removes the given item that corresponds to the given key.
        /// </summary>
        public static void Remove <TKey>(SimpleSet <TKey> Set, TKey key)
        {
            var hash  = Set.Comparer.GetHashCode(key);
            var index = (hash & int.MaxValue) % Set.Capacity;

            var entry = Set.Entries[index];

            if (entry == null)
            {
                return;
            }

            if (entry.HashCode == hash && Set.Comparer.Equals(entry.Key, key))
            {
                Set.Entries[index] = null;
                Set.Count--;

                entry.Key      = default(TKey);
                entry.HashCode = -1;
                SList.Add(Set.EntryPool, entry);
            }
            else
            {
                while (entry.Next != null)
                {
                    if (entry.Next.HashCode == hash && Set.Comparer.Equals(entry.Next.Key, key))
                    {
                        var removed = entry.Next;
                        entry.Next = entry.Next.Next;

                        removed.Key      = default(TKey);
                        removed.HashCode = -1;
                        SList.Add(Set.EntryPool, removed);

                        Set.Count--;
                    }
                    entry = entry.Next;
                }
            }
        }
Ejemplo n.º 28
0
        void TestSimpleList()
        {
            var stop = new Stopwatch();

            stop.Start();
            var list = SList.Create <int>(10);

            for (int i = 0; i < 1000000; i++)
            {
                SList.Add(list, i);
            }
            //var list = new List<int>(10);
            //for (int i = 0; i < 1000000; i++)
            //    list.Add(i);

            var sum = 0;

            for (int i = 0; i < 1000000; i++)
            {
                sum += list[i];
            }
            stop.Stop();
            Debug.Log(stop.ElapsedMilliseconds);
        }
Ejemplo n.º 29
0
        public static void FilleCommandBufferWithFileSystem(FillBufferFileSystemOptions option)
        {
            var commandBuffer = DataHolder.TerminalData.AvailableCommands;
            var data          = DataHolder.DeviceData.CurrentDevice.FileSystem;

            SList.Clear(commandBuffer);

            var currentDir = data.CurrentDir;

            if (option == FillBufferFileSystemOptions.IncludeAll || option == FillBufferFileSystemOptions.IncludeDir)
            {
                if (currentDir.ParentDir != null)
                {
                    SList.Add(commandBuffer, "..");
                }

                SList.Add(commandBuffer, ".");

                var childs = GetAllAvailableChild(currentDir);
                for (int i = 0; i < childs.Count; i++)
                {
                    SList.Add(commandBuffer, childs[i].FullPath);
                }
            }

            if (option == FillBufferFileSystemOptions.IncludeAll || option == FillBufferFileSystemOptions.IncludeFile)
            {
                var files = GetAvailableFilesFromDir(currentDir);
                for (int i = 0; i < files.Count; i++)
                {
                    SList.Add(commandBuffer, files[i].FullPath);
                }
            }

            TerminalUtil.ChangeToAvailableCommandsBuffer();
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Sets value referenced by path.
        /// </summary>
        /// <param name="target">The relative object for which to set the value.</param>
        /// <param name="value">The value to set on an object along the expression path.</param>
        /// <param name="parameters">Optional parameters for substitution; if a parameter value is null is will be populated with the created instance.</param>
        public void SetValue(object target, object value, Dictionary <string, object> parameters)
        {
            if (target == null)
            {
                throw new ArgumentNullException("target");
            }

            if (this.m_type == null)
            {
                return;
            }

            if (this.m_property == null)
            {
                return;
            }

            if (!this.m_type.IsInstanceOfType(target))
            {
                throw new ArgumentException("target is not an instance of the expected type.", "target", null);
            }

            try
            {
                object thisvalue = this.m_property.GetValue(target, null);

                if (this.m_property.PropertyType.IsGenericType &&
                    typeof(IEnumerable).IsAssignableFrom(this.m_property.PropertyType) &&
                    IsEntityType(this.m_property.PropertyType.GetGenericArguments()[0]))
                {
                    IEnumerable list    = (IEnumerable)thisvalue;
                    object      colitem = null;
                    foreach (object eachelem in list)
                    {
                        // derived class may have its own specific property (e.g. IfcSIUnit, IfcConversionBasedUnit)
                        if (this.m_identifier != null)
                        {
                            // find of specific identifier
                            Type         eachtype = eachelem.GetType();
                            PropertyInfo propElem = GetPropertyDefault(eachtype);
                            if (propElem != null)
                            {
                                object eachname = propElem.GetValue(eachelem, null);

                                if (this.m_identifier.StartsWith("@"))
                                {
                                    // find by parameter
                                    if (parameters != null && parameters.TryGetValue(this.m_identifier.Substring(1), out colitem))
                                    {
                                        break;
                                    }
                                }
                                else if (eachname != null && this.m_identifier.Equals(eachname.ToString()))
                                {
                                    // yes -- drill in
                                    colitem = eachelem;
                                    break;
                                }
                            }
                        }
                        else if (this.m_inner != null)
                        {
                            // find first that matches type
                            if (this.m_inner.Type == null || this.m_inner.Type.IsInstanceOfType(eachelem))
                            {
                                colitem = eachelem;
                                break;
                            }
                        }
                        else
                        {
                            // find first
                            colitem = eachelem;
                            break;
                        }
                    }

                    // now tunnel through
                    if (this.m_inner != null)
                    {
                        if (colitem == null && this.m_inner.Type != null)
                        {
                            if (colitem == null)
                            {
                                colitem = Activator.CreateInstance(this.m_inner.Type);

                                // name the object
                                if (this.m_identifier != null)
                                {
                                    if (this.m_identifier.StartsWith("@") && parameters != null)
                                    {
                                        // record parameter
                                        string paramname = this.m_identifier.Substring(1);
                                        parameters[paramname] = colitem;
                                    }
                                    else
                                    {
                                        PropertyInfo propDefault = GetPropertyDefault(this.m_inner.Type);
                                        if (propDefault != null)
                                        {
                                            propDefault.SetValue(colitem, value);
                                        }
                                    }
                                }
                            }
                            else if (this.m_property.PropertyType.IsClass &&
                                     this.m_property.PropertyType.IsGenericType &&
                                     (this.m_property.PropertyType.GetGenericTypeDefinition() == typeof(ISet <>) || this.m_property.PropertyType.GetGenericTypeDefinition() == typeof(IList <>)))
                            {
                                CollectionAdd(list, colitem);
                            }
                        }

                        if (colitem != null)
                        {
                            this.m_inner.SetValue(colitem, value, parameters);
                        }
                    }
                    else
                    {
                        // reference to an existing object
                        if (list.GetType().GetGenericArguments()[0].IsInstanceOfType(value))
                        {
                            if (!CollectionContains(list, value))
                            {
                                CollectionAdd(list, value);
                            }
                        }
                    }
                }
                else if (this.m_inner != null)
                {
                    // must allocate
                    if (thisvalue == null && this.m_inner.Type != null)
                    {
                        Type convtype = this.m_inner.Type;
                        if (convtype.IsValueType)
                        {
                            // convert type if type converter is defined
                            if (convtype.IsDefined(typeof(TypeConverterAttribute), true))
                            {
                                TypeConverterAttribute attr = (TypeConverterAttribute)convtype.GetCustomAttributes(typeof(TypeConverterAttribute), true)[0];
                                Type typeconv = Type.GetType(attr.ConverterTypeName);
                                if (typeconv != null)
                                {
                                    TypeConverter converter = (TypeConverter)Activator.CreateInstance(typeconv);
                                    value = converter.ConvertFrom(value);
                                    this.Property.SetValue(target, value);
                                }
                            }
                        }
                        else
                        {
                            if (thisvalue == null)
                            {
                                // get type from inner token
                                thisvalue = Activator.CreateInstance(this.m_inner.Type);
                            }
                            this.Property.SetValue(target, thisvalue);
                        }
                    }

                    if (IsEntity(thisvalue))
                    {
                        this.m_inner.SetValue(thisvalue, value, parameters);
                    }
                }
                else
                {
                    // get type converter, set value
                    Type convtype = this.Property.PropertyType;
                    if (convtype.IsInstanceOfType(value))
                    {
                        // set field instead to avoid perf hit
                        this.Property.SetValue(target, value);
                    }
#if false
                    else if (convtype == typeof(IList <IfcLabel>))
                    {
                        // address lines
                        if (value != null)
                        {
                            SList <IfcLabel> listlabel = (SList <IfcLabel>) this.Field.GetValue(target);
                            listlabel.Clear();
                            string   strval = value.ToString();
                            string[] parts  = strval.Split(new char[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                            foreach (string part in parts)
                            {
                                listlabel.Add(new IfcLabel(part));
                            }
                        }
                    }
#endif
                    else
                    {
                        // value
                        if (convtype.IsGenericType && convtype.GetGenericTypeDefinition() == typeof(Nullable <>))
                        {
                            // special case for Nullable types
                            convtype = convtype.GetGenericArguments()[0];
                        }

                        // convert type if type converter is defined
                        if (convtype.IsDefined(typeof(TypeConverterAttribute), true))
                        {
                            TypeConverterAttribute attr = (TypeConverterAttribute)convtype.GetCustomAttributes(typeof(TypeConverterAttribute), true)[0];
                            Type typeconv = Type.GetType(attr.ConverterTypeName);
                            if (typeconv != null)
                            {
                                TypeConverter converter = (TypeConverter)Activator.CreateInstance(typeconv);
                                value = converter.ConvertFrom(value);
                                this.Property.SetValue(target, value);
                            }
                        }
                        else
                        {
                            // log warning
                            System.Diagnostics.Debug.WriteLine("CvtValuePath::SetValue() - " + this.ToString() + " - " + convtype.Name + " has no type converter defined.");
                        }
                    }
                }
            }
            catch (Exception e)
            {
                // log it...
                System.Diagnostics.Debug.WriteLine("CvtValuePath::SetValue exception: " + e.ToString());
            }
        }