示例#1
0
        // A Copy( ), load( ), loadForAlgorithm( ) operation MUST BE
        // performed after construction but prior to first use !!!

        public Source_QueryParms( )
            :
            base( )
        {
            this.nativeTagGroup         = new TagGroup();
            this.nativeSingulationParms = new SingulationAlgorithmParms();
        }
 /// <summary>
 /// Allocates a new tag at the end of the tag list without updating the file.
 /// You can give the tag data by using one of the overwrite functions.
 /// </summary>
 /// <param name="type">The tag's type information.</param>
 /// <returns>The allocated tag.</returns>
 public TagInstance AllocateTag(TagGroup type)
 {
     var tagIndex = _tags.Count;
     var tag = new TagInstance(tagIndex, type);
     _tags.Add(tag);
     return tag;
 }
示例#3
0
 private void InsertTagsListToDatasource(TagGroup tags)
 {
     foreach (Tag t in tags)
     {
         InsertTagToDatasource(t);
     }
 }
示例#4
0
        /// <summary>
        /// Initializes the device tags.
        /// </summary>
        public override void InitDeviceTags()
        {
            if (opcDeviceConfig == null)
            {
                return;
            }

            foreach (SubscriptionConfig subscriptionConfig in opcDeviceConfig.Subscriptions)
            {
                TagGroup tagGroup = new TagGroup(subscriptionConfig.DisplayName);

                foreach (ItemConfig itemConfig in subscriptionConfig.Items)
                {
                    DeviceTag deviceTag = tagGroup.AddTag(itemConfig.TagCode, itemConfig.DisplayName);
                    deviceTag.Aux  = new DeviceTagMeta();
                    itemConfig.Tag = deviceTag;

                    if (itemConfig.IsString)
                    {
                        deviceTag.DataLen  = DriverUtils.GetTagDataLength(itemConfig.DataLength);
                        deviceTag.DataType = TagDataType.Unicode;
                        deviceTag.Format   = TagFormat.String;
                    }
                    else if (itemConfig.IsArray)
                    {
                        deviceTag.DataLen = itemConfig.DataLength;
                    }
                }

                DeviceTags.AddGroup(tagGroup);
            }
        }
        /// <summary>
        /// 维护所属下拉框及分组下拉框的状态
        /// </summary>
        private SelectList GetTagGroupSelectList(long groupId, string tenantTypeId)
        {
            TagService tagService = new TagService(string.Empty);

            //分组下拉框
            IEnumerable <TagGroup> tagGroups = tagService.GetGroups(tenantTypeId);
            SelectList             groupList = null;

            //如果该租户下没有分组
            if (tagGroups.Count() == 0)
            {
                groupList = new SelectList(new List <SelectListItem>()
                {
                    new SelectListItem()
                    {
                        Text = "无分组", Value = "0"
                    }
                }, "value", "text");
            }
            else
            {
                TagGroup tagGroupEntity = new TagGroup();
                tagGroupEntity.GroupName = "无分组";
                tagGroupEntity.GroupId   = 0;
                List <TagGroup> tagGroupsList = tagGroups.ToList <TagGroup>();
                tagGroupsList.Insert(0, tagGroupEntity);
                groupList = new SelectList(tagGroupsList.Select(n => new { text = n.GroupName, value = n.GroupId }), "value", "text", groupId);
            }
            return(groupList);
        }
        private void DisplayTagGroup(TagGroup tagGroup, string prefix = "")
        {
            Console.ForegroundColor = ConsoleColor.Blue;
            Console.Write(tagGroup.Name + ":" + tagGroup.Context + ":" + tagGroup.VersionTag);
            Console.ForegroundColor = ConsoleColor.DarkBlue;
            Console.WriteLine(" [TagGroup]");
            Console.ResetColor();

            Console.WriteLine(prefix + "Description: " + tagGroup.Description);
            Console.WriteLine(prefix + "QosProfile: " + tagGroup.QosProfile);
            Console.WriteLine(prefix + "Tags: ");

            try
            {
                var type = tagGroup.TopLevelType;

                foreach (var tag in type.Tags)
                {
                    DisplayTag(tag, prefix + "   ", 15);
                }
            }
            catch (ThingAPIRuntimeError e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(prefix + $"   Error displaying TagGroup details: {e.Message}");
                Console.ResetColor();
            }
        }
        /// <summary>
        /// Gets a set of matching tags for a set of patterns, returning for all matches
        /// </summary>
        /// <param name="patterns"></param>
        /// <param name="addNotFound"></param>
        /// <returns></returns>
        private List <TagInfo> GetAllMatchingTagInfoList(TagGroup tagGroup, bool addNotFound = true)
        {
            List <TagInfo>   result  = new();
            HashSet <string> hashSet = new();

            foreach (TagSearchPattern pattern in tagGroup.Patterns ?? new List <TagSearchPattern>())
            {
                if (pattern.Detected)
                {
                    var tagPatternRegex = pattern.Expression;

                    foreach (var match in _appMetaData?.Matches ?? new List <MatchRecord>())
                    {
                        foreach (var tagItem in match.Tags ?? Array.Empty <string>())
                        {
                            if (tagPatternRegex.IsMatch(tagItem))
                            {
                                if (!hashSet.Contains(tagItem))
                                {
                                    result.Add(new TagInfo
                                    {
                                        Tag        = tagItem,
                                        Confidence = match.Confidence.ToString(),
                                        Severity   = match.Severity.ToString(),
                                        ShortTag   = tagItem[(tagItem.LastIndexOf('.') + 1)..],
        /// <summary>
        /// Read and preprocess header information
        /// </summary>
        private void ReadPreprocess()
        {
            char[] gtag;
            #region Endian Switch
            ushort us_temp = InputStream.ReadUInt16();
            if (us_temp == HeaderEndian)
            {
                SetEndianState(IO.EndianState.Little);
            }
            else if (us_temp == HeaderEndianSwap)
            {
                SetEndianState(IO.EndianState.Big);
            }
            else
            {
                throw new Debug.ExceptionLog("File: Invalid switch! {0:X4}", us_temp);
            }
            #endregion

            #region Version
            us_temp = InputStream.ReadUInt16();
            Debug.Assert.If(us_temp == HeaderVersion,
                            "File: mismatching file version! [{0}, !{1}",
                            HeaderVersion, us_temp);
            #endregion
            #region Signature
            gtag = InputStream.ReadTag();
            Debug.Assert.If(TagGroup.Test(gtag, (char[])IO.TagGroups.BlamLib),
                            "File: invalid signature! [{0} !{1}]",
                            IO.TagGroups.BlamLib.TagToString(), new string(gtag));
            #endregion
            flags.Reset((uint)(InputStream.ReadUInt16() << 16) | flags);

            #region Data Version
            us_temp = InputStream.ReadUInt16();
            Debug.Assert.If(us_temp == data.Attribute.Version,
                            "File: mismatching data version! [{0}, !{1}",
                            data.Attribute.Version, us_temp);
            #endregion
            #region Data Signature
            gtag = InputStream.ReadTag();
            Debug.Assert.If(TagGroup.Test(gtag, (char[])data.GroupTag),
                            "File: invalid data signature! [{0} !{1}]",
                            data.GroupTag.TagToString(), new string(gtag));
            #endregion

            #region Data Directories
            InputStream.ReadInt32();
            InputStream.ReadInt32();
            #endregion
            #region Data
            InputStream.ReadInt32();
            int data_offset = InputStream.ReadInt32();
            #endregion

            Debug.Assert.If(InputStream.Position == HeaderSize,
                            "File: Update header size! [{0}, !{1}]", HeaderSize, InputStream.Position);

            InputStream.Seek(data_offset);
        }
示例#9
0
 void ManageSetupTagGroup()
 {
     if (engine != BlamVersion.Unknown)
     {
         tagGroup = engine.VersionToTagCollection()[tagGroupAttr.GroupIndex];
     }
 }
        public override void bindViews()
        {
            mIvBookCover          = FindViewById <ImageView>(Resource.Id.ivBookCover);
            mTvBookTitle          = FindViewById <TextView>(Resource.Id.tvBookListTitle);
            mTvAuthor             = FindViewById <TextView>(Resource.Id.tvBookListAuthor);
            mTvCatgory            = FindViewById <TextView>(Resource.Id.tvCatgory);
            mTvWordCount          = FindViewById <TextView>(Resource.Id.tvWordCount);
            mTvLatelyUpdate       = FindViewById <TextView>(Resource.Id.tvLatelyUpdate);
            mBtnRead              = FindViewById <DrawableCenterButton>(Resource.Id.btnRead);
            mBtnJoinCollection    = FindViewById <DrawableCenterButton>(Resource.Id.btnJoinCollection);
            mTvLatelyFollower     = FindViewById <TextView>(Resource.Id.tvLatelyFollower);
            mTvRetentionRatio     = FindViewById <TextView>(Resource.Id.tvRetentionRatio);
            mTvSerializeWordCount = FindViewById <TextView>(Resource.Id.tvSerializeWordCount);
            mTagGroup             = FindViewById <TagGroup>(Resource.Id.tag_group);
            mTvlongIntro          = FindViewById <TextView>(Resource.Id.tvlongIntro);
            mTvMoreReview         = FindViewById <TextView>(Resource.Id.tvMoreReview);
            mRvHotReview          = FindViewById <RecyclerView>(Resource.Id.rvHotReview);
            mRlCommunity          = FindViewById <RelativeLayout>(Resource.Id.rlCommunity);
            mTvCommunity          = FindViewById <TextView>(Resource.Id.tvCommunity);
            mTvPostCount          = FindViewById <TextView>(Resource.Id.tvHelpfulYes);
            mTvRecommendBookList  = FindViewById <TextView>(Resource.Id.tvRecommendBookList);
            mRvRecommendBoookList = FindViewById <RecyclerView>(Resource.Id.rvRecommendBoookList);

            mBtnRead.Click           += (sender, e) => onClickRead();
            mBtnJoinCollection.Click += (sender, e) => onClickJoinCollection();
            mTvAuthor.Click          += (sender, e) => searchByAuthor();
            mTvlongIntro.Click       += (sender, e) => collapseLongIntroHandler();
            mTvMoreReview.Click      += (sender, e) => onClickMoreReview();
            mRlCommunity.Click       += (sender, e) => onClickCommunity();
        }
示例#11
0
 public void WriteTagsListValue(TagGroup tags)
 {
     foreach (Tag t in tags)
     {
         WriteTagValue(t);
     }
 }
示例#12
0
        /// <summary>
        /// 新增标签组
        /// </summary>
        /// <param name="TagGroupName"></param>
        /// <returns></returns>
        public ReturnValueModel AddTagGroup(string TagGroupName)
        {
            ReturnValueModel rvm = new ReturnValueModel();
            var Taggroup         = _rep.FirstOrDefault <TagGroup>(a => a.TagGroupName == TagGroupName);

            if (Taggroup == null)
            {
                TagGroup tagGroup = new TagGroup()
                {
                    Id           = Guid.NewGuid().ToString(),
                    TagGroupName = TagGroupName,
                    CreateTime   = DateTime.Now,
                    IsEnabled    = 0,
                    IsDeleted    = 0
                };
                _rep.Insert <TagGroup>(tagGroup);
                _rep.SaveChanges();
            }

            if (Taggroup != null)
            {
                rvm.Success = false;
                rvm.Msg     = "This name already exist";
                return(rvm);
            }

            rvm.Msg     = "success";
            rvm.Success = true;
            return(rvm);
        }
示例#13
0
        public async ValueTask <IActionResult> Upsert()
        {
            if (ModelState.IsValid)
            {
                if (TagGroup.Id == Guid.Empty)
                {
                    await _tagGroup.AddAsync(TagGroup.GetAddReq());

                    //_tagGroup.Add(TagGroup.GetAddReq());
                }
                else
                {
                    var tagGroup = await _tagGroupQuery.FindAsync(new IdObject(TagGroup.Id));

                    if (tagGroup == null)
                    {
                        //await _tagGroup.AddAsync(TagGroup.GetAddReq());
                    }
                    else
                    {
                        await _tagGroup.UpdateAsync(TagGroup.GetUpdateReq());

                        //_tagGroup.Update(TagGroup.GetUpdateReq());
                    }
                }

                return(RedirectToAction("Index"));
            }

            return(View(TagGroup));
        }
        private void CreateTagGroup(TagGroup newtg)
        {
            var findtg = DBContext.TagGroups.FirstOrDefault((g) => g.Name == newtg.Name && g.State == StateCode.Active);

            if (findtg != null)
            {
                WindowMgr.SendNotification("标签组不能重名", NotificationLevel.Warning);
            }
            else
            {
                try
                {
                    DBContext.TagGroups.Add(newtg);
                    DBContext.SaveChanges();
                    WindowMgr.SendNotification("成功创建标签组", NotificationLevel.Information);
                    AddTagGroupNode(newtg);
                    ShowFormGrid(false);
                }
                catch (Exception ex)
                {
                    // TODO
                    WindowMgr.SendNotification("操作失败", NotificationLevel.Error);
                }
            }
        }
        /// <summary>
        /// Group does not exist
        ///     Create group
        ///         Add group to cache
        ///         Modify context to add it
        ///     Add all tags to group
        ///         Modify context to add all tags
        ///         Add tags to cache
        /// </summary>
        private void HandleNewTagGroup(string importedGroup, List <string> importedTags, Dictionary <Guid, TagGroup> resultGroups, Dictionary <Guid, Tag> resultTags)
        {
            var newTagGroup = new TagGroup
            {
                Id = Guid.NewGuid(),
                ApplicationUserId = _userId,
                Type   = importedGroup,
                Active = true,
            };

            var newTags = importedTags.Select(x =>
            {
                var newTag = new Tag
                {
                    Id         = Guid.NewGuid(),
                    TagGroupId = newTagGroup.Id,
                    Value      = x,
                };

                //_context.Entry(newTag).State = EntityState.Added;
                _context.Tags.Add(newTag);

                resultTags[newTag.Id] = newTag;

                return(newTag);
            }).ToList();

            newTagGroup.Tags = newTags;

            _existingGroups.AddOrUpdate(newTagGroup.Type, (id) => newTagGroup, (id, group) => group = newTagGroup);;
            _context.TagGroups.Add(newTagGroup);
            //_context.Entry(newTagGroup).State = EntityState.Added;

            resultGroups[newTagGroup.Id] = newTagGroup;
        }
        /// <summary>
        /// Group exists
        ///     Tag exists - just add to result
        ///     New Tag
        ///         Add it to context
        ///         Modify existing group
        ///         Add it to cache
        ///
        /// </summary>
        private void HandleExistingTagGroup(IEnumerable <string> importedTags, TagGroup existingGroup, Dictionary <Guid, TagGroup> resultGroups, Dictionary <Guid, Tag> resultTags)
        {
            foreach (var importedTagStr in importedTags)
            {
                var tag = existingGroup.Tags.FirstOrDefault(x => x.Value == importedTagStr);

                if (tag == null)
                {
                    tag = new Tag()
                    {
                        Id         = Guid.NewGuid(),
                        Value      = importedTagStr,
                        TagGroupId = existingGroup.Id
                    };

                    existingGroup.Tags.Add(tag);

                    _context.Entry(existingGroup).State = _context.Entry(existingGroup).State != EntityState.Added ? EntityState.Modified : EntityState.Added;

                    _context.Entry(tag).State = EntityState.Added;

                    //_context.Tags.Add(tag);
                }

                resultGroups[existingGroup.Id] = existingGroup;
                resultTags[tag.Id]             = tag;
            }

            //_context.Entry(existingGroup).State = EntityState.Modified;
        }
示例#17
0
		public void Setup(Definition definition, TagGroup tag, short head, short ver)
		{
			def = definition;
			groupTag = tag;
			header = head;
			version = ver;
		}
示例#18
0
        private void DisplayOutputs(ThingClass thingClass, string prefix = "")
        {
            var outputs = thingClass.OutputTagGroups;

            Console.WriteLine(prefix + "outputs:");
            if (outputs.Count == 0)
            {
                Console.WriteLine(prefix + "   <none>");
            }
            else
            {
                foreach (var output in outputs)
                {
                    try
                    {
                        TagGroup tagGroup = FindTagGroup(output.OutputTagGroup);
                        Console.ForegroundColor = ConsoleColor.Green;
                        Console.Write(prefix + "   " + output.Name);
                        Console.ResetColor();
                        Console.Write(": ");
                        DisplayTagGroup(tagGroup, prefix + "      ");
                    }
                    catch (TagGroupNotFoundException e)
                    {
                        Console.ForegroundColor = ConsoleColor.Red;
                        Console.WriteLine(prefix + "   TagGroup not found");
                        Console.ResetColor();
                    }
                }
            }
        }
示例#19
0
        /// <summary>
        ///  获取标签组对应的标签列表
        /// </summary>
        /// <param name="tagGroup"></param>
        /// <returns></returns>
        public ReturnValueModel GetTagGroupRelationList(TagGroup tagGroup)
        {
            ReturnValueModel rvm = new ReturnValueModel();

            try
            {
                if (tagGroup == null)
                {
                    throw new Exception("tagGroup is null");
                }

                var tagInfolist = from a in _rep.Table <TagInfo>().Where(s => s.IsDeleted != 1)
                                  join b in _rep.Table <GroupTagRel>().Where(s => s.IsDeleted != 1 && s.TagGroupId == tagGroup.Id)
                                  on a.Id equals b.TagId
                                  select a;
                rvm.Success = true;
                rvm.Msg     = "";
                rvm.Result  = new
                {
                    rows = tagInfolist
                };
            }
            catch (Exception e)
            {
                rvm.Success = false;
                rvm.Msg     = e.Message;
            }

            return(rvm);
        }
示例#20
0
        /// <summary>
        /// Allocates a new tag at the end of the tag list without updating the file.
        /// You can give the tag data by using one of the overwrite functions.
        /// </summary>
        /// <param name="type">The tag's type information.</param>
        /// <param name="name">The name of the tag instance.</param>
        /// <returns>The allocated tag.</returns>
        public CachedTagInstance AllocateTag(TagGroup type, string name = null)
        {
            var tagIndex = _tags.Count;
            var tag      = new CachedTagInstance(tagIndex, type, name);

            _tags.Add(tag);
            return(tag);
        }
示例#21
0
 public CachedTagGen3(int groupIndex, uint id, uint offset, int index, TagGroup tagGroup, string groupName)
 {
     GroupIndex = groupIndex;
     ID         = id;
     Offset     = offset;
     Index      = index;
     Group      = tagGroup;
 }
        private void addtaggroup_click(object sender, RoutedEventArgs e)
        {
            editmode = TagEditMode.AddTagGroup;
            var taggroup = new TagGroup();

            formgrid.DataContext = taggroup;
            ShowFormGrid(true);
        }
示例#23
0
 public void ReadTagsListValue(TagGroup tags)
 {
     for (int i = 0; i < tags.Count; i++)
     {
         Tag t = tags[i];
         ReadTagValue(ref t);
     }
 }
示例#24
0
        /// <summary>
        /// Allocates a new tag at the end of the tag list without updating the file.
        /// You can give the tag data by using one of the overwrite functions.
        /// </summary>
        /// <param name="type">The tag's type information.</param>
        /// <returns>The allocated tag.</returns>
        public TagInstance AllocateTag(TagGroup type)
        {
            var tagIndex = _tags.Count;
            var tag      = new TagInstance(tagIndex, type);

            _tags.Add(tag);
            return(tag);
        }
示例#25
0
        /// <summary>
        /// Initializes the device tags.
        /// </summary>
        public override void InitDeviceTags()
        {
            TagGroup tagGroup = new TagGroup();

            tagGroup.AddTag(TagCode.Mail, TagName.Mail).Format             = TagFormat.IntNumber;
            tagGroup.AddTag(TagCode.MailAttach, TagName.MailAttach).Format = TagFormat.IntNumber;
            DeviceTags.AddGroup(tagGroup);
        }
        private void AddTagGroupNode(TagGroup tg)
        {
            var node = new TreeViewItem();

            node.Style       = Application.Current.Resources["treelevel1_item"] as Style;
            node.DataContext = tg;
            tagtree.Items.Add(node);
        }
示例#27
0
 /// <summary>
 /// 数据库中的对象转换为EditModel
 /// </summary>
 /// <returns></returns>
 public static TagGroupEditModel AsTagGroupEditModel(this TagGroup tagGroup)
 {
     return(new TagGroupEditModel
     {
         GroupId = tagGroup.GroupId,
         GroupName = tagGroup.GroupName,
         TenantTypeId = tagGroup.TenantTypeId
     });
 }
示例#28
0
 public CachedTagInstance(int index, TagGroup group, string name = null)
 {
     Index = index;
     Group = group;
     if (name != null)
     {
         Name = name;
     }
 }
示例#29
0
        /// <summary>
        /// Determines if the supplied data matches this tag
        /// </summary>
        /// <param name="path">complete name (not path) to tag (without extension)</param>
        /// <param name="tag_group"></param>
        /// <returns></returns>
        /// <remarks>
        /// If <paramref name="tag_group"/> is a parent of the group tag of this tag,
        /// the <see cref="TagGroup"/> comparison will return true.
        /// </remarks>
        public bool Compare(string path, TagGroup tag_group)
        {
            if (CompareTagGroup(tag_group) && this.Name == path)
            {
                return(true);
            }

            return(false);
        }
示例#30
0
        internal bool Compare(TagIndexBase caller, string path, TagGroup tag_group)
        {
            if (CompareTagGroup(tag_group) && caller.References[referenceName] == path)
            {
                return(true);
            }

            return(false);
        }
示例#31
0
        private void OnClickCheck(object sender, RoutedEventArgs e)
        {
            var item  = (sender as FrameworkElement).DataContext;
            int index = list_view_rows.Items.IndexOf(item);

            CheckRows row = rows.Find(r => r.index == index);

            if (row == null)
            {
                ModernDialog.ShowMessage("그런 row 없다", "ERROR", MessageBoxButton.OK);
            }

            // Find Master
            TagGroup tag_group = tag_group_list.Find(t => t.master_column.table_name == row.master_table_name && t.master_column.column_name == row.master_column_name);

            if (tag_group == null)
            {
                ModernDialog.ShowMessage("그런 TagGroup 없다", "ERROR", MessageBoxButton.OK);
            }

            List <string> master_list = tag_group.master_column.id_list;

            // Find Slave
            ColumnGroup column_group = tag_group.slave_columns.Find(s => s.table_name == row.slave_table_name && s.column_name == row.slave_column_name);

            if (column_group == null)
            {
                ModernDialog.ShowMessage("그런 ColumnGroup 없다", "ERROR", MessageBoxButton.OK);
            }

            List <string> slave_list = column_group.id_list;

            string added_string = "";

            foreach (var slave in slave_list)
            {
                if (master_list.Find(m => m == slave) == null)
                {
                    string log = string.Format("존재하지 않는 id입니다. {0} : {1}\r\n", tag_group.tag_name, slave);
                    added_string += log;
                }
            }

            if (added_string == "")
            {
                rows[index].Result = "Success";
            }
            else
            {
                rows[index].Result = "Failed";
                result_box.Text   += added_string;
            }

            result_box.Text += string.Format("Check를 완료했습니다. Checked index : {0}\r\n", index);
            result_box.Text += "=========================================================\r\n";
        }
        public override void Write(IO.EndianWriter stream)
        {
            const int k_alignment = Compiler.kDefaultAlignment;
            int       align;

            using (var mem = InitializeMemoryStream())
            {
                DynamicTagGroups.Write(MemoryStream);                   // write the data array to the stream
                MemoryStream.Write((int)0); MemoryStream.Write((int)0); // alignment

                StringPoolToMemoryStream();

                Import import = OwnerState.Importer as Import;

                FixupsToMemoryStream();

                ScriptingToStream(import);

                EnumerationsToMemoryStream();

                TagReferencesToMemoryStream();

                TagDataToMemoryStream();

                #region TagBlock
                TagBlock tb = new TagBlock();
                foreach (Import.TagBlock tagb in import.Blocks.Values)
                {
                    tb.Reset(tagb);
                    tb.Write(MemoryStream);
                }
                #endregion

                #region TagGroup
                TagGroup tg = new TagGroup();
                foreach (Import.TagGroup tagg in import.Groups.Values)
                {
                    tg.Reset(tagg);
                    tg.Write(MemoryStream);
                }
                #endregion

                PostprocessWritebacks();

                // Create header
                PostprocessHeaderThenStream(stream, CalculateStringPoolBaseAddress());

                mem.WriteTo(stream.BaseStream);                 // write all the data that will be read into memory from a tool to the file
            }

            align = k_alignment - (stream.Length % k_alignment);
            if (align != k_alignment)
            {
                stream.Write(new byte[align]);
            }
        }
示例#33
0
文件: OpenOPC.cs 项目: sunl158/ide-as
        public OpenOPC(
			string name,
			string server, 
			string instance,
			string pythonpath,
			string openopcpath,
			TagGroup tagslist
			)
            : this()
        {
            base.Name = name;
            base.Tags = tagslist;
            this.serverHost = server;
            this.serverInstance = instance;
            this.pythonPath = pythonpath;
            this.openOPCPath = openopcpath;
        }
示例#34
0
        public KpTestLogic(int number)
            : base(number)
        {
            random = new Random();

            List<TagGroup> tagGroups = new List<TagGroup>();
            TagGroup tagGroup = new TagGroup("Group 1");
            tagGroup.KPTags.Add(new KPTag(1, "Tag 1"));
            tagGroup.KPTags.Add(new KPTag(2, "Tag 2"));
            tagGroup.KPTags.Add(new KPTag(3, "Tag 3"));
            tagGroup.KPTags.Add(new KPTag(4, "Tag 4"));
            tagGroup.KPTags.Add(new KPTag(5, "Tag 5"));
            tagGroups.Add(tagGroup);

            tagGroup = new TagGroup("Group 2");
            tagGroup.KPTags.Add(new KPTag(6, "Tag 6"));
            tagGroup.KPTags.Add(new KPTag(7, "Tag 7"));
            tagGroup.KPTags.Add(new KPTag(8, "Tag 8"));
            tagGroup.KPTags.Add(new KPTag(9, "Tag 9"));
            tagGroup.KPTags.Add(new KPTag(10, "Tag 10"));
            tagGroups.Add(tagGroup);

            InitKPTags(tagGroups);
        }
示例#35
0
		public DefinitionFile(TagGroup tag, BlamVersion g)
		{
			engine = g;
			groupTag = tag;
		}
示例#36
0
			public FieldSetVersioning(BlamVersion engine, FieldType container_type, DefinitionState state, TagGroup group_tag) 
				: this(engine, container_type, state)
			{
				this.headerGroupTag = group_tag;
			}
示例#37
0
		public override void Write(IO.EndianWriter stream)
		{
			const int k_alignment = Compiler.kDefaultAlignment;
			int align;
			using (var mem = InitializeMemoryStream())
			{
				DynamicTagGroups.Write(MemoryStream); // write the data array to the stream
				MemoryStream.Write((int)0); MemoryStream.Write((int)0); // alignment

				StringPoolToMemoryStream();

				Import import = OwnerState.Importer as Import;

				FixupsToMemoryStream();

				ScriptingToStream(import);

				EnumerationsToMemoryStream();

				TagReferencesToMemoryStream();

				TagDataToMemoryStream();

				#region TagBlock
				TagBlock tb = new TagBlock();
				foreach (Import.TagBlock tagb in import.Blocks.Values)
				{
					tb.Reset(tagb);
					tb.Write(MemoryStream);
				}
				#endregion

				#region TagGroup
				TagGroup tg = new TagGroup();
				foreach (Import.TagGroup tagg in import.Groups.Values)
				{
					tg.Reset(tagg);
					tg.Write(MemoryStream);
				}
				#endregion

				PostprocessWritebacks();

				// Create header
				PostprocessHeaderThenStream(stream, CalculateStringPoolBaseAddress());

				mem.WriteTo(stream.BaseStream); // write all the data that will be read into memory from a tool to the file
			}

			align = k_alignment - (stream.Length % k_alignment);
			if (align != k_alignment) stream.Write(new byte[align]);
		}
示例#38
0
		protected override void ProcessDefinition(XmlNode node, BlamLib.CheApe.ProjectState state, BlamLib.IO.XmlStream s)
		{
			StringIdFieldsInitialize(state);

			string name_str;

			switch (node.Name)
			{
				#region Tag Structs
				case "structs":
					s.SaveCursor(node);
					foreach (XmlNode n in s.Cursor.ChildNodes)
					{
						if (n.Name != "Struct") continue;

						s.SaveCursor(n);
						TagStruct block = new TagStruct(state, s);
						s.RestoreCursor();
						name_str = block.ToString();

						try { Structs.Add(name_str, block); }
						catch (ArgumentException) { Debug.LogFile.WriteLine(CheApe.Import.kDuplicateErrorStr, "tag struct definition", name_str); }
					}
					s.RestoreCursor();
					break;
				#endregion

				#region Tag Blocks
				case "blocks":
					s.SaveCursor(node);
					foreach (XmlNode n in s.Cursor.ChildNodes)
					{
						if (n.Name != "TagBlock") continue;

						s.SaveCursor(n);
						TagBlock block = new TagBlock(state, s);
						s.RestoreCursor();
						name_str = block.ToString();

						try { Blocks.Add(name_str, block); }
						catch (ArgumentException) { Debug.LogFile.WriteLine(CheApe.Import.kDuplicateErrorStr, "tag block definition", name_str); }
					}
					s.RestoreCursor();
					break;
				#endregion

				#region Tag Groups
				case "groups":
					s.SaveCursor(node);
					foreach (XmlNode n in s.Cursor.ChildNodes)
					{
						if (n.Name != "TagGroup") continue;

						s.SaveCursor(n);
						TagGroup group = new TagGroup(state, s);
						s.RestoreCursor();
						name_str = group.ToString();

						try { Groups.Add(name_str, group); }
						catch (ArgumentException) { Debug.LogFile.WriteLine(CheApe.Import.kDuplicateErrorStr, "tag group definition", name_str); }
					}
					s.RestoreCursor();
					break;
				#endregion
			}
		}
示例#39
0
			public FieldSetVersioning(BlamVersion engine, FieldType container_type, DefinitionState state)
			{
				failureReason = VersioningFailureReason.None;
				relativeOffset = 0;
				expectedCount = 1;
				needsUpgrading = false;
				useImplicitUpgrading = false;
				header = new tag_fieldset_header();

				this.type = container_type;
				this.state = state;

				if(container_type != FieldType.Struct)
					this.headerGroupTag = Blam.MiscGroups.tbfd;
				else
				{
					var groups = engine.VersionToStructCollection();
					var sa = state.Attribute as StructAttribute;

					headerGroupTag = groups[sa.GroupIndex];
				}
			}
示例#40
0
        public Result API_l8K6CGetQueryTagGroup(
            [In, Out] ref TagGroup r_strcGroup
        )
        {
            #if _TRACE_OUT_PUT
            PrintMagToTxt("API_l8K6CGetQueryTagGroup");
            #endif

            Result result = Result.OK;
            if (null == r_strcGroup)
            {
                r_strcGroup = new TagGroup();
            }

            r_strcGroup.selected = Selected.UNKNOWN;
            r_strcGroup.session  = Session.UNKNOWN;
            r_strcGroup.target   = SessionTarget.UNKNOWN;

            ENUM_CMD TxCmd = ENUM_CMD.NOTHING;
            byte[] buf = new byte[10];
            Array.Clear(buf, 0, buf.Length);

            TxCmd = ENUM_CMD.l8K6C_GET_QUERY_TAG_GROUP;
            buf[0] = (byte)TxCmd;

            if ( false == SendData(buf) )
                return Result.FAILURE;

            Array.Clear(buf, 0, buf.Length);

            //Check receive data
            if ( false == ReceiveData( TxCmd, ref buf ) )
                return Result.FAILURE;

            //Check result
            result = ConvertResult(buf[1]);
            if (Result.OK != result)
                return result;

            r_strcGroup.selected = (Selected)buf[2];
            r_strcGroup.session  = (Session) buf[3];
            r_strcGroup.target   = (SessionTarget)buf[4];

            return Result.OK;
        }
示例#41
0
 internal TagInstance(int index, TagGroup group)
 {
     Index = index;
     Group = group;
 }
示例#42
0
        private Log.WriteLineDelegate writeToLog; // метод записи в журнал линии связи

        #endregion Fields

        #region Constructors

        /// <summary>
        /// Конструктор
        /// </summary>
        public KPLogic(int number)
        {
            // private fields
            conn = null;
            appDirs = new AppDirs();
            writeToLog = text => { }; // заглушка
            terminated = false;
            caption = "";
            sessText = "";
            sendCmdText = "";
            tagTable = null;
            tagTableColLen = null;

            // protected fields
            curData = new SrezTableLight.CnlData[0];
            curDataModified = new bool[0];
            arcSrezList = new List<TagSrez>();
            eventList = new List<KPEvent>();
            lastArcSrezList = new List<TagSrez>();
            lastEventList = new List<KPEvent>();
            lastCmdList = new List<Command>();
            lastCommSucc = false;
            kpStats.Reset();

            // public properties
            Bind = false;
            Number = number;
            Name = "";
            Dll = Assembly.GetCallingAssembly().GetName().Name;
            Address = 0;
            CallNum = "";
            ReqParams = KPReqParams.Default;
            ReqTriesCnt = 1;
            SerialPort = null;
            CustomParams = null;
            CommonProps = null;
            CommLineSvc = null;

            CanSendCmd = false;
            ConnRequired = true;
            KPTags = new KPTag[0];
            TagGroups = new TagGroup[0];
            WorkState = WorkStates.Undefined;
            LastSessDT = DateTime.MinValue;
            LastCmdDT = DateTime.MinValue;
        }
示例#43
0
        /// <summary>
        /// Инициализировать теги КП, их текущие данные и признаки изменения
        /// </summary>
        /// <remarks>В результате работы метода элементы списка KPTags не могут быть null</remarks>
        protected void InitKPTags(List<KPTag> srcKPTags)
        {
            if (srcKPTags == null)
                throw new ArgumentNullException("srcKPTags");

            TagGroups = new TagGroup[0];
            int tagCnt = srcKPTags.Count;
            KPTags = new KPTag[tagCnt];
            curData = new SrezTableLight.CnlData[tagCnt];
            curDataModified = new bool[tagCnt];
            tagTable = null;

            int tagIndex = 0;
            foreach (KPTag kpTag in srcKPTags)
                KPTags[tagIndex++] = kpTag == null ? new KPTag() : kpTag;

            for (int i = 0; i < tagCnt; i++)
            {
                curData[i] = SrezTableLight.CnlData.Empty;
                curDataModified[i] = true;
            }
        }
示例#44
0
		public DefinitionFile(TagGroup tag, GameMan.Namespace g, GameMan.Platform p)
		{
			engine = GameMan.ToBlamVersion(g, p);
			groupTag = tag;
		}
        private void ReadParameterValuesFromPLC()
        {
            try
            {
                //Calculate what DB Offsets to Read From
                int iStart = SwitchOverWeightDBOffset.LastIndexOf('D');
                int iLength = SwitchOverWeightDBOffset.Length;
                string s = (SwitchOverWeightDBOffset.Substring(iStart + 1, iLength - iStart - 1));
                int i1 = Convert.ToInt32(s);
                int i2 = i1 + 4;
                int i3 = i2 + 4;
                int i4 = i3 + 4;
                int i5 = i4 + 4;
                int i6 = i5 + 4;
                int i7 = i6 + 2;
                int i8 = i7 + 2;
                int i9 = i8 + 2;
                int i10 = i9 + 2;
                int i11 = i10 + 2;
                int i12 = i11 + 2;
                int i13 = i12 + 4;
                int i14 = i13 + 2;
                int i15 = i14 + 2;
                int i16 = i15 + 2;

                TagGroup tg = new TagGroup();
                Tag t1 = new Tag(ScaleDBNumber + ".DBD" + i1, S7Link.Tag.ATOMIC.DWORD, 1);
                Tag t2 = new Tag(ScaleDBNumber + ".DBD" + i2, S7Link.Tag.ATOMIC.DWORD, 1);
                Tag t3 = new Tag(ScaleDBNumber + ".DBD" + i3, S7Link.Tag.ATOMIC.DWORD, 1);
                Tag t4 = new Tag(ScaleDBNumber + ".DBD" + i4, S7Link.Tag.ATOMIC.DWORD, 1);
                Tag t5 = new Tag(ScaleDBNumber + ".DBD" + i5, S7Link.Tag.ATOMIC.DWORD, 1);
                Tag t6 = new Tag(ScaleDBNumber + ".DBW" + i6, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t7 = new Tag(ScaleDBNumber + ".DBW" + i7, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t8 = new Tag(ScaleDBNumber + ".DBW" + i8, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t9 = new Tag(ScaleDBNumber + ".DBW" + i9, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t10 = new Tag(ScaleDBNumber + ".DBW" + i10, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t11 = new Tag(ScaleDBNumber + ".DBW" + i11, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t12 = new Tag(ScaleDBNumber + ".DBD" + i12, S7Link.Tag.ATOMIC.DWORD, 1);
                Tag t13 = new Tag(ScaleDBNumber + ".DBW" + i13, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t14 = new Tag(ScaleDBNumber + ".DBW" + i14, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t15 = new Tag(ScaleDBNumber + ".DBW" + i15, S7Link.Tag.ATOMIC.WORD, 1);
                Tag t16 = new Tag(ScaleDBNumber + ".DBD" + i16, S7Link.Tag.ATOMIC.DWORD, 1);

                tg.AddTag(t1);
                tg.AddTag(t2);
                tg.AddTag(t3);
                tg.AddTag(t4);
                tg.AddTag(t5);
                tg.AddTag(t6);
                tg.AddTag(t7);
                tg.AddTag(t8);
                tg.AddTag(t9);
                tg.AddTag(t10);
                tg.AddTag(t11);
                tg.AddTag(t12);
                tg.AddTag(t13);
                tg.AddTag(t14);
                tg.AddTag(t15);
                tg.AddTag(t16);

                if (!PLCR.IsConnected)
                    PLCR.Connect();

                PLCR.GroupRead(tg);

                SwitchOverWeight_Online = Convert.ToDouble(t1.Value) / 1000;
                CutOffWeight_Online = Convert.ToDouble(t2.Value) / 1000;
                TolerancePositiveWeight_Online = Convert.ToDouble(t3.Value) / 1000;
                ToleranceNegativeWeight_Online = Convert.ToDouble(t4.Value) / 1000;
                CutOffWeightCorrectionMax_Online = Convert.ToDouble(t5.Value) / 1000;
                DosingTimeSlow_Online = Convert.ToDouble(t6.Value) / 10;
                SwitchOverTimeFastToSlow_Online = Convert.ToDouble(t7.Value) / 10;
                TipPulseLength_Online = Convert.ToDouble(t8.Value) / 10;
                DosingTimeMax_Online = Convert.ToDouble(t9.Value) / 10;
                TolerancePositiveProportion_Online = Convert.ToDouble(t10.Value);
                ToleranceNegativeProportion_Online = Convert.ToDouble(t11.Value);
                AutoFaultResetWeight_Online = Convert.ToDouble(t12.Value) / 1000;
                AutoFaultResetPercent_Online = Convert.ToDouble(t13.Value);
                DosingSpeedFast_Online = Convert.ToDouble(t14.Value);
                DosingSpeedSlow_Online = Convert.ToDouble(t15.Value);
                FineDosingWeight_Online = Convert.ToDouble(t16.Value) / 1000;
            }
            catch (Exception ex)
            {
                var msgBox = base.GetService<IMessageBoxService>();
                if (msgBox != null)
                    msgBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
        public void cmdDownloadParametersImplementation()
        {
            try
            {
                var msgBox = base.GetService<IMessageBoxService>();
                if (msgBox != null)
                {
                    var result = msgBox.Show("Are you sure you want to download the OFFLINE values to the PLC? This will OVERWRITE ONLINE values.", "Confrim Download. OFFLINE --> ONLINE", MessageBoxButton.YesNo, MessageBoxImage.Question);

                    if (result == MessageBoxResult.Yes)
                    {
                        //Calculate what DB Offsets to Read From
                        int iStart = SwitchOverWeightDBOffset.LastIndexOf('D');
                        int iLength = SwitchOverWeightDBOffset.Length;
                        string s = (SwitchOverWeightDBOffset.Substring(iStart + 1, iLength - iStart - 1));
                        int i1 = Convert.ToInt32(s);
                        int i2 = i1 + 4;
                        int i3 = i2 + 4;
                        int i4 = i3 + 4;
                        int i5 = i4 + 4;
                        int i6 = i5 + 4;
                        int i7 = i6 + 2;
                        int i8 = i7 + 2;
                        int i9 = i8 + 2;
                        int i10 = i9 + 2;
                        int i11 = i10 + 2;
                        int i12 = i11 + 2;
                        int i13 = i12 + 4;
                        int i14 = i13 + 2;
                        int i15 = i14 + 2;
                        int i16 = i15 + 2;

                        TagGroup tg = new TagGroup();
                        Tag t1 = new Tag(ScaleDBNumber + ".DBD" + i1, S7Link.Tag.ATOMIC.DWORD, 1);
                        Tag t2 = new Tag(ScaleDBNumber + ".DBD" + i2, S7Link.Tag.ATOMIC.DWORD, 1);
                        Tag t3 = new Tag(ScaleDBNumber + ".DBD" + i3, S7Link.Tag.ATOMIC.DWORD, 1);
                        Tag t4 = new Tag(ScaleDBNumber + ".DBD" + i4, S7Link.Tag.ATOMIC.DWORD, 1);
                        Tag t5 = new Tag(ScaleDBNumber + ".DBD" + i5, S7Link.Tag.ATOMIC.DWORD, 1);
                        Tag t6 = new Tag(ScaleDBNumber + ".DBW" + i6, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t7 = new Tag(ScaleDBNumber + ".DBW" + i7, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t8 = new Tag(ScaleDBNumber + ".DBW" + i8, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t9 = new Tag(ScaleDBNumber + ".DBW" + i9, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t10 = new Tag(ScaleDBNumber + ".DBW" + i10, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t11 = new Tag(ScaleDBNumber + ".DBW" + i11, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t12 = new Tag(ScaleDBNumber + ".DBD" + i12, S7Link.Tag.ATOMIC.DWORD, 1);
                        Tag t13 = new Tag(ScaleDBNumber + ".DBW" + i13, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t14 = new Tag(ScaleDBNumber + ".DBW" + i14, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t15 = new Tag(ScaleDBNumber + ".DBW" + i15, S7Link.Tag.ATOMIC.WORD, 1);
                        Tag t16 = new Tag(ScaleDBNumber + ".DBD" + i16, S7Link.Tag.ATOMIC.DWORD, 1);

                        t1.Value = SwitchOverWeight * 1000;
                        t2.Value = CutOffWeight * 1000;
                        t3.Value = TolerancePositiveWeight * 1000;
                        t4.Value = ToleranceNegativeWeight * 1000;
                        t5.Value = CutOffWeightCorrectionMax * 1000;
                        t6.Value = DosingTimeSlow * 10;
                        t7.Value = SwitchOverTimeFastToSlow * 10;
                        t8.Value = TipPulseLength * 10;
                        t9.Value = DosingTimeMax * 10;
                        t10.Value = TolerancePositiveProportion;
                        t11.Value = ToleranceNegativeProportion;
                        t12.Value = AutoFaultResetWeight * 1000;
                        t13.Value = AutoFaultResetPercent;
                        t14.Value = DosingSpeedFast;
                        t15.Value = DosingSpeedSlow;
                        t16.Value = FineDosingWeight * 1000;

                        tg.AddTag(t1);
                        tg.AddTag(t2);
                        tg.AddTag(t3);
                        tg.AddTag(t4);
                        tg.AddTag(t5);
                        tg.AddTag(t6);
                        tg.AddTag(t7);
                        tg.AddTag(t8);
                        tg.AddTag(t9);
                        tg.AddTag(t10);
                        tg.AddTag(t11);
                        tg.AddTag(t12);
                        tg.AddTag(t13);
                        tg.AddTag(t14);
                        tg.AddTag(t15);
                        tg.AddTag(t16);

                        if (!PLCW.IsConnected)
                            PLCW.Connect();

                        PLCR.GroupWrite(tg);

                        ReadParameterValuesFromPLC();
                    }
                }

            }
            catch (Exception ex)
            {
                var msgBox = base.GetService<IMessageBoxService>();
                if (msgBox != null)
                    msgBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#47
0
 // A Copy( ), load( ), loadForAlgorithm( ) operation MUST BE
 // performed after construction but prior to first use !!!
 public Source_QueryParms( )
     : base()
 {
     this.nativeTagGroup = new TagGroup();
     this.nativeSingulationParms = new SingulationAlgorithmParms();
 }
示例#48
0
		/// <summary>
		/// Construct a tag field
		/// </summary>
		/// <param name="value"></param>
		public Tag(TagGroup value) :					this()				{ value.Tag.CopyTo(this.Value, 0); }
示例#49
0
		void ProcessTagGroups(BlamLib.CheApe.ProjectState state, IO.XmlStream s)
		{
			foreach (XmlNode n in s.Cursor.ChildNodes)
			{
				if (n.Name != "TagGroup") continue;

				s.SaveCursor(n);
				var group = new TagGroup(state, s);
				s.RestoreCursor();
				string name_str = group.ToString();

				try { Groups.Add(name_str, group); }
				catch (ArgumentException) { Debug.LogFile.WriteLine(CheApe.Import.kDuplicateErrorStr, "tag group definition", name_str); }
			}
		}
示例#50
0
		/// <summary>
		/// Processes attributes applied to one of the inheriting classes of this class
		/// </summary>
		private void ProcessAtrributes(FileManageable inst)
		{
			#region Get definition attribute
			Type t = inst.GetType();
			object[] attr = t.GetCustomAttributes(typeof(ClassAttribute), false);
			if (attr.Length == 0) return;

			ClassAttribute ca = attr[0] as ClassAttribute;
			attribute = ca;
			#endregion

			groupTag = TagGroups.Groups[ca.GroupIndex];
		}
示例#51
0
        /// <summary>
        /// Инициализировать группы тегов, теги КП, их текущие данные и признаки изменения
        /// </summary>
        /// <remarks>В результате работы метода элементы списков TagGroups и KPTags не могут быть null</remarks>
        protected void InitKPTags(List<TagGroup> srcTagGroups)
        {
            if (srcTagGroups == null)
                throw new ArgumentNullException("srcTagGroups");

            // подсчёт количества тегов
            int tagCnt = 0;
            foreach (TagGroup tagGroup in srcTagGroups)
            {
                if (tagGroup != null)
                    tagCnt += tagGroup.KPTags.Count;
            }

            // инициализация данных
            TagGroups = srcTagGroups.ToArray();
            KPTags = new KPTag[tagCnt];
            curData = new SrezTableLight.CnlData[tagCnt];
            curDataModified = new bool[tagCnt];
            tagTable = null;

            int groupCnt = TagGroups.Length;
            int tagIndex = 0;
            for (int groupIndex = 0; groupIndex < groupCnt; groupIndex++)
            {
                TagGroup tagGroup = TagGroups[groupIndex];
                if (tagGroup == null)
                {
                    TagGroups[groupIndex] = new TagGroup();
                }
                else
                {
                    foreach (KPTag kpTag in tagGroup.KPTags)
                        KPTags[tagIndex++] = kpTag == null ? new KPTag() : kpTag;
                }
            }

            for (int i = 0; i < tagCnt; i++)
            {
                curData[i] = SrezTableLight.CnlData.Empty;
                curDataModified[i] = true;
            }
        }
示例#52
0
        /// <summary>
        /// Инициализировать теги КП и группы переменных на основе конфигурации
        /// </summary>
        private void InitKPTags()
        {
            int groupCnt = config.VarGroups.Count;
            List<TagGroup> tagGroups = new List<TagGroup>(groupCnt);
            varGroups = new VarGroup[groupCnt];
            int signal = 1;

            for (int i = 0; i < groupCnt; i++)
            {
                Config.VarGroup configVarGroup = config.VarGroups[i];
                int varCnt = configVarGroup.Variables.Count;
                TagGroup tagGroup = new TagGroup(configVarGroup.Name);
                VarGroup varGroup = new VarGroup(configVarGroup.Name, varCnt, signal);

                for (int j = 0; j < varCnt; j++)
                {
                    Config.Variable configVar = configVarGroup.Variables[j];
                    KPTag kpTag = new KPTag(signal++, configVar.Name);
                    tagGroup.KPTags.Add(kpTag);
                    varGroup.VarNames[j] = configVar.Name;
                    varGroup.Variables[j] = CreateVariable(configVar);
                }

                tagGroups.Add(tagGroup);
                varGroups[i] = varGroup;
            }

            InitKPTags(tagGroups);
        }
示例#53
0
        //------------------------------------------------------------------------------//
        //                                Manual Start Stop                             //
        //------------------------------------------------------------------------------//
        public void ManualStart(string ObjectNumber, bool SwitchOn)
        {
            if (MainWindow.stat_iUserLevel >= 2)
            {
                try
                {
                    if (!PLCW.IsConnected)
                        PLCW.Connect();

                    if (PLCW.IsConnected)
                    {
                        Tag tObjNo = new Tag("DB3.DBD50", S7Link.Tag.ATOMIC.DWORD, 1);
                        Tag tCmdOn = new Tag("DB3.DBX55.1", S7Link.Tag.ATOMIC.BOOL, 1);
                        Tag tCmdOff = new Tag("DB3.DBX55.0", S7Link.Tag.ATOMIC.BOOL, 1);
                        Tag tCmdManOff = new Tag("DB3.DBX57.5", S7Link.Tag.ATOMIC.BOOL, 1);
                        Tag tCmdManOn = new Tag("DB3.DBX55.5", S7Link.Tag.ATOMIC.BOOL, 1);
                        Tag tReqDefine = new Tag("DB3.DBX43.0", S7Link.Tag.ATOMIC.BOOL, 1);
                        Tag tCmdHN = new Tag("DB3.DBX55.1", S7Link.Tag.ATOMIC.BOOL, 1);

                        if (SwitchOn)
                        {
                            tObjNo.Value = ObjectNumber;
                            tCmdOn.Value = true;
                            tCmdManOn.Value = true;
                            tCmdOff.Value = false;
                            tCmdManOff.Value = false;
                            tReqDefine.Value = true;
                        }
                        else
                        {
                            tObjNo.Value = ObjectNumber;
                            tCmdOn.Value = false;
                            tCmdManOn.Value = false;
                            tCmdOff.Value = true;
                            tCmdManOff.Value = true;
                            tReqDefine.Value = true;
                        }

                        TagGroup tg1 = new TagGroup();
                        tg1.AddTag(tObjNo);
                        tg1.AddTag(tCmdOn);
                        tg1.AddTag(tCmdManOn);
                        tg1.AddTag(tCmdOff);
                        tg1.AddTag(tCmdManOff);
                        tg1.AddTag(tReqDefine);

                        PLCW.GroupWrite(tg1);
                        PLCW.Disconnect();
                        MainWindow.stat_sActiveObjectNo = "";
                    }
                    else
                    {
                        MessageBox.Show("Not Connected");
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Manual Start --> " + ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            else
            {
                MessageBox.Show("You do not have sufficient privileges to perform this action! ", " access denied", MessageBoxButton.OK, MessageBoxImage.Stop);
            }
        }
示例#54
0
		////////////////////////////////////////////////////////////////////////////////////////////////////
		/// <summary>   Opens a tag. </summary>
		///
		/// <param name="tagPath">  Full pathname of the tag file. </param>
		/// <param name="tagGroup"> Group the tag belongs to. </param>
		///
		/// <returns>   A BlamLib.Managers.TagManager. </returns>
		protected BlamLib.Managers.TagManager OpenTag(string tagPath, TagGroup tagGroup)
		{
			var datumIndex = mTagIndexHandler.IndexInterface.Open(tagPath, tagGroup, ITagStreamFlags.LoadDependents);

			if (!BlamLib.Managers.TagIndex.IsValid(datumIndex))
			{
				return null;
			}

			var tagManager = mTagIndexHandler.IndexInterface[datumIndex];

			return tagManager;
		}
示例#55
0
        /// <summary>
        /// Reads the header for the tag instance from a stream.
        /// </summary>
        /// <param name="reader">The stream to read from.</param>
        internal void ReadHeader(BinaryReader reader)
        {
            Checksum = reader.ReadUInt32();                        // 0x00 uint32 checksum
            TotalSize = reader.ReadUInt32();                       // 0x04 uint32 total size
            var numDependencies = reader.ReadInt16();              // 0x08 int16  dependencies count
            var numDataFixups = reader.ReadInt16();                // 0x0A int16  data fixup count
            var numResourceFixups = reader.ReadInt16();            // 0x0C int16  resource fixup count
            reader.BaseStream.Position += 2;                       // 0x0E int16  (padding)
            MainStructOffset = reader.ReadUInt32();                // 0x10 uint32 main struct offset
            var groupTag = new Tag(reader.ReadInt32());            // 0x14 int32  group tag
            var parentGroupTag = new Tag(reader.ReadInt32());      // 0x18 int32  parent group tag
            var grandparentGroupTag = new Tag(reader.ReadInt32()); // 0x1C int32  grandparent group tag
            var groupName = new StringId(reader.ReadUInt32());     // 0x20 uint32 group name stringid
            Group = new TagGroup(groupTag, parentGroupTag, grandparentGroupTag, groupName);

            // Read dependencies
            var dependencies = new HashSet<int>();
            for (var j = 0; j < numDependencies; j++)
                dependencies.Add(reader.ReadInt32());
            Dependencies = new ReadOnlySet<int>(dependencies);

            // Read offsets
            _pointerOffsets = new List<uint>(numDataFixups);
            for (var j = 0; j < numDataFixups; j++)
                _pointerOffsets.Add(PointerToOffset(reader.ReadUInt32()));
            _resourceOffsets = new List<uint>(numResourceFixups);
            for (var j = 0; j < numResourceFixups; j++)
                _resourceOffsets.Add(PointerToOffset(reader.ReadUInt32()));
        }
示例#56
0
 /// <summary>
 /// Determines whether the tag belongs to a tag group.
 /// </summary>
 /// <param name="group">The tag group.</param>
 /// <returns><c>true</c> if the tag belongs to the group.</returns>
 public bool IsInGroup(TagGroup group)
 {
     return Group.BelongsTo(group);
 }