Ejemplo n.º 1
0
        public void Break(BreakType type)
        {
            if (type == BreakType.Shutdown)
            {
                if (ServiceLocator.IsRegistered <CommandAsyncProcessor> ( ))
                {
                    foreach (CommandAsyncProcessor processor in ServiceLocator.RetrieveAll <CommandAsyncProcessor> ( ))
                    {
                        if (processor != null)
                        {
                            processor.Stop( );

                            processor.Dispose( );
                        }
                    }
                }

                if (ServiceLocator.IsRegistered <SettingsChangedNotifier> ( ))
                {
                    using (SettingsChangedNotifier configChangedNotifier = ServiceLocator.Retrieve <SettingsChangedNotifier> ( ))
                    {
                        configChangedNotifier.Enabled = false;
                    }
                }
            }
        }
Ejemplo n.º 2
0
 void IProcessBreak.Break(BreakType type)
 {
     if (JobManager != null)
     {
         JobManager.Stop();
     }
 }
Ejemplo n.º 3
0
        /* TODO: Support address masks and null address */
        public void SetBreakpoint(BreakType type, uint?address)
        {
            m64p_breakpoint breakpoint = new m64p_breakpoint
            {
                address = address.Value,
                endaddr = address.Value + 0x03,
                flags   = (uint)m64p_dbg_bkp_flags.M64P_BPT_FLAG_ENABLED
            };

            switch (type)
            {
            case BreakType.Read:
                breakpoint.flags |= (uint)m64p_dbg_bkp_flags.M64P_BPT_FLAG_READ;
                break;

            case BreakType.Write:
                breakpoint.flags |= (uint)m64p_dbg_bkp_flags.M64P_BPT_FLAG_WRITE;
                break;

            case BreakType.Execute:
                breakpoint.flags |= (uint)m64p_dbg_bkp_flags.M64P_BPT_FLAG_EXEC;
                break;
            }

            m64pDebugBreakpointCommand(m64p_dbg_bkp_command.M64P_BKP_CMD_ADD_STRUCT, 0, ref breakpoint);
        }
Ejemplo n.º 4
0
        private void FireBreakpointEvent(int bpt)
        {
            // bpt equal to -1 means we're stepping
            if ((bpt == -1) || (BreakpointHit == null))
            {
                return;
            }

            m64p_breakpoint breakpoint = new m64p_breakpoint();

            m64pDebugBreakpointCommand(m64p_dbg_bkp_command.M64P_BKP_CMD_GET_STRUCT, (uint)bpt, ref breakpoint);

            BreakType type = BreakType.Execute;

            if (CheckBreakpointFlag(ref breakpoint, m64p_dbg_bkp_flags.M64P_BPT_FLAG_READ))
            {
                type = BreakType.Read;
            }
            else if (CheckBreakpointFlag(ref breakpoint, m64p_dbg_bkp_flags.M64P_BPT_FLAG_WRITE))
            {
                type = BreakType.Write;
            }

            BreakpointHit(breakpoint.address, type);
        }
Ejemplo n.º 5
0
 /// <summary>
 /// Reads the XML base.
 /// </summary>
 /// <param name="reader">The reader.</param>
 protected override void ReadXmlBase(XmlReader reader)
 {
     if (reader == null)
     {
         throw new ArgumentNullException("reader");
     }
     if (reader.NodeType == ((XmlNodeType)((int)XmlNodeType.None)))
     {
         reader.Read();
     }
     if (reader.NodeType == ((XmlNodeType)((int)XmlNodeType.XmlDeclaration)))
     {
         reader.Read();
     }
     if (reader.NodeType == ((XmlNodeType)((int)XmlNodeType.Element)))
     {
         string str;
         if (((str = reader.Name) != null) && (str == "PageBreak"))
         {
             this.pageBreak = Serializer.ReadAttributeEnum <BreakType>("value", BreakType.None, reader);
         }
         else
         {
             base.ReadXmlBase(reader);
         }
     }
 }
Ejemplo n.º 6
0
 public void Break(BreakType type)
 {
     if (null != _clientSession)
     {
         _clientSession.ProcessCCancelRequest(_sessionProxy.MessageID);
     }
 }
Ejemplo n.º 7
0
    private static char smethod_25(Class394 A_0, CharacterFormat A_1)
    {
        int       num       = 4;
        BreakType lineBreak = BreakType.LineBreak;

        while (A_0.method_19())
        {
            string str = A_0.method_1();
            if (str != null)
            {
                if (!(str == BookmarkStart.b("帩唫席唯", num)))
                {
                    if (str == BookmarkStart.b("䤩䀫䬭儯䀱", num))
                    {
                        A_1.SetAttr(0x2d, Class860.smethod_11(A_0.method_3()));
                    }
                }
                else
                {
                    lineBreak = Class860.smethod_13(A_0.method_3());
                }
            }
        }
        return(smethod_26(lineBreak));
    }
Ejemplo n.º 8
0
        private void SetBreakpoint(uint address, BreakType breakType)
        {
            bool continueing = isContinue;

            if (continueing)
            {
                Stop();
            }

            switch (breakType)
            {
            case BreakType.Instruction:
                statusLabel.Text = $"Set instruction break point at {address:X8}";
                Interact(String.Format("Z0,{0:X8},4", address));
                listBoxBp.Items.Add($"INSTR: {address:X8}");
                break;

            case BreakType.Write:
                statusLabel.Text = $"Set write break point at {address:X8}";
                Interact(String.Format("Z2,{0:X8},4", address));
                listBoxBp.Items.Add($"WRITE: {address:X8}");
                break;

            case BreakType.Read:
                statusLabel.Text = $"Set read break point at {address:X8}";
                Interact(String.Format("Z3,{0:X8},4", address));
                listBoxBp.Items.Add($"READ : {address:X8}");
                break;
            }

            addressCollection.Add(textBoxBp.Text);
        }
Ejemplo n.º 9
0
 public void Break(BreakType type)
 {
     if (result != null && !result.IsCompleted)
     {
         result.Cancel();
     }
 }
Ejemplo n.º 10
0
        private void ValidateBreakType()
        {
            if (String.IsNullOrWhiteSpace(BreakType))
            {
                var guruMeditation = new BreakTypeNullException();
                guruMeditation.Data.Add(nameof(ExternalBreakRef), ExternalBreakRef);

                throw guruMeditation;
            }

            if (BreakType.Length < BreakConstants.MinimumBreakTypeLength)
            {
                var guruMeditation = new BreakTypeTooShortException();
                guruMeditation.Data.Add(nameof(ExternalBreakRef), ExternalBreakRef);

                throw guruMeditation;
            }

            // Check that the first two characters are would be long enough.
            // Optimiser uses just the first two character so they must be valid
            // in isolation.
            var prefix = BreakType.Substring(0, 2).Trim();

            if (prefix.Length < BreakConstants.MinimumBreakTypeLength)
            {
                var guruMeditation = new BreakTypePrefixTooShortException();
                guruMeditation.Data.Add(nameof(ExternalBreakRef), ExternalBreakRef);

                throw guruMeditation;
            }
        }
Ejemplo n.º 11
0
 public void Break(BreakType type)
 {
     if (CopyQueue != null)
     {
         CopyQueue.Dispose();
     }
 }
Ejemplo n.º 12
0
 public void Break(BreakType type)
 {
     if (JobManager != null)
     {
         JobManager.Stop();
     }
 }
Ejemplo n.º 13
0
        private void TimeClockAccess(int message, BreakType breakType)
        {
            bool result = viewModel.RegisterTimeClock(breakType);

            ShowMessage(message, result);
            Close();
        }
Ejemplo n.º 14
0
 public void Pause()
 {
     if (IsRunning == true)
     {
         _breakType           = BreakType.Break;
         BreakOnNextStatement = true;
     }
 }
Ejemplo n.º 15
0
 /// <param name="owner">Part that owns this break</param>
 /// <param name="problems">The type of problem</param>
 /// <param name="initialSeverity">The rate at which it causes a resource to be lost, if any.</param>
 /// <param name="severityMultiplier"></param>
 internal BrokenPart(Part owner, BreakType problem, float initialSeverity = -1, float severityMultiplier = 1.01f)
 {
     id = owner.GetHashCode();
     partName = owner.name;
     this.problems = problem;
     severity = initialSeverity;
     sevMult = severityMultiplier;
 }
 /// <summary>
 ///     Initializes a new instance of the <see cref="Contest"/> class.
 /// </summary>
 /// <param name="id">The contest id.</param>
 /// <externalUnit cref="breakType"/>
 /// <externalUnit cref="BreakType"/>
 /// <externalUnit cref="Candidate"/>
 /// <externalUnit cref="Contest"/>
 /// <externalUnit cref="OfficeText"/>
 /// <externalUnit cref="RectangleF"/>
 /// <revision revisor="dev11" date="12/19/2008" version="1.0.0.0">
 ///     Member Created
 /// </revision>
 public Contest(int id)
 {
     this.id         = id;
     this.texts      = new List <OfficeText>();
     this.candidates = new List <Candidate>();
     this.rectangle  = new RectangleF();
     this.breakType  = BreakType.None;
 }
Ejemplo n.º 17
0
        public void Break(BreakType type)
        {
            Instance = null;

            if (_serverWorker != null)
            {
                _serverWorker.Dispose();
            }
        }
Ejemplo n.º 18
0
 public void Break(BreakType type)
 {
     if (type == BreakType.Shutdown)
     {
         //
         // Cancel all pending jobs
         //
         Scheduler.CancelAll();
     }
 }
Ejemplo n.º 19
0
 public void StepOut()
 {
     if (IsRunning == true)
     {
         _stepMode            = StepMode.Out;
         _breakType           = BreakType.Break;
         BreakOnNextStatement = false;
         _event.Set();
     }
 }
Ejemplo n.º 20
0
 public void StepOver()
 {
     if (IsRunning == true)
     {
         _stepMode            = StepMode.Over;
         _breakType           = BreakType.Step;
         BreakOnNextStatement = true;
         _event.Set();
     }
 }
Ejemplo n.º 21
0
 public bool Insert(BreakType model)
 {
     try {
         using (var uow = _unitOfWorkFactory.Create()) {
             uow.BreakType.Insert(model);
             uow.SaveChanges();
             return(true);
         }
     } catch { return(false); }
 }
Ejemplo n.º 22
0
 public void Break(BreakType type)
 {
     try
     {
         if (null != _clientSession)
         {
             _clientSession.ProcessCCancelRequest(_messageId);
         }
     }
     catch {}
 }
Ejemplo n.º 23
0
        public void Break(BreakType type)
        {
            #region LOG
            {
                string message = @"Image Download - DownloadAddin::Break";

                Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined, DateTime.Now,
                                  LogType.Information, MessageDirection.None, message, null, null);
            }
            #endregion
        }
Ejemplo n.º 24
0
    private static char smethod_26(BreakType A_0)
    {
        switch (A_0)
        {
        case BreakType.PageBreak:
            return('\f');

        case BreakType.ColumnBreak:
            return('\x000e');
        }
        return('\v');
    }
Ejemplo n.º 25
0
        /// <summary>
        /// 启动调试进程
        /// </summary>
        /// <param name="script"></param>
        /// <param name="breakPoints"></param>
        private void ThreadProc(JintDebugInstance instance)
        {
            IsRunning = true;
            try
            {
                //_breakType = BreakType.Break;
                _breakType           = BreakType.Break;
                BreakOnNextStatement = true;

                _breakType           = BreakType.Step;
                BreakOnNextStatement = false;

                engine = new Engine(cfg => cfg.AllowClr(typeof(DataSet).Assembly).CatchClrExceptions().DebugMode());

                if (instance.InputJson != "")
                {
                    engine.SetValue("strjson", instance.InputJson);
                    engine.Execute("var model=JSON.parse(strjson);");
                }

                //增加一个excel帮助类
                //var excel = new JIntExcelHelepr();
                //engine.SetValue("excel", excel);

                foreach (var bp in instance.BreakPoints)
                {
                    engine.BreakPoints.Add(new BreakPoint(bp.Line, bp.Column));
                }
                var func = engine.Execute(instance.Script).GetValue("exec");
                engine.Break += Engine_Break;
                engine.Step  += Engine_Step;

                var result = func.Invoke().ToObject();
                if (this.OnEnd != null)
                {
                    this.OnEnd.Invoke(this, result);
                }
            }
            catch (JavaScriptException ex)
            {
                if (this.OnError != null)
                {
                    this.OnError.Invoke(this, ex);
                }
            }
            finally
            {
                engine    = null;
                IsRunning = false;
            }
        }
Ejemplo n.º 26
0
        public void Break(BreakType type)
        {
            try
            {
                if (null != __CFindScu)
                {
                    Cancelling = true;

                    __CFindScu.CancelRequest();
                }
            }
            catch
            { }
        }
Ejemplo n.º 27
0
 public static BreakTypeViewModel MToVM(BreakType model)
 {
     return(new BreakTypeViewModel()
     {
         ID = "" + model.id,
         Description = model.Description,
         CompanyID = model.CompanyID,
         OrderNumber = model.OrderNumber.Value,
         HexColor = model.HexColor,
         EnableTime = model.EnableTime.Value.ToString(),
         DisableTime = model.DisableTime.Value.ToString(),
         TimeLimit = model.TimeLimit.HasValue ? model.TimeLimit.Value : 0
     });
 }
Ejemplo n.º 28
0
        public void Break(BreakType type)
        {
            if (UpdateQueue != null)
            {
                UpdateQueue.Dispose();
                UpdateQueue = null;
            }

            if (RetryProcessor != null)
            {
                RetryProcessor.Stop();
                RetryProcessor = null;
            }
        }
Ejemplo n.º 29
0
    private static void smethod_24(Class581 A_0, CharacterFormat A_1)
    {
        int            num       = 0x12;
        BreakType      lineBreak = BreakType.LineBreak;
        LineBreakClear none      = LineBreakClear.None;
        bool           flag      = A_0.imethod_1().method_1().ToLower() == BookmarkStart.b("嬷䠹", 0x12);

        while (A_0.imethod_1().method_19())
        {
            string str = A_0.imethod_1().method_1();
            if (str != null)
            {
                if (!(str == BookmarkStart.b("䰷䌹䰻嬽", num)))
                {
                    if (str == BookmarkStart.b("嬷嘹夻弽㈿", num))
                    {
                        none = Class860.smethod_11(A_0.imethod_1().method_3());
                    }
                }
                else
                {
                    lineBreak = Class860.smethod_13(A_0.imethod_1().method_3());
                }
            }
        }
        Break @break = new Break(A_0.Interface50.imethod_0(), lineBreak);

        if (lineBreak == BreakType.LineBreak)
        {
            @break.TextRange.Text = BookmarkStart.b("㌷", num);
        }
        @break.ClearType = none;
        if (flag)
        {
            @break.IsCrBreak = true;
        }
        if (A_1 != null)
        {
            @break.TextRange.ApplyCharacterFormat(A_1);
        }
        if ((A_0.imethod_1().method_57() != null) && (A_0.imethod_1().method_57() is MergeField))
        {
            A_0.imethod_1().method_51().Append(Class816.string_27);
        }
        else
        {
            A_0.method_9(@break);
        }
    }
Ejemplo n.º 30
0
        public void Break(BreakType type)
        {
            #region LOG
            {
                string message = @"Image Download - Session Break";
                Logger.Global.Log(string.Empty, string.Empty, -1, string.Empty, string.Empty, -1, DicomCommandType.Undefined, DateTime.Now,
                                  LogType.Information, MessageDirection.None, message, null, null);
            }
            #endregion

            if (type == BreakType.Shutdown)
            {
                JobsService.ShutDown();
            }
        }
Ejemplo n.º 31
0
    private void OnEnable()
    {
        // Define when the editor opens
        tractionType = TractionType.none;
        speedType    = SpeedType.none;
        breakType    = BreakType.none;

        m_createVehicleIcon        = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/CreateVehicleIcon.png");
        m_engineSettingsIcon       = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/EngineSettingsIcon.png");
        m_bodySettingsIcon         = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/BodySettingsIcon.png");
        m_sedanTemplateIcon        = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/SedanTemplateIcon.png");
        m_JipTemplateIcon          = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/JipTemplateIcon.png");
        m_TruckTemplateIcon        = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/TruckTemplateIcon.png");
        m_BusTemplateIcon          = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/BusTemplateIcon.png");
        m_CustomEngineSettingsIcon = (Texture)AssetDatabase.LoadMainAssetAtPath("Assets/VehicleSystemFree/Icon/CustomVehicleIcon.png");
    }
Ejemplo n.º 32
0
		public BreakpointData(UInt64 offset, BreakType breakType, BreakpointFlags flags,
			DataBreakpointAccessTypes dkind, UInt32 dataSize, UInt32 procType,
			UInt32 matchThread, UInt32 id, UInt32 passCount, UInt32 currentPasscount, String command, String expr)
		{
			Offset = offset;
			Flags = flags;
			BreakType = breakType;
			DataBreakpointKind = dkind;
			DataSize = dataSize;
			ProcType = procType;
			MatchThread = matchThread;
			Id = id;
			PassCount = passCount;
			CurrentPassCount = currentPasscount;
			Command = command;
			Expression = expr;			
		}		
Ejemplo n.º 33
0
 /// <summary>
 /// Inserts a page, column, or section break.
 /// When you insert a page or column break, the break replaces the selection. If you don't want to replace the selection, use the Collapse method before using the InsertBreak method.
 /// </summary>
 /// <param name="type"></param>
 public void InsertBreak(BreakType type)
 {
     InternalObject.GetType().InvokeMember("InsertBreak", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, new object[] { type });
 }
Ejemplo n.º 34
0
 /**
  * Specifies that a break shall be placed at the current location in the run
  * content.
  * A break is a special character which is used to override the
  * normal line breaking that would be performed based on the normal layout
  * of the document's contents.
  * <p>
  * The behavior of this break character (the
  * location where text shall be restarted After this break) shall be
  * determined by its type values.
  * </p>
  * @see BreakType
  */
 public void AddBreak(BreakType type)
 {
     CT_Br br = run.AddNewBr();
     br.type = EnumConverter.ValueOf<ST_BrType, BreakType>(type);
 }
 /// <summary>
 /// When WorkTime radio button checked - change selected break type to WorkTimeBreak.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="e">Ignored.</param>
 private void _WorkTimeChecked(object sender, RoutedEventArgs e)
 {
     _selectedType = BreakType.WorkTime;
 }
 /// <summary>
 /// When TimeWindow radio button checked - change selected break type to TimeWindowBreak.
 /// </summary>
 /// <param name="sender">Ignored.</param>
 /// <param name="e">Ignored.</param>
 private void _TimeWindowChecked(object sender, RoutedEventArgs e)
 {
     _selectedType = BreakType.TimeWindow;
 }
Ejemplo n.º 37
0
		// 处理一条记录对应于一个<record>定义
		// container参数完全可能为null,这表示<record>为根元素
		// return:
		//		-1	出错
		//		0	正常返回
		int DoSingleItem(
			object objParam,
			XmlNode node,
			int nIndex,
			FilterItem container,
			string strData,
			string strNextName,
			out BreakType breakType,
			out string strError)
		{
			strError = "";
			breakType = BreakType.None;

			/*
			Debug.Assert(node != null, "node参数不能为null");

			HashFilterItem itemNode = (HashFilterItem)NodeTable[node];

			if (itemNode == null) 
			{
				Debug.Assert(false, "NodeTable中缺乏事项");
				return -1;
			}

			Debug.Assert(node == itemNode.xmlNode, "item成员xmlNode不正确");

			Type entryClassType = itemNode.FunctionType;

			if (entryClassType == null) 
			{
				Debug.Assert(false, itemNode.FunctionName + "没有预先填充Type");
				return -1;
			}

			// 把fltx.cs代码中的Batch层对象new,并保持
			// new一个Batch派生对象
			FilterItem itemHost = (FilterItem)entryClassType.InvokeMember(null, 
				BindingFlags.DeclaredOnly | 
				BindingFlags.Public | BindingFlags.NonPublic | 
				BindingFlags.Instance | BindingFlags.CreateInstance, null, null,
				null);
			*/
			// 创建一个新FilterItem对象
			FilterItem itemHost = NewFilterItem(
				objParam,
				node,
				out strError);
			if (itemHost == null)
				return -1;

			itemHost.Data = strData;
			itemHost.Index = nIndex;
			itemHost.Container = container;
			// itemHost.FilterRoot = container != null ? container : itemHost;
			itemHost.FilterRoot = GetRootFilterItem(itemHost);

			Debug.Assert(itemHost.FilterRoot != null, "itemHost.FilterRoot不应当==null");

			if (node.Name == "record") 
			{
                itemHost.NodeType = NodeType.Record;
				itemHost.Data = strData;
				itemHost.Name = "";
				itemHost.Content = strData;
			}
			else if (node.Name == "field")
			{
                itemHost.NodeType = NodeType.Field;
                itemHost.Data = strData;
				if (strData.Length < 3) 
				{
					strError = "字段全部数据长度不足3字符";
					goto ERROR1;
				}
				itemHost.Name = strData.Substring(0, 3);	// 这里要求调用本函数的,准备头标区这个特殊“字段”时,要加上'hdr'2字符在内容前面
				// control field  001-009没有子字段
				if (FilterItem.IsControlFieldName(itemHost.Name) == true)
				{
					itemHost.Indicator = "";
					itemHost.Content = strData.Substring(3);
				}
				else 
				{
                    if (strData.Length >= 5)
                    {
                        itemHost.Indicator = strData.Substring(3, 2);
                        itemHost.Content = strData.Substring(5);
                    }
                    else
                    {
                        // 2006/11/24
                        itemHost.Indicator = "";
                        itemHost.Content = "";
                    }

				}
			}
			else if (node.Name == "group") 
			{
                itemHost.NodeType = NodeType.Group;
                itemHost.Data = strData;
				itemHost.Name = "";
				itemHost.Content = strData;
			}
			else if (node.Name == "subfield")
			{
                itemHost.NodeType = NodeType.Subfield;
                itemHost.Data = strData;
				if (strData.Length < 1) 
				{
					strError = "子字段全部数据长度不足1字符";
					goto ERROR1;
				}
				itemHost.Name = strData.Substring(0, 1);
				itemHost.Content = strData.Substring(1);
			}

			itemHost.SetDupCount();
			itemHost.NextName = strNextName;
			if (itemHost.Container != null) 
			{
				itemHost.PrevName = itemHost.Container.LastChildName;	// 利用上次遗留的

				// 这一句有点多余。因为本函数返回后, 后面立即会做修改LastChildName的事情
				itemHost.Container.LastChildName = itemHost.Name;	// 保存这次的
			}

			itemHost.OnBegin();

			// 检查无意义的break设置情况
			if (CheckBreakException == true
				&& node.Name == "subfield"
				&& (itemHost.Break == BreakType.SkipCaseEnd
				|| itemHost.Break == BreakType.SkipCase) )
			{
				throw(new Exception("<subfield>元素内script代码中用Break = ???改变结构匹配流程无任何意义..."));
			}


			if (itemHost.Break == BreakType.SkipCaseEnd)
				goto SKIP1;	// 不做OnEnd()
			if (itemHost.Break == BreakType.SkipCase)
				goto SKIP;	// 不做OnBegin的兄弟case,但是要做OnEnd()


			// int i;
			int nRet;
			// XmlNode child = null;
			BreakType thisBreak = BreakType.None;

			// <record>希望下级是<field>
			if (node.Name == "record") 
			{
				// 切割记录为若干字段,匹配case
				for(int r=0;;r++) 
				{
					string strField;
					string strNextFieldName;

					// 从记录中得到一个字段
					// parameters:
					//		strMARC		MARC记录
					//		strFieldName	字段名。如果==null,表示任意字段
					//		nIndex		同名字段中的第几个。从0开始计算(0表示头标区)
					//		strField	[out]输出字段。包括字段名、必要的字段指示符、字段内容。不包含字段结束符。
					//					注意头标区当作一个字段返回,strField中不包含字段名,一上来就是头标区内容
					// return:
					//		-1	error
					//		0	not found
					//		1	found
					nRet = MarcDocument.GetField(strData,
						null,
						r,
						out strField,
						out strNextFieldName);
					if (nRet == -1)
					{
                        // 2009/11/1
                        if (String.IsNullOrEmpty(strData) == true)
                            break;

                        strError = "DoSingleItem() GetField() error";
						return -1;
					}
					if (nRet == 0)
						break;

					if (strField.Length < 3)
						goto SKIP;


					string strFieldName = "";
					if (r != 0)
						strFieldName = strField.Substring(0,3);
					else 
					{
						strFieldName = "hdr";
						strField = strFieldName + strField;
					}
                    // ***
                    itemHost.IncChildDupCount(strFieldName);

					// for(i=0;i<node.ChildNodes.Count;i++) 
                    foreach(XmlNode child in node.ChildNodes)
					{
						// child = node.ChildNodes[i];

						if (child.NodeType != XmlNodeType.Element)
							continue;

						if (child.Name != "field")
							continue;

						// 匹配字段名
						nRet = MatchName( strFieldName, DomUtil.GetAttr(child, "name"));
						if (nRet == 1) 
						{
							nRet = DoSingleItem(
								objParam,
								child,
								r,
								itemHost,
								strField,
								strNextFieldName,
								out thisBreak,
								out strError);
							if (nRet == -1)
								return -1;

							if (itemHost.Break != BreakType.None)
								break;
						}


					} // end of for

					itemHost.LastChildName = strFieldName;	// 保存这次的
					if (itemHost.Break != BreakType.None)
						goto SKIP;

				}

			}
			else if (node.Name == "field")
			{

				// 若下级为subfield
				string strFirstChildName = GetFirstChildElementType(node);
				// field下的subfield
				if (strFirstChildName == "subfield") 
				{
					// 切割记录为若干子字段,匹配case
					for(int s=0;;s++) 
					{
						string strSubfield;
						string strNextSubfieldName;

						// 从字段或组中得到一个子字段
						// parameters:
						//		strText		字段内容,或者子字段组内容。
						//		textType	表示strText中包含的是字段内容还是组内容。
						//		strSubfieldName	子字段名。如果==null,表示任意子字段
						//					形式为'a'这样的。
						//		nIndex			同名子字段中的第几个。从0开始计算。
						//		strSubfield		输出子字段。子字段名(1字符)、子字段内容。
						//		strNextSubfieldName	下一个子字段的名字,一个字符
						// return:
						//		-1	error
						//		0	not found
						//		1	found
						nRet = MarcDocument.GetSubfield(strData,
							ItemType.Field,
							null,
							s,
							out strSubfield,
							out strNextSubfieldName);
						if (nRet == -1)
						{
							strError = "GetSubfield() error";
							return -1;
						}
						if (nRet == 0)
							break;

						if (strSubfield.Length < 1)
							goto SKIP;

						string strSubfieldName = strSubfield.Substring(0,1);

                        // ***
                        itemHost.IncChildDupCount(strSubfieldName);

						// for(i=0;i<node.ChildNodes.Count;i++) 
                        foreach(XmlNode child in node.ChildNodes)
						{
							// child = node.ChildNodes[i];

							if (child.NodeType != XmlNodeType.Element)
								continue;

							if (child.Name != "subfield")
								continue;

							// 匹配子字段名
							nRet = MatchName( strSubfieldName,  DomUtil.GetAttr(child, "name"));
							if (nRet == 1) 
							{
								nRet = DoSingleItem(
									objParam,
									child, 
									s,
									itemHost,
									strSubfield,
									strNextSubfieldName,
									out thisBreak,
									out strError);
								if (nRet == -1)
									return -1;
								if (itemHost.Break != BreakType.None)
									break;

							}

						} // end of for

						itemHost.LastChildName = strSubfieldName;	// 保存这次的
						if (itemHost.Break != BreakType.None)
							goto SKIP;

					}
				}
				// field下嵌套的field
				if (strFirstChildName == "field") 
				{
					// 切割字符串为若干字段,匹配case
					for(int r=0;;r++) 
					{
						string strField;
						string strNextFieldName;

						// 从记录中得到一个字段
						// parameters:
						//		strMARC		MARC记录
						//		strFieldName	字段名。如果==null,表示任意字段
						//		nIndex		同名字段中的第几个。从0开始计算(0表示头标区)
						//		strField	[out]输出字段。包括字段名、必要的字段指示符、字段内容。不包含字段结束符。
						//					注意头标区当作一个字段返回,strField中不包含字段名,一上来就是头标区内容
						// return:
						//		-1	error
						//		0	not found
						//		1	found
						nRet = MarcDocument.GetNestedField(strData,
							null,
							r,
							out strField,
							out strNextFieldName);
						if (nRet == -1)
						{
							strError = "GetNestedField() error";
							return -1;
						}
						if (nRet == 0)
							break;

						if (strField.Length < 3)
							goto SKIP;


						string strFieldName = "";
						strFieldName = strField.Substring(0,3);

                        // ***
                        itemHost.IncChildDupCount(strFieldName);

						// 嵌套字段不存在头标区'hdr'字段问题?

						//for(i=0;i<node.ChildNodes.Count;i++) 
                        foreach(XmlNode child in node.ChildNodes)
						{
							//child = node.ChildNodes[i];

							if (child.NodeType != XmlNodeType.Element)
								continue;

							if (child.Name != "field")
								continue;

							// 匹配字段名
							nRet = MatchName( strFieldName, DomUtil.GetAttr(child, "name"));
							if (nRet == 1) 
							{
								nRet = DoSingleItem(
									objParam,
									child,
									r,
									itemHost,
									strField,
									strNextFieldName,
									out thisBreak,
									out strError);
								if (nRet == -1)
									return -1;
								if (itemHost.Break != BreakType.None)
									break;
							}


						} // end of for

						itemHost.LastChildName = strFieldName;	// 保存这次的
						if (itemHost.Break != BreakType.None)
							goto SKIP;

					}

				}

				// field 下的group
				else if (strFirstChildName == "group") 
				{
					// 切割记录为若干子字段,匹配case
					for(int g=0;;g++) 
					{
						string strGroup;

						// 从字段中得到子字段组
						// parameters:
						//		strGroup	[out]结果。
						// return:
						//		-1	error
						//		0	not found
						//		1	found
						nRet = MarcDocument.GetGroup(strData,
							g,
							out strGroup);
						if (nRet == -1)
						{
							strError = "GetGroup() error";
							return -1;
						}
						if (nRet == 0)
							break;

						string strGroupName = Convert.ToString(g);

                        // ***
                        itemHost.IncChildDupCount(strGroupName);

						// for(i=0;i<node.ChildNodes.Count;i++) 
                        foreach(XmlNode child in node.ChildNodes)
						{
							// child = node.ChildNodes[i];

							if (child.NodeType != XmlNodeType.Element)
								continue;

							if (child.Name != "group")
								continue;

							// 匹配组名
							nRet = MatchName( strGroupName,  DomUtil.GetAttr(child, "name"));
							if (true/*nRet == 1*/) 
							{
								nRet = DoSingleItem(
									objParam,
									child,
									g,
									itemHost,
									strGroup, 
									"",
									out thisBreak,
									out strError);
								if (nRet == -1)
									return -1;
								if (itemHost.Break != BreakType.None)
									break;

							}

						} // end of for

						itemHost.LastChildName = "";	// 保存这次的
						if (itemHost.Break != BreakType.None)
							goto SKIP;

					}
				}

			}
			else if (node.Name == "group")
			{
				// 若下级为subfield
				string strFirstChildName = GetFirstChildElementType(node);
				if (strFirstChildName != "subfield") 
				{
					strError = ".fltx中<group>下级必须为<subfield>元素";
					return -1;
				}


				// 切割记录为若干子字段,匹配case
				for(int s=0;;s++) 
				{
					string strSubfield;
					string strNextSubfieldName;

					// 从字段或组中得到一个子字段
					// parameters:
					//		strText		字段内容,或者子字段组内容。
					//		textType	表示strText中包含的是字段内容还是组内容。
					//		strSubfieldName	子字段名。如果==null,表示任意子字段
					//					形式为'a'这样的。
					//		nIndex			同名子字段中的第几个。从0开始计算。
					//		strSubfield		输出子字段。子字段名(1字符)、子字段内容。
					//		strNextSubfieldName	下一个子字段的名字,一个字符
					// return:
					//		-1	error
					//		0	not found
					//		1	found
					nRet = MarcDocument.GetSubfield(strData,
						ItemType.Group,
						null,
						s,
						out strSubfield,
						out strNextSubfieldName);
					if (nRet == -1)
					{
						strError = "GetSubfield() error";
						return -1;
					}
					if (nRet == 0)
						break;

					if (strSubfield.Length < 1)
						goto SKIP;

					string strSubfieldName = strSubfield.Substring(0,1);
                    // ***
                    itemHost.IncChildDupCount(strSubfieldName);

					// for(i=0;i<node.ChildNodes.Count;i++) 
                    foreach (XmlNode child in node.ChildNodes)
                    {
						// child = node.ChildNodes[i];

						if (child.NodeType != XmlNodeType.Element)
							continue;

						if (child.Name != "subfield")
							continue;

						// 匹配子字段名
						nRet = MatchName( strSubfieldName,  DomUtil.GetAttr(child, "name"));
						if (nRet == 1) 
						{
							nRet = DoSingleItem(
								objParam,
								child,
								s,
								itemHost,
								strSubfield,
								strNextSubfieldName,
								out thisBreak,
								out strError);
							if (nRet == -1)
								return -1;
							if (itemHost.Break != BreakType.None)
								break;

						}

					} // end of for

					itemHost.LastChildName = strSubfieldName;	// 保存这次的
					if (itemHost.Break != BreakType.None)
						goto SKIP;


				}

			}			
			else if (node.Name == "subfield")
			{
				// 暂时没有什么处理

			}

			SKIP:

				if (itemHost.Break != BreakType.SkipCaseEnd) 
				{
					itemHost.OnEnd();
				}

           
			SKIP1:

				/*
				if (itemHost.Break != BreakType.None)
					return 1;
				*/

				breakType = itemHost.Break;

			return 0;

			ERROR1:
				return -1;
		}
Ejemplo n.º 38
0
 internal void UpdateProblems(BrokenPart.BreakType updatedProblems)
 {
     problems |= updatedProblems;
 }