void CLink::Load(CProfINIFile & SavePF) { if (1) return; CString Line, V; Line=SavePF.RdStr("Links", m_sTag, ""); if (Line.GetLength()>0) { int iStart=0; int lLink = SafeAtoL(Line.Tokenize(",", iStart)); //int lDbg = SafeAtoL(Line.Tokenize(",", iStart)); int lHold = SafeAtoL(Line.Tokenize(",", iStart)); V=Line.Tokenize("'", iStart); //m_bSltDbgOn=lDbg!=0; m_State.m_bHold=lHold!=0; CFullValue FV(OPC_QUALITY_GOOD); StringToVariant(Type(), V, FV, false); gs_SlotMngr.AppendChange(eCSD_File, -1, eCSD_Link, m_lLink, -1/*gs_SlotMngr.GetTransactionID()*/, FV, NULL, true); } };
int CCopyBlock::CopyTagBlocks() { CWaitCursor Wait; // ASSERT(eSrc!=CB_List); //this src type not allowed // ASSERT(eDst!=CB_Tag); //this dst type not allowed ASSERT(pEO); CProfINIFile SrcPF(bSrcDatalib ? CfgFiles() : PrjFiles(), (char*)CopyBlkFileName); CheckCopyBlockVer(SrcPF); CProfINIFile DstPF(bDstDatalib ? CfgFiles() : PrjFiles(), (char*)CopyBlkFileName); if (!CheckCopyBlockVer(DstPF, true)) return 0; int Cnt = 0; //gs_pTheSFELib->FE_SetHoldGlobalLinks(true); //gs_Exec.SetHoldValidateData(true, true, true); gs_Exec.BeginBulkChange(); Strng Section; if (eSrc==CB_SelectedTag) Section = TempBlockName; else Section.Set("%s(%s)", sSrc(), sModelClass()); char Buff[16384]; DWORD dw = SrcPF.RdSection(Section(), Buff, sizeof(Buff)); ASSERT(dw<sizeof(Buff)-2); //section too large!!! if (eDst==CB_Block) { Strng DstSection; DstSection.Set("%s(%s)", sDst(), sModelClass()); DstPF.WrSection(DstSection(), Buff); } else { Strng_List sStrList; CXM_Route Route; CXM_ObjectData ObjData; char* p = Buff; while (p[0]) { int len = strlen(p); char* Nextp = p; Nextp += (len + 1); char* pp = strchr(p, '='); if (pp) { pp[0] = 0; char* pValue = &pp[1]; char* ppp = strchr(p, '.'); Strng PartTag; PartTag = (ppp==NULL ? p : ppp); for (int i=0; i<TagList.GetSize(); i++) { Strng WrkTag(TagList[i]()); WrkTag += PartTag; //CXM_ObjectTag ObjTag(WrkTag(), 0); //need to use TABOpt_AllInfoOnce because of tags that contain a strList! CXM_ObjectTag ObjTag(WrkTag(), TABOpt_AllInfoOnce);//0);//TABOpt_Exists);//TABOpt_Parms);//TABOpt_ValCnvsOnce); Route.Clear(); if (pEO->XReadTaggedItem(ObjTag, ObjData, Route)) { CPkDataItem * pItem = ObjData.FirstItem(); byte cType = pItem->Type(); PkDataUnion DU; if (IsStrng(cType)) DU.SetTypeString(cType, pValue); else if (IsFloatData(cType)) DU.SetTypeDouble(cType, SafeAtoF(pValue)); else if (IsIntData(cType) && pItem->Contains(PDI_StrList)) { pItem->GetStrList(sStrList); pStrng pS = sStrList.Find(pValue); //const int Indx = (pS==NULL ? 0 : sStrList.Index(pS)); const int Indx = (pS==NULL ? 0 : pS->Index()); DU.SetTypeLong(cType, Indx); } else DU.SetTypeLong(cType, SafeAtoL(pValue)); CXM_ObjectData OD(0, 0, WrkTag(), 0, DU); if (pEO->XWriteTaggedItem(OD, Route)==TOData_NotFound) LogWarning(WrkTag(), 0, "Write tag failed"); else Cnt++; //if (pEO->XWriteTaggedItem(OD, Route)!=TOData_OK) // LogWarning(WrkTag(), 0, "Write tag failed (possibly invalid data)"); } else LogWarning(WrkTag(), 0, "Unable to read tag"); } } p = Nextp; } } //TaggedObject::SetHoldValidateData(false); //gs_Exec.SetHoldValidateData(false, true, true); //gs_pTheSFELib->FE_SetHoldGlobalLinks(false); gs_Exec.EndBulkChange(); //TaggedObject::SetXWritesBusy(false); return Cnt; }