Пример #1
0
            public override ErrorList Validate()
            {
                var result = new ErrorList();

                result.AddRange(base.Validate());

                if (SeverityElement != null)
                {
                    result.AddRange(SeverityElement.Validate());
                }
                if (Type != null)
                {
                    result.AddRange(Type.Validate());
                }
                if (DetailsElement != null)
                {
                    result.AddRange(DetailsElement.Validate());
                }
                if (LocationElement != null)
                {
                    LocationElement.ForEach(elem => result.AddRange(elem.Validate()));
                }

                return(result);
            }
Пример #2
0
            public override IDeepCopyable CopyTo(IDeepCopyable other)
            {
                var dest = other as OperationOutcomeIssueComponent;

                if (dest != null)
                {
                    base.CopyTo(dest);
                    if (SeverityElement != null)
                    {
                        dest.SeverityElement = (Code <Hl7.Fhir.Model.OperationOutcome.IssueSeverity>)SeverityElement.DeepCopy();
                    }
                    if (CodeElement != null)
                    {
                        dest.CodeElement = (Code <Hl7.Fhir.Model.OperationOutcome.IssueType>)CodeElement.DeepCopy();
                    }
                    if (Details != null)
                    {
                        dest.Details = (Hl7.Fhir.Model.CodeableConcept)Details.DeepCopy();
                    }
                    if (DiagnosticsElement != null)
                    {
                        dest.DiagnosticsElement = (Hl7.Fhir.Model.FhirString)DiagnosticsElement.DeepCopy();
                    }
                    if (LocationElement != null)
                    {
                        dest.LocationElement = new List <Hl7.Fhir.Model.FhirString>(LocationElement.DeepCopy());
                    }
                    return(dest);
                }
                else
                {
                    throw new ArgumentException("Can only copy to an object of the same type", "other");
                }
            }
Пример #3
0
    public bool LoadBin(byte[] binContent)
    {
        m_mapElements.Clear();
        m_vecAllElements.Clear();
        int nCol, nRow;
        int readPos = 0;

        readPos += GameAssist.ReadInt32Variant(binContent, readPos, out nCol);
        readPos += GameAssist.ReadInt32Variant(binContent, readPos, out nRow);
        List <string> vecLine     = new List <string>(nCol);
        List <int>    vecHeadType = new List <int>(nCol);
        string        tmpStr;
        int           tmpInt;

        for (int i = 0; i < nCol; i++)
        {
            readPos += GameAssist.ReadString(binContent, readPos, out tmpStr);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out tmpInt);
            vecLine.Add(tmpStr);
            vecHeadType.Add(tmpInt);
        }
        if (vecLine.Count != 4)
        {
            Ex.Logger.Log("Location.csv中列数量与生成的代码不匹配!");
            return(false);
        }
        if (vecLine[0] != "ID")
        {
            Ex.Logger.Log("Location.csv中字段[ID]位置不对应"); return(false);
        }
        if (vecLine[1] != "PosX")
        {
            Ex.Logger.Log("Location.csv中字段[PosX]位置不对应"); return(false);
        }
        if (vecLine[2] != "Dungeons")
        {
            Ex.Logger.Log("Location.csv中字段[Dungeons]位置不对应"); return(false);
        }
        if (vecLine[3] != "Layer")
        {
            Ex.Logger.Log("Location.csv中字段[Layer]位置不对应"); return(false);
        }

        for (int i = 0; i < nRow; i++)
        {
            LocationElement member = new LocationElement();
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.ID);
            readPos += GameAssist.ReadFloat(binContent, readPos, out member.PosX);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Dungeons);
            readPos += GameAssist.ReadInt32Variant(binContent, readPos, out member.Layer);

            member.IsValidate = true;
            m_vecAllElements.Add(member);
            m_mapElements[member.ID] = member;
        }
        return(true);
    }
Пример #4
0
    public bool LoadCsv(string strContent)
    {
        if (strContent.Length == 0)
        {
            return(false);
        }
        m_mapElements.Clear();
        m_vecAllElements.Clear();
        int           contentOffset = 0;
        List <string> vecLine;

        vecLine = GameAssist.readCsvLine(strContent, ref contentOffset);
        if (vecLine.Count != 4)
        {
            Ex.Logger.Log("Location.csv中列数量与生成的代码不匹配!");
            return(false);
        }
        if (vecLine[0] != "ID")
        {
            Ex.Logger.Log("Location.csv中字段[ID]位置不对应"); return(false);
        }
        if (vecLine[1] != "PosX")
        {
            Ex.Logger.Log("Location.csv中字段[PosX]位置不对应"); return(false);
        }
        if (vecLine[2] != "Dungeons")
        {
            Ex.Logger.Log("Location.csv中字段[Dungeons]位置不对应"); return(false);
        }
        if (vecLine[3] != "Layer")
        {
            Ex.Logger.Log("Location.csv中字段[Layer]位置不对应"); return(false);
        }

        while (true)
        {
            vecLine = GameAssist.readCsvLine(strContent, ref contentOffset);
            if ((int)vecLine.Count == 0)
            {
                break;
            }
            if ((int)vecLine.Count != (int)4)
            {
                return(false);
            }
            LocationElement member = new LocationElement();
            member.ID       = Convert.ToInt32(vecLine[0]);
            member.PosX     = Convert.ToSingle(vecLine[1]);
            member.Dungeons = Convert.ToInt32(vecLine[2]);
            member.Layer    = Convert.ToInt32(vecLine[3]);

            member.IsValidate = true;
            m_vecAllElements.Add(member);
            m_mapElements[member.ID] = member;
        }
        return(true);
    }
Пример #5
0
        public static GenericMessage MakeLocationResponse(long id, double lat, double lon, string lang)
        {
            string          image_url = $"https://maps.googleapis.com/maps/api/staticmap?size=764x400&center={lat},{lon}&zoom=15&markers={lat},{lon}";
            string          item_url  = $"http://maps.apple.com/maps?q={lat},{lon}&z=16";
            LocationElement element   = new LocationElement(DataConstants.GetMessage("CLOSEST_TOILET", lang), image_url, "", null, item_url);
            List <Element>  elements  = new List <Element>();

            elements.Add(element);
            IPayload   payload    = new PayloadMessage("generic", elements, true, "horizontal");
            Attachment attachment = new Attachment("template", payload);

            return(new GenericMessage(id, attachment));
        }
Пример #6
0
        internal LocationData(RedirectData parent, LocationElement element)
            : this(parent)
        {
            Enabled         = element.Enabled;
            Name            = element.Name;
            Url             = element.Url;
            MatchExpression = element.MatchExpression;

            foreach (FilterElement item in element)
            {
                base.Add(new FilterData(this, item));
            }
        }
Пример #7
0
        internal LocationElement GetElement()
        {
            LocationElement element = new LocationElement();

            element.Enabled         = Enabled;
            element.Name            = Name;
            element.Url             = Url;
            element.MatchExpression = MatchExpression;

            foreach (FilterData item in this)
            {
                element.Add(item.GetElement());
            }

            return(element);
        }
 void InitialiseLocationSelector()
 {
     LocationElement.InitialiseMutliSelect(FilterPreferences.Locations);
 }
Пример #9
0
        /// <summary>
        /// Get location of an element, return an array XYZ
        /// </summary>
        /// <param name="e">The e<see cref="Element"/></param>
        /// <returns></returns>
        public static LocationElement GetLocationElement(Element e)
        {
            LocationElement elementLocation = new LocationElement()
            {
                LocationType = "null"
            };

            Location position = e.Location;

            if (null == position)
            {
                elementLocation.LocationType = "null";
                return(elementLocation);
            }
            else
            {
                // If the location is a point location, give the user information
                LocationPoint positionPoint = position as LocationPoint;

                LocationCurve positionCurve = position as LocationCurve;

                if (null != positionPoint)
                {
                    elementLocation = new LocationElement
                    {
                        LocationType     = "Point",
                        Location_point01 = new PointXYZ
                        {
                            X = positionPoint.Point.X,
                            Y = positionPoint.Point.Y,
                            Z = positionPoint.Point.Z
                        }
                    };
                }
                else
                {
                    if (null != positionCurve)
                    {
                        // il faut analyser curve line and curve courbe
                        Curve curve = positionCurve.Curve;
                        elementLocation = new LocationElement
                        {
                            LocationType     = "Curve",
                            Location_point01 = new PointXYZ
                            {
                                X = curve.GetEndPoint(0).X,
                                Y = curve.GetEndPoint(0).Y,
                                Z = curve.GetEndPoint(0).Z
                            },
                            Location_point02 = new PointXYZ
                            {
                                X = curve.GetEndPoint(1).X,
                                Y = curve.GetEndPoint(1).Y,
                                Z = curve.GetEndPoint(1).Z
                            }
                        };
                    }
                }
            }

            return(elementLocation);
        }
Пример #10
0
        public override ErrorList Validate()
        {
            var result = new ErrorList();

            result.AddRange(base.Validate());

            if (MasterIdentifier != null)
            {
                result.AddRange(MasterIdentifier.Validate());
            }
            if (Identifier != null)
            {
                Identifier.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Subject != null)
            {
                result.AddRange(Subject.Validate());
            }
            if (Type != null)
            {
                result.AddRange(Type.Validate());
            }
            if (Subtype != null)
            {
                result.AddRange(Subtype.Validate());
            }
            if (Author != null)
            {
                Author.ForEach(elem => result.AddRange(elem.Validate()));
            }
            if (Custodian != null)
            {
                result.AddRange(Custodian.Validate());
            }
            if (Authenticator != null)
            {
                result.AddRange(Authenticator.Validate());
            }
            if (CreatedElement != null)
            {
                result.AddRange(CreatedElement.Validate());
            }
            if (IndexedElement != null)
            {
                result.AddRange(IndexedElement.Validate());
            }
            if (StatusElement != null)
            {
                result.AddRange(StatusElement.Validate());
            }
            if (DocStatus != null)
            {
                result.AddRange(DocStatus.Validate());
            }
            if (Supercedes != null)
            {
                result.AddRange(Supercedes.Validate());
            }
            if (DescriptionElement != null)
            {
                result.AddRange(DescriptionElement.Validate());
            }
            if (Confidentiality != null)
            {
                result.AddRange(Confidentiality.Validate());
            }
            if (PrimaryLanguageElement != null)
            {
                result.AddRange(PrimaryLanguageElement.Validate());
            }
            if (MimeTypeElement != null)
            {
                result.AddRange(MimeTypeElement.Validate());
            }
            if (Format != null)
            {
                result.AddRange(Format.Validate());
            }
            if (SizeElement != null)
            {
                result.AddRange(SizeElement.Validate());
            }
            if (HashElement != null)
            {
                result.AddRange(HashElement.Validate());
            }
            if (LocationElement != null)
            {
                result.AddRange(LocationElement.Validate());
            }
            if (Service != null)
            {
                result.AddRange(Service.Validate());
            }
            if (Context != null)
            {
                result.AddRange(Context.Validate());
            }

            return(result);
        }
Пример #11
0
 public override IDeepCopyable CopyTo(IDeepCopyable other)
 {
     var dest = other as OperationOutcomeIssueComponent;
     
     if (dest != null)
     {
         base.CopyTo(dest);
         if(SeverityElement != null) dest.SeverityElement = (Code<Hl7.Fhir.Model.OperationOutcome.IssueSeverity>)SeverityElement.DeepCopy();
         if(Type != null) dest.Type = (Hl7.Fhir.Model.Coding)Type.DeepCopy();
         if(DetailsElement != null) dest.DetailsElement = (Hl7.Fhir.Model.FhirString)DetailsElement.DeepCopy();
         if(LocationElement != null) dest.LocationElement = new List<Hl7.Fhir.Model.FhirString>(LocationElement.DeepCopy());
         return dest;
     }
     else
     	throw new ArgumentException("Can only copy to an object of the same type", "other");
 }
Пример #12
0
        public override IDeepCopyable CopyTo(IDeepCopyable other)
        {
            var dest = other as DocumentReference;

            if (dest != null)
            {
                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 (Subject != null)
                {
                    dest.Subject = (Hl7.Fhir.Model.ResourceReference)Subject.DeepCopy();
                }
                if (Type != null)
                {
                    dest.Type = (Hl7.Fhir.Model.CodeableConcept)Type.DeepCopy();
                }
                if (Class != null)
                {
                    dest.Class = (Hl7.Fhir.Model.CodeableConcept)Class.DeepCopy();
                }
                if (Author != null)
                {
                    dest.Author = new List <Hl7.Fhir.Model.ResourceReference>(Author.DeepCopy());
                }
                if (Custodian != null)
                {
                    dest.Custodian = (Hl7.Fhir.Model.ResourceReference)Custodian.DeepCopy();
                }
                if (PolicyManagerElement != null)
                {
                    dest.PolicyManagerElement = (Hl7.Fhir.Model.FhirUri)PolicyManagerElement.DeepCopy();
                }
                if (Authenticator != null)
                {
                    dest.Authenticator = (Hl7.Fhir.Model.ResourceReference)Authenticator.DeepCopy();
                }
                if (CreatedElement != null)
                {
                    dest.CreatedElement = (Hl7.Fhir.Model.FhirDateTime)CreatedElement.DeepCopy();
                }
                if (IndexedElement != null)
                {
                    dest.IndexedElement = (Hl7.Fhir.Model.Instant)IndexedElement.DeepCopy();
                }
                if (StatusElement != null)
                {
                    dest.StatusElement = (Code <Hl7.Fhir.Model.DocumentReference.DocumentReferenceStatus>)StatusElement.DeepCopy();
                }
                if (DocStatus != null)
                {
                    dest.DocStatus = (Hl7.Fhir.Model.CodeableConcept)DocStatus.DeepCopy();
                }
                if (RelatesTo != null)
                {
                    dest.RelatesTo = new List <Hl7.Fhir.Model.DocumentReference.DocumentReferenceRelatesToComponent>(RelatesTo.DeepCopy());
                }
                if (DescriptionElement != null)
                {
                    dest.DescriptionElement = (Hl7.Fhir.Model.FhirString)DescriptionElement.DeepCopy();
                }
                if (Confidentiality != null)
                {
                    dest.Confidentiality = new List <Hl7.Fhir.Model.CodeableConcept>(Confidentiality.DeepCopy());
                }
                if (PrimaryLanguageElement != null)
                {
                    dest.PrimaryLanguageElement = (Hl7.Fhir.Model.Code)PrimaryLanguageElement.DeepCopy();
                }
                if (MimeTypeElement != null)
                {
                    dest.MimeTypeElement = (Hl7.Fhir.Model.Code)MimeTypeElement.DeepCopy();
                }
                if (FormatElement != null)
                {
                    dest.FormatElement = new List <Hl7.Fhir.Model.FhirUri>(FormatElement.DeepCopy());
                }
                if (SizeElement != null)
                {
                    dest.SizeElement = (Hl7.Fhir.Model.Integer)SizeElement.DeepCopy();
                }
                if (HashElement != null)
                {
                    dest.HashElement = (Hl7.Fhir.Model.FhirString)HashElement.DeepCopy();
                }
                if (LocationElement != null)
                {
                    dest.LocationElement = (Hl7.Fhir.Model.FhirUri)LocationElement.DeepCopy();
                }
                if (Service != null)
                {
                    dest.Service = (Hl7.Fhir.Model.DocumentReference.DocumentReferenceServiceComponent)Service.DeepCopy();
                }
                if (Context != null)
                {
                    dest.Context = (Hl7.Fhir.Model.DocumentReference.DocumentReferenceContextComponent)Context.DeepCopy();
                }
                return(dest);
            }
            else
            {
                throw new ArgumentException("Can only copy to an object of the same type", "other");
            }
        }
Пример #13
0
 private LocationTable()
 {
     m_mapElements    = new Dictionary <int, LocationElement>();
     m_emptyItem      = new LocationElement();
     m_vecAllElements = new List <LocationElement>();
 }