Esempio n. 1
0
        private void RebuildJournal()
        {
            journalWriter?.Close();

            using (var writer = new StreamWriter(journalFileTmp.Open(FileMode.Create, FileAccess.Write, FileShare.ReadWrite))) {
                writer.WriteLine(Magic);
                writer.WriteLine(Version1);
                writer.WriteLine(appVersion.ToString());
                writer.WriteLine(ValueCount.ToString());
                writer.WriteLine();

                foreach (var entry in lruEntries.Values)
                {
                    writer.WriteLine(null != entry.UnsafeCurrentEditor
            ? $"{DirtyFlag} {entry.Key}"
            : $"{CleanFlag} {entry.Key}{entry.GetLengths()}");
                }
            }

            if (journalFile.Exists)
            {
                RenameTo(journalFile, journalFileBackup, true);
            }

            RenameTo(journalFileTmp, journalFile, false);
            journalFileBackup.Delete();

            journalWriter = new StreamWriter(journalFile.Open(FileMode.Append, FileAccess.Write, FileShare.ReadWrite));
        }
Esempio n. 2
0
 [Test] public void DefaultConstructor()
 {
     var valueCount = new ValueCount();
     AssertAreEqual(new ValueCount(0, 1), valueCount);
     AssertAreEqual(new ValueCount((uint?) null), valueCount);
     AssertAreEqual(new ValueCount("?"), valueCount);
 }
Esempio n. 3
0
        private static string GetResultAssignment(ValueCount resultCount, string sourceName, ValueCount sourceCount)
        {
            string constructedVector = GlslVectorUtils.ConstructVector(resultCount, sourceCount,
                                                                       GlslUtils.vertexOutputPrefix + sourceName);

            return($"{resultName}.rgb = {constructedVector};");
        }
Esempio n. 4
0
 [Test] public void OneArgConstructorIntNonNegative()
 {
     var value = 10;
     var valueCount = new ValueCount(value);
     Assert.AreEqual(value, valueCount.Min);
     Assert.AreEqual(value, valueCount.Max);
     Assert.AreEqual("{10}", valueCount.OriginalString);
 }
 public ShaderAttribute(string name, AttributeType type)
 {
     Name            = name;
     Type            = type;
     ValueCount      = GetValueCount(type);
     Interpolation   = GetInterpolationQualifier(type);
     TypeDeclaration = GetTypeDeclaration(type);
 }
        private static string GetResultAssignment(ValueCount resultCount, TextureRenderInfo texture,
                                                  string uv0Name, string normalName)
        {
            string swizzle  = GlslVectorUtils.GetSwizzle(texture.TextureSwizzle);
            string texCoord = GetTexCoord(texture.UvCoord, uv0Name, normalName);

            return($"{resultName}.rgb = texture({texture.Name}, {texCoord}).{swizzle};");
        }
Esempio n. 7
0
        // parameters:
        //      max 返回最多多少个元素。如果为 -1,表示不限制
        //      hit_count   返回命中总数。是命中的整个集合的数量,除去 start 以后的值
        public List <ValueCount> ListDates(int start,
                                           int max,
                                           out int hit_count)
        {
            hit_count = 0;
            IMongoCollection <AccessLogItem> collection = this.LogCollection;

            if (collection == null)
            {
                return(null);
            }

#if NO
            BasicDBObject key = new BasicDBObject();
            14.key.put("name", "true");
            15.BasicDBObject initial = new BasicDBObject();
            16.initial.put("count", 0);
            17.BasicDBObject condition = new BasicDBObject();
            18.// condition.put("name", "liguohui");
            19.String reduceString = "function(obj,prev) { prev.count++; }";

            20.DBObject dbo = coll.group(key, condition, initial, reduceString);
#endif
            var document    = new BsonDocument("count", 0);
            var keyFunction = (BsonJavaScript) @"function(doc) {
        var date = new Date(doc.OperTime);
        var dateKey = date.toISOString().slice(0, 10);
        return {'day':dateKey};
    }";
            //         var dateKey = date.getFullYear()+'|'+(date.getMonth()+1)+'|'+date.getDate();
            var result = collection.Group(
                Query.Null,
                keyFunction,
                document,
                new BsonJavaScript("function(doc, out){ out.count++; }"),
                null
                ).Skip <BsonDocument>(start);

            List <ValueCount> values = new List <ValueCount>();
            int nCount = 0;
            foreach (BsonDocument doc in result)
            {
                ValueCount item = new ValueCount();
                item.Value = doc.GetValue("day", "").ToString().Replace("-", "");
                item.Count = doc.GetValue("count", 0).ToInt32();
                values.Add(item);
                nCount++;
                if (max != -1 && nCount >= max)
                {
                    break;
                }
            }

            hit_count = result.Count <BsonDocument>();
            return(values);
        }
Esempio n. 8
0
        private static string GetMaxSharedComponents(ValueCount sourceCount, ValueCount targetCount)
        {
            string resultingComponents = "";

            int count = Math.Min((int)sourceCount, (int)targetCount);

            for (int i = 0; i < count; i++)
            {
                resultingComponents += vectorComponents[i];
            }

            return(resultingComponents);
        }
        public static string ConstructVector(ValueCount targetValueCount, ValueCount sourceCount, string sourceName, string fillValue = "1.0")
        {
            // TODO: What happens when target and source count are both 1?
            int targetCount = (int)targetValueCount;

            if (sourceCount == ValueCount.One)
            {
                return($"vec{targetCount}({sourceName})");
            }

            string components = GetMaxSharedComponents(sourceCount, targetValueCount);

            // Add 1's for the remaining parts of the constructor.
            string paddingValues = GetPaddingValues(components.Length, targetCount, fillValue);

            return($"vec{targetCount}({sourceName}.{components}{paddingValues})");
        }
Esempio n. 10
0
        public static string ConstructVector(ValueCount targetValueCount, ValueCount sourceCount, string sourceName)
        {
            int targetCount = (int)targetValueCount;

            if (sourceCount == ValueCount.One)
            {
                return($"vec{targetCount}({sourceName})");
            }

            string components = GetMaxSharedComponents(sourceCount, targetValueCount);

            // Add 1's for the remaining parts of the constructor.
            string paddingValues = "";

            for (int i = components.Length; i < targetCount; i++)
            {
                paddingValues += ", 1";
            }

            return($"vec{targetCount}({sourceName}.{components}{paddingValues})");
        }
Esempio n. 11
0
        private void ReadJournal()
        {
            using (var reader = new StreamReader(journalFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite))) {
                var magic            = reader.ReadLine();
                var version          = reader.ReadLine();
                var appVersionString = reader.ReadLine();
                var valueCountString = reader.ReadLine();
                var blank            = reader.ReadLine();

                if (Magic != magic ||
                    Version1 != version ||
                    appVersion.ToString() != appVersionString ||
                    ValueCount.ToString() != valueCountString ||
                    string.Empty != blank)
                {
                    throw new IOException($"unexpected journal header: [{magic}, {version}, {valueCountString}, {blank}");
                }

                var lineCount = 0;

                while (true)
                {
                    try {
                        ReadJournalLine(reader.ReadLine());
                        lineCount++;
                    } catch (EndOfStreamException) {
                        break;
                    }
                }

                redundantOpCount = lineCount - lruEntries.Count;
            }

            // XXX: Original, reader.hasUnterminatedLine()
            // If we ended on a truncated line, rebuild the journal before appending to it.

            journalWriter = new StreamWriter(journalFile.Open(FileMode.Append, FileAccess.Write, FileShare.ReadWrite));
        }
Esempio n. 12
0
        // parameters:
        //      max 返回最多多少个元素。如果为 -1,表示不限制
        //      hit_count   返回命中总数。是命中的整个集合的数量,除去 start 以后的值
        public List<ValueCount> ListDates(int start, int max, out int hit_count)
        {
            hit_count = 0;
            MongoCollection<AccessLogItem> collection = this.LogCollection;
            if (collection == null)
                return null;

#if NO
            BasicDBObject key = new BasicDBObject();   
14.key.put("name", "true");   
15.BasicDBObject initial = new BasicDBObject();   
16.initial.put("count", 0);   
17.BasicDBObject condition = new BasicDBObject();   
18.// condition.put("name", "liguohui");   
19.String reduceString = "function(obj,prev) { prev.count++; }";   

20.DBObject dbo = coll.group(key, condition , initial, reduceString); 
#endif
            var document = new BsonDocument("count", 0);
            var keyFunction = (BsonJavaScript)@"function(doc) {
        var date = new Date(doc.OperTime);
        var dateKey = date.toISOString().slice(0, 10);
        return {'day':dateKey};
    }";
            //         var dateKey = date.getFullYear()+'|'+(date.getMonth()+1)+'|'+date.getDate();
            var result = collection.Group(
                Query.Null,
                keyFunction,
                document,
                new BsonJavaScript("function(doc, out){ out.count++; }"),
                null
            ).Skip<BsonDocument>(start);


            List<ValueCount> values = new List<ValueCount>();
            int nCount = 0;
            foreach (BsonDocument doc in result)
            {
                ValueCount item = new ValueCount();
                item.Value = doc.GetValue("day", "").ToString().Replace("-", "");
                item.Count = doc.GetValue("count", 0).ToInt32();
                values.Add(item);
                nCount++;
                if (max != -1 && nCount >= max)
                    break;
            }

            hit_count = result.Count<BsonDocument>();
            return values;
        }
Esempio n. 13
0
 [Test] public void TwoArgConstructorUintSecondNull()
 {
     var value1 = (uint?) 10;
     var valueCount = new ValueCount(value1, null);
     Assert.AreEqual(value1, valueCount.Min);
     Assert.AreEqual(null, valueCount.Max);
     Assert.AreEqual("{10,}", valueCount.OriginalString);
 }
Esempio n. 14
0
 [Test] public void TwoArgConstructorIntFirstNegative()
 {
     var value1 = -10;
     var value2 = 30;
     var valueCount = new ValueCount(value1, value2);
     Assert.AreEqual(0, valueCount.Min);
     Assert.AreEqual(value2, valueCount.Max);
     Assert.AreEqual("{0,30}", valueCount.OriginalString);
 }
Esempio n. 15
0
 [Test] public void TwoArgConstructorIntSecondNegative()
 {
     var value1 = 10;
     var value2 = -10;
     var valueCount = new ValueCount(value1, value2);
     Assert.AreEqual(value1, valueCount.Min);
     Assert.AreEqual(null, valueCount.Max);
     Assert.AreEqual("{10,}", valueCount.OriginalString);
 }
Esempio n. 16
0
 /// <summary>
 /// Creates a new vertex attribute.
 /// </summary>
 /// <param name="name">The name of the attribute in the shader</param>
 /// <param name="valueCount">The number of components for the value</param>
 /// <param name="type">The data type of the value</param>
 /// <exception cref="System.NotSupportedException"><paramref name="type"/> is not
 /// a supported attribute type.</exception>
 public VertexIntAttribute(string name, ValueCount valueCount, VertexAttribIntegerType type)
     : base(name, valueCount, (VertexAttribPointerType)type)
 {
     // The default attribute pointer type enum contains all the integer values.
     SizeInBytes = (int)valueCount * AttribPointerUtils.GetSizeInBytes(type);
 }
Esempio n. 17
0
 [Test] public void OneArgConstructorStringTwoIntFirstMissing()
 {
     var valueCount = new ValueCount(",30");
     AssertAreEqualSimple(new ValueCount(0, 30), valueCount);
 }
Esempio n. 18
0
 [Test] public void OneArgConstructorStringOptional()
 {
     var valueCount = new ValueCount("?");
     AssertAreEqual(new ValueCount(0, 1), valueCount);
 }
Esempio n. 19
0
 [Test] public void OneArgConstructorStringOneInt()
 {
     var valueCount = new ValueCount("10");
     AssertAreEqualSimple(new ValueCount(10), valueCount);
 }
Esempio n. 20
0
 private static void AssertAreEqual(ValueCount v1, ValueCount v2)
 {
     AssertAreEqualShort(v1, v2);
     Assert.AreEqual(v1.OriginalString, v2.OriginalString);
 }
Esempio n. 21
0
 [Test] public void OneArgConstructorStringAllMissing()
 {
     var valueCount = new ValueCount(",");
     AssertAreEqualSimple(new ValueCount(0, 1), valueCount);
 }
Esempio n. 22
0
 private static void AssertAreEqualShort(ValueCount v1, ValueCount v2)
 {
     Assert.AreEqual(v1.Min, v2.Min);
     Assert.AreEqual(v1.Max, v2.Max);
 }
Esempio n. 23
0
 /// <summary>
 /// Serves as a hash function for a particular type.
 /// </summary>
 /// <returns>
 /// A hash code for the current <see cref="T:System.Object"/>.
 /// </returns>
 /// <filterpriority>2</filterpriority>
 public override int GetHashCode()
 {
     return(DataSource.GetHashCode() ^ SiteName.GetHashCode() ^
            (ValueCount != null ? ValueCount.GetHashCode() : 0) ^ ServiceDesciptionUrl.GetHashCode() ^
            VarCode.GetHashCode());
 }
Esempio n. 24
0
 public static string ConstructVector(ValueCount targetValueCount, ShaderAttribute source)
 {
     return(ConstructVector(targetValueCount, source.ValueCount, source.Name));
 }
Esempio n. 25
0
 [Test] public void OneArgConstructorStringTwoIntSecondMissing()
 {
     var valueCount = new ValueCount("10,");
     AssertAreEqualSimple(new ValueCount(10, null), valueCount);
 }
Esempio n. 26
0
 public AppendConstAction(Argument argument, IActionContainer container)
     : base(argument, container)
 {
     valueCount = new ValueCount(0);
 }
Esempio n. 27
0
        // parameters:
        //      nCount  本次希望获取的记录数。如果==-1,表示希望尽可能多地获取
        // return:
        //      -1  error
        //      0   file not found
        //      1   succeed
        //      2   超过范围,本次调用无效
        public int GetOperLogs(
            string strLibraryCodeList,
            string strFileName,
            long lIndex,
            long lHint,
            int nCount,
            string strStyle,
            string strFilter,
            out OperLogInfo[] records,
            out string strError)
        {
            records  = null;
            strError = "";
            List <OperLogInfo> results = new List <OperLogInfo>();

            if (StringUtil.IsInList("getfilenames", strStyle) == true)
            {
                int hit_count           = 0;
                int nStart              = (int)lIndex;
                List <ValueCount> dates = ListDates(nStart,   // bug???
                                                    MAX_FILENAME_COUNT, out hit_count);
                int nEnd = dates.Count;
                if (nCount == -1)
                {
                    nEnd = dates.Count;
                }
                else
                {
                    nEnd = Math.Min(nStart + nCount, dates.Count);
                }

                // 一次不让超过最大数量
                if (nEnd - nStart > MAX_FILENAME_COUNT)
                {
                    nEnd = nStart + MAX_FILENAME_COUNT;
                }

                for (int i = nStart; i < nEnd; i++)
                {
                    ValueCount  item = dates[i];
                    OperLogInfo info = new OperLogInfo();
                    info.Index            = i;
                    info.Xml              = item.Value + ".log";
                    info.AttachmentLength = item.Count;
                    results.Add(info);
                }

#if NO
                records = new OperLogInfo[results.Count];
                results.CopyTo(records);
#endif
                records = results.ToArray();
                return((int)lIndex + hit_count);

#if NO
                DirectoryInfo di  = new DirectoryInfo(this.m_strDirectory);
                FileInfo[]    fis = di.GetFiles("????????.log");

                if (fis.Length == 0)
                {
                    return(0);   // 一个文件也没有
                }
                // 日期小者在前
                Array.Sort(fis, new FileInfoCompare(true));

                int nStart = (int)lIndex;
                int nEnd   = fis.Length;
                if (nCount == -1)
                {
                    nEnd = fis.Length;
                }
                else
                {
                    nEnd = Math.Min(nStart + nCount, fis.Length);
                }

                // 一次不让超过最大数量
                if (nEnd - nStart > MAX_FILENAME_COUNT)
                {
                    nEnd = nStart + MAX_FILENAME_COUNT;
                }
                for (int i = nStart; i < nEnd; i++)
                {
                    OperLogInfo info = new OperLogInfo();
                    info.Index            = i;
                    info.Xml              = fis[i].Name;
                    info.AttachmentLength = fis[i].Length;
                    results.Add(info);
                }

                records = new OperLogInfo[results.Count];
                results.CopyTo(records);
                return(1);
#endif
            }

            if (string.IsNullOrEmpty(strFileName) == true ||
                strFileName.Length < 8)
            {
                strError = "strFileName 参数值不能为空,或者长度小于 8 字符";
                return(-1);
            }

            string date = strFileName.Substring(0, 8);
            IEnumerable <AccessLogItem> collection = Find(date, (int)lIndex);
            if (collection == null)
            {
                return(0);
            }
            List <OperLogInfo> infos = new List <OperLogInfo>();
            foreach (AccessLogItem item in collection)
            {
                OperLogInfo info = new OperLogInfo();
                info.AttachmentLength = 0;
                info.HintNext         = 0;
                info.Index            = lIndex++;
                info.Xml = GetXml(item);
                infos.Add(info);
            }
            if (infos.Count == 0)
            {
                return(2);
            }

            records = infos.ToArray();
            return(1);
        }
Esempio n. 28
0
 public void TwoArgConstructorUintInversedOrder()
 {
     var value1 = (uint?)10;
     var value2 = (uint?)30;
     var valueCount = new ValueCount(value2, value1);
     Assert.AreEqual(value1, valueCount.Min);
     Assert.AreEqual(value2, valueCount.Max);
     Assert.AreEqual("{10,30}", valueCount.OriginalString);
 }
Esempio n. 29
0
 private static void AssertAreEqualSimple(ValueCount v1, ValueCount v2)
 {
     AssertAreEqualShort(v1, v2);
     AssertAreEqualRepr(v1, v2);
 }
Esempio n. 30
0
 public BinarySearchTreeNode(T val)
 {
     Value = new ValueCount <T>(val, 1);
 }
Esempio n. 31
0
        // parameters:
        //      max 返回最多多少个元素。如果为 -1,表示不限制
        //      hit_count   返回命中总数。是命中的整个集合的数量,除去 start 以后的值
        public List <ValueCount> ListDates(int start,
                                           int max,
                                           out int hit_count)
        {
            hit_count = 0;
            IMongoCollection <AccessLogItem> collection = this.LogCollection;

            if (collection == null)
            {
                return(null);
            }

            // https://stackoverflow.com/questions/55124152/aggregate-substr-in-mongodb-c-sharp-driver
            // TODO: 注意测试一下

            /*
             * var myresults = collection.Aggregate()
             * .Group(central => DateTimeUtil.DateTimeToString8(central.OperTime),
             * g => new { Id = g.Key, Count = g.Count() })
             * .Skip(start)
             * .ToList();
             */
#if NO
            // mongodb 4.0 以上可用。3.x 版本不能用这个方法
            var myresults = collection.Aggregate()
                            .Group(central => central.OperTime.ToString().Substring(0, 10), // "yyyyMMdd"
                                   g => new { Id = g.Key, Count = g.Count() })
                            .SortBy(o => o.Id)
                            .Skip(start)
                            .ToList();
#endif


            var myresults = collection.Aggregate()
                            .Group(central => new
            {
                Year  = central.OperTime.Year,
                Month = central.OperTime.Month,
                Day   = central.OperTime.Day
            },
                                   g => new { Id = g.Key, Count = g.Count() })
                            .SortBy(o => o.Id)
                            .Skip(start)
                            .ToList();

            hit_count = myresults.Count;
            List <ValueCount> values = new List <ValueCount>();
            int nCount = 0;
            foreach (var doc in myresults)
            {
                ValueCount item = new ValueCount();
                // item.Value = doc.Id.ToString().Replace("-", "");
                item.Value = doc.Id.Year.ToString().PadLeft(4, '0')
                             + doc.Id.Month.ToString().PadLeft(2, '0')
                             + doc.Id.Day.ToString().PadLeft(2, '0');
                item.Count = doc.Count;
                values.Add(item);
                nCount++;
                if (max != -1 && nCount >= max)
                {
                    break;
                }
            }

            return(values);

            /*
             * var document = new BsonDocument("count", 0);
             * var keyFunction = (BsonJavaScript)@"function(doc) {
             * var date = new Date(doc.OperTime);
             * var dateKey = date.toISOString().slice(0, 10);
             * return {'day':dateKey};
             * }";
             * //         var dateKey = date.getFullYear()+'|'+(date.getMonth()+1)+'|'+date.getDate();
             * var result = collection.Group(
             *  Query.Null,
             *  keyFunction,
             *  document,
             *  new BsonJavaScript("function(doc, out){ out.count++; }"),
             *  null
             * ).Skip<BsonDocument>(start);
             *
             * List<ValueCount> values = new List<ValueCount>();
             * int nCount = 0;
             * foreach (BsonDocument doc in result)
             * {
             *  ValueCount item = new ValueCount();
             *  item.Value = doc.GetValue("day", "").ToString().Replace("-", "");
             *  item.Count = doc.GetValue("count", 0).ToInt32();
             *  values.Add(item);
             *  nCount++;
             *  if (max != -1 && nCount >= max)
             *      break;
             * }
             *
             * hit_count = result.Count<BsonDocument>();
             * return values;
             */
        }
Esempio n. 32
0
 /// <summary>
 /// Creates a new vertex attribute.
 /// </summary>
 /// <param name="name">The name of the attribute in the shader</param>
 /// <param name="valueCount">The number of components for the value</param>
 /// <param name="type">The data type of the value</param>
 /// <param name="normalized">Indicates whether integer types should be converted to floating point</param>
 /// <exception cref="System.NotImplementedException"><paramref name="type"/> is not an implemented attribute type.</exception>
 public VertexFloatAttribute(string name, ValueCount valueCount, VertexAttribPointerType type, bool normalized = false)
     : base(name, valueCount, type)
 {
     Normalized  = normalized;
     SizeInBytes = (int)valueCount * AttribPointerUtils.GetSizeInBytes(type);
 }
Esempio n. 33
0
 [Test] public void TwoArgConstructorUintFirstNull()
 {
     var value2 = (uint?) 30;
     var valueCount = new ValueCount(null, value2);
     Assert.AreEqual(0, valueCount.Min);
     Assert.AreEqual(value2, valueCount.Max);
     Assert.AreEqual("{0,30}", valueCount.OriginalString);
 }
Esempio n. 34
0
 [Test] public void OneArgConstructorStringZeroOrMore()
 {
     var valueCount = new ValueCount("*");
     AssertAreEqual(new ValueCount(0, null), valueCount);
 }
Esempio n. 35
0
 private static void AssertAreEqualRepr(ValueCount v1, ValueCount v2)
 {
     Assert.AreEqual(v1.ToString(), v2.ToString());
 }
Esempio n. 36
0
        /// <summary>
        /// Serialize to a JSON object
        /// </summary>
        public new void SerializeJson(Utf8JsonWriter writer, JsonSerializerOptions options, bool includeStartObject = true)
        {
            if (includeStartObject)
            {
                writer.WriteStartObject();
            }

            ((Fhir.R4.Models.BackboneElement) this).SerializeJson(writer, options, false);

            if (!string.IsNullOrEmpty(Name))
            {
                writer.WriteString("name", (string)Name !);
            }

            if (_Name != null)
            {
                writer.WritePropertyName("_name");
                _Name.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueBase64Binary))
            {
                writer.WriteString("valueBase64Binary", (string)ValueBase64Binary !);
            }

            if (_ValueBase64Binary != null)
            {
                writer.WritePropertyName("_valueBase64Binary");
                _ValueBase64Binary.SerializeJson(writer, options);
            }

            if (ValueBoolean != null)
            {
                writer.WriteBoolean("valueBoolean", (bool)ValueBoolean !);
            }

            if (!string.IsNullOrEmpty(ValueCanonical))
            {
                writer.WriteString("valueCanonical", (string)ValueCanonical !);
            }

            if (_ValueCanonical != null)
            {
                writer.WritePropertyName("_valueCanonical");
                _ValueCanonical.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueCode))
            {
                writer.WriteString("valueCode", (string)ValueCode !);
            }

            if (_ValueCode != null)
            {
                writer.WritePropertyName("_valueCode");
                _ValueCode.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueDate))
            {
                writer.WriteString("valueDate", (string)ValueDate !);
            }

            if (_ValueDate != null)
            {
                writer.WritePropertyName("_valueDate");
                _ValueDate.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueDateTime))
            {
                writer.WriteString("valueDateTime", (string)ValueDateTime !);
            }

            if (_ValueDateTime != null)
            {
                writer.WritePropertyName("_valueDateTime");
                _ValueDateTime.SerializeJson(writer, options);
            }

            if (ValueDecimal != null)
            {
                writer.WriteNumber("valueDecimal", (decimal)ValueDecimal !);
            }

            if (_ValueDecimal != null)
            {
                writer.WritePropertyName("_valueDecimal");
                _ValueDecimal.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueId))
            {
                writer.WriteString("valueId", (string)ValueId !);
            }

            if (_ValueId != null)
            {
                writer.WritePropertyName("_valueId");
                _ValueId.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueInstant))
            {
                writer.WriteString("valueInstant", (string)ValueInstant !);
            }

            if (_ValueInstant != null)
            {
                writer.WritePropertyName("_valueInstant");
                _ValueInstant.SerializeJson(writer, options);
            }

            if (ValueInteger != null)
            {
                writer.WriteNumber("valueInteger", (int)ValueInteger !);
            }

            if (!string.IsNullOrEmpty(ValueMarkdown))
            {
                writer.WriteString("valueMarkdown", (string)ValueMarkdown !);
            }

            if (_ValueMarkdown != null)
            {
                writer.WritePropertyName("_valueMarkdown");
                _ValueMarkdown.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueOid))
            {
                writer.WriteString("valueOid", (string)ValueOid !);
            }

            if (_ValueOid != null)
            {
                writer.WritePropertyName("_valueOid");
                _ValueOid.SerializeJson(writer, options);
            }

            if (ValuePositiveInt != null)
            {
                writer.WriteNumber("valuePositiveInt", (uint)ValuePositiveInt !);
            }

            if (!string.IsNullOrEmpty(ValueString))
            {
                writer.WriteString("valueString", (string)ValueString !);
            }

            if (_ValueString != null)
            {
                writer.WritePropertyName("_valueString");
                _ValueString.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueTime))
            {
                writer.WriteString("valueTime", (string)ValueTime !);
            }

            if (_ValueTime != null)
            {
                writer.WritePropertyName("_valueTime");
                _ValueTime.SerializeJson(writer, options);
            }

            if (ValueUnsignedInt != null)
            {
                writer.WriteNumber("valueUnsignedInt", (uint)ValueUnsignedInt !);
            }

            if (!string.IsNullOrEmpty(ValueUri))
            {
                writer.WriteString("valueUri", (string)ValueUri !);
            }

            if (_ValueUri != null)
            {
                writer.WritePropertyName("_valueUri");
                _ValueUri.SerializeJson(writer, options);
            }

            if (!string.IsNullOrEmpty(ValueUrl))
            {
                writer.WriteString("valueUrl", (string)ValueUrl !);
            }

            if (_ValueUrl != null)
            {
                writer.WritePropertyName("_valueUrl");
                _ValueUrl.SerializeJson(writer, options);
            }

            if (ValueUuid != null)
            {
                writer.WriteString("valueUuid", (Guid)ValueUuid !);
            }

            if (ValueAddress != null)
            {
                writer.WritePropertyName("valueAddress");
                ValueAddress.SerializeJson(writer, options);
            }

            if (ValueAge != null)
            {
                writer.WritePropertyName("valueAge");
                ValueAge.SerializeJson(writer, options);
            }

            if (ValueAnnotation != null)
            {
                writer.WritePropertyName("valueAnnotation");
                ValueAnnotation.SerializeJson(writer, options);
            }

            if (ValueAttachment != null)
            {
                writer.WritePropertyName("valueAttachment");
                ValueAttachment.SerializeJson(writer, options);
            }

            if (ValueCodeableConcept != null)
            {
                writer.WritePropertyName("valueCodeableConcept");
                ValueCodeableConcept.SerializeJson(writer, options);
            }

            if (ValueCoding != null)
            {
                writer.WritePropertyName("valueCoding");
                ValueCoding.SerializeJson(writer, options);
            }

            if (ValueContactPoint != null)
            {
                writer.WritePropertyName("valueContactPoint");
                ValueContactPoint.SerializeJson(writer, options);
            }

            if (ValueCount != null)
            {
                writer.WritePropertyName("valueCount");
                ValueCount.SerializeJson(writer, options);
            }

            if (ValueDistance != null)
            {
                writer.WritePropertyName("valueDistance");
                ValueDistance.SerializeJson(writer, options);
            }

            if (ValueDuration != null)
            {
                writer.WritePropertyName("valueDuration");
                ValueDuration.SerializeJson(writer, options);
            }

            if (ValueHumanName != null)
            {
                writer.WritePropertyName("valueHumanName");
                ValueHumanName.SerializeJson(writer, options);
            }

            if (ValueIdentifier != null)
            {
                writer.WritePropertyName("valueIdentifier");
                ValueIdentifier.SerializeJson(writer, options);
            }

            if (ValueMoney != null)
            {
                writer.WritePropertyName("valueMoney");
                ValueMoney.SerializeJson(writer, options);
            }

            if (ValuePeriod != null)
            {
                writer.WritePropertyName("valuePeriod");
                ValuePeriod.SerializeJson(writer, options);
            }

            if (ValueQuantity != null)
            {
                writer.WritePropertyName("valueQuantity");
                ValueQuantity.SerializeJson(writer, options);
            }

            if (ValueRange != null)
            {
                writer.WritePropertyName("valueRange");
                ValueRange.SerializeJson(writer, options);
            }

            if (ValueRatio != null)
            {
                writer.WritePropertyName("valueRatio");
                ValueRatio.SerializeJson(writer, options);
            }

            if (ValueReference != null)
            {
                writer.WritePropertyName("valueReference");
                ValueReference.SerializeJson(writer, options);
            }

            if (ValueSampledData != null)
            {
                writer.WritePropertyName("valueSampledData");
                ValueSampledData.SerializeJson(writer, options);
            }

            if (ValueSignature != null)
            {
                writer.WritePropertyName("valueSignature");
                ValueSignature.SerializeJson(writer, options);
            }

            if (ValueTiming != null)
            {
                writer.WritePropertyName("valueTiming");
                ValueTiming.SerializeJson(writer, options);
            }

            if (ValueContactDetail != null)
            {
                writer.WritePropertyName("valueContactDetail");
                ValueContactDetail.SerializeJson(writer, options);
            }

            if (ValueContributor != null)
            {
                writer.WritePropertyName("valueContributor");
                ValueContributor.SerializeJson(writer, options);
            }

            if (ValueDataRequirement != null)
            {
                writer.WritePropertyName("valueDataRequirement");
                ValueDataRequirement.SerializeJson(writer, options);
            }

            if (ValueExpression != null)
            {
                writer.WritePropertyName("valueExpression");
                ValueExpression.SerializeJson(writer, options);
            }

            if (ValueParameterDefinition != null)
            {
                writer.WritePropertyName("valueParameterDefinition");
                ValueParameterDefinition.SerializeJson(writer, options);
            }

            if (ValueRelatedArtifact != null)
            {
                writer.WritePropertyName("valueRelatedArtifact");
                ValueRelatedArtifact.SerializeJson(writer, options);
            }

            if (ValueTriggerDefinition != null)
            {
                writer.WritePropertyName("valueTriggerDefinition");
                ValueTriggerDefinition.SerializeJson(writer, options);
            }

            if (ValueUsageContext != null)
            {
                writer.WritePropertyName("valueUsageContext");
                ValueUsageContext.SerializeJson(writer, options);
            }

            if (ValueDosage != null)
            {
                writer.WritePropertyName("valueDosage");
                ValueDosage.SerializeJson(writer, options);
            }

            if (ValueMeta != null)
            {
                writer.WritePropertyName("valueMeta");
                ValueMeta.SerializeJson(writer, options);
            }

            if (Resource != null)
            {
                writer.WritePropertyName("resource");
                JsonSerializer.Serialize <Fhir.R4.Models.Resource>(writer, (Fhir.R4.Models.Resource)Resource, options);
            }

            if ((Part != null) && (Part.Count != 0))
            {
                writer.WritePropertyName("part");
                writer.WriteStartArray();

                foreach (ParametersParameter valPart in Part)
                {
                    valPart.SerializeJson(writer, options, true);
                }

                writer.WriteEndArray();
            }

            if (includeStartObject)
            {
                writer.WriteEndObject();
            }
        }
Esempio n. 37
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name">The name of the attribute in the shader</param>
 /// <param name="valueCount">The number of components</param>
 /// <param name="type">The data type</param>
 protected VertexAttribute(string name, ValueCount valueCount, VertexAttribPointerType type)
 {
     Name       = name;
     ValueCount = valueCount;
     Type       = type;
 }
Esempio n. 38
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name">The name of the attribute</param>
 /// <param name="type">The data type of the attribute</param>
 /// <param name="valueCount">The number of vector components or 1 for scalars</param>
 public AttribSetEventArgs(string name, VertexAttribPointerType type, ValueCount valueCount)
 {
     Name       = name;
     Type       = type;
     ValueCount = valueCount;
 }
Esempio n. 39
0
 [Test] public void OneArgConstructorUint()
 {
     var value = (uint?) 10;
     var valueCount = new ValueCount(value);
     Assert.AreEqual(value, valueCount.Min);
     Assert.AreEqual(value, valueCount.Max);
     Assert.AreEqual("{10}", valueCount.OriginalString);
 }