当前位置: 首页>>代码示例>>C#>>正文


C# SubRecord类代码示例

本文整理汇总了C#中SubRecord的典型用法代码示例。如果您正苦于以下问题:C# SubRecord类的具体用法?C# SubRecord怎么用?C# SubRecord使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SubRecord类属于命名空间,在下文中一共展示了SubRecord类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Evaluate

 public override bool Evaluate(Record r, SubRecord sr)
 {
     if (this.Type == BatchCondRecordType.Create)
     {
         if (sr == null)
         {
             // guess the best insert location
             int idx = -1;
             RecordStructure rs;
             if ( RecordStructure.Records.TryGetValue(r.Name, out rs) )
             {
                 for ( int i = Array.FindIndex(rs.subrecords, structure => structure.name == this.Record.name) - 1; i >= 0; --i)
                 {
                     var srsname = rs.subrecords[i].name;
                     idx = r.SubRecords.IndexOf(r.SubRecords.FirstOrDefault(x => x.Name == srsname));
                 }
             }
             sr = new SubRecord(this.Record);
             if (idx < 0) r.SubRecords.Add(sr); 
             else r.SubRecords.Insert(idx+1, sr); 
         }
     }
     else if (this.Type == BatchCondRecordType.Delete)
     {
         while (sr != null)
         {
             r.SubRecords.Remove(sr);
             sr = r.SubRecords.FirstOrDefault(x => x.Name == this.Record.name);
         }
     }
     return true;
 }
开发者ID:rxantos,项目名称:tesv-snip,代码行数:32,代码来源:BatchElement.cs

示例2: MediumLevelRecordEditor

        public MediumLevelRecordEditor(SubRecord sr, SubrecordStructure ss, dFormIDLookupS formIDLookup, dFormIDScan formIDScan, dLStringLookup strIDLookup)
        {
            this.InitializeComponent();
            Icon = Resources.tesv_ico;
            SuspendLayout();
            this.sr = sr;
            this.ss = ss;
            this.formIDLookup = formIDLookup;
            this.formIDScan = formIDScan;
            this.strIDLookup = strIDLookup;

            int offset = 0;
            byte[] data = sr.GetReadonlyData();
            this.boxes = new List<TextBox>(ss.elements.Length);
            this.valueTypes = new List<ElementValueType>(ss.elements.Length);
            this.elements = new List<Panel>();
            int groupOffset = 0;
            int CurrentGroup = 0;
            try
            {
                for (int i = 0; i < ss.elements.Length; i++)
                {
                    if (ss.elements[i].optional > 0 && offset == data.Length)
                    {
                        this.AddElement(ss.elements[i]);
                    }
                    else
                    {
                        this.AddElement(ss.elements[i], ref offset, data, ref groupOffset, ref CurrentGroup);
                        if (ss.elements[i].repeat > 0)
                        {
                            this.repeatcount++;
                            if (offset < data.Length)
                            {
                                i--;
                            }
                        }
                    }
                }

                if (ss.elements[ss.elements.Length - 1].repeat > 0 && this.repeatcount > 0)
                {
                    this.AddElement(ss.elements[ss.elements.Length - 1]);
                }
            }
            catch
            {
                MessageBox.Show("The subrecord doesn't appear to conform to the expected structure.\n" + "Saving is disabled, and the formatted information may be incorrect", "Warning");
                this.bSave.Enabled = false;
            }

            ResumeLayout();
        }
开发者ID:figment,项目名称:tesvsnip,代码行数:53,代码来源:MediumLevelRecordEditor.cs

示例3: AddMaster

        public bool AddMaster(string masterName)
        {
            Record brcTES4 = Records.OfType<Record>().FirstOrDefault(x => x.Name == "TES4");
            if (brcTES4 == null)
                throw new ApplicationException("Plugin lacks a valid TES4 record. Cannot continue.");
            // find existing if already present
            foreach (var mast in brcTES4.SubRecords.Where(x => x.Name == "MAST"))
            {
                var path = mast.GetStrData();
                if (string.Compare(path, masterName, true) == 0)
                    return false;
            }
            int idx = brcTES4.SubRecords.IndexOf(brcTES4.SubRecords.FirstOrDefault(x => x.Name == "INTV"));
            if (idx < 0) idx = brcTES4.SubRecords.Count;

            var sbrMaster = new SubRecord();
            sbrMaster = new SubRecord();
            sbrMaster.Name = "DATA";
            sbrMaster.SetData(new byte[] {0, 0, 0, 0, 0, 0, 0, 0});
            brcTES4.InsertRecord(idx, sbrMaster);

            sbrMaster = new SubRecord();
            sbrMaster.Name = "MAST";
            Int32 intCount = Encoding.CP1252.GetByteCount(masterName);
            var bteData = new byte[intCount + 1];
            Array.Copy(Encoding.CP1252.GetBytes(masterName), bteData, intCount);
            sbrMaster.SetData(bteData);
            brcTES4.InsertRecord(idx, sbrMaster);

            // Fix Masters
            //  Update IDs for current record to be +1
            return true;
        }
开发者ID:rxantos,项目名称:tesv-snip,代码行数:33,代码来源:Plugin.cs

示例4: CreateSubRecordVisit

            private void CreateSubRecordVisit(Action action)
            {
                SubRecord recordFieldValues = _currentRecord;
                _currentRecord = new SubRecord(new Dictionary<string, string>(), recordFieldValues);

                action();

                //add the person as a subrecord...
                _subrecords.Add(new SubRecord(_currentRecord.Data.ToDictionary(x => x.Key, x => x.Value), recordFieldValues));
                //...and put the record back.
                _currentRecord = recordFieldValues;
            }
开发者ID:Herbert42,项目名称:gedcomx-csharp,代码行数:12,代码来源:RecordHelper.cs

示例5: Match

        public override bool Match(Record r, SubRecord sr, Element se)
        {
            if (this.Type == SearchCondElementType.Exists && se != null)
            {
                return true;
            }

            if (this.Type == SearchCondElementType.Missing && se == null)
            {
                return true;
            }

            if (se == null)
            {
                return false;
            }

            var value = sr.GetCompareValue(se);
            int diff = ValueComparer.Compare(value, this.Value);
            switch (this.Type)
            {
                case SearchCondElementType.Equal:
                    return diff == 0;
                case SearchCondElementType.Not:
                    return diff != 0;
                case SearchCondElementType.Greater:
                    return diff > 0;
                case SearchCondElementType.Less:
                    return diff < 0;
                case SearchCondElementType.GreaterEqual:
                    return diff >= 0;
                case SearchCondElementType.LessEqual:
                    return diff <= 0;
                case SearchCondElementType.StartsWith:
                    if (diff == 0)
                    {
                        return true;
                    }

                    if (value != null && this.Value != null)
                    {
                        return value.ToString().StartsWith(this.Value.ToString(), StringComparison.CurrentCultureIgnoreCase);
                    }

                    break;
                case SearchCondElementType.EndsWith:
                    if (diff == 0)
                    {
                        return true;
                    }

                    if (value != null && this.Value != null)
                    {
                        return value.ToString().EndsWith(this.Value.ToString(), StringComparison.CurrentCultureIgnoreCase);
                    }

                    break;
                case SearchCondElementType.Contains:
                    if (diff == 0)
                    {
                        return true;
                    }

                    if (value != null && this.Value != null)
                    {
                        return value.ToString().IndexOf(this.Value.ToString(), StringComparison.CurrentCultureIgnoreCase) >= 0;
                    }

                    break;
            }

            return false;
        }
开发者ID:figment,项目名称:tesvsnip,代码行数:73,代码来源:SearchElement.cs

示例6: Match

 public abstract bool Match(Record r, SubRecord sr, Element se);
开发者ID:rxantos,项目名称:tesv-snip,代码行数:1,代码来源:SearchElement.cs

示例7: Process

        public void Process(FalloutSnip.Data.Subrecord sr, SubRecord subrec)
        {
            FalloutSnip.Data.SubrecordElement expectedElement = (sr.Elements.Count >= 1) ? sr.Elements[0] : null;
            if (expectedElement != null && expectedElement.type == "blob")
                return;

            byte[] data = subrec.GetReadonlyData();
            if (data.Length == 0)
            {
                if (sr.Elements.Count == 0)
                    sr.Elements.Add(CreateBlob());
                return;
            }
            if (data.Length == 2)            {

            // common scenarios
                if (expectedElement != null && expectedElement.size == 2)
                    return;

                FalloutSnip.Data.SubrecordElement elem = new FalloutSnip.Data.SubrecordElement();
                elem.name = "Unknown";
                elem.type = "short";
                elem.size = 2;
                sr.Elements.Add(elem);
                UpdateSize(sr);
                return;
            }

            if (data.Length > 0)
            {
                bool isAscii = true;
                for (int i = 0; i < data.Length - 1 && isAscii; ++i)
                    isAscii = !Char.IsControl((char)data[i]);
                isAscii = (isAscii && data[data.Length - 1] == 0);
                if (isAscii)
                {
                    // test if its a string
                    if (expectedElement == null)
                    {
                        FalloutSnip.Data.SubrecordElement elem = new FalloutSnip.Data.SubrecordElement();
                        elem.name = "Unknown";
                        elem.type = "string";
                        sr.Elements.Add(elem);
                    }
                    else if (expectedElement.type != "string")
                    {
                        sr.Elements.Clear();
                        sr.Elements.Add(CreateBlob());
                    }
                    return;
                }
            }
            for (int offset = 0, elemSize = 4; offset < data.Length; offset += elemSize)
            {
                if (IsCanceled) return;

                int left = data.Length - offset;
                if (left >= 4)                {

            // common scenarios
                    if (expectedElement != null && expectedElement.size == 4)
                        continue;

                    ushort lhs = TypeConverter.h2s(data[offset], data[offset + 1]);
                    ushort uhs = TypeConverter.h2s(data[offset + 2], data[offset + 3]);
                    uint ui4 = TypeConverter.h2i(data[offset], data[offset + 1], data[offset + 2], data[offset + 3]);
                    if (ui4 == 0)
                    {
                        if (expectedElement == null)
                        {
                            FalloutSnip.Data.SubrecordElement elem = new FalloutSnip.Data.SubrecordElement();
                            elem.name = "Unknown";
                            elem.type = "int";
                            elem.size = 4;
                            sr.Elements.Add(elem);
                            UpdateSize(sr);
                            continue;
                        }
                    }
                    else
                    {
                        float flt = TypeConverter.h2f(data[offset], data[offset + 1], data[offset + 2], data[offset + 3]);
                        if (IsLikelyFloat(flt))                        {

            // replace element which is int with float
                            if (expectedElement == null)
                            {
                                FalloutSnip.Data.SubrecordElement elem = new FalloutSnip.Data.SubrecordElement();
                                elem.name = "Unknown";
                                elem.type = "float";
                                elem.size = 4;
                                sr.Elements.Add(elem);
                            }
                            else
                            {
                                if (expectedElement.type == "int")
                                    expectedElement.type = "float";
                            }
                            continue;
                        }
//.........这里部分代码省略.........
开发者ID:Emilgardis,项目名称:falloutsnip,代码行数:101,代码来源:RecordBuilder.cs

示例8: ProcessSubRecord

        private void ProcessSubRecord(Subrecord sr, SubRecord[] srs)
        {
            long minSize = srs.Min(a => a.Size);
            long maxSize = srs.Max(a => a.Size);
            if (maxSize == 0)
            {
                // likely a group start
                sr.size = -1;
                return;
            }

            int szCount = 0;
            foreach (var ss in srs)
            {
                if (ss.Size == 0)
                {
                    continue;
                }

                var data = ss.GetReadonlyData();
                if (IsLikelyString(new ArraySegment<byte>(data, 0, (int) ss.Size)))
                {
                    if (++szCount > 10)
                    {
                        var elem = CreateType(null, "string");
                        sr.Items.Add(elem);
                        break;
                    }
                }
                else
                {
                    break;
                }
            }

            if (sr.Elements.Any())
            {
                return; // found string
            }

            if (minSize == maxSize && maxSize < 256)
            {
                sr.size = (int) maxSize;
                int index = 0;

                // Walk through each element guessing the data type
                for (int offset = 0, elemSize = 4; offset < maxSize; offset += elemSize)
                {
                    int numZero = 0;
                    int numFloat = 0;
                    int num2Short = 0;
                    int isFormID = 0;
                    int numTotal = 0;
                    int isLString = 0;
                    string reftype = null;

                    if (maxSize - offset < 4)
                    {
                        if (maxSize >= 2)
                        {
                            var elem = CreateType(index++, "short");
                            elem.size = 2;
                            sr.Items.Add(elem);
                            elemSize = 2;
                            continue;
                        }
                        else
                        {
                            var elem = CreateType(index++, "byte");
                            elem.size = 1;
                            sr.Items.Add(elem);
                            elemSize = 1;
                            continue;
                        }
                    }

                    foreach (var ss in srs)
                    {
                        // .Random(srs.Length < 10 ? 0 : srs.Length / 10)
                        ++numTotal;
                        var data = ss.GetReadonlyData();
                        uint ui4 = TypeConverter.h2i(data[offset], data[offset + 1], data[offset + 2], data[offset + 3]);
                        if (ui4 == 0)
                        {
                            ++numZero;
                            continue;
                        }

                        ushort lhs = TypeConverter.h2s(data[offset], data[offset + 1]);
                        ushort uhs = TypeConverter.h2s(data[offset + 2], data[offset + 3]);
                        float flt = TypeConverter.h2f(data[offset], data[offset + 1], data[offset + 2], data[offset + 3]);
                        if (IsLikelyFloat(flt))
                        {
                            ++numFloat;
                        }

                        if (lhs > 0 && lhs < 255 && uhs > 0 && uhs < 255)
                        {
                            ++num2Short;
                        }
//.........这里部分代码省略.........
开发者ID:Emilgardis,项目名称:falloutsnip,代码行数:101,代码来源:RecordBuilder.cs

示例9: Compile

        public static bool Compile(Record r2, out string msg)
        {
            msg=null;
            r=new Record();
            string script=null;
            int scptype=0;
            foreach(SubRecord sr2 in r2.SubRecords) {
                if(sr2.Name=="SCTX") script=sr2.GetStrData();
                if(sr2.Name=="SCHR") {
                    byte[] tmp=sr2.GetReadonlyData();
                    scptype=TypeConverter.h2si(tmp[16], tmp[17], tmp[18], tmp[19]);
                }
            }
            if(script==null) {
                msg="Script had no SCTX record to compile";
                return false;
            }
            locals.Clear();
            localList.Clear();
            edidRefs.Clear();
            refcount=0;
            errors.Clear();

            ts=new TokenStream(script, errors);
            if(errors.Count>0) return OutputErrors( out msg);
            Token[] smt=ts.PopNextStatement();
            if(smt.Length!=2||!smt[0].IsKeyword(Keywords.ScriptName)||smt[1].token==null) return ReturnError("Expected 'ScriptName <edid>'", out msg);
            SubRecord sr=new SubRecord();
            sr.Name="EDID";
            sr.SetStrData(smt[1].utoken, true);
            r.AddRecord(sr);
            r.descriptiveName=" ("+smt[1].token+")";
            schr=new SubRecord();
            schr.Name="SCHR";
            r.AddRecord(schr);
            scda=new SubRecord();
            scda.Name="SCDA";
            r.AddRecord(scda);
            sr=new SubRecord();
            sr.Name="SCTX";
            sr.SetStrData(script, false);
            r.AddRecord(sr);

            bw=new BinaryWriter(new MemoryStream());
            Emit(0x001d);
            Emit(0x0000);
            try {
                HandleVariables();
            } catch(Exception ex) {
                return ReturnError(ex.Message, out msg);
            }
            for(int i=0;i<localList.Count;i++) {
                if(localList[i].type==VarType.Ref) {
                    sr=new SubRecord();
                    sr.Name="SCRV";
                    sr.SetData(TypeConverter.si2h(i+1));
                    r.AddRecord(sr);
                    refcount++;
                    localList[i].refid=refcount;
                }
            }
            while(ts.PeekNextStatement().Length>0) {
                try {
                    HandleBlock();
                } catch(Exception ex) {
                    return ReturnError(ex.Message, out msg);
                }
            }
            if(errors.Count>0) {
                return OutputErrors(out msg);
            }

            byte[] header=new byte[20];
            TypeConverter.si2h(refcount, header, 4);
            TypeConverter.i2h((uint)bw.BaseStream.Length, header, 8);
            TypeConverter.si2h(localList.Count, header, 12);
            TypeConverter.si2h(scptype, header, 16);
            schr.SetData(header);
            byte[] compileddata=((MemoryStream)bw.BaseStream).GetBuffer();
            if(compileddata.Length!=bw.BaseStream.Length) Array.Resize<byte>(ref compileddata, (int)bw.BaseStream.Length);
            scda.SetData(compileddata);
            r2.SubRecords.Clear();
            r2.SubRecords.AddRange(r.SubRecords);
            bw.Close();
            return true;
        }
开发者ID:robjer,项目名称:tesvsnip,代码行数:86,代码来源:ScriptCompiler.cs

示例10: EmitRefLabel

 private static void EmitRefLabel(Token t, RefType type)
 {
     if(t.type==TokenType.Global) {
         EmitByte(0x47);
     } else {
         switch(type) {
         case RefType.Standard: Emit(0x1c); break;
         case RefType.Expression: EmitByte(0x72); break;
         case RefType.Standalone: EmitByte(0x5a); break;
         }
     }
     if(t.type==TokenType.Local) {
         LocalVar var=locals[t.token];
         if(var.refid==0) AddError("Variable was not of type ref");
         else Emit((ushort)var.refid);
     } else if(t.type==TokenType.edid||t.type==TokenType.Global) {
         if(!edidRefs.ContainsKey(t.token)) {
             SubRecord sr=new SubRecord();
             sr.Name="SCRO";
             if(t.type==TokenType.edid) sr.SetData(TypeConverter.i2h(edidList[t.token].Key));
             else sr.SetData(TypeConverter.i2h(globals[t.token]));
             r.AddRecord(sr);
             refcount++;
             edidRefs[t.token]=(ushort)refcount;
         }
         Emit(edidRefs[t.token]);
     } else {
         AddError("Expected ref variable or edid");
     }
 }
开发者ID:robjer,项目名称:tesvsnip,代码行数:30,代码来源:ScriptCompiler.cs

示例11: CompileResultScript

        public static bool CompileResultScript(SubRecord sr, out Record r2, out string msg)
        {
            msg=null;
            r2=null;
            r=new Record();
            string script=sr.GetStrData();
            locals.Clear();
            localList.Clear();
            edidRefs.Clear();
            refcount=0;
            errors.Clear();

            ts=new TokenStream(script, errors);
            if(errors.Count>0) return OutputErrors(out msg);
            schr=new SubRecord();
            schr.Name="SCHR";
            r.AddRecord(schr);
            scda=new SubRecord();
            scda.Name="SCDA";
            r.AddRecord(scda);
            sr=(SubRecord)sr.Clone();
            r.AddRecord(sr);

            bw=new BinaryWriter(new MemoryStream());

            while(ts.PeekNextStatement().Length>0) {
                try {
                    HandleResultsBlock();
                } catch(Exception ex) {
                    return ReturnError(ex.Message, out msg);
                }
            }

            if(errors.Count>0) {
                return OutputErrors(out msg);
            }

            byte[] header=new byte[20];
            TypeConverter.si2h(refcount, header, 4);
            TypeConverter.i2h((uint)bw.BaseStream.Length, header, 8);
            TypeConverter.si2h(localList.Count, header, 12);
            TypeConverter.si2h(0x10000, header, 16);
            schr.SetData(header);
            byte[] compileddata=((MemoryStream)bw.BaseStream).GetBuffer();
            if(compileddata.Length!=bw.BaseStream.Length) Array.Resize<byte>(ref compileddata, (int)bw.BaseStream.Length);
            scda.SetData(compileddata);
            bw.Close();
            r2=r;
            return true;
        }
开发者ID:robjer,项目名称:tesvsnip,代码行数:50,代码来源:ScriptCompiler.cs

示例12: InnerLoop

        private LoopContext.LoopEvalResult InnerLoop(SubRecord[] subs, Dictionary<int, Conditional> conditions, LoopContext context)
        {
            while (true)
            {
                if (context.idx >= subs.Length || context.ssidx >= context.sss.Length)
                {
                    return LoopContext.LoopEvalResult.Success;
                }

                var ssb = context.sss[context.ssidx];
                var sb = subs[context.idx];
                if (ssb is SubrecordGroup)
                {
                    var sg = ssb as SubrecordGroup;
                    var newcontext = new LoopContext(context.idx, sg.elements);
                    LoopContext.LoopEvalResult result = this.InnerLoop(subs, conditions, newcontext);
                    if (context.idx == newcontext.idx)
                    {
                        if (ssb.optional > 0 || (ssb.repeat > 0 && context.matches > 0))
                        {
                            ++context.ssidx;
                            context.matches = 0;
                            continue;
                        }
                    }
                    else
                        if (result == LoopContext.LoopEvalResult.Success)
                        {
                            if (ssb.repeat == 0)
                            {
                                ++context.ssidx;
                            }
                            else
                            {
                                ++context.matches;
                            }

                            context.idx = newcontext.idx;
                            continue;
                        }

                    break;
                }
                else
                    if (ssb is SubrecordStructure)
                    {
                        var ss = (SubrecordStructure) ssb;
                        if (ss.Condition != CondType.None && !MatchRecordCheckCondition(conditions, ss))
                        {
                            ++context.ssidx;
                            continue;
                        }

                        if (sb.Name == ss.name && (ss.size == 0 || ss.size == sb.Size))
                        {
                            sb.AttachStructure(ss);
                            if (ss.ContainsConditionals)
                            {
                                foreach (var elem in this.EnumerateElements(sb))
                                {
                                    if (elem != null && elem.Structure != null)
                                    {
                                        var es = elem.Structure;
                                        if (es.CondID != 0)
                                        {
                                            conditions[es.CondID] = new Conditional(elem.Type, elem.Value);
                                        }
                                    }
                                }
                            }

                            ++context.idx;
                            if (ss.repeat == 0)
                            {
                                ++context.ssidx;
                                context.matches = 0;
                            }
                            else
                            {
                                // keep ss context and try again
                                ++context.matches;
                            }

                            continue;
                        }
                        else
                        {
                            if (ss.optional > 0 || (ss.repeat > 0 && context.matches > 0))
                            {
                                ++context.ssidx;
                                context.matches = 0;
                                continue;
                            }
                            else
                            {
                                // true failure
                                break;
                            }
                        }
                    }
//.........这里部分代码省略.........
开发者ID:rxantos,项目名称:tesv-snip,代码行数:101,代码来源:Record.cs

示例13: NewMediumLevelRecordEditor

        public NewMediumLevelRecordEditor(Plugin p, Record r, SubRecord sr, SubrecordStructure ss)
        {
            this.InitializeComponent();
            Icon = Resources.fosnip;
            SuspendLayout();
            this.sr = sr;
            this.ss = ss;
            this.p = p;
            this.r = r;

            // walk each element in standard fashion
            int panelOffset = 0;
            try
            {
                this.fpanel1.ColumnStyles[0] = new ColumnStyle(SizeType.Percent, 100.0f);
                int maxWidth = this.fpanel1.Width - SystemInformation.VerticalScrollBarWidth - 8;
                int leftOffset = 0; // 8;
                foreach (var elem in ss.elements)
                {
                    Control c = null;
                    if (elem.options != null && elem.options.Length > 1)
                    {
                        c = new OptionsElement();
                    }
                    else if (elem.flags != null && elem.flags.Length > 1)
                    {
                        c = new FlagsElement();
                    }
                    else
                    {
                        switch (elem.type)
                        {
                            case ElementValueType.LString:
                                c = new LStringElement();
                                break;
                            case ElementValueType.FormID:
                                c = new FormIDElement();
                                break;
                            case ElementValueType.Blob:
                                c = new HexElement();
                                break;
                            default:
                                c = new TextElement();
                                break;
                        }
                    }

                    if (c is IElementControl)
                    {
                        var ec = c as IElementControl;
                        ec.formIDLookup = p.GetRecordByID;
                        ec.formIDScan = p.EnumerateRecords;
                        ec.strIDLookup = p.LookupFormStrings;
                        ec.Element = elem;

                        if (elem.repeat > 0)
                        {
                            var ge = new RepeatingElement();
                            c = ge;
                            c.Left = leftOffset;
                            c.Width = maxWidth;
                            c.Top = panelOffset;
                            c.Anchor = c.Anchor | AnchorStyles.Left | AnchorStyles.Right;

                            ge.InnerControl = ec;
                            ge.Element = elem;
                            ec = ge;
                        }
                        else if (elem.optional > 0)
                        {
                            var re = new OptionalElement();
                            c = re;
                            c.Left = leftOffset;
                            c.Width = maxWidth;
                            c.Top = panelOffset;
                            c.Anchor = c.Anchor | AnchorStyles.Left | AnchorStyles.Right;

                            re.InnerControl = ec;
                            re.Element = elem;
                            ec = re;
                            c = re;
                        }
                        else
                        {
                            c.Left = leftOffset;
                            c.Width = maxWidth;
                            c.Top = panelOffset;
                            c.Anchor = c.Anchor | AnchorStyles.Left | AnchorStyles.Right;
                        }

                        this.controlMap.Add(elem, ec);
                        int idx = this.fpanel1.RowCount - 1;
                        this.fpanel1.Controls.Add(c, 0, idx);
                        var info = new RowStyle(SizeType.Absolute, c.Size.Height+2);
                        if (idx == 0)
                            this.fpanel1.RowStyles[0] = info;
                        else
                            this.fpanel1.RowStyles.Add(info);
                        panelOffset = 0;
                        ++this.fpanel1.RowCount;
//.........这里部分代码省略.........
开发者ID:Emilgardis,项目名称:falloutsnip,代码行数:101,代码来源:NewMediumLevelRecordEditor.cs

示例14: Match

 public override bool Match(Record r, SubRecord sr)
 {
     return this.Type == SearchCondRecordType.Exists ^ sr == null;
 }
开发者ID:figment,项目名称:tesvsnip,代码行数:4,代码来源:SearchSubrecord.cs

示例15: VisitGedcomx

            public override void VisitGedcomx(Gedcomx gx)
            {
                if (IsCensusRecord(gx))
                {
                    _parsingCensus = true;
                }

                _currentRecord = new SubRecord();
                _subrecords = new List<SubRecord>();

                base.VisitGedcomx(gx);

                if (_subrecords.Count > 0)
                {
                    int max = _subrecords.Max(x => x.GetLevel());

                    // Only export "full" rows, since the subrecord chaining has some incomplete records (e.g., the parent records)
                    foreach (SubRecord subrecord in _subrecords.Where(x => x.GetLevel() == max))
                    {
                        _rows.Add(subrecord.ToRow());
                    }
                }
                else
                {
                    //no subrecords; just add the record fields.
                    _rows.Add(_currentRecord.ToRow());
                }

                _parsingCensus = false;
                _currentRecord = null;
                _subrecords = null;
            }
开发者ID:Herbert42,项目名称:gedcomx-csharp,代码行数:32,代码来源:RecordHelper.cs


注:本文中的SubRecord类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。