Exemple #1
0
        public void EnsureLazyLoaded()
        {
            if (!lazyLoad || texture != null)
            {
                return;
            }

            Vector4 sourceVector = Vector4.Zero;
            bool    temp2        = false;

            LoadTexture(ref sourceVector, ref temp2, preMultipliedAlpha);
            if (sourceRect.Width == 0 && sourceRect.Height == 0)
            {
                sourceRect     = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
                size           = SourceElement.GetAttributeVector2("size", Vector2.One);
                size.X        *= sourceRect.Width;
                size.Y        *= sourceRect.Height;
                RelativeOrigin = SourceElement.GetAttributeVector2("origin", new Vector2(0.5f, 0.5f));
            }
            foreach (Sprite s in list)
            {
                if (s == this)
                {
                    continue;
                }
                if (s.FullPath == FullPath && s.texture != null)
                {
                    s.texture = texture;
                }
            }
        }
Exemple #2
0
 private void SetWebRequestPriperties(HttpWebRequest webRequest)
 {
     webRequest.KeepAlive   = true;
     webRequest.Method      = SourceElement.GetAttribute("MethodDispatch");
     webRequest.Timeout     = Utils.StringToInt(SourceObject.Root.GetAttribute("Timeout"));
     webRequest.Credentials = CredentialCache.DefaultCredentials;
 }
Exemple #3
0
        public void Init(Gender gender = Gender.None)
        {
            if (IsInitialized)
            {
                return;
            }
            _gender = SpritePath.Contains("[GENDER]") ? gender : Gender.None;
            ParsePath(false);
            if (Sprite != null)
            {
                Sprite.Remove();
            }
            Sprite              = new Sprite(SourceElement, file: SpritePath);
            Limb                = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true);
            HideLimb            = SourceElement.GetAttributeBool("hidelimb", false);
            HideOtherWearables  = SourceElement.GetAttributeBool("hideotherwearables", false);
            InheritLimbDepth    = SourceElement.GetAttributeBool("inheritlimbdepth", true);
            InheritTextureScale = SourceElement.GetAttributeBool("inherittexturescale", false);
            InheritOrigin       = SourceElement.GetAttributeBool("inheritorigin", false);
            InheritSourceRect   = SourceElement.GetAttributeBool("inheritsourcerect", false);
            DepthLimb           = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("depthlimb", "None"), true);
            Sound               = SourceElement.GetAttributeString("sound", "");
            var index = SourceElement.GetAttributePoint("sheetindex", new Point(-1, -1));

            if (index.X > -1 && index.Y > -1)
            {
                SheetIndex = index;
            }
            IsInitialized = true;
        }
Exemple #4
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as DocumentManifest;

            if (dest == null)
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }

            base.CopyTo(dest);
            if (MasterIdentifier != null)
            {
                dest.MasterIdentifier = (Hl7.Fhir.Model.Identifier)MasterIdentifier.DeepCopy();
            }
            if (Identifier != null)
            {
                dest.Identifier = new List <Hl7.Fhir.Model.Identifier>(Identifier.DeepCopy());
            }
            if (StatusElement != null)
            {
                dest.StatusElement = (Code <Hl7.Fhir.Model.DocumentReferenceStatus>)StatusElement.DeepCopy();
            }
            if (Type != null)
            {
                dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
            }
            if (Subject != null)
            {
                dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
            }
            if (CreatedElement != null)
            {
                dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopy();
            }
            if (Author != null)
            {
                dest.Author = new List <Hl7.Fhir.Model.ResourceReference>(Author.DeepCopy());
            }
            if (Recipient != null)
            {
                dest.Recipient = new List <Hl7.Fhir.Model.ResourceReference>(Recipient.DeepCopy());
            }
            if (SourceElement != null)
            {
                dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopy();
            }
            if (DescriptionElement != null)
            {
                dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy();
            }
            if (Content != null)
            {
                dest.Content = new List <Hl7.Fhir.Model.ResourceReference>(Content.DeepCopy());
            }
            if (Related != null)
            {
                dest.Related = new List <Hl7.Fhir.Model.DocumentManifest.RelatedComponent>(Related.DeepCopy());
            }
            return(dest);
        }
Exemple #5
0
        private void DragMoved()
        {
            Point CurrentPosition = System.Windows.Input.Mouse.GetPosition(pnlMap);

            SourceElement.SourcePoint.X = Convert.ToInt32((CurrentPosition.X - _positionOnSource.X) / Zoom);
            SourceElement.SourcePoint.Y = Convert.ToInt32((CurrentPosition.Y - _positionOnSource.Y) / Zoom);
            SourceElement.InvalidateVisual();
        }
Exemple #6
0
        public void Init(Gender gender = Gender.None)
        {
            if (IsInitialized)
            {
                return;
            }
            _gender = UnassignedSpritePath.Contains("[GENDER]") ? gender : Gender.None;
            ParsePath(false);
            Sprite?.Remove();
            Sprite                      = new Sprite(SourceElement, file: SpritePath);
            Limb                        = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("limb", "Head"), true);
            HideLimb                    = SourceElement.GetAttributeBool("hidelimb", false);
            HideOtherWearables          = SourceElement.GetAttributeBool("hideotherwearables", false);
            CanBeHiddenByOtherWearables = SourceElement.GetAttributeBool("canbehiddenbyotherwearables", true);
            InheritLimbDepth            = SourceElement.GetAttributeBool("inheritlimbdepth", true);
            var scale = SourceElement.GetAttribute("inheritscale");

            if (scale != null)
            {
                InheritScale = scale.GetAttributeBool(false);
            }
            else
            {
                InheritScale = SourceElement.GetAttributeBool("inherittexturescale", false);
            }
            IgnoreLimbScale    = SourceElement.GetAttributeBool("ignorelimbscale", false);
            IgnoreTextureScale = SourceElement.GetAttributeBool("ignoretexturescale", false);
            IgnoreRagdollScale = SourceElement.GetAttributeBool("ignoreragdollscale", false);
            SourceElement.GetAttributeBool("inherittexturescale", false);
            InheritOrigin     = SourceElement.GetAttributeBool("inheritorigin", false);
            InheritSourceRect = SourceElement.GetAttributeBool("inheritsourcerect", false);
            DepthLimb         = (LimbType)Enum.Parse(typeof(LimbType), SourceElement.GetAttributeString("depthlimb", "None"), true);
            Sound             = SourceElement.GetAttributeString("sound", "");
            Scale             = SourceElement.GetAttributeFloat("scale", 1.0f);
            Rotation          = MathHelper.ToRadians(SourceElement.GetAttributeFloat("rotation", 0.0f));
            var index = SourceElement.GetAttributePoint("sheetindex", new Point(-1, -1));

            if (index.X > -1 && index.Y > -1)
            {
                SheetIndex = index;
            }

            HideWearablesOfType = new List <WearableType>();
            var wearableTypes = SourceElement.GetAttributeStringArray("hidewearablesoftype", null);

            if (wearableTypes != null && wearableTypes.Length > 0)
            {
                foreach (var value in wearableTypes)
                {
                    if (Enum.TryParse(value, ignoreCase: true, out WearableType wearableType))
                    {
                        HideWearablesOfType.Add(wearableType);
                    }
                }
            }

            IsInitialized = true;
        }
Exemple #7
0
        private void SetHeaders(HttpWebRequest webRequest)
        {
            xmlNodeList HeadersList = SourceElement.SelectNodes("HeadersList");

            foreach (xmlElement Header in HeadersList)
            {
                string HeaderName  = Header.GetAttribute("Name");
                string HeaderValue = TargetObject.XQuery(Header.GetAttribute("Value"));
                webRequest.Headers.Add(HeaderName, HeaderValue);
            }
        }
        /// <summary>
        /// Searches the given source element (e.g. property) and updates the report if element can be found in source code files.
        /// </summary>
        /// <param name="sourceElement">The source element.</param>
        /// <param name="filenameByFileIdDictionary">Dictionary containing all files used in the report by their corresponding id.</param>
        /// <param name="fileIdsOfClass">The file ids of class.</param>
        /// <param name="reportElement">The report element.</param>
        /// <param name="updateReportElement">Action that updates the report element.</param>
        /// <param name="filesContainer">The files container.</param>
        /// <returns><c>true</c> if source element has been found.</returns>
        protected bool SearchElement(
            SourceElement sourceElement,
            Dictionary <string, string> filenameByFileIdDictionary,
            IEnumerable <string> fileIdsOfClass,
            XContainer reportElement,
            Action <XContainer, SourceElementPosition, string> updateReportElement,
            XContainer filesContainer)
        {
            Func <bool> searchSourceElement = () =>
            {
                foreach (var fileId in fileIdsOfClass)
                {
                    var elementPosition = SourceCodeAnalyzer.FindSourceElement(filenameByFileIdDictionary[fileId], sourceElement);

                    if (elementPosition != null)
                    {
                        updateReportElement(reportElement, elementPosition, fileId);
                        return(true);
                    }
                }

                return(false);
            };

            // Search files from module first
            if (!searchSourceElement())
            {
                // Property has not been found in classes of module, now search the common directory
                if (this.ClassSearcher == null)
                {
                    this.ClassSearcher = this.classSearcherFactory.CreateClassSearcher(CommonDirectorySearcher.GetCommonDirectory(filenameByFileIdDictionary.Values));
                }

                fileIdsOfClass = this.TryToFindFileIdsOfClass(
                    this.ClassSearcher,
                    sourceElement.Classname,
                    filenameByFileIdDictionary,
                    filesContainer);

                // Property has not been found in common directory, now search the global directory
                if (!searchSourceElement())
                {
                    fileIdsOfClass = this.TryToFindFileIdsOfClass(
                        this.globalClassSearcher,
                        sourceElement.Classname,
                        filenameByFileIdDictionary,
                        filesContainer);
                    return(searchSourceElement());
                }
            }

            return(true);
        }
        // --------------------------------------------------
        // SERIALIZATION
        // --------------------------------------------------

        #region Serialization

        /// <summary>
        /// Updates information for storage.
        /// </summary>
        /// <param name="log">The log to update.</param>
        public override void UpdateStorageInfo(IBdoLog log = null)
        {
            if (PathDetail != null)
            {
                foreach (DataElement dataElement in PathDetail.Items)
                {
                    dataElement.UpdateStorageInfo(log);
                }
            }

            SourceElement?.UpdateStorageInfo(log);
        }
Exemple #10
0
        void Source_LayoutUpdated(object sender, EventArgs e)
        {
            Rect bounds = SourceElement.GetBounds();

            Point p = TargetElement.FindClosestPoint(bounds.GetCenter());

            Point[] newPoints = JunctionGeometryHelper.ComputeOptimalConnection(bounds, new Rect(p.X, p.Y, 1, 1), false);

            if (newPoints[0] != points[0] || newPoints[1] != points[1])
            {
                points = newPoints;
                InvalidateVisual();
            }
        }
Exemple #11
0
        // --------------------------------------------------
        // CLONING
        // --------------------------------------------------

        #region Cloning

        /// <summary>
        /// Clones this instance.
        /// </summary>
        /// <returns>Returns a cloned instance.</returns>
        public override object Clone(params string[] areas)
        {
            DataReferenceDto dto = base.Clone(areas) as DataReferenceDto;

            if (SourceElement != null)
            {
                dto.SourceElement = SourceElement.Clone() as DataElement;
            }
            if (PathDetail != null)
            {
                dto.PathDetail = PathDetail.Clone() as DataElementSet;
            }
            return(dto);
        }
Exemple #12
0
        /// <summary>
        /// Updates information for runtime.
        /// </summary>
        /// <param name="scope">The scope to consider.</param>
        /// <param name="scriptVariableSet">The set of script variables to consider.</param>
        /// <param name="log">The log to update.</param>
        public override void UpdateRuntimeInfo(
            IBdoScope scope = null,
            IScriptVariableSet scriptVariableSet = null,
            IBdoLog log = null)
        {
            if (PathDetail != null)
            {
                foreach (DataElement dataElement in PathDetail.Items)
                {
                    dataElement.UpdateRuntimeInfo(scope, scriptVariableSet, log);
                }
            }

            SourceElement?.UpdateRuntimeInfo(scope, scriptVariableSet, log);
        }
Exemple #13
0
        public void ICollectionTypeIsMappedToListTypeCorrectly()
        {
            var mapper = new MemberMapper();

            var source = new SourceElement[]
            {
                new SourceElement
                {
                    Value = "X"
                }
            };

            var result = mapper.Map <ICollection <SourceElement>, List <DestElement> >(source);

            Assert.AreEqual("X", result.First().Value);
        }
Exemple #14
0
        private void SetContentType(HttpWebRequest webRequest)
        {
            string contentType = SourceElement.GetAttribute("ContentType");

            if (contentType == "multipart/form-data")
            {
                string boundary = "---------------------------" + DateTime.Now.Ticks.ToString("x");
                webRequest.ContentType = "multipart/form-data; boundary=" + boundary;
                SetMultipartFormData(boundary);
            }
            else
            {
                webRequest.ContentType = contentType;
            }

            ContentType = contentType;
        }
Exemple #15
0
        public void ArrayTypeIsMappedToICollectionTypeCorrectly()
        {
            var mapper = new MemberMapper();

            var source = new SourceElement[]
            {
                new SourceElement
                {
                    Value = "X"
                }
            };

            var destination = new DestElement[0];

            var result = mapper.Map <SourceElement[], ICollection <DestElement> >(source, destination);

            Assert.AreEqual("X", result.First().Value);
        }
Exemple #16
0
    void Awake()
    {
        sourceElement       = GetComponentInParent <SourceElement> ();
        intermediaryElement = GetComponentInParent <IntermediaryElement> ();

        if (sourceElement != null)
        {
            targetElements = sourceElement.targetElements;
        }
        else if (intermediaryElement != null)
        {
            targetElements = intermediaryElement.targetElements;
        }
        else
        {
            throw new MissingComponentException("Parent is missing component SourceElement or IntermediaryElement");
        }
    }
Exemple #17
0
        public void EnsureLazyLoaded(bool isAsync = false)
        {
            if (!LazyLoad || texture != null || cannotBeLoaded || loadingAsync)
            {
                return;
            }
            loadingAsync = isAsync;

            Vector4 sourceVector   = Vector4.Zero;
            bool    temp2          = false;
            int     maxLoadRetries = 3;

            for (int i = 0; i <= maxLoadRetries; i++)
            {
                try
                {
                    LoadTexture(ref sourceVector, ref temp2);
                }
                catch (System.IO.IOException)
                {
                    if (i == maxLoadRetries || !File.Exists(FilePath))
                    {
                        throw;
                    }
                    DebugConsole.NewMessage("Loading sprite \"" + FilePath + "\" failed, retrying in 250 ms...");
                    System.Threading.Thread.Sleep(500);
                }
            }

            if (sourceRect.Width == 0 && sourceRect.Height == 0)
            {
                sourceRect     = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
                size           = SourceElement.GetAttributeVector2("size", Vector2.One);
                size.X        *= sourceRect.Width;
                size.Y        *= sourceRect.Height;
                RelativeOrigin = SourceElement.GetAttributeVector2("origin", new Vector2(0.5f, 0.5f));
            }
            if (texture == null)
            {
                cannotBeLoaded = true;
            }
        }
Exemple #18
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as Meta;

            if (dest != null)
            {
                base.CopyTo(dest);
                if (VersionIdElement != null)
                {
                    dest.VersionIdElement = (Hl7.Fhir.Model.Id)VersionIdElement.DeepCopy();
                }
                if (LastUpdatedElement != null)
                {
                    dest.LastUpdatedElement = (Hl7.Fhir.Model.Instant)LastUpdatedElement.DeepCopy();
                }
                if (SourceElement != null)
                {
                    dest.SourceElement = (Hl7.Fhir.Model.FhirUri)SourceElement.DeepCopy();
                }
                if (ProfileElement != null)
                {
                    dest.ProfileElement = new List <Hl7.Fhir.Model.FhirUri>(ProfileElement.DeepCopy());
                }
                if (Security != null)
                {
                    dest.Security = new List <Hl7.Fhir.Model.Coding>(Security.DeepCopy());
                }
                if (Tag != null)
                {
                    dest.Tag = new List <Hl7.Fhir.Model.Coding>(Tag.DeepCopy());
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Exemple #19
0
        public void EnsureLazyLoaded()
        {
            if (!LazyLoad || texture != null || cannotBeLoaded)
            {
                return;
            }

            Vector4 sourceVector = Vector4.Zero;
            bool    temp2        = false;

            LoadTexture(ref sourceVector, ref temp2);
            if (sourceRect.Width == 0 && sourceRect.Height == 0)
            {
                sourceRect     = new Rectangle((int)sourceVector.X, (int)sourceVector.Y, (int)sourceVector.Z, (int)sourceVector.W);
                size           = SourceElement.GetAttributeVector2("size", Vector2.One);
                size.X        *= sourceRect.Width;
                size.Y        *= sourceRect.Height;
                RelativeOrigin = SourceElement.GetAttributeVector2("origin", new Vector2(0.5f, 0.5f));
            }
            if (texture == null)
            {
                cannotBeLoaded = true;
            }
        }
Exemple #20
0
 public void Click() => SourceElement.Click();
Exemple #21
0
 public void SearchFor(string searchText)
 {
     SourceElement.Clear();
     SourceElement.SendKeys(searchText);
     SourceElement.SendKeys(Keys.Return);
 }
Exemple #22
0
 void Awake()
 {
     collider      = GetComponent <CircleCollider2D> ();
     sourceElement = GetComponent <SourceElement> ();
     menu          = GetComponentInChildren <ElementMenu> ();
 }
Exemple #23
0
 void Awake()
 {
     sourceElement = GetComponent <SourceElement> ();
 }
Exemple #24
0
    public static void SendEvent(SourceElement sourceElement)
    {
        var sender = sourceElement.GetComponent <ICanSendAudio> ();

        FeedTargets(sender, sender.GetTargets());
    }
Exemple #25
0
 public void Click()
 {
     BeforeClick?.Invoke(this, SourceLocator.ToString());
     SourceElement.Click();
     AfterClick?.Invoke(this, SourceLocator.ToString());
 }
Exemple #26
0
 public string GetClassName()
 {
     return(SourceElement.GetClassName());
 }
        private static void InitializingTraceSource(object sender, InitializingTraceSourceEventArgs e)
        {
            TraceSource traceSource = e.TraceSource;

            // Ported from https://referencesource.microsoft.com/#System/compmod/system/diagnostics/TraceSource.cs,176
            SourceElementsCollection sources = DiagnosticsConfiguration.Sources;

            if (sources != null)
            {
                SourceElement sourceElement = sources[traceSource.Name];
                if (sourceElement != null)
                {
                    e.WasInitialized = true;

                    // First check if the type changed.
                    if (HasSourceSwitchTypeChanged())
                    {
                        if (!string.IsNullOrEmpty(sourceElement.SwitchName))
                        {
                            CreateSwitch(sourceElement.SwitchType, sourceElement.SwitchName);
                        }
                        else
                        {
                            CreateSwitch(sourceElement.SwitchType, traceSource.Name);

                            if (!string.IsNullOrEmpty(sourceElement.SwitchValue))
                            {
                                traceSource.Switch.Level = (SourceLevels)Enum.Parse(typeof(SourceLevels), sourceElement.SwitchValue);
                            }
                        }
                    }
                    else if (!string.IsNullOrEmpty(sourceElement.SwitchName))
                    {
                        // Create a new switch if the name changed, otherwise just refresh.
                        if (sourceElement.SwitchName != traceSource.Switch.DisplayName)
                        {
                            CreateSwitch(sourceElement.SwitchType, sourceElement.SwitchName);
                        }
                        else
                        {
                            traceSource.Switch.Refresh();
                        }
                    }
                    else
                    {
                        // The SwitchValue changed; just update our internalSwitch.
                        if (!string.IsNullOrEmpty(sourceElement.SwitchValue))
                        {
                            traceSource.Switch.Level = (SourceLevels)Enum.Parse(typeof(SourceLevels), sourceElement.SwitchValue);
                        }
                        else
                        {
                            traceSource.Switch.Level = SourceLevels.Off;
                        }
                    }

                    TraceListener[] newListenerCollection = new TraceListener[sourceElement.Listeners.Count];
                    int             listnerOffset         = 0;
                    foreach (ListenerElement listenerElement in sourceElement.Listeners)
                    {
                        TraceListener listener = traceSource.Listeners[listenerElement.Name];
                        if (listener != null)
                        {
                            newListenerCollection[listnerOffset++] = listenerElement.RefreshRuntimeObject(listener);
                        }
                        else
                        {
                            newListenerCollection[listnerOffset++] = listenerElement.GetRuntimeObject();
                        }
                    }

                    TraceUtils.CopyStringDictionary(sourceElement.Attributes, traceSource.Attributes);

                    traceSource.Listeners.Clear();
                    traceSource.Listeners.AddRange(newListenerCollection);
                }
                else
                {
                    // There was no config, so clear whatever we have.
                    traceSource.Switch.Level = traceSource.DefaultLevel;
                    traceSource.Listeners.Clear();
                    traceSource.Attributes.Clear();
                }

                bool HasSourceSwitchTypeChanged()
                {
                    string sourceTypeName = sourceElement.SwitchType;
                    Type   currentType    = traceSource.Switch.GetType();

                    if (string.IsNullOrEmpty(sourceTypeName))
                    {
                        // SourceSwitch is the default switch type.
                        return(currentType != typeof(SourceSwitch));
                    }

                    if (sourceTypeName == currentType.FullName)
                    {
                        return(false);
                    }

                    // Since there can be more than one valid AssemblyQualifiedName for a given Type this
                    // check can return true for some cases which can cause a minor side effect of a new
                    // Switch being created instead of just being refreshed.
                    return(sourceElement.SwitchType != currentType.AssemblyQualifiedName);
                }
            }

            void CreateSwitch(string typeName, string name)
            {
                if (!string.IsNullOrEmpty(typeName))
                {
                    traceSource.Switch = (SourceSwitch)TraceUtils.GetRuntimeObject(typeName, typeof(SourceSwitch), name);
                }
                else
                {
                    traceSource.Switch = new SourceSwitch(name, traceSource.DefaultLevel.ToString());
                }
            }
        }
Exemple #28
0
        public void ICollectionTypeIsMappedToIEnumerableTypeCorrectly()
        {
            var mapper = new MemberMapper();

              var source = new SourceElement[]
              {
            new SourceElement
            {
              Value = "X"
            }
              };

              var destination = new DestElement[0];

              var result = mapper.Map<ICollection<SourceElement>, IEnumerable<DestElement>>(source, destination);

              Assert.AreEqual("X", result.First().Value);
        }
Exemple #29
0
 private void tbSize_TextChanged(object sender, TextChangedEventArgs e)
 {
     SourceElement.InvalidateVisual();
 }
        // GET: api/CroweCurConv?source=?&fromCur=?&toCur=?&date=?
        public async Task <IHttpActionResult> Get(string source, string fromCur, string toCur, decimal amount, string date)
        {
            SourceElement    processingSource = null;
            StringDictionary dictParam        = null;

            foreach (SourceElement sourceElem in _sources)
            {
                if (sourceElem.Name == source)
                {
                    processingSource = sourceElem;
                    break;
                }
            }

            if (processingSource != null)
            {
                if (processingSource.Enabled)
                {
                    var processor = ProcessorFactory.CreateandReturnObj(processingSource.Name);

                    if (!processingSource.Secure)
                    {
                        dictParam = GetRequestParamDictionary(fromCur, toCur, amount.ToString(), date);
                    }
                    else
                    {
                        dictParam = GetRequestParamDictionary(fromCur, toCur, amount.ToString(), date, processingSource.LoginUrl);
                    }
                    try
                    {
                        var responseString = await processor.Process(processingSource.Url, dictParam);

                        return(Ok(responseString));
                    }
                    catch (WebException ex)
                    {
                        using (WebResponse response = ex.Response)
                        {
                            HttpWebResponse httpWebResponse = response as HttpWebResponse;
                            if (httpWebResponse.StatusCode == HttpStatusCode.BadRequest)
                            {
                                return(BadRequest());
                            }
                            else if (httpWebResponse.StatusCode == HttpStatusCode.InternalServerError)
                            {
                                return(InternalServerError());
                            }
                            else if (httpWebResponse.StatusCode == HttpStatusCode.NotFound)
                            {
                                return(NotFound());
                            }
                        }
                    }
                }
                else
                {
                    return(Ok(Constants.SOURCEDISABLEDMSG));
                }
            }
            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #31
0
        public void ICollectionTypeIsMappedToListTypeCorrectly()
        {
            var mapper = new MemberMapper();

              var source = new SourceElement[]
              {
            new SourceElement
            {
              Value = "X"
            }
              };

              var result = mapper.Map<ICollection<SourceElement>, List<DestElement>>(source);

              Assert.AreEqual("X", result.First().Value);
        }
Exemple #32
0
 private Config(SourceElement source, String appDir)
 {
     _source = source;
     _appDir = appDir;
 }