public CtrlParser(FileRef filepath)
        {
            m_scanner = new CSScanner <SymbolRecord, TokenRef.Type>(CreateSymbol, CreateSourceObject, new TokenRef.Type[] { TokenRef.Type.Keyword, TokenRef.Type.Modifier, TokenRef.Type.Operator, TokenRef.Type.Identifier });

            if (!filepath.IsAbsoluteFilepath)
            {
                throw new ArgumentException($"Absolute Filepath required! ", nameof(filepath));
            }

            FileRef designer = filepath.CreateAs("Designer.cs");
            FileRef resource = filepath.CreateAs("resx");

            m_srcRef = new SourceRef(filepath, designer, resource);
            int i = 0;

            foreach (SourceFile srcFile in m_srcRef.FileList)
            {
                SourceObject srcObj = m_scanner.Scan(srcFile);                   // After call, SourceObj sequence will be available through m_srcRef.FileList[n] (.Sequence)

#if DEBUG
                srcObj = srcFile.Sequence;
                Debug.Write("", srcFile.Text);
                while (srcObj != null)
                {
                    Debug.Write(srcObj.Text + " ");
                    srcObj = srcObj.Sequence;
                }
                Debug.WriteLine("");
#endif
            }
        }
Exemple #2
0
 void VerifyModifiers(SourceObject e, Modifiers modifiers, Modifiers allowedModifiers)
 {
     if ((modifiers & ~allowedModifiers) != 0)
     {
         Log.Error(e.Source, ErrorCode.E4001, (modifiers & ~allowedModifiers).ToLiteral().Quote() + " is not valid for " + e.Quote());
     }
 }
Exemple #3
0
        bool VerifySimilar(string name, SourceObject e, Namescope p, Dictionary <string, SourceObject> names)
        {
            SourceObject result;

            if (names.TryGetValue(name, out result))
            {
                if (result != e && !(
                        result is DataType && e is DataType ||
                        result is Method && e is Method ||
                        result is Constructor && e is Constructor ||
                        result is Operator && e is Operator ||
                        result is Cast && e is Cast ||
                        result is Property && e is Property
                        ))
                {
                    OnDuplicate(e.Source, (p.IsRoot ? "" : p + ".") + name, result.Source);
                    return(false);
                }
            }
            else
            {
                names.Add(name, e);
            }

            return(true);
        }
        public Dictionary <string, ScrapySource> GenerateSource(ScheduleSource[] scheduleSources, string messageId)
        {
            Dictionary <string, ScrapySource> result = new Dictionary <string, ScrapySource>();

            foreach (var item in scheduleSources)
            {
                ISourceGen   sourceGen    = GetSourceGen(item.Type);
                var          param        = sourceGen.GetParameter(item.Parameters, Guid.NewGuid().ToString());
                SourceObject sourceObject = new SourceObject()
                {
                    Parameters = param.Parameter,
                    Type       = param.SourceType
                };
                ScrapySource scrapySource = new ScrapySource()
                {
                    GenType   = sourceGen.GenType,
                    Name      = item.Name,
                    JobId     = Guid.NewGuid().ToString(),
                    MessageId = messageId,
                    Source    = sourceObject,
                    SaveTo    = "transform/" + param.RecommendLocation + ".dat"
                };
                result.Add(item.Name, scrapySource);
            }
            return(result);
        }
Exemple #5
0
        public void Map_SpecifyDestinationTypeOnly_ReturnsMappedDestinationObject()
        {
            // Arrange
            var srcObj = new SourceObject()
            {
                Id       = 1,
                Name     = "map model service",
                Create   = new DateTime(2000, 1, 1),
                Children = new List <string>()
                {
                    "Child 1", "Child 2"
                }
            };

            var mapModelService = new MapModelService();

            Mapper.CreateMap <SourceObject, DestinationObject>();

            // Act
            var destObj = mapModelService.Map <DestinationObject>(srcObj);

            // Assert
            Assert.AreEqual(srcObj.Id, destObj.Id);
            Assert.AreEqual(srcObj.Name, destObj.Name);
            Assert.AreEqual(srcObj.Create, destObj.Create);
            Assert.AreEqual(srcObj.Children, destObj.Children);
        }
			public void AddChild(SourceObject childObject)
			{
				if (this.Children == null)
					this.Children = new List<SourceObject>();

				Children.Add(childObject);
			}
		public void Test3()
		{
			SourceObject so = new SourceObject();
			TestObject3  to = Map.ObjectToObject<TestObject3>(so);

			Assert.AreEqual(true, to.Value);
		}
        public void EnumTest()
        {
            SourceObject so = new SourceObject();
            DestObject   o  = (DestObject)Map.ObjectToObject(so, typeof(DestObject));

            Assert.AreEqual(StringAlignment.Near, o.test);
        }
Exemple #9
0
        //Stringrepresentation erstellen
        public override string ToString()
        {
            string representation;

            representation = SourceObject.ToString();
            return(representation);
        }
Exemple #10
0
        public static string GetUri(this SourceObject entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (entity is Namespace)
            {
                return(GetUri((Namespace)entity));
            }
            if (entity is Block)
            {
                return(GetUri((Block)entity));
            }
            if (entity is MetaProperty)
            {
                return(GetUri((MetaProperty)entity));
            }
            if (entity is DataType)
            {
                return(GetUri((DataType)entity));
            }
            if (entity is Member)
            {
                return(GetUri((Member)entity));
            }

            throw new ArgumentException("Unknown entity type: " + entity.GetType().Name);
        }
Exemple #11
0
        public void Should_map_the_existing_array_elements_over()
        {
            var sourceList = new List <SourceObject>();
            var destList   = new List <DestObject>();

            var config = new MapperConfiguration(cfg => cfg.CreateMap <SourceObject, DestObject>());

            config.AssertConfigurationIsValid();

            var source1 = new SourceObject {
                Id = 1,
            };

            sourceList.Add(source1);

            var source2 = new SourceObject {
                Id = 2,
            };

            sourceList.Add(source2);

            source1.AddChild(source2); // This causes the problem

            config.CreateMapper().Map(sourceList, destList);

            destList.Count.ShouldBe(2);
            destList[0].Children.Count.ShouldBe(1);
            destList[0].Children[0].ShouldBeSameAs(destList[1]);
        }
Exemple #12
0
        public void CheckDecreaseMemory()
        {
            SourceObject sourceObject = new SourceObject();

            for (int i = 0; i < 10; i++)
            {
                sourceObject.Completed0 += (Action)getPropertyMethods[i, 0].Invoke(listenerObject[i], null);
                sourceObject.Completed  += (Action <int>)getPropertyMethods[i, 1].Invoke(listenerObject[i], null);
                sourceObject.Completed1 += (Action <int, double>)getPropertyMethods[i, 2].Invoke(listenerObject[i], null);
                sourceObject.Completed2 += (Action <int, double, int>)getPropertyMethods[i, 3].Invoke(listenerObject[i], null);
                sourceObject.Completed3 += (Action <int, int, int, int>)getPropertyMethods[i, 4].Invoke(listenerObject[i], null);
            }

            long initialMemoryCount = GC.GetTotalMemory(true);

            for (int i = 0; i < 10; i++)
            {
                listenerObject[i] = null;
            }
            GC.Collect(2, GCCollectionMode.Forced);

            long currentMemoryCount = GC.GetTotalMemory(true);

            bool expectedResult = true;

            bool actualResult = (currentMemoryCount < initialMemoryCount);

            Assert.AreEqual(expectedResult, actualResult);
        }
            public void Should_map_the_existing_array_elements_over()
            {
                var sourceList = new List<SourceObject>();
                var destList = new List<DestObject>();

                var config = new MapperConfiguration(cfg => cfg.CreateMap<SourceObject, DestObject>().PreserveReferences());
                config.AssertConfigurationIsValid();

                var source1 = new SourceObject
                {
                    Id = 1,
                };
                sourceList.Add(source1);

                var source2 = new SourceObject
                {
                    Id = 2,
                };
                sourceList.Add(source2);

                source1.AddChild(source2); // This causes the problem

                config.CreateMapper().Map(sourceList, destList);

                destList.Count.ShouldEqual(2);
                destList[0].Children.Count.ShouldEqual(1);
                destList[0].Children[0].ShouldBeSameAs(destList[1]);
            }
Exemple #14
0
        /// <summary>
        /// Renders the Xray image on the CPU.
        /// </summary>
        /// <param name="bsource"></param>
        /// <param name="sourceObject"></param>
        /// <param name="viewObject"></param>
        /// <param name="xrayImageEffect"></param>
        /// <param name="trimatEffect"></param>
        /// <param name="effects"></param>
        /// <param name="displayWidth"></param>
        /// <param name="displayHeight"></param>
        /// <param name="adornerLayerManager"></param>
        /// <param name="displayAnnotations"></param>
        /// <param name="displayMeasurements"></param>
        /// <returns>The newly rendered bitmap.</returns>
        public static BitmapSource GetRenderedXrayImage(BitmapSource bsource,
                                                        SourceObject sourceObject,
                                                        ViewObject viewObject,
                                                        ShaderEffect xrayOrTrimateImageEffect,
                                                        List <Effect> effects,
                                                        double displayWidth,
                                                        double displayHeight,
                                                        AdornerLayerManager adornerLayerManager,
                                                        bool displayAnnotations,
                                                        bool displayMeasurements)
        {
            if (xrayOrTrimateImageEffect != null && xrayOrTrimateImageEffect.GetType() == typeof(XrayImageEffect))
            {
                RenderXrayImage_XRayImageEffect(ref bsource, (XrayImageEffect)xrayOrTrimateImageEffect, sourceObject);
            }
            //else if (xrayOrTrimateImageEffect.GetType() == typeof(TrimatEffect))
            //{
            //    RenderXrayImage_TrimatEffect(ref bsource, (TrimatEffect)xrayOrTrimateImageEffect, sourceObject, viewObject);
            //}
            foreach (Effect effect in effects)
            {
                ApplyEffectToBitmap(ref bsource, effect);
            }
            if (displayAnnotations)
            {
                RenderAnnotations(ref bsource, displayWidth, displayHeight, adornerLayerManager);
            }
            if (displayMeasurements)
            {
                RenderMeasurements(ref bsource, displayWidth, displayHeight, adornerLayerManager);
            }

            return(bsource);
        }
            public void AddChild(SourceObject childObject)
            {
                if (this.Children == null)
                    this.Children = new List<SourceObject>();

                Children.Add(childObject);
            }
Exemple #16
0
        private SourceObject ProcessToken(string type, string token, SourceObject sequence, ref Regex curRE)
        {
            TRecord record;

            switch (type)
            {
            case "identifier":
                record = m_symbolTable.FindOrAdd(token, m_typeList[3]);
                sequence.LinkNext(CreateSourceObject(record));
                sequence = sequence.Sequence;
                break;

            case "ws":
                // ignored for now
                break;

            case "symbol":
                sequence = IndentifyOperators(token, sequence);
                break;

            case "comment":
                break;

            case "string":
                break;

            case "blank":
                break;

            case "preprocessor":
                break;
            }

            return(sequence);
        }
Exemple #17
0
        public SourceObject IndentifyOperators(string token, SourceObject srcObj)
        {
            if (string.IsNullOrWhiteSpace(token))
            {
                throw new InvalidOperationException("Could not identify symbol!\nSee inner exception.",
                                                    new ArgumentException("Parameter cannot be null, Empty or Whitespace!", nameof(token)));
            }

            int p   = 0;
            int len = token.Length;

            do
            {
                if (m_symbolTable.TryFind(token.Substring(p, len), out TRecord record))
                {
                    srcObj.LinkNext(CreateSourceObject(record));
                    srcObj = srcObj.Sequence;
                    p     += len;
                    len    = token.Length - p;
                }
                else
                {
                    len--;
                }
            } while (len > 0);

            if (p < token.Length)                                                         // this indicates that a (portion) of the token was not identified
            {
                srcObj.LinkNext(new ErrorObj($"@:{token.Substring(p, token.Length-p)}")); // HACK: create an error/warn/info system with sensible codes
                srcObj = srcObj.Sequence;
            }

            return(srcObj);
        }
Exemple #18
0
        public void Test3()
        {
            SourceObject so = new SourceObject();
            TestObject3  to = Map.ObjectToObject <TestObject3>(so);

            Assert.AreEqual(true, to.Value);
        }
        public void NullableEnumTest()
        {
            SourceObject so = new SourceObject();

            Object5 b = Map.ObjectToObject <Object5>(so);

            Assert.AreEqual(Enum2.Value1, b.test);
        }
 private PropertyInfo GetProperty(string propertyName)
 {
     if (SourceObject == null)
     {
         return(null);
     }
     return(SourceObject.GetType().GetProperty(propertyName, Type.EmptyTypes));
 }
 /// <summary> 割り当て済みの <see cref="SourceObject"/> を解放する </summary>
 public void Unbind()
 {
     if (source)
     {
         Destroy(source.gameObject);
     }
     source = null;
 }
Exemple #22
0
        public void ObjectToObjectTO()
        {
            SourceObject so = new SourceObject();
            Object1      o  = Map.ObjectToObject <Object1>(so);

            Assert.AreEqual(10, o.Field1);
            Assert.AreEqual(20, o.Field2);
            Assert.AreEqual(30, o.Field3);
        }
Exemple #23
0
        public void Test1()
        {
            SourceObject source = new SourceObject();
            DestObject   dest   = Map./*[a]*/ ObjectToObject/*[/a]*/ <DestObject>(source);

            Assert.AreEqual(true, dest.BoolValue);
            Assert.AreEqual(10, dest.IntValue);
            Assert.AreEqual("test", dest.StrValue);
        }
Exemple #24
0
        public void ObjectToObjectOT()
        {
            SourceObject so = new SourceObject();
            Object1      o  = (Object1)Map.ObjectToObject(so, typeof(Object1));

            Assert.AreEqual(10, o.Field1);
            Assert.AreEqual(20, o.Field2);
            Assert.AreEqual(30, o.Field3);
        }
 public SteppedBinderTests()
 {
     _sourceObject = new SourceObject();
     _innerBinding = new Binding(nameof(SourceObject.Value))
     {
         Source = _sourceObject,
         Mode   = BindingMode.TwoWay
     };
 }
		public void Test1()
		{
			SourceObject source = new SourceObject();
			DestObject   dest   = Map./*[a]*/ObjectToObject/*[/a]*/<DestObject>(source);

			Assert.AreEqual(true,   dest.BoolValue);
			Assert.AreEqual(10,     dest.IntValue);
			Assert.AreEqual("test", dest.StrValue);
		}
 void VerifyVisibility(SourceObject owner, Visibility visibility, DataType dt)
 {
     if (VerifyAccessibleEntity(owner.Source, dt) &&
         !visibility.IsVisibile(dt) && (
             !Environment.IsGeneratingCode ||
             !Backend.Has(TypeOptions.IgnoreProtection)))
     {
         Log.Error(owner.Source, ErrorCode.E4128, dt.Quote() + " is less accessible than " + owner.Quote());
     }
 }
Exemple #28
0
        public void InstrumentationIsNotAttachedIfConfigurationIsMissing()
        {
            DictionaryConfigurationSource     dictionary      = new DictionaryConfigurationSource();
            InstrumentationAttachmentStrategy attacher        = new InstrumentationAttachmentStrategy();
            ConfigurationReflectionCache      reflectionCache = new ConfigurationReflectionCache();
            SourceObject sourceObject = new SourceObject();

            attacher.AttachInstrumentation(sourceObject, dictionary, reflectionCache);
            Assert.IsFalse(ShouldNeverBeInstantiatedListener.WasInstantiated);
        }
Exemple #29
0
        public void DictionaryToObject()
        {
            var so = new SourceObject();
            var ht = Map.ObjectToDictionary(so);
            var o1 = (Object1)Map.DictionaryToObject(ht, typeof(Object1));

            Assert.AreEqual(10, o1.Field1);
            Assert.AreEqual(20, o1.Field2);
            Assert.AreEqual(30, o1.Field3);
        }
Exemple #30
0
        public void Should_ImplicitMap_NonNullableToNullable()
        {
            var sourceObject = new SourceObject {
                NullableInt = 123
            };
            var destObject = Mapper.Map <SourceObject, DestObject>(sourceObject);

            Assert.NotNull(destObject.NullableInt);
            Assert.AreEqual(sourceObject.NullableInt, destObject.NullableInt.Value);
        }
        public void ShouldMapToImplicitlySpecifiedType()
        {
            var sourceObject = new SourceObject { IntValue = 5, StringValue = "five", FirstValue = 10 };

            var destinationObject = sourceObject.MapTo() as DestinationObject;

            Assert.NotNull(destinationObject);
            Assert.AreEqual(sourceObject.IntValue, destinationObject.IntValue);
            Assert.AreEqual(sourceObject.StringValue, destinationObject.StringValue);
            Assert.AreEqual(sourceObject.FirstValue, destinationObject.SecondValue);
        }
Exemple #32
0
    /// <summary> <see cref="SourceObject"/> を割り当てる </summary>
    public void Bind()
    {
        if (_sourceObject != null)
        {
            UnBind();
        }
        var source = GetObject();

        source.transform.SetParent(isRelease ? table.transform : transform);
        _sourceObject = source;
    }
Exemple #33
0
        public void ObjectToObjectOO()
        {
            SourceObject so = new SourceObject();
            Object1      o  = new Object1();

            Map.ObjectToObject(so, o);

            Assert.AreEqual(10, o.Field1);
            Assert.AreEqual(20, o.Field2);
            Assert.AreEqual(30, o.Field3);
        }
Exemple #34
0
        public void ObjectToDictionary()
        {
            SourceObject so = new SourceObject();
            Hashtable    ht = new Hashtable();

            Map.ObjectToDictionary(so, ht);

            Assert.AreEqual(10, ht["Field1"]);
            Assert.AreEqual("20", ht["Field2"]);
            Assert.AreEqual(30, ht["Field3"]);
        }
        public void InstrumentationIsNotAttachedIfConfigurationIsMissing()
        {
            DictionaryConfigurationSource dictionary = new DictionaryConfigurationSource();
            InstrumentationAttachmentStrategy attacher = new InstrumentationAttachmentStrategy();
            ConfigurationReflectionCache reflectionCache = new ConfigurationReflectionCache();

            SourceObject sourceObject = new SourceObject();
            attacher.AttachInstrumentation(sourceObject, dictionary, reflectionCache);

            Assert.IsFalse(ShouldNeverBeInstantiatedListener.WasInstantiated);
        }
 public void RefreshFromSource()
 {
     if (SourceObject != null)
     {
         Type type = SourceObject.GetType();
         SourceProperty = type.GetProperty(_SourcePropertyName, BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
         if (SourceProperty != null)
         {
             Value = SourceProperty.GetValue(SourceObject, null);
         }
     }
 }
        public void InstrumentationIsNotAttachedIfAllConfigOptionsAreFalse()
        {
            DictionaryConfigurationSource dictionary = new DictionaryConfigurationSource();
            dictionary.Add(InstrumentationConfigurationSection.SectionName,
                new InstrumentationConfigurationSection(false, false, false));

            InstrumentationAttachmentStrategy attacher = new InstrumentationAttachmentStrategy();
            ConfigurationReflectionCache reflectionCache = new ConfigurationReflectionCache();

            SourceObject sourceObject = new SourceObject();
            attacher.AttachInstrumentation(sourceObject, dictionary, reflectionCache);

            Assert.IsFalse(ShouldNeverBeInstantiatedListener.WasInstantiated);
        }
Exemple #38
0
 /// <summary> <see cref="SourceObject"/> を割り当てる </summary>
 public void Bind()
 {
     if (_sourceObject != null) { UnBind(); }
     var source = GetObject();
     source.transform.SetParent(isRelease ? table.transform : transform);
     _sourceObject = source;
 }
Exemple #39
0
 /// <summary> <see cref="SourceObject"/> を解放する </summary>
 public void UnBind()
 {
     Destroy(_sourceObject.gameObject);
     _sourceObject = null;
 }
        public void UpdateUniformityInfo(Point startPoint, Point endPoint, SourceObject HighEnergySourceObject)
        {
            int startidx = (int)startPoint.X;
            int fnidx = (int)endPoint.X;
            int tmp = 0;
            float [] linedata;

            if (Math.Abs(startidx - fnidx) < 2) return;
            UniformityData = startPoint.X.ToString() + "&" + startPoint.Y.ToString() + "&" + endPoint.X.ToString() + "&" + endPoint.Y.ToString();

            if (HighEnergySourceObject != null)
            {
                // some test
                if (startidx > fnidx)
                {
                    tmp = fnidx;
                    fnidx = startidx;
                    startidx = tmp;
                }

                linedata = new float[fnidx - startidx];
                startidx = HighEnergySourceObject.Width * (int)endPoint.Y + startidx;
                BitmapSource bms = HighEnergySourceObject.Source;
                Array.Copy(HighEnergySourceObject.Data, startidx, linedata, 0, linedata.Length);
                //===================================================================================================
                for (int k = 0; k < linedata.Length; k++)
                    linedata[k] *= 65356;//??????????????????????????????????????? kumsal's requirement
                //====================================================================================================

                float max = (float)(Conversion.MaxValue(linedata));
                float min = (float)(Conversion.MinValue(linedata));

                float coeff = (float)((max - min) * 0.1);
                max += coeff;
                min -= coeff;//adjust graph 
                if (UniformityChart.Series.Count > 0)
                    UniformityChart.Series[0].Points.Clear();
                UniformityChart.ChartAreas[0].AxisY.StripLines.Clear();
                UniformityChart.ChartAreas[0].AxisY.ScaleView.Size = (max - min);//?????????????????
                UniformityChart.ChartAreas[0].AxisY.Maximum = Math.Round(max, 0);
                UniformityChart.ChartAreas[0].AxisY.Minimum = Math.Round(min, 0);
                UniformityChart.ChartAreas[0].AxisX.IsStartedFromZero = true;
                for (int j = 1; j < linedata.Length + 1; j++)
                {
                    System.Windows.Forms.DataVisualization.Charting.DataPoint dp = new System.Windows.Forms.DataVisualization.Charting.DataPoint(j, linedata[j - 1]);
                    UniformityChart.Series[0].Points.Add(dp);

                }

                double mean = UniformityChart.DataManipulator.Statistics.Mean(UniformityChart.Series[0].Name);
                double std = Math.Sqrt(UniformityChart.DataManipulator.Statistics.Variance(UniformityChart.Series[0].Name, true));
                UniformityChart.ChartAreas[0].AxisX.ScaleView.ZoomReset(0);
                UniformityChart.ChartAreas[0].AxisY.ScaleView.ZoomReset(0);
                MeanValue.Text = Math.Round(UniformityChart.DataManipulator.Statistics.Mean(UniformityChart.Series[0].Name), 0).ToString();
                STDValue.Text = Math.Round(Math.Sqrt(UniformityChart.DataManipulator.Statistics.Variance(UniformityChart.Series[0].Name, true)), 0).ToString();
                STDPercentValue.Text = Math.Round((std / mean) * 100, 1).ToString("F");
                MinValue.Text = Math.Round(Conversion.MinValue(linedata), 0).ToString();
                MaxValue.Text = Math.Round((decimal)Conversion.MaxValue(linedata), 0).ToString();

            }
        }
Exemple #41
0
        private List<ViewObject> GetImageData()
        {
            List<ViewObject> ret = new List<ViewObject>();

            MemoryStream tipMS = null;

            bool injectTIP = false;

            PxeAccess.TIPStatus tipStatus;

            if (m_CaseObj.caseType == CaseType.FTICase)
            {
                DataAttachment ftiAttachment = null;
                foreach (DataAttachment attachment in m_CaseObj.attachments.GetFTIImageAttachments())
                {
                    tipMS = attachment.attachmentData;
                    injectTIP = true;
                    ftiAttachment = attachment;
                    break;
                }

                m_CaseObj.attachments.Remove(ftiAttachment);
            }

            foreach (DataAttachment attachment in m_CaseObj.attachments.GetXrayImageAttachments())
            {
                MemoryStream ms = attachment.attachmentData;

                PxeAccess pxeAccess = new PxeAccess();

                Rect view0Rect = new Rect();
                Rect view1Rect = new Rect();

                if (injectTIP)
                {
                    tipStatus = new PxeAccess.TIPStatus();
                    pxeAccess.OpenPXEImageFromMemoryWithTIP(ms, tipMS, ref tipStatus);

                    if (tipStatus.injectionsucess == 0)
                    {
                        m_CaseObj.IsCaseEditable = false;
                        m_SysConfig.SelectedArchiveDuringAutoSelect = true;                       
                    }
                    else
                    {
                        view0Rect = new Rect(new Point((double)tipStatus.injectLocation_view0.left,
                                                       (double)tipStatus.injectLocation_view0.top),
                                             new Point((double)tipStatus.injectLocation_view0.right,
                                                       (double)tipStatus.injectLocation_view0.bottom));

                        view1Rect = new Rect(new Point((double)tipStatus.injectLocation_view1.left,
                                                       (double)tipStatus.injectLocation_view1.top),
                                             new Point((double)tipStatus.injectLocation_view1.right,
                                                       (double)tipStatus.injectLocation_view1.bottom));
                    }
                }
                else
                {
                    pxeAccess.OpenPXEImageFromMemory(ms);
                }

                if (pxeAccess.pxeHeader.sequenceNum != null)
                {
                    if (m_CaseObj.scanInfo == null)
                    {
                        m_CaseObj.scanInfo = new ScanInfo();
                    }

                    if (m_CaseObj.scanInfo.container == null)
                    {
                        m_CaseObj.scanInfo.container = new Container();
                    }

                    m_CaseObj.scanInfo.container.SequenceNum = pxeAccess.pxeHeader.sequenceNum.ToString();
                }

                if (pxeAccess.pxeHeader.batchNumber != null)
                {
                    if (m_CaseObj.scanInfo == null)
                    {
                        m_CaseObj.scanInfo = new ScanInfo();
                    }

                    if (m_CaseObj.scanInfo.conveyance == null)
                    {
                        m_CaseObj.scanInfo.conveyance = new Conveyance();
                    }

                    m_CaseObj.scanInfo.conveyance.BatchNum = pxeAccess.pxeHeader.batchNumber.ToString();
                }

                if (pxeAccess.pxeHeader.viewBuffer_0.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy = null;
                    SourceObject trimat = null;
                    ViewType viewType = ViewType.Unknown;

                    int width = (int)pxeAccess.pxeHeader.viewBuffer_0.width;
                    int height = (int)pxeAccess.pxeHeader.viewBuffer_0.height;

                    if (pxeAccess.pxeHeader.viewBuffer_0.isDualEnergy != 0)
                    {
                        highEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawH"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        lowEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawL"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        trimat = new SourceObject(pxeAccess.GetImageBuffer("FinalCompHL"), pxeAccess.GetImageBuffer("FinalAlpha"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.viewBuffer_0.isHighEnergy != 0)
                    {
                        highEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawH"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.HighEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.viewBuffer_0.isHighEnergy == 0)
                    {
                        lowEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawL"), width, height, m_SysConfig.FlipView1XAxis, m_SysConfig.FlipView1YAxis);
                        viewType = ViewType.LowEnergy;
                    }

                    ViewObject viewObj = new ViewObject("View0",
                                                        pxeAccess.pxeHeader.pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        trimat,
                                                        pxeAccess.pxeHeader.detectorsPerBoard,
                                                        pxeAccess.pxeHeader.bitsPerPixel,
                                                        pxeAccess.pxeHeader.samplingSpeed,
                                                        pxeAccess.pxeHeader.samplingSpace,
                                                        GetAnnotationsForView("View0"));

                    if (injectTIP)
                    {
                        viewObj.TIPMarkings = new List<Rect>();
                        viewObj.TIPMarkings.Add(view0Rect);
                    }

                    m_View0HighEnergySource = highEnergy;

                    ret.Add(viewObj);                    
                }

                if (pxeAccess.pxeHeader.viewBuffer_1.isValidView != 0)
                {
                    SourceObject highEnergy = null;
                    SourceObject lowEnergy = null;
                    SourceObject trimat = null;
                    ViewType viewType = ViewType.Unknown;

                    int width = (int)pxeAccess.pxeHeader.viewBuffer_1.width;
                    int height = (int)pxeAccess.pxeHeader.viewBuffer_1.height;

                    if (pxeAccess.pxeHeader.viewBuffer_0.isDualEnergy != 0)
                    {
                        highEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawH1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        lowEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawL1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        trimat = new SourceObject(pxeAccess.GetImageBuffer("FinalCompHL1"), pxeAccess.GetImageBuffer("FinalAlpha1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.DualEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.viewBuffer_0.isHighEnergy != 0)
                    {
                        highEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawH1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.HighEnergy;
                    }
                    else if (width > 0 && height > 0 && pxeAccess.pxeHeader.viewBuffer_0.isHighEnergy == 0)
                    {
                        lowEnergy = new SourceObject(pxeAccess.GetImageBuffer("RawL1"), width, height, m_SysConfig.FlipView2XAxis, m_SysConfig.FlipView2YAxis);
                        viewType = ViewType.LowEnergy;
                    }

                    ViewObject viewObj = new ViewObject("View1",
                                                        pxeAccess.pxeHeader.pxeIndex,
                                                        viewType,
                                                        highEnergy,
                                                        lowEnergy,
                                                        trimat,
                                                        pxeAccess.pxeHeader.detectorsPerBoard,
                                                        pxeAccess.pxeHeader.bitsPerPixel,
                                                        pxeAccess.pxeHeader.samplingSpeed,
                                                        pxeAccess.pxeHeader.samplingSpace,
                                                        GetAnnotationsForView("View1"));

                    if (injectTIP)
                    {
                        viewObj.TIPMarkings = new List<Rect>();
                        viewObj.TIPMarkings.Add(view1Rect);
                    }

                    ret.Add(viewObj);                    
                }

                Conversion.SamplingSpace = pxeAccess.pxeHeader.samplingSpace;
            }

            return ret;
        }
Exemple #42
0
		public void ObjectToObjectOO()
		{
			SourceObject so = new SourceObject();
			Object1      o  = new Object1();
 
			Map.ObjectToObject(so, o);

			Assert.AreEqual(10, o.Field1);
			Assert.AreEqual(20, o.Field2);
			Assert.AreEqual(30, o.Field3);
		}
		public void NullableEnumTest()
		{
			SourceObject so = new SourceObject();

			Object5 b = Map.ObjectToObject<Object5>(so);
			Assert.AreEqual(Enum2.Value1, b.test);
		}
		public void EnumTest()
		{
			SourceObject so = new SourceObject();
			DestObject o = (DestObject)Map.ObjectToObject(so, typeof(DestObject));

			Assert.AreEqual(StringAlignment.Near, o.test);
		}
Exemple #45
0
		public void ObjectToObjectOT()
		{
			SourceObject so = new SourceObject();
			Object1      o  = (Object1)Map.ObjectToObject(so, typeof(Object1));

			Assert.AreEqual(10, o.Field1);
			Assert.AreEqual(20, o.Field2);
			Assert.AreEqual(30, o.Field3);
		}
Exemple #46
0
		public void ObjectToObjectTO()
		{
			SourceObject so = new SourceObject();
			Object1      o  = Map.ObjectToObject<Object1>(so);

			Assert.AreEqual(10, o.Field1);
			Assert.AreEqual(20, o.Field2);
			Assert.AreEqual(30, o.Field3);
		}
Exemple #47
0
		public void ObjectToDictionary()
		{
			SourceObject so = new SourceObject();
			Hashtable    ht = new Hashtable();
 
			Map.ObjectToDictionary(so, ht);

			Assert.AreEqual(10,   ht["Field1"]);
			Assert.AreEqual("20", ht["Field2"]);
			Assert.AreEqual(30,   ht["Field3"]);
		}
Exemple #48
0
		public void DictionaryToObject()
		{
			var so = new SourceObject();
			var ht = Map.ObjectToDictionary(so);
			var o1 = (Object1)Map.DictionaryToObject(ht, typeof(Object1));

			Assert.AreEqual(10, o1.Field1);
			Assert.AreEqual(20, o1.Field2);
			Assert.AreEqual(30, o1.Field3);
		}