protected void CoreProcessRequest()
        {
            try {
                bool transacted = protocol.MethodAttribute.TransactionEnabled;
                if (protocol.IsOneWay)
                {
                    WorkItemCallback callback       = null;
                    TraceMethod      callbackMethod = null;
                    if (protocol.OnewayInitException != null)
                    {
                        callback       = new WorkItemCallback(this.ThrowInitException);
                        callbackMethod = Tracing.On ? new TraceMethod(this, "ThrowInitException") : null;
                    }
                    else
                    {
                        parameters     = protocol.ReadParameters();
                        callback       = transacted ? new WorkItemCallback(this.OneWayInvokeTransacted) : new WorkItemCallback(this.OneWayInvoke);
                        callbackMethod = Tracing.On ? transacted ? new TraceMethod(this, "OneWayInvokeTransacted") : new TraceMethod(this, "OneWayInvoke") : null;
                    }

                    if (Tracing.On)
                    {
                        Tracing.Information(Res.TracePostWorkItemIn, callbackMethod);
                    }
                    WorkItem.Post(callback);
                    if (Tracing.On)
                    {
                        Tracing.Information(Res.TracePostWorkItemOut, callbackMethod);
                    }

                    protocol.WriteOneWayResponse();
                }
                else if (transacted)
                {
                    parameters = protocol.ReadParameters();
                    InvokeTransacted();
                }
                else
                {
                    parameters = protocol.ReadParameters();
                    Invoke();
                }
            }
            catch (Exception e) {
                if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                {
                    throw;
                }
                if (Tracing.On)
                {
                    Tracing.ExceptionCatch(TraceEventType.Error, this, "CoreProcessRequest", e);
                }
                if (!protocol.IsOneWay)
                {
                    WriteException(e);
                }
            }

            TraceFlush();
        }
Example #2
0
        private void Close()
        {
            if (this.notifySink != null && connection != null)
            {
                lock (InternalSyncObject) {
                    if (this.notifySink != null && connection != null)
                    {
                        TraceMethod method = Tracing.On ? new TraceMethod(this, "Close") : null;
                        if (Tracing.On)
                        {
                            Tracing.Enter("RemoteDebugger", method);
                        }

                        try {
                            UnsafeNativeMethods.UnregisterNotifySource(connection, this);
                        }
                        catch (Exception e) {
                            if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                            {
                                throw;
                            }
                            if (Tracing.On)
                            {
                                Tracing.ExceptionCatch(TraceEventType.Warning, method, e);
                            }
                        }
                        if (Tracing.On)
                        {
                            Tracing.Exit("RemoteDebugger", method);
                        }
                        this.notifySink = null;
                    }
                }
            }
        }
Example #3
0
        static void Main(string[] args)
        {
            //if test one case can open the log to console
            TraceMethod.SetDefaultTraceType(new TraceMethod.TraceType[] { TraceMethod.TraceType.CONCOLE, TraceMethod.TraceType.FILE });
            //TraceMethod.SetDefaultTraceType(new TraceMethod.TraceType[] { TraceMethod.TraceType.FILE });
            int cmd = 0;

            Console.WriteLine("input the test case number (0 then quit; 111 then run all cases):");

            do
            {
                cmd = 4;//*111;/*/int.Parse(Console.ReadLine());
                //cmd = Convert.ToInt16(Console.ReadLine());
                if (cmd == 111)
                {
                    TestCaseParser.RunAllTestCase();
                }
                else if (cmd.Equals(0))
                {
                    break;
                }
                else if (TestCaseParser.IsTestCaseExist(cmd))
                {
                    TestCaseParser.RunTestCase(cmd);
                }
                else
                {
                    Console.WriteLine($"input {cmd} is invalid!");
                }
                TestCaseParser.Report();
                Console.ReadLine();
                Console.WriteLine("请输入需要执行的用例编号,退出输入“0”:");
            } while(true);
        }
        protected IAsyncResult BeginCoreProcessRequest(AsyncCallback callback, object asyncState)
        {
            IAsyncResult asyncResult;

            if (protocol.MethodAttribute.TransactionEnabled)
            {
                throw new InvalidOperationException(Res.GetString(Res.WebAsyncTransaction));
            }

            parameters = protocol.ReadParameters();
            if (protocol.IsOneWay)
            {
                TraceMethod callbackMethod = Tracing.On ? new TraceMethod(this, "OneWayAsyncInvoke") : null;
                if (Tracing.On)
                {
                    Tracing.Information(Res.TracePostWorkItemIn, callbackMethod);
                }
                WorkItem.Post(new WorkItemCallback(this.OneWayAsyncInvoke));
                if (Tracing.On)
                {
                    Tracing.Information(Res.TracePostWorkItemOut, callbackMethod);
                }
                asyncResult = new CompletedAsyncResult(asyncState, true);
                if (callback != null)
                {
                    callback(asyncResult);
                }
            }
            else
            {
                asyncResult = BeginInvoke(callback, asyncState);
            }
            return(asyncResult);
        }
Example #5
0
        public override object Read(WebResponse response, Stream responseStream)
        {
            object obj3;

            try
            {
                if (response == null)
                {
                    throw new ArgumentNullException("response");
                }
                if (!ContentType.MatchesBase(response.ContentType, "text/xml"))
                {
                    throw new InvalidOperationException(Res.GetString("WebResultNotXml"));
                }
                Encoding     encoding   = RequestResponseUtils.GetEncoding(response.ContentType);
                StreamReader textReader = new StreamReader(responseStream, encoding, true);
                TraceMethod  caller     = Tracing.On ? new TraceMethod(this, "Read", new object[0]) : null;
                if (Tracing.On)
                {
                    Tracing.Enter(Tracing.TraceId("TraceReadResponse"), caller, new TraceMethod(this.xmlSerializer, "Deserialize", new object[] { textReader }));
                }
                object obj2 = this.xmlSerializer.Deserialize(textReader);
                if (Tracing.On)
                {
                    Tracing.Exit(Tracing.TraceId("TraceReadResponse"), caller);
                }
                obj3 = obj2;
            }
            finally
            {
                response.Close();
            }
            return(obj3);
        }
 /// <include file='doc\XmlReturnReader.uex' path='docs/doc[@for="XmlReturnReader.Read"]/*' />
 public override object Read(WebResponse response, Stream responseStream)
 {
     try {
         if (response == null)
         {
             throw new ArgumentNullException("response");
         }
         if (!ContentType.MatchesBase(response.ContentType, ContentType.TextXml))
         {
             throw new InvalidOperationException(Res.GetString(Res.WebResultNotXml));
         }
         Encoding     e      = RequestResponseUtils.GetEncoding(response.ContentType);
         StreamReader reader = new StreamReader(responseStream, e, true);
         TraceMethod  caller = Tracing.On ? new TraceMethod(this, "Read") : null;
         if (Tracing.On)
         {
             Tracing.Enter(Tracing.TraceId(Res.TraceReadResponse), caller, new TraceMethod(xmlSerializer, "Deserialize", reader));
         }
         object returnValue = xmlSerializer.Deserialize(reader);
         if (Tracing.On)
         {
             Tracing.Exit(Tracing.TraceId(Res.TraceReadResponse), caller);
         }
         return(returnValue);
     }
     finally {
         response.Close();
     }
 }
Example #7
0
        internal IHttpHandler CoreGetHandler(Type type, HttpContext context, HttpRequest request, HttpResponse response)
        {
            TraceMethod method = Tracing.On ? new TraceMethod(this, "CoreGetHandler", new object[0]) : null;

            ServerProtocolFactory[] serverProtocolFactories = this.GetServerProtocolFactories();
            ServerProtocol          protocol = null;
            bool abortProcessing             = false;

            for (int i = 0; i < serverProtocolFactories.Length; i++)
            {
                try
                {
                    protocol = serverProtocolFactories[i].Create(type, context, request, response, out abortProcessing);
                    if (((protocol != null) && (protocol.GetType() != typeof(UnsupportedRequestProtocol))) || abortProcessing)
                    {
                        break;
                    }
                }
                catch (Exception exception)
                {
                    if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
                    {
                        throw;
                    }
                    throw Tracing.ExceptionThrow(method, new InvalidOperationException(Res.GetString("FailedToHandleRequest0"), exception));
                }
            }
            if (abortProcessing)
            {
                return(new NopHandler());
            }
            if (protocol == null)
            {
                if ((request.PathInfo != null) && (request.PathInfo.Length != 0))
                {
                    throw Tracing.ExceptionThrow(method, new InvalidOperationException(Res.GetString("WebUnrecognizedRequestFormatUrl", new object[] { request.PathInfo })));
                }
                throw Tracing.ExceptionThrow(method, new InvalidOperationException(Res.GetString("WebUnrecognizedRequestFormat")));
            }
            if (protocol is UnsupportedRequestProtocol)
            {
                throw Tracing.ExceptionThrow(method, new HttpException(((UnsupportedRequestProtocol)protocol).HttpCode, Res.GetString("WebUnrecognizedRequestFormat")));
            }
            bool isAsync       = protocol.MethodInfo.IsAsync;
            bool enableSession = protocol.MethodAttribute.EnableSession;

            if (isAsync)
            {
                if (enableSession)
                {
                    return(new AsyncSessionHandler(protocol));
                }
                return(new AsyncSessionlessHandler(protocol));
            }
            if (enableSession)
            {
                return(new SyncSessionHandler(protocol));
            }
            return(new SyncSessionlessHandler(protocol));
        }
Example #8
0
        private void ImportSerializers(SoapReflectedMethod soapMethod, Evidence serverEvidence)
        {
            XmlMapping[] mappings = this.GetXmlMappingsForMethod(soapMethod).ToArray();
            TraceMethod  caller   = Tracing.On ? new TraceMethod(this, "ImportSerializers", new object[0]) : null;

            if (Tracing.On)
            {
                Tracing.Enter(Tracing.TraceId("TraceCreateSerializer"), caller, new TraceMethod(typeof(XmlSerializer), "FromMappings", new object[] { mappings, serverEvidence }));
            }
            XmlSerializer[] serializerArray = null;
            if (AppDomain.CurrentDomain.IsHomogenous)
            {
                serializerArray = XmlSerializer.FromMappings(mappings);
            }
            else
            {
                serializerArray = XmlSerializer.FromMappings(mappings, serverEvidence);
            }
            if (Tracing.On)
            {
                Tracing.Exit(Tracing.TraceId("TraceCreateSerializer"), caller);
            }
            int num = 0;

            this.parameterSerializer = serializerArray[num++];
            if (soapMethod.responseMappings != null)
            {
                this.returnSerializer = serializerArray[num++];
            }
            this.inHeaderSerializer = serializerArray[num++];
            if (soapMethod.outHeaderMappings != null)
            {
                this.outHeaderSerializer = serializerArray[num++];
            }
        }
Example #9
0
        public override XmlVisitor GetVariantXmlNode()
        {
            XmlVisitor variant1 = XmlVisitor.Create("Variant", null);

            {//BMGR-0040 //BMGR-0030
                variant1.AppendChild("Index", m_Idx);
                variant1.AppendChild("Type", string.Format("POINT_{0}", PointVariantPos[0]));
                variant1.AppendChild("Object_name", string.Format("{0}_{1}", m_pt.Point.Name, PointVariantPos[0]));
            }

            //BMGR-0041 //BMGR-0031
            if (-1 != InputRank)
            {
                variant1.AppendChild("Input_rank", InputRank);
            }
            else if (-1 != value)
            {
                variant1.AppendChild("Value", value);
            }
            else
            {
                TraceMethod.RecordInfo($"Point[{m_pt.Info}] not in IBBM input and can't calculate value, log Error!");
            }
            return(variant1);
        }
Example #10
0
        /// <summary>
        /// set the cell value and style.
        /// now set style of each cell, has not found the method of set col or row style
        /// </summary>
        /// <param name="row"></param>
        /// <param name="col"></param>
        /// <param name="val"></param>
        /// <param name="daseed">if the cell has dash line</param>
        /// <param name="background">if the cell has background</param>
        private void setcellvaluestyle(IRow row, int col, string val, bool daseed = false)
        {
            ICell cell = row.GetCell(col);

            if (null == cell)
            {
                cell = row.CreateCell(col);
            }

            if (true == daseed)
            {
                cell.CellStyle = dashstyle;
            }
            else
            {
                if (colstyles.ContainsKey(col))
                {
                    cell.CellStyle = colstyles[col];
                }
                else
                {
                    TraceMethod.RecordInfo($"get no cellstyle of col{col}");
                }
            }
            cell.SetCellValue(val);
        }
Example #11
0
        private string bitStrTohexStr(string bitStr)
        {
            if (0 != bitStr.Length % 8)
            {
                TraceMethod.RecordInfo($"Error: generate BM Message len={bitStr.Length} % 8 != 0, which is invalid!");
            }
            System.Text.RegularExpressions.CaptureCollection cs =
                System.Text.RegularExpressions.Regex.Match(bitStr, @"([01]{8})+").Groups[1].Captures;
            //byte[] byteList = new byte[cs.Count];

            byteList = new byte[cs.Count];

            string hexBuff = "";

            for (int i = 0; i < cs.Count; ++i)
            {
                byteList[i] = Convert.ToByte(cs[i].Value, 2);
                hexBuff    += Convert.ToString(byteList[i], 16).ToUpper().PadLeft(2, '0') + " ";
            }

            //AfterCoding = new byte[128];
            //ScrambleTel(byteList, AfterCoding);

            hexBuff = hexBuff.Remove(hexBuff.Length - 1, 1);
            return(hexBuff);
        }
Example #12
0
 private bool AddNewRoute(bool isSplitRoute, RouteSegment rs)
 {
     if (isSplitRoute == true)
     {
         if (rs.m_PtLst.Count > 0)
         {
             TraceMethod.Record(TraceMethod.TraceKind.ERROR, $"sydb split route[{rs.Info}] should has no point, this route will ignore\n");
             return(false);
         }
         if (null == m_Spacing_routeLst.Find(x => (x.m_OrgSig.ID == rs.m_OrgSig.ID &&
                                                   x.m_BlkLst.Count == rs.m_BlkLst.Count && x.m_BlkLst.All(rs.m_BlkLst.Contains))))
         {
             m_Spacing_routeLst.Add(rs);
         }
         else
         {
             TraceMethod.RecordInfo($"Warning: split route[{rs.Info}] is repeated, ignore the repeat ones!\r\n");
         }
     }
     else
     {
         if (null == m_RouteSpacing_routeLst.Find(x => (x.m_OrgSig.ID == rs.m_OrgSig.ID &&
                                                        x.m_BlkLst.Count == rs.m_BlkLst.Count && x.m_BlkLst.All(rs.m_BlkLst.Contains))))
         {
             m_RouteSpacing_routeLst.Add(rs);
         }
         else
         {
             TraceMethod.RecordInfo($"Warning: route[{rs.Info}] is repeated, ignore the repeat ones!\r\n");
         }
     }
     return(true);
 }
Example #13
0
        /// <include file='doc\WebServiceHandlerFactory.uex' path='docs/doc[@for="WebServiceHandlerFactory.GetHandler"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public IHttpHandler GetHandler(HttpContext context, string verb, string url, string filePath)
        {
            TraceMethod method = Tracing.On ? new TraceMethod(this, "GetHandler") : null;

            if (Tracing.On)
            {
                Tracing.Enter("IHttpHandlerFactory.GetHandler", method, Tracing.Details(context.Request));
            }

            new AspNetHostingPermission(AspNetHostingPermissionLevel.Minimal).Demand();
            //if (CompModSwitches.Remote.TraceVerbose) DumpRequest(context);
            //System.Diagnostics.Debugger.Break();
#if DEBUG
            if (CompModSwitches.Remote.TraceVerbose)
            {
                DumpRequest(context);
            }
#endif

            Type         type    = GetCompiledType(url, context);
            IHttpHandler handler = CoreGetHandler(type, context, context.Request, context.Response);

            if (Tracing.On)
            {
                Tracing.Exit("IHttpHandlerFactory.GetHandler", method);
            }

            return(handler);
        }
Example #14
0
        public List <IBeaconInfo> GetBeacons()
        {
            List <IBeaconInfo> list = new List <IBeaconInfo>();

            list.AddRange(beaconInfoList);
            list.AddRange(boundBeaconInfoList);

            List <string> beaconnames = (from beacon in list
                                         select beacon.Name).ToList <string>();

            string buff = "The beaconnames from layout.csv and boundarybeacons.xml is repeated, please modify";

            if (false == checkRepeat(beaconnames,ref buff))   // no repeat return true else false.
            {
                TraceMethod.Record(TraceMethod.TraceKind.ERROR,buff);
            }
            list = list.GroupBy(p => p.Name).Select(g => g.First()).ToList();

            List <string> ids = (from beacon in list select beacon.ID.ToString()).ToList <string>();

            buff = "The IDs from layout.csv and boundarybeacons.xml is repeated, please modify";
            if (false == checkRepeat(ids,ref buff))
            {
                TraceMethod.Record(TraceMethod.TraceKind.ERROR,buff);
            }
            return(list.GroupBy(p => p.ID).Select(g => g.First()).ToList());
        }
 protected IAsyncResult BeginCoreProcessRequest(AsyncCallback callback, object asyncState)
 {
     if (this.protocol.MethodAttribute.TransactionEnabled)
     {
         throw new InvalidOperationException(Res.GetString("WebAsyncTransaction"));
     }
     this.parameters = this.protocol.ReadParameters();
     if (this.protocol.IsOneWay)
     {
         TraceMethod method = Tracing.On ? new TraceMethod(this, "OneWayAsyncInvoke", new object[0]) : null;
         if (Tracing.On)
         {
             Tracing.Information("TracePostWorkItemIn", new object[] { method });
         }
         WorkItem.Post(new WorkItemCallback(this.OneWayAsyncInvoke));
         if (Tracing.On)
         {
             Tracing.Information("TracePostWorkItemOut", new object[] { method });
         }
         IAsyncResult ar = new CompletedAsyncResult(asyncState, true);
         if (callback != null)
         {
             callback(ar);
         }
         return(ar);
     }
     return(this.BeginInvoke(callback, asyncState));
 }
        internal override bool Initialize()
        {
            this.serverType = (DocumentationServerType)base.GetFromCache(typeof(DocumentationServerProtocol), base.Type);
            if (this.serverType == null)
            {
                lock (ServerProtocol.InternalSyncObject)
                {
                    this.serverType = (DocumentationServerType)base.GetFromCache(typeof(DocumentationServerProtocol), base.Type);
                    if (this.serverType == null)
                    {
                        string uri = Uri.EscapeUriString(base.Request.Url.ToString()).Replace("#", "%23");
                        this.serverType = new DocumentationServerType(base.Type, uri);
                        base.AddToCache(typeof(DocumentationServerProtocol), base.Type, this.serverType);
                    }
                }
            }
            WebServicesSection current = WebServicesSection.Current;

            if ((current.WsdlHelpGenerator.Href != null) && (current.WsdlHelpGenerator.Href.Length > 0))
            {
                TraceMethod caller = Tracing.On ? new TraceMethod(this, "Initialize", new object[0]) : null;
                if (Tracing.On)
                {
                    Tracing.Enter("ASP.NET", caller, new TraceMethod(typeof(PageParser), "GetCompiledPageInstance", new object[] { current.WsdlHelpGenerator.HelpGeneratorVirtualPath, current.WsdlHelpGenerator.HelpGeneratorPath, base.Context }));
                }
                this.handler = this.GetCompiledPageInstance(current.WsdlHelpGenerator.HelpGeneratorVirtualPath, current.WsdlHelpGenerator.HelpGeneratorPath, base.Context);
                if (Tracing.On)
                {
                    Tracing.Exit("ASP.NET", caller);
                }
            }
            return(true);
        }
Example #17
0
        /// <summary>
        /// 生成数据
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void progressBar1_Click(object sender, EventArgs e)
        {
            if (true == IsBusy)
            {
                return;
            }
            IsBusy = true;
            //show the log tab
            this.tags.SelectedTab = tabPageLog;

            //update the interface
            GenProess(100, 0);
            TraceMethod.RecordInfo("Start to generate, please wait....");

            if (Program.AUTOTEST)
            {//if for test, do it directly
                Generate();
            }
            else
            {
                //create a new thread to do the generate
                Thread doGenerate = new Thread(Generate);
                doGenerate.Start();
            }
        }
Example #18
0
        private static void CloseSharedResources()
        {
            if (connection != null)
            {
                lock (InternalSyncObject) {
                    if (connection != null)
                    {
                        TraceMethod method = Tracing.On ? new TraceMethod(typeof(RemoteDebugger), "CloseSharedResources") : null;
                        if (Tracing.On)
                        {
                            Tracing.Enter("RemoteDebugger", method);
                        }

                        try {
                            Marshal.ReleaseComObject(connection);
                        }
                        catch (Exception e) {
                            if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException)
                            {
                                throw;
                            }
                            if (Tracing.On)
                            {
                                Tracing.ExceptionCatch(TraceEventType.Warning, typeof(RemoteDebugger), "CloseSharedResources", e);
                            }
                        }
                        if (Tracing.On)
                        {
                            Tracing.Exit("RemoteDebugger", method);
                        }
                        connection = null;
                    }
                }
            }
        }
Example #19
0
        public override bool Generate(object outputpath)
        {
            //chapter 4
            string path = (string)outputpath + "\\BMV";

            Sys.NewEmptyPath(path);

            if (!GenrateDeviceByIBBM())
            {
                TraceMethod.RecordInfo("GenrateDeviceByIBBM error!");
                return(false);
            }

            if (!GenerateBeaconData())
            {
                TraceMethod.RecordInfo("GenerateBeaconData error!");
                return(false);
            }

            //BMGR-0014 generate block_mode_variants_file for all beacons in a line
            string filename = string.Format("{0}\\block_mode_variants_file.xml", path);

            if (!GenerateBMVFile(filename))
            {
                TraceMethod.RecordInfo("Generate block_mode_variants_file.xml error!");
                return(false);
            }

            TraceMethod.RecordInfo("[Steps 4-2]:BMGenTool BMVFGen run completed!");
            return(true);
        }
Example #20
0
        //in this func use class member BFGen.isITC
        private bool GenBeaconXMLFile(IBeaconInfo beacon, string filename)
        {
            Balise xmlFile = new Balise();

            //BMGR-0002
            xmlFile.name = new StringData(beacon.Name);

            //BMGR-0003
            xmlFile.Telegram.type = new StringData("LONG");

            //Telegram get
            if (isITC)
            {//BMGR-0004
                TraceMethod.RecordInfo("error:iTC not support now!");
                xmlFile.Telegram.Value = new StringData("iTC not support");
            }
            else
            {
                BeaconMessage bm = new BeaconMessage();
                xmlFile.Telegram.Value = new StringData(bm.GenerateMessage(beacon, sydb.LineID));
            }

            FileSerializer.Serialize(xmlFile, filename, AddLogHead());
            return(true);
        }
Example #21
0
        //BMGR-0022
        public bool GetRouteSegments(RouteSegConfig SyDBRouteCfg,GENERIC_SYSTEM_PARAMETERS.IMPLEMENTATION_BEACON_BLOCK_MODE.BM_BEACON beaconIbbm)
        {
            //use SigTypeFunc instead of Type_function, the values are similar
            if (Sys.TYPEFUNC_SPACING == SignalInfo.Signal_Type_Function)
            {
                UpdateRsList(SyDBRouteCfg.m_Spacing_routeLst,beaconIbbm);
                if (1 != RsList.Count())
                {
                    TraceMethod.RecordInfo($"Original Signal[{SignalInfo.Info}] find routesegment error, the route num={RsList.Count()} of Spacing Signal should be 1!");
                    return(false);
                }
            }
            else if (Sys.TYPEFUNC_ROUTESPACING == SignalInfo.Signal_Type_Function)
            {
                UpdateRsList(SyDBRouteCfg.m_RouteSpacing_routeLst,beaconIbbm);
                if (RsList.Count() < 1 || RsList.Count() > 10)
                {
                    TraceMethod.RecordInfo($"Original Signal[{SignalInfo.Info}] find routesegment error, the route num={RsList.Count()} of Route Spacing Signal should be [1,10]!");
                    return(false);
                }
            }
            else
            {
                TraceMethod.RecordInfo($"Original Signal[{SignalInfo.Info}] SigTypeFunc={SignalInfo.Signal_Type_Function} is unknow!");
                return(false);
            }

            return(true);
        }
Example #22
0
        public bool generateRouteSegments()
        {
            //BMGR-0022 if more than one route, should be ordered by ID increase.
            List <GENERIC_SYSTEM_PARAMETERS.ROUTES.ROUTE> orderRouteList = Sydb.routeInfoList.OrderBy(o => (int)o.ID).ToList();

            foreach (GENERIC_SYSTEM_PARAMETERS.ROUTES.ROUTE route in orderRouteList)
            {
                if (false == route.IsValidBMRoute())
                {
                    continue;
                }

                //this is a RouteSpacing route
                if (null == route.Spacing_Signal_ID_List.Signal_ID || 0 == route.Spacing_Signal_ID_List.Signal_ID.Count)
                {
                    try
                    {
                        RouteSegment rs = new RouteSegment(route);
                        AddNewRoute(false, rs);
                    }
                    catch (Exception ex)
                    {
                        TraceMethod.RecordInfo(ex.Message);
                    }
                }
                else if (0 < route.Spacing_Signal_ID_List.Signal_ID.Count) //split the route to 1 RouteSpacing route and 1 or more Spacing route
                {                                                          //after BMGR-0022: split the route which has spacing signals
                    splitRoute(route);
                }
            }
            return(true);
        }
Example #23
0
        //BMGR-0066
        private string GetSwitchPos()
        {
            string sp = "";

            if (null == m_Ol)
            {
                return(sp);
            }
            switch ((string)m_Ol.Overlap_Type)
            {
            case "Not Interlocked":
            case "Reduce":
            case "":
                break;

            case "CBI Critical Normal":
                sp = "Normal";
                break;

            case "CBI Critical Reverse":
                sp = "Reverse";
                break;

            case "CBI Preferred Normal":
            case "CBI Preferred Reverse":
                sp = "Either";
                break;

            default:
                TraceMethod.Record(TraceMethod.TraceKind.WARNING,$"Invalid OverlapType in sydb [{m_Ol.Overlap_Type}]");
                break;
            }
            return(sp);
        }
Example #24
0
        public override bool Generate(object outputpath)
        {
            string path = (string)outputpath + "\\LEU";

            Sys.NewEmptyPath(path);

            string filename = string.Format("{0}\\LEU_Result_Filtered_Values.xml", path);
            bool   isGen    = GenerateLEUResultFilterFile(filename);

            if (!isGen)
            {
                TraceMethod.RecordInfo("Generate LEU Result Filtered Value file error!");
                return(false);
            }
            #region [THFDebug]
            if (BMGenTest.Program.GenerateTJFormat)
            {
                if (GenBasciXml(filename, path))
                {
                    TraceMethod.RecordInfo("Generate basic_beacons.xml file successfully!");
                }
                else
                {
                    TraceMethod.RecordInfo("Generate basic_beacons.xml file error!");
                }
            }
            #endregion
            TraceMethod.RecordInfo("[Steps 4-3]:BMGenTool Generate LEU Result Filtered Value file run completed!");
            return(true);
        }
Example #25
0
        /// <summary>
        /// get values from input data
        /// and set the values in member processData for write to excel
        /// </summary>
        /// <param name="leulist"></param>
        /// <param name="data">data in LEU_Result_Filtered_Values.xml</param>
        /// <param name="msgfiledir">path of LEUBinary which include all TGM files of all LEUs</param>
        /// <returns></returns>
        private void getdataprocess(List <LEU> leulist, List <LEU_filtered_values.leu> data, string msgfiledir)
        {
            if (null == leulist || 0 == leulist.Count)
            {
                return;
            }
            var groupedList = leulist.GroupBy(r => r.CI_Name);//1 sheet == 1 CI area

            foreach (var group in groupedList)
            {
                List <List <string> > pagedata = new List <List <string> >();//one page has leus in same group
                if (null != data)
                {
                    foreach (LEU leuname in group)
                    {
                        if (-1 == data.FindIndex(l => l.NAME == leuname.Name))
                        {
                            TraceMethod.Record(TraceMethod.TraceKind.WARNING,
                                               $"can't find leu[{leuname.Name}] in file LEU_Result_Filtered_Values.xml, CI-LEU report will lack this LEU");
                            continue;
                        }
                        LEU_filtered_values.leu leu = data.Find(l => l.NAME == leuname.Name);
                        foreach (LEU_filtered_values.leu.BEACON b in leu.beaconList)
                        {
                            pagedata.AddRange(getrecordfrombeacon(b, leu.NAME, msgfiledir, hasTGM));
                        }
                    }
                }
                processData[group.Key] = pagedata;
            }
        }
Example #26
0
 internal void RunExtensions(SoapExtension[] extensions, bool throwOnException)
 {
     if (extensions != null)
     {
         TraceMethod caller = Tracing.On ? new TraceMethod(this, "RunExtensions", new object[] { extensions, throwOnException }) : null;
         if ((this.stage & (SoapMessageStage.AfterDeserialize | SoapMessageStage.BeforeDeserialize)) != ((SoapMessageStage)0))
         {
             for (int i = 0; i < extensions.Length; i++)
             {
                 if (Tracing.On)
                 {
                     Tracing.Enter("SoapExtension", caller, new TraceMethod(extensions[i], "ProcessMessage", new object[] { this.stage }));
                 }
                 extensions[i].ProcessMessage(this);
                 if (Tracing.On)
                 {
                     Tracing.Exit("SoapExtension", caller);
                 }
                 if (this.Exception != null)
                 {
                     if (throwOnException)
                     {
                         throw this.Exception;
                     }
                     if (Tracing.On)
                     {
                         Tracing.ExceptionIgnore(TraceEventType.Warning, caller, this.Exception);
                     }
                 }
             }
         }
         else
         {
             for (int j = extensions.Length - 1; j >= 0; j--)
             {
                 if (Tracing.On)
                 {
                     Tracing.Enter("SoapExtension", caller, new TraceMethod(extensions[j], "ProcessMessage", new object[] { this.stage }));
                 }
                 extensions[j].ProcessMessage(this);
                 if (Tracing.On)
                 {
                     Tracing.Exit("SoapExtension", caller);
                 }
                 if (this.Exception != null)
                 {
                     if (throwOnException)
                     {
                         throw this.Exception;
                     }
                     if (Tracing.On)
                     {
                         Tracing.ExceptionIgnore(TraceEventType.Warning, caller, this.Exception);
                     }
                 }
             }
         }
     }
 }
Example #27
0
        private bool splitRoute(GENERIC_SYSTEM_PARAMETERS.ROUTES.ROUTE route)
        {
            if (null == route)
            {
                return(false);
            }
            int startSigID = route.Origin_Signal_ID;
            List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK> blkList = new List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK>();
            List <int> dstSigIDs = new List <int>();

            dstSigIDs.AddRange(route.Spacing_Signal_ID_List.Signal_ID.Cast <int>());
            dstSigIDs.Add(route.Destination_Signal_ID);
            foreach (int blkID in route.Block_ID_List.Block_ID)
            {
                var blk = (GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK)Sys.GetNode(blkID, Sydb.blockInfoList.Cast <Node>().ToList());

                int dstSigID = SyDB.GetSigIDInBlock(blkID, dstSigIDs);
                if (0 < dstSigID && dstSigIDs.Exists(x => x == dstSigID))
                {
                    List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK> newBlkList = new List <GENERIC_SYSTEM_PARAMETERS.BLOCKS.BLOCK>();
                    newBlkList.AddRange(blkList);
                    newBlkList.Add(blk);
                    try
                    {
                        RouteSegment split_rs = new RouteSegment(startSigID, dstSigID, newBlkList, route);

                        //update info for new split route
                        {
                            blkList.Clear();
                            dstSigIDs.Remove(dstSigID);
                            startSigID = dstSigID;
                        }

                        if (route.Origin_Signal_ID == split_rs.m_OrgSig.ID)//route_spacing signal route
                        {
                            AddNewRoute(false, split_rs);
                        }
                        else//spacing signal route
                        {
                            AddNewRoute(true, split_rs);
                        }
                    }
                    catch (Exception ex)
                    {
                        TraceMethod.RecordInfo(ex.Message);
                    }
                }
                else
                {
                    blkList.Add(blk);
                }
            }//end of foreach (int blkID in route.BlockIDList)
            if (0 != dstSigIDs.Count)
            {
                TraceMethod.RecordInfo($"route {route.Info} split error, some signal can't get splited route, such as signalID[{dstSigIDs[0]}]\n");
                return(false);
            }
            return(true);
        }
 protected void CoreProcessRequest()
 {
     try
     {
         bool transactionEnabled = this.protocol.MethodAttribute.TransactionEnabled;
         if (this.protocol.IsOneWay)
         {
             WorkItemCallback callback = null;
             TraceMethod      method   = null;
             if (this.protocol.OnewayInitException != null)
             {
                 callback = new WorkItemCallback(this.ThrowInitException);
                 method   = Tracing.On ? new TraceMethod(this, "ThrowInitException", new object[0]) : null;
             }
             else
             {
                 this.parameters = this.protocol.ReadParameters();
                 callback        = transactionEnabled ? new WorkItemCallback(this.OneWayInvokeTransacted) : new WorkItemCallback(this.OneWayInvoke);
                 method          = Tracing.On ? (transactionEnabled ? new TraceMethod(this, "OneWayInvokeTransacted", new object[0]) : new TraceMethod(this, "OneWayInvoke", new object[0])) : null;
             }
             if (Tracing.On)
             {
                 Tracing.Information("TracePostWorkItemIn", new object[] { method });
             }
             WorkItem.Post(callback);
             if (Tracing.On)
             {
                 Tracing.Information("TracePostWorkItemOut", new object[] { method });
             }
             this.protocol.WriteOneWayResponse();
         }
         else if (transactionEnabled)
         {
             this.parameters = this.protocol.ReadParameters();
             this.InvokeTransacted();
         }
         else
         {
             this.parameters = this.protocol.ReadParameters();
             this.Invoke();
         }
     }
     catch (Exception exception)
     {
         if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
         {
             throw;
         }
         if (Tracing.On)
         {
             Tracing.ExceptionCatch(TraceEventType.Error, this, "CoreProcessRequest", exception);
         }
         if (!this.protocol.IsOneWay)
         {
             this.WriteException(exception);
         }
     }
     TraceFlush();
 }
        internal override SoapServerMethod RouteRequest()
        {
            object requestElement;
            string str = base.ServerProtocol.Request.Headers["SOAPAction"];

            if (str == null)
            {
                throw new SoapException(System.Web.Services.Res.GetString("UnableToHandleRequestActionRequired0"), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/"));
            }
            if (base.ServerType.routingOnSoapAction)
            {
                if (str.StartsWith("\"", StringComparison.Ordinal) && str.EndsWith("\"", StringComparison.Ordinal))
                {
                    str = str.Substring(1, str.Length - 2);
                }
                requestElement = System.Web.HttpUtility.UrlDecode(str);
            }
            else
            {
                try
                {
                    requestElement = base.GetRequestElement();
                }
                catch (SoapException)
                {
                    throw;
                }
                catch (Exception exception)
                {
                    if (((exception is ThreadAbortException) || (exception is StackOverflowException)) || (exception is OutOfMemoryException))
                    {
                        throw;
                    }
                    throw new SoapException(System.Web.Services.Res.GetString("TheRootElementForTheRequestCouldNotBeDetermined0"), new XmlQualifiedName("Server", "http://schemas.xmlsoap.org/soap/envelope/"), exception);
                }
            }
            TraceMethod caller = Tracing.On ? new TraceMethod(this, "RouteRequest", new object[0]) : null;

            if (Tracing.On)
            {
                Tracing.Enter("RouteRequest", caller, new TraceMethod(base.ServerType, "GetMethod", new object[] { requestElement }), Tracing.Details(base.ServerProtocol.Request));
            }
            SoapServerMethod method = base.ServerType.GetMethod(requestElement);

            if (Tracing.On)
            {
                Tracing.Exit("RouteRequest", caller);
            }
            if (method != null)
            {
                return(method);
            }
            if (base.ServerType.routingOnSoapAction)
            {
                throw new SoapException(System.Web.Services.Res.GetString("WebHttpHeader", new object[] { "SOAPAction", (string)requestElement }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/"));
            }
            throw new SoapException(System.Web.Services.Res.GetString("TheRequestElementXmlnsWasNotRecognized2", new object[] { ((XmlQualifiedName)requestElement).Name, ((XmlQualifiedName)requestElement).Namespace }), new XmlQualifiedName("Client", "http://schemas.xmlsoap.org/soap/envelope/"));
        }
Example #30
0
 public bool CheckAspect(ASPECT asp)
 {
     if (Aspect.Exists(x => x.Mask == asp.Mask))
     {
         TraceMethod.RecordInfo($"Error: {asp.Mask} is repeat in balise {name}-{id}");
         return(false);
     }
     return(true);
 }