Ejemplo n.º 1
0
        private void InternGetOneXData(string vstrAppName, ref object rvarXDataType, ref object rvarXDataValue)
        {
            rvarXDataType  = null;
            rvarXDataValue = null;
            string       dstrName          = Strings.UCase(vstrAppName);
            AcadXDataApp dobjAcadXDataApp2 = default(AcadXDataApp);

            if (mobjDictNames.ContainsKey(dstrName))
            {
                try
                {
                    dobjAcadXDataApp2 = (AcadXDataApp)mcolClass[dstrName];
                }
                catch (Exception ex2)
                {
                    ProjectData.SetProjectError(ex2);
                    Exception ex = ex2;
                    ProjectData.ClearProjectError();
                }
                dobjAcadXDataApp2?.GetXData(ref rvarXDataType, ref rvarXDataValue);
            }
            dobjAcadXDataApp2 = null;
        }
Ejemplo n.º 2
0
        private void InternGetAllXData(ref object rvarXDataType, ref object rvarXDataValue)
        {
            rvarXDataType  = null;
            rvarXDataValue = null;
            int dlngCount = -1;

            checked
            {
                IEnumerator  enumerator = default(IEnumerator);
                AcadXDataApp dobjAcadXDataApp3;
                try
                {
                    enumerator = mcolClass.Values.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        dobjAcadXDataApp3 = (AcadXDataApp)enumerator.Current;
                        dlngCount         = dlngCount + dobjAcadXDataApp3.Count + 1;
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                if (dlngCount > -1)
                {
                    int         dlngIdx         = 0;
                    object[]    davarXDataType  = new object[dlngCount + dlngIdx + 1];
                    object[]    davarXDataValue = new object[dlngCount + dlngIdx + 1];
                    IEnumerator enumerator2     = default(IEnumerator);
                    try
                    {
                        enumerator2 = mcolClass.Values.GetEnumerator();
                        object[] dvarAppXDataType  = default(object[]);
                        object[] dvarAppXDataValue = default(object[]);
                        while (enumerator2.MoveNext())
                        {
                            dobjAcadXDataApp3 = (AcadXDataApp)enumerator2.Current;
                            AcadXDataApp acadXDataApp    = dobjAcadXDataApp3;
                            object       rvarXDataType2  = dvarAppXDataType;
                            object       rvarXDataValue2 = dvarAppXDataValue;
                            acadXDataApp.GetXData(ref rvarXDataType2, ref rvarXDataValue2);
                            dvarAppXDataValue = (object[])rvarXDataValue2;
                            dvarAppXDataType  = (object[])rvarXDataType2;
                            int num  = Information.LBound(dvarAppXDataType);
                            int num2 = Information.UBound(dvarAppXDataType);
                            for (int dlngAppIdx = num; dlngAppIdx <= num2; dlngAppIdx++)
                            {
                                davarXDataType[dlngIdx]  = RuntimeHelpers.GetObjectValue(dvarAppXDataType[dlngAppIdx]);
                                davarXDataValue[dlngIdx] = RuntimeHelpers.GetObjectValue(dvarAppXDataValue[dlngAppIdx]);
                                dlngIdx++;
                            }
                        }
                    }
                    finally
                    {
                        if (enumerator2 is IDisposable)
                        {
                            (enumerator2 as IDisposable).Dispose();
                        }
                    }
                    rvarXDataType  = Support.CopyArray(davarXDataType);
                    rvarXDataValue = Support.CopyArray(davarXDataValue);
                }
                dobjAcadXDataApp3 = null;
            }
        }
Ejemplo n.º 3
0
        public void SetXData(object vvarXDataType, object vvarXDataValue)
        {
            string                      dstrErrMsg           = default(string);
            AcadXDataApp                dobjOldAcadXDataApp4 = default(AcadXDataApp);
            AcadXDataApp                dobjNewAcadXDataApp4 = default(AcadXDataApp);
            OrderedDictionary           dcolClass2;
            Dictionary <object, object> dobjDictNames2;

            if (vvarXDataType == null && vvarXDataValue == null)
            {
                IEnumerator enumerator = default(IEnumerator);
                try
                {
                    enumerator = mcolClass.Values.GetEnumerator();
                    while (enumerator.MoveNext())
                    {
                        dobjOldAcadXDataApp4 = (AcadXDataApp)enumerator.Current;
                        dobjOldAcadXDataApp4.FriendQuit();
                        dobjOldAcadXDataApp4 = null;
                    }
                }
                finally
                {
                    if (enumerator is IDisposable)
                    {
                        (enumerator as IDisposable).Dispose();
                    }
                }
                mcolClass     = new OrderedDictionary();
                mobjDictNames = new Dictionary <object, object>();
            }
            else
            {
                if (!hwpDxf_XData.BkDXFXData_Check(RuntimeHelpers.GetObjectValue(vvarXDataType), RuntimeHelpers.GetObjectValue(vvarXDataValue), ref dstrErrMsg, nvblnWithAppName: true, nvblnExtCoords: false))
                {
                    goto IL_0328;
                }
                dcolClass2     = new OrderedDictionary();
                dobjDictNames2 = new Dictionary <object, object>();
                int num  = Information.LBound((Array)vvarXDataType);
                int num2 = Information.UBound((Array)vvarXDataType);
                checked
                {
                    for (int dlngIdx2 = num; dlngIdx2 <= num2; dlngIdx2++)
                    {
                        short dintXDataType = Conversions.ToShort(NewLateBinding.LateIndexGet(vvarXDataType, new object[1]
                        {
                            dlngIdx2
                        }, null));
                        object dvarXDataValue = RuntimeHelpers.GetObjectValue(NewLateBinding.LateIndexGet(vvarXDataValue, new object[1]
                        {
                            dlngIdx2
                        }, null));
                        if (dintXDataType == 1001)
                        {
                            string dstrName2;
                            if (dobjNewAcadXDataApp4 != null)
                            {
                                dstrName2 = Strings.UCase(dobjNewAcadXDataApp4.AppName);
                                dcolClass2.Add(dstrName2, dobjNewAcadXDataApp4);
                                dobjDictNames2.Add(dstrName2, dstrName2);
                                dobjNewAcadXDataApp4 = null;
                            }
                            string dstrAppName = Conversions.ToString(dvarXDataValue);
                            dstrName2 = Strings.UCase(dstrAppName);
                            if (dobjDictNames2.ContainsKey(dstrName2))
                            {
                                try
                                {
                                    dobjNewAcadXDataApp4 = (AcadXDataApp)dcolClass2[dstrName2];
                                }
                                catch (Exception ex3)
                                {
                                    ProjectData.SetProjectError(ex3);
                                    Exception ex = ex3;
                                    ProjectData.ClearProjectError();
                                }
                            }
                            else
                            {
                                dobjNewAcadXDataApp4 = null;
                            }
                            if (dobjNewAcadXDataApp4 == null)
                            {
                                dobjNewAcadXDataApp4 = new AcadXDataApp();
                                dobjNewAcadXDataApp4.FriendLetAppName = dstrAppName;
                            }
                            InternAddAcadObjectRegisteredApplication(dstrName2);
                            continue;
                        }
                        if (dobjNewAcadXDataApp4 != null)
                        {
                            dobjNewAcadXDataApp4.FriendAdd(dintXDataType, RuntimeHelpers.GetObjectValue(dvarXDataValue));
                            continue;
                        }
                        goto IL_01ca;
                    }
                    if (dobjNewAcadXDataApp4 != null)
                    {
                        string dstrName2 = Strings.UCase(dobjNewAcadXDataApp4.AppName);
                        dcolClass2.Add(dstrName2, dobjNewAcadXDataApp4);
                        dobjDictNames2.Add(dstrName2, dstrName2);
                        dobjNewAcadXDataApp4 = null;
                    }
                    int count = dcolClass2.Count;
                    for (int dlngIdx2 = 1; dlngIdx2 <= count; dlngIdx2++)
                    {
                        dobjNewAcadXDataApp4 = (AcadXDataApp)dcolClass2[dlngIdx2 - 1];
                        string dstrAppName = dobjNewAcadXDataApp4.AppName;
                        string dstrName2   = Strings.UCase(dstrAppName);
                        if (mobjDictNames.ContainsKey(dstrName2))
                        {
                            try
                            {
                                dobjOldAcadXDataApp4 = (AcadXDataApp)mcolClass[dstrName2];
                            }
                            catch (Exception ex4)
                            {
                                ProjectData.SetProjectError(ex4);
                                Exception ex2 = ex4;
                                ProjectData.ClearProjectError();
                            }
                        }
                        else
                        {
                            dobjOldAcadXDataApp4 = null;
                        }
                        if (dobjOldAcadXDataApp4 != null)
                        {
                            mcolClass.Remove(dstrName2);
                            mobjDictNames.Remove(dstrName2);
                            dobjOldAcadXDataApp4 = null;
                        }
                        dobjNewAcadXDataApp4.FriendLetNodeParentID     = base.NodeID;
                        dobjNewAcadXDataApp4.FriendLetApplicationIndex = mlngApplicationIndex;
                        dobjNewAcadXDataApp4.FriendLetDocumentIndex    = mlngDocumentIndex;
                        dobjNewAcadXDataApp4.FriendLetDatabaseIndex    = mlngDatabaseIndex;
                        mcolClass.Add(dstrName2, dobjNewAcadXDataApp4);
                        mobjDictNames.Add(dstrName2, dstrName2);
                    }
                }
            }
            goto IL_034e;
IL_01ca:
            dstrErrMsg = "Fehlender Applikationsname.";
            goto IL_0328;
IL_034e:
            dobjOldAcadXDataApp4 = null;
            dobjNewAcadXDataApp4 = null;
            dcolClass2           = null;
            dobjDictNames2       = null;
            return;

IL_0328:
            Information.Err().Raise(50000, "AcadXData", "Ungültige erweiterte Daten.\n" + dstrErrMsg);
            goto IL_034e;
        }