Inheritance: MonoBehaviour
        private bool HandleVariableExcluded(DataTypes.Variables.VariableSave variable, DataTypes.RecursiveVariableFinder rvf)
        {
            string rootName = variable.GetRootName();

            bool shouldExclude = false;

            if (rootName == "Texture Top" || rootName == "Texture Left")
            {
                var addressMode = rvf.GetValue<TextureAddress>("Texture Address");

                shouldExclude = addressMode == TextureAddress.EntireTexture;
            }

            if (rootName == "Texture Width" || rootName == "Texture Height")
            {
                var addressMode = rvf.GetValue<TextureAddress>("Texture Address");

                shouldExclude = addressMode == TextureAddress.EntireTexture ||
                    addressMode == TextureAddress.DimensionsBased;
            }

            if (rootName == "Texture Width Scale" || rootName == "Texture Height Scale")
            {
                var addressMode = rvf.GetValue<TextureAddress>("Texture Address");

                shouldExclude = addressMode == TextureAddress.EntireTexture ||
                    addressMode == TextureAddress.Custom;
            }

            return shouldExclude;
        }
 private static void OnLogTableCreated(object sender, DataTypes.EventHandling.LogTableCreationEventArg e)
 {
     var p = e.Params;
     m_LogTables[e.Id] = new Table(p.TableName, (Logger.DBAccess.Enums.GameSubTypeEnum)Enum.Parse(typeof(Logger.DBAccess.Enums.GameSubTypeEnum), p.Variant.ToString()), p.MinPlayersToStart, p.MaxPlayers, (Logger.DBAccess.Enums.BlindTypeEnum)Enum.Parse(typeof(Logger.DBAccess.Enums.BlindTypeEnum), p.Blind.ToString()), (Logger.DBAccess.Enums.LobbyTypeEnum)Enum.Parse(typeof(Logger.DBAccess.Enums.LobbyTypeEnum), p.Lobby.OptionType.ToString()), (Logger.DBAccess.Enums.LimitTypeEnum)Enum.Parse(typeof(Logger.DBAccess.Enums.LimitTypeEnum), p.Limit.ToString()), m_LogServer);
     m_LogTables[e.Id].RegisterTable();
     m_LogGamesStatus[e.Id] = false;
 }
Exemplo n.º 3
0
        private static object CreateAndAddInstanceFromClipboard(string instanceType, DataTypes.ArrowElementSave currentArrowElement, string xmlSerializedString)
        {
            object newObject = null;

            if (instanceType == typeof(AxisAlignedRectangleSave).Name)
            {

                AxisAlignedRectangleSave aars = FileManager.XmlDeserializeFromString<AxisAlignedRectangleSave>(
                    xmlSerializedString);

                currentArrowElement.Rectangles.Add(aars);
                newObject = aars;
            }
            else if (instanceType == typeof(CircleSave).Name)
            {

                CircleSave circleSave = FileManager.XmlDeserializeFromString<CircleSave>(
                    xmlSerializedString);

                currentArrowElement.Circles.Add(circleSave);
                newObject = circleSave;

            }
            else if (instanceType == typeof(SpriteSave).Name)
            {

                SpriteSave spriteSave = FileManager.XmlDeserializeFromString<SpriteSave>(
                    xmlSerializedString);

                currentArrowElement.Sprites.Add(spriteSave);
                newObject = spriteSave;
            }

            return newObject;
        }
Exemplo n.º 4
0
 public EhrExtractContent(string archetypeNodeId, DataTypes.Text.DvText name)
     : base(archetypeNodeId, name)
 {
     // TODO: implement SetAttributeDictionary and CheckInvariant overrides
     SetAttributeDictionary();
     CheckInvariants();
 }
Exemplo n.º 5
0
 public Rmessage(Byte data)
 {
     Type = DataTypes.BYTESTREAM;//setting type (Bitstream) in object field
     content = new Byte[8];      //create array with message and header of parameter
     content[0] = 5;             //setting type (Bitstream)
     content[1] = 1;             //setting length (1 byte)
     content[4] = data;          //copying data to send
 }
 public ImpactScienceData(DataTypes dataType, float energy, String biome, double latitude, float amount, float xmitValue, float labBoost, String id, String dataname, bool triggered, uint flightID)
     : base(amount, xmitValue, labBoost, id, dataname, triggered, flightID)
 {
     this.datatype = dataType;
     kineticEnergy = energy;
     this.biome = biome;
     this.latitude = latitude;
 }
Exemplo n.º 7
0
 public Musician(DataTypes.MusicianData md, ContentManager cm, SpriteBatch sb)
 {
     texture = cm.Load<Texture2D>(md.Texture);
     map = cm.Load<Dictionary<string, Rectangle>>(md.SpriteMap).Values.ToArray();
     position = md.Position;
     frameRate = md.FrameRate;
     spriteBatch = sb;
 }
Exemplo n.º 8
0
        public ImageSet(ImageCollection collection, int index, DataTypes type, object dataObject)
            : this(collection, index)
        {
            this.DataType   = type;
            this.DataObject = dataObject;

            this.Status = Statues.None;
        }
Exemplo n.º 9
0
 // INPUT CORRECT
 // This method checks that the player's input corresponds to the expected input -
 // That they are in the right place and that they are pressing the right thing.
 public bool inputCorrect(DataTypes.InputType input)
 {
     if (stateMachine.CurrentNode == stateMachine.PlayerNode &&
         (input.ToString() == stateMachine.PlayerEdge.NextNodeType.ToString() ||
      ((input.ToString()=="HIT" || input.ToString()=="SNARE"))||
      stateMachine.CurrentEdge.NextNodeType.ToString()=="ROLL")){
         return true;
     } else return false;
 }
Exemplo n.º 10
0
        private static void OnLogGameCreated(object sender, DataTypes.EventHandling.LogGameEventArg e)
        {
            if (m_LogGamesStatus[e.Id])
                return;

            m_LogGamesStatus[e.Id] = true;
            m_LogGames[e.Id] = new Game(m_LogTables[e.Id]);
            m_LogGames[e.Id].RegisterGame();
        }
Exemplo n.º 11
0
        internal static byte[] GetBytes(int size, DataTypes[] types, object[] data)
        {
            byte[] bytes = new byte[size];
            int currentPlace = 0;

            for (int i = 0; i < types.Length; ++i)
            {
                switch (types[i])
                {
                    case DataTypes.Bool:
                        BitConverter.GetBytes((bool)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.DateTime:
                        BitConverter.GetBytes(((DateTime)data[i]).ToBinary()).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.Byte:
                        bytes[currentPlace] = (byte)data[i];
                        break;
                    case DataTypes.Short:
                        BitConverter.GetBytes((short)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.UShort:
                        BitConverter.GetBytes((ushort)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.Int:
                        BitConverter.GetBytes((int)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.UInt:
                        BitConverter.GetBytes((uint)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.Long:
                        BitConverter.GetBytes((long)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.ULong:
                        BitConverter.GetBytes((ulong)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.Float:
                        BitConverter.GetBytes((float)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.Double:
                        BitConverter.GetBytes((double)data[i]).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.Name:
                        string s = ((string)data[i]).PadRight(16);
                        encode.GetBytes(s).CopyTo(bytes, currentPlace);
                        break;
                    case DataTypes.Message:
                        string st = ((string)data[i]).PadRight(64);
                        encode.GetBytes(st).CopyTo(bytes, currentPlace);
                        break;
                }

                currentPlace += GetSize(types[i]);
            }

            return bytes;
        }
Exemplo n.º 12
0
        public AuditDetails(string systemId, DataTypes.Text.DvCodedText changeType)
            : this()
        {
            DesignByContract.Check.Require(!string.IsNullOrEmpty(systemId), "systemId must not be null or empty");
            DesignByContract.Check.Require(changeType != null, "changeType must not be null");

            this.systemId = systemId;
            this.timeCommitted = new OpenEhr.RM.DataTypes.Quantity.DateTime.DvDateTime();
            this.changeType = changeType;
        }
Exemplo n.º 13
0
 public FeederAudit(FeederAuditDetails originatingSystemAudit,
     AssumedTypes.List<DataTypes.Basic.DvIdentifier> originatingSystemItemIds,            
     DataTypes.Encapsulated.DvEncapsulated originalContent)
     : this()
 {
     Check.Require(originatingSystemAudit != null);
     this.originatingSystemAudit = originatingSystemAudit;
     this.originatingSystemItemIds = originatingSystemItemIds;
     this.originalContent = originalContent;
 }
Exemplo n.º 14
0
 /// <summary>
 /// Constructs a new tile
 /// </summary>
 /// <param name="position">Initial position of the tile</param>
 /// <param name="texture">Texture content to render</param>
 /// <param name="collision">Collision type used for collision resolution</param>
 public Tile(Vector2 position, Texture2D texture, DataTypes.CollisionType collision)
 {
     colliding = false;
     this.position = position;
     prevPosition = position;
     this.texture = texture;
     this.collisionType = collision;
     this.forces = new List<Vector2>();
     this.impulses = new List<Vector2>();
 }
Exemplo n.º 15
0
        // System ID is not set here, expecting it top be set by the server
        public AuditDetails(DataTypes.Text.DvCodedText changeType, PartyProxy committer)
            : this()
        {
            DesignByContract.Check.Require(changeType != null, "changeType must not be null");
            DesignByContract.Check.Require(committer != null, "committer must not be null");

            this.changeType = changeType;
            this.committer = committer;

            this.CheckDefaultInvariants();
        }
Exemplo n.º 16
0
        public StateMachine(DataTypes.BitmapUnsafe bitmap, List<State> states)
        {
            _bitmap = bitmap;
            _states = states;

            startx = rand.Next(0, bitmap.Width);
            starty = rand.Next(0, bitmap.Height);
            startstate = states[rand.Next(0, states.Count)];

            Reset();
        }
Exemplo n.º 17
0
        int rowSize; //Number of bytes in each row

        #endregion Fields

        #region Constructors

        internal Table(string _path, DataTypes[] types, int size)
        {
            path = _path;
            dataTypes = types;
            rowSize = size;

            if (!File.Exists(path))
                File.Create(path);

            GetRowCount();
        }
Exemplo n.º 18
0
        public Link(DataTypes.Text.DvText meaning, DataTypes.Text.DvText type,
            DataTypes.Uri.DvEhrUri target)
            : this()
        {
            Check.Require(meaning != null && type != null && target != null);
            this.meaning = meaning;
            this.type = type;
            this.target = target;

            CheckInvariants();
        }
Exemplo n.º 19
0
        public Rmessage(Int32 data)
        {
            Type = DataTypes.INT;

            content = new Byte[8];
            Byte[] val = BitConverter.GetBytes(data);
            Byte[] btype = BitConverter.GetBytes((int)Type);

            Array.Copy(btype, 0, content, 0, 4);
            Array.Copy(val, 0, content, 4, 4);
            content[1] = 4;
        }
Exemplo n.º 20
0
 public void GenerateCSharpSignature(DataTypes types, LrpStream stream)
 {
     if (this.Direction == ParameterDirection.InOut)
     {
         stream.Write("ref ");
     }
     else if (this.Direction == ParameterDirection.Out)
     {
         stream.Write("out ");
     }
     stream.Write("{0} {1}", types.ToCSharpFullName(this.Type), this.Name);
 }
Exemplo n.º 21
0
        protected ExtractLocatable(string archetypeNodeId, DataTypes.Text.DvText name)
            : this()
        {
            Check.Require(!string.IsNullOrEmpty(archetypeNodeId), "archetype node id must not be null or empty");
            this.archetypeNodeId = archetypeNodeId;

            Check.Require(name != null, "name must not be null");
            Check.Require(!string.IsNullOrEmpty(name.Value), "name value must not be null or empty");
            this.name = name;

            Check.Invariant(attributesDictionary != null, "Attributes diction must not be null");
        }
Exemplo n.º 22
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="systemId"></param>
 /// <param name="location"></param>
 /// <param name="provider"></param>
 /// <param name="subject"></param>
 /// <param name="time"></param>
 /// <param name="versionId"></param>
 public FeederAuditDetails(string systemId, Common.Generic.PartyIdentified location,
     Common.Generic.PartyIdentified provider, Common.Generic.PartyProxy subject,
     DataTypes.Quantity.DateTime.DvDateTime time, string versionId)
     : this()
 {
     this.systemId = systemId;
     this.location = location;
     this.provider = provider;
     this.subject = subject;
     this.time = time;
     this.versionId = versionId;
 }
Exemplo n.º 23
0
        void OnProjectLoad(DataTypes.GumProjectSave obj)
        {
            if (obj != null && !string.IsNullOrEmpty(obj.FullFileName))
            {
                string fileName = obj.FullFileName;

                MainWindow.Text = "Gum: " + fileName;
            }
            else
            {
                MainWindow.Text = "Gum";
            }
        }
Exemplo n.º 24
0
        public IsmTransition(DataTypes.Text.DvCodedText currentState, DataTypes.Text.DvCodedText transition,
            DataTypes.Text.DvCodedText careflowStep)
            : this()
        {
            Check.Require(currentState != null, "current_state must not be null");

            this.currentState = currentState;
            this.transition = transition;
            this.careflowStep = careflowStep;

            SetAttributeDictionary();
            this.SetAttributeDictionary();
        }
Exemplo n.º 25
0
        readonly int _rowSize; //Number of bytes in each row

        #endregion Fields

        #region Constructors

        internal Table(Database _database, string name, string path, DataTypes[] types, int size)
        {
            database = _database;
            _name = name;
            _path = path;
            _dataTypes = types;
            _rowSize = size;
            _dataPositions = database.GetPositions(_dataTypes);

            //Open the file but dont close it until the table needs "unloaded"
            _fileStream = File.Open(_path, FileMode.OpenOrCreate);

            GetRowCount();
        }
Exemplo n.º 26
0
        public ExtractChapter(string archetypeNodeId, DataTypes.Text.DvText name, 
            ExtractEntityIdentifier entityIdentifer, ExtractEntityContent content)
            : base(archetypeNodeId, name)
        {
            // TODO: Set attribute values
            this.entityIdentifier = entityIdentifer;
            this.content = content;

            // TODO: implement SetAttributeDictionary and CheckInvariant overrides
            SetAttributeDictionary();
            CheckInvariants();

            DesignByContract.Check.Ensure(EntityIdentifier != null, "EntityIdentifier must not be null");
            DesignByContract.Check.Ensure(Content != null, "Content must not be null");
        }
Exemplo n.º 27
0
        public City(DataTypes.WorldData.City c)
        {
            AbsolutePosition = c.Position;
            RelativePosition = c.Position;
            State = c.State;
            clearedDialogue = new DialogModel(c.ClearedDialogAsset);
            unlockedDialogue = new DialogModel(c.UnlockedDialogAsset);
            newlyUnlockedDialogue = new DialogModel(c.NewlyUnlockedDialogAsset);
            successDialogue = new DialogModel(c.SuccessAsset);
            Name = c.Name;

            Unlocked = new Models.City[] { null, null, null };

            Data = c;
        }
Exemplo n.º 28
0
        public static StateMachine FromString(DataTypes.BitmapUnsafe image, string value, int maxstates)
        {
            StateMachine retval = new StateMachine();
            retval._bitmap = image;

            value = value.Substring(1);
            if (value[0] != 's') throw new Exception("wrong function for dupmachine");

            value = value.Substring(1);

            int index;

            index = value.IndexOf('i');

            int statecount = Convert.ToInt32(value.Substring(0, index));
            value = value.Substring(index + 1);

            index = value.IndexOf('x');

            int initialstate = Convert.ToInt32(value.Substring(0, index));
            value = value.Substring(index + 1);

            index = value.IndexOf('y');

            retval.startx = Convert.ToInt32(value.Substring(0, index));
            value = value.Substring(index + 1);

            index = value.IndexOf('[');

            retval.starty = Convert.ToInt32(value.Substring(0, index));
            value = value.Substring(index);

            retval._states = new List<State>();

            for (int n = 0; n < statecount; n++)
            {
                index = value.IndexOf(']');
                retval._states.Add(State.FromString(value.Substring(0, index + 1), maxstates));
                value = value.Substring(index + 1);
            }

            if (value != ")") throw new Exception("end mismatch");

            retval.startstate = retval._states[initialstate];

            retval.Reset();
            return retval;
        }
Exemplo n.º 29
0
        public Rmessage(String data)
        {
            Type = DataTypes.STRING;

            Byte[] input = ASCIIEncoding.ASCII.GetBytes(data);

            Int32 PacketLength = 4;
            while ((input.Length + 1) > PacketLength) PacketLength += 4;

            content = new Byte[4 + PacketLength];
            Array.Copy(input, 0, content, 4, input.Length);

            Byte[] length = BitConverter.GetBytes(PacketLength);
            Array.Copy(length, 0, content, 1, 3);
            content[0] = (byte)Type;
        }
Exemplo n.º 30
0
        public Participation(DataTypes.Text.DvText function,
            DataTypes.Quantity.DvInterval<DataTypes.Quantity.DateTime.DvDateTime> time,
            DataTypes.Text.DvCodedText mode, PartyProxy performer)
            : this()
        {
            Check.Require(function != null, "function must not be null.");
            Check.Require(mode != null, "mode must not be null");
            Check.Require(performer != null, "performer must not be null");

            this.function = function;
            this.time = time;
            this.mode = mode;
            this.performer = performer;

            this.CheckStrictInvariants();
        }
Exemplo n.º 31
0
 public override void read(DataTypes dataTypes, List <byte> data)
 {
     reason = dataTypes.ReadNextString(data);
 }
 IInsertUpdateBuilderDynamic IInsertUpdateBuilderDynamic.Column(string columnName, object value, DataTypes parameterType, int size)
 {
     base.xcd08eddb14ea4239.x4fe829ca2eecf51e(columnName, value, parameterType, size);
     return(this);
 }
Exemplo n.º 33
0
        /// <summary>
        /// Finds the targets for the specified reference.
        /// </summary>
        private static void UpdateInstanceDescriptions(Session session, List <AeEventAttribute> instances, bool throwOnError)
        {
            try
            {
                ReadValueIdCollection nodesToRead = new ReadValueIdCollection();

                for (int ii = 0; ii < instances.Count; ii++)
                {
                    ReadValueId nodeToRead = new ReadValueId();
                    nodeToRead.NodeId      = instances[ii].NodeId;
                    nodeToRead.AttributeId = Attributes.Description;
                    nodesToRead.Add(nodeToRead);

                    nodeToRead             = new ReadValueId();
                    nodeToRead.NodeId      = instances[ii].NodeId;
                    nodeToRead.AttributeId = Attributes.DataType;
                    nodesToRead.Add(nodeToRead);

                    nodeToRead             = new ReadValueId();
                    nodeToRead.NodeId      = instances[ii].NodeId;
                    nodeToRead.AttributeId = Attributes.ValueRank;
                    nodesToRead.Add(nodeToRead);
                }

                // start the browse operation.
                DataValueCollection      results         = null;
                DiagnosticInfoCollection diagnosticInfos = null;

                session.Read(
                    null,
                    0,
                    TimestampsToReturn.Neither,
                    nodesToRead,
                    out results,
                    out diagnosticInfos);

                ClientBase.ValidateResponse(results, nodesToRead);
                ClientBase.ValidateDiagnosticInfos(diagnosticInfos, nodesToRead);

                // update the instances.
                for (int ii = 0; ii < nodesToRead.Count; ii += 3)
                {
                    AeEventAttribute instance = instances[ii / 3];

                    instance.Description = results[ii].GetValue <LocalizedText>(LocalizedText.Null).Text;
                    instance.DataType    = results[ii + 1].GetValue <NodeId>(NodeId.Null);
                    instance.ValueRank   = results[ii + 2].GetValue <int>(ValueRanks.Any);

                    if (!NodeId.IsNull(instance.DataType))
                    {
                        instance.BuiltInType = DataTypes.GetBuiltInType(instance.DataType, session.TypeTree);
                    }
                }
            }
            catch (Exception exception)
            {
                if (throwOnError)
                {
                    throw new ServiceResultException(exception, StatusCodes.BadUnexpectedError);
                }
            }
        }
Exemplo n.º 34
0
        public void ShouldConvertDate(string input, string expected)
        {
            var result = DataTypes.ToLocalDateTime(input);

            Assert.Equal(expected, result.Value.ToString("yyyyMMdd"));
        }
Exemplo n.º 35
0
 public IDeleteBuilder Where(string columnName, object value, DataTypes parameterType, int size)
 {
     Actions.ColumnValueAction(columnName, value, parameterType, size);
     return(this);
 }
Exemplo n.º 36
0
        /// <summary>
        ///     Implements Validate method from <see cref="IValidatableObject" /> interface
        /// </summary>
        /// <param name="validationContext">Context the validation runs in</param>
        /// <returns>List of validation results if any</returns>
        IEnumerable <ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            var validationResults = new List <ValidationResult>();

            foreach (var nodeTypeKeyValue in NodeTypes)
            {
                nodeTypeKeyValue.Value.SetDerivedFromToRoot(nodeTypeKeyValue.Key);

                foreach (var requirementKeyValue in nodeTypeKeyValue.Value.Requirements.SelectMany(r => r).ToArray())
                {
                    if (!string.IsNullOrEmpty(requirementKeyValue.Value.Node) &&
                        !NodeTypes.ContainsKey(requirementKeyValue.Value.Node))
                    {
                        validationResults.Add(CreateRequirementValidationResult(requirementKeyValue, nodeTypeKeyValue));
                    }
                }

                foreach (var capabilityKeyValue in nodeTypeKeyValue.Value.Capabilities)
                {
                    if (!CapabilityTypes.ContainsKey(capabilityKeyValue.Value.Type))
                    {
                        validationResults.Add(CreateCapabilityTypeValidationResult(nodeTypeKeyValue.Key,
                                                                                   capabilityKeyValue.Value.Type, capabilityKeyValue.Key));
                    }
                }

                foreach (var complexDataTypeKeyValue in DataTypes)
                {
                    foreach (var basicDatatypeKeyValue in complexDataTypeKeyValue.Value.Properties)
                    {
                        var basicType = basicDatatypeKeyValue.Value.Type;
                        if (!DataTypes.ContainsKey(basicType))
                        {
                            validationResults.Add(new ValidationResult(
                                                      string.Format("Data type '{0}' specified as part of data type '{1}' not found.",
                                                                    basicType,
                                                                    complexDataTypeKeyValue.Key)));
                        }
                    }
                }

                var circularDependencyValidationResults = nodeTypeKeyValue.Value.ValidateCircularDependency().ToList();
                if (circularDependencyValidationResults.Any())
                {
                    return(validationResults.Concat(circularDependencyValidationResults));
                }
            }

            var importCircularValidationResults = ValidateImportsCircularDependency();

            if (importCircularValidationResults.Any())
            {
                return(validationResults.Concat(importCircularValidationResults));
            }

            if (!validationResults.Any())
            {
                var requirementsGraph = new ToscaNodeTypeRequirementsGraph(this);
                if (requirementsGraph.ContainsCyclicLoop())
                {
                    validationResults.Add(new ValidationResult("Circular dependency detected by requirements on node type"));
                }
            }
            return(validationResults);
        }
Exemplo n.º 37
0
 public TCNetDataHeader(DataTypes data) : base(MessageTypes.Data)
 {
     DataType = data;
 }
Exemplo n.º 38
0
 public static Exception IntDeserializationFailure(DataTypes type)
 {
     return(new SerializationException($"Waited for an int, got {type:G} (0x{type:X})"));
 }
Exemplo n.º 39
0
 public DataBase(DataTypes DataType)
 {
     Type = DataType;
 }
Exemplo n.º 40
0
 /// <summary>
 /// Initializes a new instance of the Field class using specified parameters.
 /// </summary>
 /// <param name="dataType">Type of data field.</param>
 /// <param name="value">Content of a field.</param>
 public Field(DataTypes dataType, object value)
 {
     DataType = dataType;
     Value    = value;
 }
Exemplo n.º 41
0
 public DataBase(byte[] Data, ref int offset, DataTypes DataType) : this(DataType)
 {
     Parse(Data, ref offset);
 }
Exemplo n.º 42
0
 public DataItem(short index, DataTypes dataType, byte[] data)
 {
     Index    = index;
     DataType = dataType;
     Data     = data;
 }
Exemplo n.º 43
0
 public static FileFactory ForExtension(string extension)
 {
     return(ForDataType(DataTypes.ForExtension(extension)));
 }
        public void ConvertEntityContainer()
        {
            var taupoModel = new EntityModelSchema()
            {
                new EntityContainer("MyContainer")
                {
                    new EntitySet("Customers", "Customer"),
                    new EntitySet("Orders", "Order")
                    {
                        new AttributeAnnotation()
                        {
                            Content = new XAttribute(this.annotationNamespace + "foo1", "bar1")
                        },
                    },
                    new AssociationSet("CustomerOrders", "CustomerOrder")
                    {
                        new AssociationSetEnd("Order", "Orders"),
                        new AssociationSetEnd("Customer", "Customers")
                    },
                    new FunctionImport("FunctionImport1")
                    {
                        ReturnTypes = { new FunctionImportReturnType(DataTypes.CollectionOfEntities("Customer"), "Customers") },
                        Parameters  = { new FunctionParameter("ExcludingId", EdmDataTypes.Int32) },
                        Annotations = { new AttributeAnnotation()
                                        {
                                            Content = new XAttribute(this.annotationNamespace + "foo5", "bar5")
                                        } },
                    },
                    new AttributeAnnotation()
                    {
                        Content = new XAttribute(this.annotationNamespace + "foo4", "bar4")
                    },
                },
                new EntityType("Customer")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                },
                new EntityType("Order")
                {
                    new MemberProperty("Id", EdmDataTypes.Int32)
                    {
                        IsPrimaryKey = true
                    },
                },
                new AssociationType("CustomerOrder")
                {
                    new AssociationEnd("Customer", "Customer", EndMultiplicity.One, OperationAction.Cascade),
                    new AssociationEnd("Order", "Order", EndMultiplicity.Many),
                },
            }
            .ApplyDefaultNamespace("NS1")
            .Resolve();

            IEdmModel result = this.converter.ConvertToEdmModel(taupoModel);

            IEdmEntityType customer = (IEdmEntityType)result.FindType("NS1.Customer");
            IEdmEntityType order    = (IEdmEntityType)result.FindType("NS1.Order");

            IEdmEntityContainer convertedContainer = result.EntityContainer;

            Assert.AreEqual("MyContainer", convertedContainer.Name);
            Assert.AreEqual(3, convertedContainer.Elements.Count());
            Assert.AreEqual(2, convertedContainer.Elements.OfType <IEdmEntitySet>().Count());
            Assert.AreEqual(1, convertedContainer.Elements.OfType <IEdmOperationImport>().Count());

            Assert.AreEqual(1, result.DirectValueAnnotations(convertedContainer).Count());
            Assert.AreEqual("bogus", result.DirectValueAnnotations(convertedContainer).First().NamespaceUri);
            Assert.AreEqual("foo4", result.DirectValueAnnotations(convertedContainer).First().Name);
            Assert.AreEqual("bar4", (((IEdmDirectValueAnnotation)result.DirectValueAnnotations(convertedContainer).First()).Value as IEdmStringValue).Value);

            IEdmEntitySet convertedCustomerSet = convertedContainer.Elements.OfType <IEdmEntitySet>().ElementAt(0);

            Assert.AreEqual("Customers", convertedCustomerSet.Name);
            Assert.AreEqual(result.FindType("NS1.Customer"), convertedCustomerSet.ElementType);

            Assert.AreEqual(0, result.DirectValueAnnotations(convertedCustomerSet).Count(a => a.NamespaceUri == "bogus"));

            IEdmEntitySet convertedOrderSet = convertedContainer.Elements.OfType <IEdmEntitySet>().ElementAt(1);

            Assert.AreEqual("Orders", convertedOrderSet.Name);
            Assert.AreEqual(result.FindType("NS1.Order"), convertedOrderSet.ElementType);

            var annotations = result.DirectValueAnnotations(convertedOrderSet).Where(a => a.NamespaceUri == "bogus");

            Assert.AreEqual(1, annotations.Count());
            Assert.AreEqual("foo1", annotations.First().Name);
            Assert.AreEqual("bar1", (((IEdmDirectValueAnnotation)annotations.First()).Value as IEdmStringValue).Value);

            var toOrder = customer.NavigationProperties().First();

            Assert.AreSame(convertedOrderSet, convertedCustomerSet.FindNavigationTarget(toOrder));
            Assert.AreEqual("CustomerOrders", result.GetAssociationSetName(convertedCustomerSet, toOrder));

            var toCustomer = order.NavigationProperties().First();

            Assert.AreSame(convertedCustomerSet, convertedOrderSet.FindNavigationTarget(toCustomer));
            Assert.AreEqual("CustomerOrders", result.GetAssociationSetName(convertedOrderSet, toCustomer));

            IEdmOperationImport convertedFunctionImport = convertedContainer.Elements.OfType <IEdmOperationImport>().First();

            Assert.AreEqual("FunctionImport1", convertedFunctionImport.Name);
            IEdmEntitySet eset;

            Assert.IsTrue(convertedFunctionImport.TryGetStaticEntitySet(out eset));
            Assert.AreEqual(convertedCustomerSet, eset);

            Assert.AreEqual(EdmTypeKind.Collection, convertedFunctionImport.ReturnType.TypeKind());
            Assert.AreEqual(null, convertedFunctionImport.ReturnType.FullName());

            Assert.AreEqual(1, convertedFunctionImport.Parameters.Count());
            Assert.AreEqual("ExcludingId", convertedFunctionImport.Parameters.First().Name);
            Assert.AreEqual(EdmTypeKind.Primitive, convertedFunctionImport.Parameters.First().Type.TypeKind());

            Assert.AreEqual(1, result.DirectValueAnnotations(convertedFunctionImport).Count());
            Assert.AreEqual("bogus", result.DirectValueAnnotations(convertedFunctionImport).First().NamespaceUri);
            Assert.AreEqual("foo5", result.DirectValueAnnotations(convertedFunctionImport).First().Name);
            Assert.AreEqual("bar5", (((IEdmDirectValueAnnotation)result.DirectValueAnnotations(convertedFunctionImport).First()).Value as IEdmStringValue).Value);
        }
Exemplo n.º 45
0
        public void ShouldConvertDateTextToISODate(string input, string expected)
        {
            var result = DataTypes.HL7DateTextAsISODateText(input);

            Assert.Equal(expected, result);
        }
Exemplo n.º 46
0
 public virtual IUpdateBuilder Where(string columnName, object value, DataTypes parameterType, int size)
 {
     Actions.WhereAction(columnName, value, parameterType, size);
     return(this);
 }
Exemplo n.º 47
0
        /// <summary>
        /// Collects instance declarations nodes from with a type.
        /// </summary>
        public static void CollectInstanceDeclarations(
            Session session,
            ComNamespaceMapper mapper,
            NodeState node,
            AeEventAttribute parent,
            List <AeEventAttribute> instances,
            IDictionary <string, AeEventAttribute> map)
        {
            List <BaseInstanceState> children = new List <BaseInstanceState>();

            node.GetChildren(session.SystemContext, children);

            if (children.Count == 0)
            {
                return;
            }

            // process the children.
            for (int ii = 0; ii < children.Count; ii++)
            {
                BaseInstanceState instance = children[ii];

                // only interested in objects and variables.
                if (instance.NodeClass != NodeClass.Object && instance.NodeClass != NodeClass.Variable)
                {
                    return;
                }

                // ignore instances without a modelling rule.
                if (NodeId.IsNull(instance.ModellingRuleId))
                {
                    return;
                }

                // create a new declaration.
                AeEventAttribute declaration = new AeEventAttribute();

                declaration.RootTypeId  = (parent != null)?parent.RootTypeId:node.NodeId;
                declaration.NodeId      = (NodeId)instance.NodeId;
                declaration.BrowseName  = instance.BrowseName;
                declaration.NodeClass   = instance.NodeClass;
                declaration.Description = (instance.Description != null)?instance.Description.ToString():null;

                // get data type information.
                BaseVariableState variable = instance as BaseVariableState;

                if (variable != null)
                {
                    declaration.DataType  = variable.DataType;
                    declaration.ValueRank = variable.ValueRank;

                    if (!NodeId.IsNull(variable.DataType))
                    {
                        declaration.BuiltInType = DataTypes.GetBuiltInType(declaration.DataType, session.TypeTree);
                    }
                }

                if (!LocalizedText.IsNullOrEmpty(instance.DisplayName))
                {
                    declaration.DisplayName = instance.DisplayName.Text;
                }
                else
                {
                    declaration.DisplayName = instance.BrowseName.Name;
                }

                if (parent != null)
                {
                    declaration.BrowsePath            = new QualifiedNameCollection(parent.BrowsePath);
                    declaration.BrowsePathDisplayText = Utils.Format("{0}/{1}", parent.BrowsePathDisplayText, mapper.GetLocalBrowseName(instance.BrowseName));
                    declaration.DisplayPath           = Utils.Format("{0}/{1}", parent.DisplayPath, instance.DisplayName);
                }
                else
                {
                    declaration.BrowsePath            = new QualifiedNameCollection();
                    declaration.BrowsePathDisplayText = Utils.Format("{0}", instance.BrowseName);
                    declaration.DisplayPath           = Utils.Format("{0}", instance.DisplayName);
                }

                declaration.BrowsePath.Add(instance.BrowseName);

                // check if reading an overridden declaration.
                AeEventAttribute overriden = null;

                if (map.TryGetValue(declaration.BrowsePathDisplayText, out overriden))
                {
                    declaration.OverriddenDeclaration = overriden;
                }

                map[declaration.BrowsePathDisplayText] = declaration;

                // only interested in variables.
                if (instance.NodeClass == NodeClass.Variable)
                {
                    instances.Add(declaration);
                }

                // recusively build tree.
                CollectInstanceDeclarations(session, mapper, instance, declaration, instances, map);
            }
        }
Exemplo n.º 48
0
 IInsertUpdateBuilder IInsertUpdateBuilder.Column(string columnName, object value, DataTypes parameterType, int size)
 {
     Actions.ColumnValueAction(columnName, value, parameterType, size);
     return(this);
 }
 IInsertUpdateBuilderDynamic IInsertUpdateBuilderDynamic.Column(string propertyName, DataTypes parameterType, int size)
 {
     base.xcd08eddb14ea4239.xbb4ee78ca371cf6a((ExpandoObject)base.x6b73aa01aa019d3a.Item, propertyName, parameterType, size);
     return(this);
 }
 public bool IsIgnoreInfoSource(DataTypes type, IgnoreInfoSourceOptions ignoreInfoSourceOptions)
 {
     return(_inclusionControls[type].IsIgnoreInfoSource(ignoreInfoSourceOptions));
 }
Exemplo n.º 51
0
        private static data.tmpDS.marketDataDataTable GetMarketData(DateTime frDate, DateTime toDate, commonClass.AppTypes.TimeScale timeScale, string stockCodeList, DataTypes type)
        {
            string sqlCond = "";

            if (timeScale != commonClass.AppTypes.MainDataTimeScale)
            {
                sqlCond += (sqlCond == "" ? "" : " AND ") + " type='" + timeScale.Code + "'";
            }
            sqlCond += (sqlCond == "" ? "" : " AND ") +
                       "onDate BETWEEN '" + common.system.ConvertToSQLDateString(frDate) + "'" +
                       " AND '" + common.system.ConvertToSQLDateString(toDate) + "'";

            sqlCond += (sqlCond == "" ? "" : " AND ");
            switch (type)
            {
            case DataTypes.Advancing: sqlCond += "closePrice>openPrice"; break;

            case DataTypes.Declining: sqlCond += "closePrice<openPrice"; break;

            default: sqlCond += "closePrice=openPrice"; break;
            }

            if (stockCodeList != null && stockCodeList != "")
            {
                sqlCond += (sqlCond == "" ? "" : " AND ") + " stockCode IN  (" + stockCodeList + ")";
            }
            else
            {
                sqlCond += (sqlCond == "" ? "" : " AND ") +
                           " stockCode IN  (SELECT code FROM stockCode WHERE status & " + ((byte)commonClass.AppTypes.CommonStatus.Enable).ToString() + ">0)";
            }
            string sqlCmd =
                "SELECT onDate,COUNT(*) AS val0,SUM(volume) AS val1" +
                " FROM " + (timeScale == commonClass.AppTypes.MainDataTimeScale ? "priceData" : "priceDataSum") +
                " WHERE " + sqlCond +
                " GROUP BY onDate ORDER BY onDate";

            data.tmpDS.marketDataDataTable tbl = new data.tmpDS.marketDataDataTable();
            DbAccess.LoadFromSQL(tbl, sqlCmd);
            return(tbl);
        }
Exemplo n.º 52
0
        protected override List <ColumnSchema> GetProcedureResultColumns(DataTable resultTable)
        {
            return
                ((
                     from r in resultTable.AsEnumerable()

                     let systemType = r.Field <Type>("DataType")
                                      let columnName = GetEmptyStringIfInvalidColumnName(r.Field <string>("ColumnName"))
                                                       let providerType = Converter.ChangeTypeTo <int>(r["ProviderType"])
                                                                          let dataType = DataTypes.FirstOrDefault(t => t.ProviderDbType == providerType)
                                                                                         let columnType = dataType == null ? null : dataType.TypeName
                                                                                                          let length = r.Field <int>("ColumnSize")
                                                                                                                       let precision = Converter.ChangeTypeTo <int>(r["NumericPrecision"])
                                                                                                                                       let scale = Converter.ChangeTypeTo <int>(r["NumericScale"])
                                                                                                                                                   let isNullable = Converter.ChangeTypeTo <bool>(r["AllowDBNull"])

                                                                                                                                                                    select new ColumnSchema
            {
                ColumnType = GetDbType(columnType, dataType, length, precision, scale, null, null, null),
                ColumnName = columnName,
                IsNullable = isNullable,
                MemberName = ToValidName(columnName),
                MemberType = ToTypeName(systemType, isNullable),
                SystemType = systemType ?? typeof(object),
                DataType = GetDataType(columnType, null, length, precision, scale),
                ProviderSpecificType = GetProviderSpecificType(columnType),
            }
                     ).ToList());
        }
Exemplo n.º 53
0
 public override byte[] write(DataTypes dataTypes)
 {
     throw new System.NotImplementedException();
 }
Exemplo n.º 54
0
        public override void Add()
        {
            var folderId = DataTypes.CreateFolder("Aub.Blogs");

            DataTypes.CreateFromFolder("~/App_Data/Aubergine/Blog/DataTypes/", folderId);
        }
Exemplo n.º 55
0
        protected override void Execute()
        {
            // init patch directory
            if (flags.Has("init"))
            {
                string deployDirectory = Helpers.AbsolutePath(arguments.Length > 0 ? arguments[0] : "autopatch");
                string deployFilePath  = Path.ChangeExtension(deployDirectory, Constants.ydr);
                Dictionary <string, string> targets = new Dictionary <string, string>();
                for (int i = 1; i < arguments.Length; i++)
                {
                    // parse targets in format name:path or just path
                    string[] tmp  = arguments[i].Split(new[] { ':' }, 2, StringSplitOptions.RemoveEmptyEntries);
                    string   name = tmp.Length > 1 && tmp[0].Length > 1 ? tmp[0] : Path.GetFileName(tmp[0]);
                    string   path = Helpers.AbsolutePath(tmp.Length > 1 && tmp[0].Length > 1 ? tmp[1] : tmp[0]);
                    targets.Add(name, path);
                }
                if (targets.Count == 0)
                {
                    Fail("No target directories specified");
                }

                Directory.CreateDirectory(deployDirectory);

                int fileCount = 0;

                dynamic info = new JObject();
                info.build      = 0;
                info.nameschema = "inc.{buildno}.{target}.patch.ykc";
                info.deploydir  = deployDirectory;
                info.targets    = new JArray();
                foreach (var targetInfo in targets)
                {
                    string   targetName = targetInfo.Key;
                    string   targetPath = targetInfo.Value;
                    string[] files      = Directory.GetFiles(targetPath, "*", SearchOption.AllDirectories);

                    dynamic target = new JObject();
                    {
                        target.name  = targetName;
                        target.path  = targetPath;
                        target.files = new JArray();
                        foreach (string file in files)
                        {
                            // ignore unknown file types and hidden files
                            if (!DataTypes.ForExtension(DataTypes.BaseExtension(Path.GetExtension(file))).IncludeInArchive())
                            {
                                continue;
                            }
                            if (new FileInfo(file).Attributes.HasFlag(FileAttributes.Hidden))
                            {
                                continue;
                            }

                            dynamic entry = new JObject();
                            {
                                entry.name    = Helpers.RelativePath(file, targetPath);
                                entry.size    = Helpers.FileSize(file);
                                entry.hash    = Helpers.FileHash(file);
                                entry.version = 0;
                            }
                            target.files.Add(entry);

                            fileCount++;
                        }
                    }
                    info.targets.Add(target);
                    Log("Added target '" + targetName + "' (" + target.files.Count + " files) [" + targetPath + "]", ConsoleColor.Yellow);
                }
                Log("Successfully added " + fileCount + " file in " + info.targets.Count + " targets", ConsoleColor.Green);

                File.WriteAllText(deployFilePath, JsonConvert.SerializeObject(info, Formatting.Indented));
            }

            else
            {
                if (arguments.Length == 0)
                {
                    Fail("No target file specified");
                }
                string deployFilePath = Helpers.AbsolutePath(arguments[0]);

                int changedFiles = 0, newFiles = 0;

                if (deployFilePath.EndsWith(Constants.ydr, StringComparison.OrdinalIgnoreCase))
                {
                    dynamic info = JsonConvert.DeserializeObject(File.ReadAllText(deployFilePath));
                    info.build = (int)info.build + 1;

                    foreach (var target in info.targets)
                    {
                        List <string> includedFiles = new List <string>();
                        string[]      files         = Directory.GetFiles((string)target.path, "*", SearchOption.AllDirectories);
                        foreach (string file in files)
                        {
                            string localName = Helpers.RelativePath(file, (string)target.path);

                            // ignore unknown file types and hidden files
                            if (!DataTypes.ForExtension(DataTypes.BaseExtension(Path.GetExtension(localName))).IncludeInArchive())
                            {
                                continue;
                            }
                            if (new FileInfo(file).Attributes.HasFlag(FileAttributes.Hidden))
                            {
                                continue;
                            }

                            bool include = true, exists = false;
                            foreach (var localFile in target.files)
                            {
                                if (localName.Equals((string)localFile.name, StringComparison.OrdinalIgnoreCase))
                                {
                                    exists = true;
                                    string hash = Helpers.FileHash(file);
                                    long   size = Helpers.FileSize(file);

                                    if (size != (long)localFile.size || !hash.Equals((string)localFile.hash))
                                    {
                                        // update file entry if files differ
                                        localFile.size    = size;
                                        localFile.hash    = hash;
                                        localFile.version = (int)localFile.version + 1;
                                    }
                                    else
                                    {
                                        include = false;
                                    }
                                    break;
                                }
                            }
                            if (!exists)
                            {
                                Log("[New file]   " + localName, ConsoleColor.Green);
                                dynamic entry = new JObject();
                                {
                                    entry.name    = localName;
                                    entry.size    = Helpers.FileSize(file);
                                    entry.hash    = Helpers.FileHash(file);
                                    entry.version = 1;
                                }
                                target.files.Add(entry);
                                newFiles++;
                            }
                            if (include)
                            {
                                string mainFile = Path.ChangeExtension(localName, DataTypes.BaseExtension(Path.GetExtension(localName)));
                                if (!includedFiles.Contains(mainFile))
                                {
                                    includedFiles.Add(mainFile);
                                    if (exists)
                                    {
                                        Log("[Changed]    " + localName, ConsoleColor.Yellow);
                                    }
                                    if (exists)
                                    {
                                        changedFiles++;
                                    }
                                }
                            }
                            else
                            {
                                Log("[Up to date] " + localName, ConsoleColor.Red);
                            }
                            // Log(include ? exists ? "Changed" : "New file" : "Up to date", ConsoleColor.Cyan);
                        }

                        if (includedFiles.Count > 0)
                        {
                            bool verbose = flags.Has('v');
                            flags.Unset('v');
                            YukaArchive archive = new YukaArchive();
                            foreach (string file in includedFiles)
                            {
                                dynamic factory = FileFactory.ForExtension(Path.GetExtension(file));
                                if (factory != null)
                                {
                                    string realname = Path.ChangeExtension(file, DataTypes.ForExtension(Path.GetExtension(file)).BinaryExtension());
                                    Console.WriteLine(realname);
                                    dynamic      data = factory.FromSource(Path.Combine((string)target.path, file));
                                    MemoryStream ms   = new MemoryStream();
                                    factory.ToBinary(data, ms);
                                    archive.files[realname] = ms;
                                }
                            }
                            string name = (string)info.nameschema;

                            name = name.Replace("{buildno}", ((int)info.build).ToString("D3"));
                            name = name.Replace("{target}", ((string)target.name));
                            name = name.Replace("{date}", DateTime.Now.ToString("yyyy-MM-dd"));
                            name = name.Replace("{time}", DateTime.Now.ToString("HH-mm-ss"));

                            ArchiveFactory.Instance.ToSource(archive, Path.Combine((string)info.deploydir, name));
                            if (verbose)
                            {
                                flags.Set('v');
                            }
                        }
                    }

                    Log("Deployed " + newFiles + " new files and " + changedFiles + " updates", ConsoleColor.Green);

                    File.WriteAllText(deployFilePath, JsonConvert.SerializeObject(info, Formatting.Indented));
                }
            }

            if (flags.Has('w'))
            {
                Console.ReadLine();
            }
        }
Exemplo n.º 56
0
 /// <summary>
 /// Adds or replaces the cache value of the implicitly given type.
 /// </summary>
 /// <param name="dataType">The type of the cache entry.</param>
 /// <param name="value">The actual data.</param>
 /// <param name="timeOfAquisition">The time at which the data has been aquired.</param>
 /// <typeparam name="TCacheValue">The type of the cache value.</typeparam>
 public void AddOrReplaceCacheValue <TCacheValue>(DataTypes dataType, TCacheValue value, DateTime timeOfAquisition) where TCacheValue : class
 {
     this.cacheData[dataType] = new CacheDataSet <TCacheValue>(value, timeOfAquisition);
 }
Exemplo n.º 57
0
 public static Exception UnexpectedDataType(DataTypes expected, DataTypes actual)
 {
     return(new ArgumentException($"Unexpected data type: {expected} is expected, but got {actual}."));
 }
Exemplo n.º 58
0
 public DataBase(Wxv.Swg.Common.Files.IFFFile.Node Source, ref int offset, DataTypes DataType) : this(DataType)
 {
     Parse(Source, ref offset);
 }
Exemplo n.º 59
0
 public static Exception BadTypeException(DataTypes actual, params DataTypes[] expectedCodes)
 {
     return(new SerializationException($"Got {actual:G} (0x{actual:X}), while expecting one of these: {String.Join(", ", expectedCodes)}"));
 }
Exemplo n.º 60
0
 void setNumTextColor(DataTypes.BiomeType biome)
 {
     LevelNum.GetComponent <Shadow>().effectColor = DataTypes.GetButtonColorFrom(biome);
 }