예제 #1
0
        private bool InternReadSection(ref string nrstrErrMsg)
        {
            nrstrErrMsg = null;
            int dlngIdx = mlngSecBeg;

            InternIncreaseIndex(ref dlngIdx, 1);
            AcadSummaryInfo      dobjAcadSummaryInfo = mobjAcadDocument.SummaryInfo;
            bool                 dblnError           = default(bool);
            bool                 dblnTitle           = default(bool);
            bool                 dblnSubject         = default(bool);
            bool                 dblnAuthor          = default(bool);
            bool                 dblnKeywords        = default(bool);
            bool                 dblnComments        = default(bool);
            bool                 dblnLastSavedBy     = default(bool);
            bool                 dblnRevisionNumber  = default(bool);
            AcadSysVar           dobjAcadSysVar;
            AcadSummaryInfoField dobjAcadSummaryInfoField = default(AcadSummaryInfoField);

            while (dlngIdx <= mlngSecEnd && !dblnError)
            {
                string dstrVarName1 = Conversions.ToString(mobjDictReadValues[dlngIdx]);
                string dstrVarName2 = Strings.Mid(dstrVarName1, 2);
                int    dlngCode1    = Conversions.ToInteger(mobjDictReadCodes[dlngIdx]);
                checked
                {
                    if (dlngCode1 != 9)
                    {
                        nrstrErrMsg = "Ungültiger Gruppencode für Variable in Zeile " + Conversions.ToString(dlngIdx * 2 + 1) + ".";
                        dblnError   = true;
                        continue;
                    }
                    if (!LikeOperator.LikeString(dstrVarName1, "$*", CompareMethod.Binary))
                    {
                        nrstrErrMsg = "Ungültiger Variablenprefix in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                        dblnError   = true;
                        continue;
                    }
                    object dvarValue5;
                    if (dobjAcadSummaryInfoField != null)
                    {
                        int dlngCode5 = Conversions.ToInteger(mobjDictReadCodes[dlngIdx + 1]);
                        if (Operators.CompareString(Strings.UCase(dstrVarName2), Strings.UCase("CUSTOMPROPERTY"), TextCompare: false) != 0)
                        {
                            nrstrErrMsg = "Datei-Info: Ungültiger Bezeichner für den Wert einer benutzerdefinierten Eigenschaft in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                            dblnError   = true;
                        }
                        else if (dlngCode5 != 1)
                        {
                            nrstrErrMsg = "Datei-Info: Ungültiger Gruppencode für den Wert einer benutzerdefinierten Eigenschaft in Zeile " + Conversions.ToString(dlngIdx * 2 + 3) + ".";
                            dblnError   = true;
                        }
                        else
                        {
                            dvarValue5 = RuntimeHelpers.GetObjectValue(mobjDictReadValues[dlngIdx + 1]);
                            dobjAcadSummaryInfoField.Value = Conversions.ToString(dvarValue5);
                            InternIncreaseIndex(ref dlngIdx, 2);
                        }
                        dobjAcadSummaryInfoField = null;
                        continue;
                    }
                    if (InternCheckIsSummaryInfo(dstrVarName2))
                    {
                        int dlngCode5 = Conversions.ToInteger(mobjDictReadCodes[dlngIdx + 1]);
                        if (dlngCode5 != 1)
                        {
                            nrstrErrMsg = "Ungültiger Gruppencode für Datei-Info in Zeile " + Conversions.ToString(dlngIdx * 2 + 3) + ".";
                            dblnError   = true;
                            continue;
                        }
                        dvarValue5 = RuntimeHelpers.GetObjectValue(mobjDictReadValues[dlngIdx + 1]);
                        string left = Strings.UCase(dstrVarName2);
                        if (Operators.CompareString(left, Strings.UCase("TITLE"), TextCompare: false) == 0)
                        {
                            if (dblnTitle)
                            {
                                nrstrErrMsg = "Doppelter Datei-Info-Eintrag in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                                dblnError   = true;
                            }
                            else
                            {
                                dblnTitle = true;
                                dobjAcadSummaryInfo.Title = Conversions.ToString(dvarValue5);
                                InternIncreaseIndex(ref dlngIdx, 2);
                            }
                        }
                        else if (Operators.CompareString(left, Strings.UCase("SUBJECT"), TextCompare: false) == 0)
                        {
                            if (dblnSubject)
                            {
                                nrstrErrMsg = "Doppelter Datei-Info-Eintrag in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                                dblnError   = true;
                            }
                            else
                            {
                                dblnSubject = true;
                                dobjAcadSummaryInfo.Subject = Conversions.ToString(dvarValue5);
                                InternIncreaseIndex(ref dlngIdx, 2);
                            }
                        }
                        else if (Operators.CompareString(left, Strings.UCase("AUTHOR"), TextCompare: false) == 0)
                        {
                            if (dblnAuthor)
                            {
                                nrstrErrMsg = "Doppelter Datei-Info-Eintrag in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                                dblnError   = true;
                            }
                            else
                            {
                                dblnAuthor = true;
                                dobjAcadSummaryInfo.Author = Conversions.ToString(dvarValue5);
                                InternIncreaseIndex(ref dlngIdx, 2);
                            }
                        }
                        else if (Operators.CompareString(left, Strings.UCase("KEYWORDS"), TextCompare: false) == 0)
                        {
                            if (dblnKeywords)
                            {
                                nrstrErrMsg = "Doppelter Datei-Info-Eintrag in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                                dblnError   = true;
                            }
                            else
                            {
                                dblnKeywords = true;
                                dobjAcadSummaryInfo.Keywords = Conversions.ToString(dvarValue5);
                                InternIncreaseIndex(ref dlngIdx, 2);
                            }
                        }
                        else if (Operators.CompareString(left, Strings.UCase("COMMENTS"), TextCompare: false) == 0)
                        {
                            if (dblnComments)
                            {
                                nrstrErrMsg = "Doppelter Datei-Info-Eintrag in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                                dblnError   = true;
                            }
                            else
                            {
                                dblnComments = true;
                                dobjAcadSummaryInfo.Comments = Conversions.ToString(dvarValue5);
                                InternIncreaseIndex(ref dlngIdx, 2);
                            }
                        }
                        else if (Operators.CompareString(left, Strings.UCase("LASTSAVEDBY"), TextCompare: false) == 0)
                        {
                            if (dblnLastSavedBy)
                            {
                                nrstrErrMsg = "Doppelter Datei-Info-Eintrag in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                                dblnError   = true;
                            }
                            else
                            {
                                dblnLastSavedBy = true;
                                dobjAcadSummaryInfo.FriendLetLastSavedBy = Conversions.ToString(dvarValue5);
                                InternIncreaseIndex(ref dlngIdx, 2);
                            }
                        }
                        else if (Operators.CompareString(left, Strings.UCase("REVISIONNUMBER"), TextCompare: false) == 0)
                        {
                            if (dblnRevisionNumber)
                            {
                                nrstrErrMsg = "Doppelter Datei-Info-Eintrag in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                                dblnError   = true;
                            }
                            else
                            {
                                dblnRevisionNumber = true;
                                dobjAcadSummaryInfo.FriendLetRevisionNumber = Conversions.ToString(dvarValue5);
                                InternIncreaseIndex(ref dlngIdx, 2);
                            }
                        }
                        else if (Operators.CompareString(left, Strings.UCase("CUSTOMPROPERTYTAG"), TextCompare: false) == 0)
                        {
                            dvarValue5 = Strings.Trim(Conversions.ToString(dvarValue5));
                            if (Operators.ConditionalCompareObjectEqual(dvarValue5, null, TextCompare: false))
                            {
                                nrstrErrMsg = "Datei-Info: Ungültiger Name einer benutzerdefinierten Eigenschaft in Zeile " + Conversions.ToString(dlngIdx * 2 + 4) + ".";
                                dblnError   = true;
                            }
                            else if (dobjAcadSummaryInfo.CustomExistsByKey(Conversions.ToString(dvarValue5)) != 0)
                            {
                                nrstrErrMsg = "Datei-Info: Der Name einer benutzerdefinierten Eigenschaft ist bereits vergeben, in Zeile " + Conversions.ToString(dlngIdx * 2 + 4) + ".";
                                dblnError   = true;
                            }
                            else
                            {
                                dobjAcadSummaryInfoField = dobjAcadSummaryInfo.Fields.Add(Conversions.ToString(dvarValue5), null);
                                InternIncreaseIndex(ref dlngIdx, 2);
                            }
                        }
                        else if (Operators.CompareString(left, Strings.UCase("CUSTOMPROPERTY"), TextCompare: false) == 0)
                        {
                            nrstrErrMsg = "Datei-Info: Wert einer benutzerdefinierten Eigenschaft ohne Namen in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                            dblnError   = true;
                        }
                        continue;
                    }
                    dobjAcadSysVar = mobjAcadDocument.FriendFindVariable(dstrVarName2);
                    if (dobjAcadSysVar == null)
                    {
                        nrstrErrMsg = "Ungültiger Variablenname '" + dstrVarName2 + "' in Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                        hwpDxf_Functions.BkDXF_DebugPrint(nrstrErrMsg);
                        dblnError = true;
                        continue;
                    }
                    object dvarHeaderCode = RuntimeHelpers.GetObjectValue(dobjAcadSysVar.HeaderCode);
                    if (dobjAcadSysVar.ArraySize == null)
                    {
                        int dlngCode5 = Conversions.ToInteger(mobjDictReadCodes[dlngIdx + 1]);
                        if (Operators.ConditionalCompareObjectNotEqual(dlngCode5, dvarHeaderCode, TextCompare: false))
                        {
                            nrstrErrMsg = "Ungültiger Gruppencode für Variablenwert in Zeile " + Conversions.ToString(dlngIdx * 2 + 3) + ".";
                            dblnError   = true;
                            continue;
                        }
                        dvarValue5 = RuntimeHelpers.GetObjectValue(mobjDictReadValues[dlngIdx + 1]);
                        switch (dobjAcadSysVar.Name)
                        {
                        case "CECOLOR":
                            dvarValue5 = hwpDxf_Functions.BkDXF_ColorLongToString(unchecked ((Enums.AcColor)Conversions.ToInteger(dvarValue5)));
                            break;

                        case "DIMDSEP":
                            dvarValue5 = Strings.Chr(Conversions.ToInteger(dvarValue5));
                            break;

                        case "FINGERPRINTGUID":
                            dvarValue5 = Strings.Trim(Conversions.ToString(dvarValue5));
                            if (Operators.ConditionalCompareObjectEqual(dvarValue5, null, TextCompare: false))
                            {
                                dvarValue5 = Guid.NewGuid().ToString().ToUpper();
                            }
                            break;

                        case "VERSIONGUID":
                            dvarValue5 = Strings.Trim(Conversions.ToString(dvarValue5));
                            if (Operators.ConditionalCompareObjectEqual(dvarValue5, null, TextCompare: false))
                            {
                                dvarValue5 = Guid.NewGuid().ToString().ToUpper();
                            }
                            break;
                        }
                        if (!dobjAcadSysVar.FriendSetValue(RuntimeHelpers.GetObjectValue(dvarValue5), vblnRaiseEvent: true, ref nrstrErrMsg))
                        {
                            nrstrErrMsg = nrstrErrMsg + " Ab Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                            dblnError   = true;
                        }
                        else
                        {
                            InternIncreaseIndex(ref dlngIdx, 2);
                        }
                        continue;
                    }
                    int         dlngLBound      = Information.LBound((Array)dvarHeaderCode);
                    int         dlngArraySize   = Conversions.ToInteger(dobjAcadSysVar.ArraySize);
                    VariantType varType_Renamed = dobjAcadSysVar.VarType_Renamed;
                    dvarValue5 = ((varType_Renamed != (VariantType)8201) ? new object[dlngArraySize - 1 + 1] : new object[dlngArraySize - 1 + 1]);
                    int dlngCount = 0;
                    while (unchecked (dlngCount < dlngArraySize && !dblnError))
                    {
                        int dlngCode5 = Conversions.ToInteger(mobjDictReadCodes[dlngIdx + dlngCount + 1]);
                        if (Operators.ConditionalCompareObjectNotEqual(dlngCode5, NewLateBinding.LateIndexGet(dvarHeaderCode, new object[1]
                        {
                            dlngLBound
                        }, null), TextCompare: false))
                        {
                            nrstrErrMsg = "Ungültiger Gruppencode für Variablenwert in Zeile " + Conversions.ToString((dlngIdx + dlngCount + 1) * 2 + 1) + ".";
                            dblnError   = true;
                        }
                        else
                        {
                            NewLateBinding.LateIndexSet(dvarValue5, new object[2]
                            {
                                dlngCount,
                                mobjDictReadValues[dlngIdx + dlngCount + 1]
                            }, null);
                            dlngLBound++;
                            dlngCount++;
                        }
                    }
                    if (!dblnError)
                    {
                        if (!dobjAcadSysVar.FriendSetValue(RuntimeHelpers.GetObjectValue(dvarValue5), vblnRaiseEvent: true, ref nrstrErrMsg))
                        {
                            nrstrErrMsg = nrstrErrMsg + " Ab Zeile " + Conversions.ToString(dlngIdx * 2 + 2) + ".";
                            dblnError   = true;
                        }
                        else
                        {
                            InternIncreaseIndex(ref dlngIdx, dlngArraySize + 1);
                        }
                    }
                }
            }
            bool InternReadSection = !dblnError;

            dobjAcadSysVar           = null;
            dobjAcadSummaryInfoField = null;
            dobjAcadSummaryInfo      = null;
            return(InternReadSection);
        }