Example #1
0
        public void StringValuesAreEquatable()
        {
            var a       = new StringObject("moooooooo imma cow");
            var secondA = new StringObject("moooooooo imma cow");
            var b       = new StringObject("moooooooo imma cat");
            var secondB = new StringObject("moooooooo imma cat");

            Assert.IsTrue(a.Equals(a));
            Assert.IsTrue(a.Equals((object)a));

            Assert.IsTrue(a.Equals(secondA));
            Assert.IsTrue(a.Equals((object)secondA));

            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(a.Equals((object)b));

            Assert.IsTrue(b.Equals(b));
            Assert.IsTrue(b.Equals((object)b));

            Assert.IsTrue(b.Equals(secondB));
            Assert.IsTrue(b.Equals((object)secondB));

            Assert.IsFalse(b.Equals(a));
            Assert.IsFalse(b.Equals((object)a));
        }
        public bool DeleteFile(string strRemotePath)
        {
            if (!this.bLogin)
            {
                return(false);
            }
            List <string> toDelete = new List <string>();

            toDelete.Add(SAWCommon.ConvertPath(strRemotePath));
            StringObject error = new StringObject();
            List <SDKItemOperatorResult> results = new List <SDKItemOperatorResult>();

            if (0 != sdkObject.DeleteFiles(strRepositoryName, toDelete, false, ref results, error))  //DestoryPermanently is set as false
            {
                return(false);
            }
            else
            {
                if (OperatorResultsHaveError(results))  //File is already deleted but not Purged.
                {
                    return(false);
                }
                else
                {
                    return(true);
                }
            }
        }
        public List <SAWItemInfo> EnumItems(string path, int ver)
        {
            if (false == GetFileInfo(path, -1).isdir)
            {
                return(null);
            }
            List <SAWItemInfo> result = new List <SAWItemInfo>();

            path = SAWCommon.ConvertPath(path);
            List <string> listSubFileNames       = new List <string>();
            StringObject  strobjError            = new StringObject();
            bool          bRecursive             = false;
            List <string> listSubFolderFullNames = new List <string>();

            if ((0 != sdkObject.GetSubFolderFromParentFolder(strRepositoryName, path, bRecursive, ref listSubFolderFullNames, strobjError)) ||
                (0 != sdkObject.GetFileListFromParentProject(strRepositoryName, path, ref listSubFileNames, strobjError)))
            {
                return(null);
            }
            foreach (string strSubFolder in listSubFolderFullNames)
            {
                result.Add(GetFileInfo(strSubFolder, -1));
            }
            foreach (string strSubFile in listSubFileNames)
            {
                result.Add(GetFileInfo(strSubFile, -1));
            }
            return(result);
        }
        public bool UndoCheckoutFiles(string strRemoteFile)
        {
            List <string> listFileFullNameToUndoCheckout      = new List <string>();
            int           enumUndoCheckOutChangedFileHandling = EnumUndoCheckOutChangedFileHandling.enumUndoCheckOutAndDeleteLocalCopy;
            int           enumEOL         = EnumEOL.enumEOLNative;
            int           enumSetFileTime = EnumSetLocalFileTime.enumCurrentFileTime;
            bool          bReadOnly       = false;
            List <SDKItemOperatorResult> listItemOperateResults = new List <SDKItemOperatorResult>();
            StringObject strobjError = new StringObject();

            strRemoteFile = SAWCommon.ConvertPath(strRemoteFile);
            listFileFullNameToUndoCheckout.Add(strRemoteFile);
            if (0 != sdkObject.UndoCheckoutFiles(strRepositoryName, listFileFullNameToUndoCheckout, enumUndoCheckOutChangedFileHandling, enumEOL, enumSetFileTime, bReadOnly, ref listItemOperateResults, strobjError))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(listItemOperateResults))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public bool GetFile(int version, string strLocalPath, string strRemotePath)
        {
            string strFileServerFullNameToGet = SAWCommon.ConvertPath(strRemotePath);
            long   lVersionNumber             = version;
            string strLocalFileFullName       = strLocalPath;
            bool   bMakeWritable             = true;
            int    iEnumEOL                  = EnumEOL.enumEOLNative;
            int    iEnumSetLocalFileTime     = EnumSetLocalFileTime.enumCurrentFileTime;
            int    iEnumModifiedFileHandling = EnumModifiedFileHandling.enumReplaceModifiedFile;
            SDKDiffMergeParameter        stDiffMergeParameter   = new SDKDiffMergeParameter();
            List <SDKItemOperatorResult> listItemOperateResults = new List <SDKItemOperatorResult>();
            StringObject strobjError = new StringObject();

            if (0 != sdkObject.GetOldVersionFile(strRepositoryName, strFileServerFullNameToGet, lVersionNumber, strLocalFileFullName, bMakeWritable, iEnumEOL, iEnumModifiedFileHandling, iEnumSetLocalFileTime, stDiffMergeParameter, ref listItemOperateResults, strobjError))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(listItemOperateResults))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
        public bool CheckInFiles(string strLocalPath, string strRemotePath, string Comment)
        {
            List <string> listFilesFullNameToCheckIn = new List <string>();
            bool          bKeepCheckout    = false;
            bool          bRemoveLocalCopy = true;
            string        strComment       = Comment;
            List <long>   listIssueID      = new List <long>();
            bool          bUseReadOnly     = false;
            int           iEnumCheckInUnChangedFileHandling     = EnumCheckinUnchangedFileHandling.enumUndoCheckinUnchangedFile;
            List <SDKItemOperatorResult> listItemOperateResults = new List <SDKItemOperatorResult>();
            BoolObject   bConflictExists = new BoolObject();
            StringObject strobjError     = new StringObject();

            strRemotePath = SAWCommon.ConvertPath(strRemotePath);
            listFilesFullNameToCheckIn.Add(strRemotePath);
            if (0 != sdkObject.CheckInFiles(strRepositoryName, listFilesFullNameToCheckIn, bKeepCheckout, bRemoveLocalCopy, strComment, listIssueID, bUseReadOnly, iEnumCheckInUnChangedFileHandling, ref listItemOperateResults, bConflictExists, strobjError))
            {
                return(false);
            }
            else
            {
                if (!OperatorResultsHaveError(listItemOperateResults))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
        }
Example #7
0
        public ActionResult RemoveProject(String id)
        {
            StringObject str = new StringObject();

            str.Object = id;
            return(View(str));
        }
Example #8
0
        public void StringObjectsShouldNotBeEquals()
        {
            StringObject so1 = new StringObject("a");
            StringObject so2 = new StringObject("2");

            Assert.AreNotEqual(so1, so2);
            Assert.AreNotEqual(so1.GetHashCode(), so2.GetHashCode());
        }
Example #9
0
        private StringObject StringCode(string content, int startIndex = 0)
        {
            StringObject stringObject = new StringObject();

            stringObject.Content    = content;
            stringObject.StartIndex = startIndex;
            return(stringObject);
        }
Example #10
0
        public void TestEquals()
        {
            PrimitiveTestPatternBuffer patternBuffer = new PrimitiveTestPatternBuffer();
            UShortObject u = new UShortObject(12345);
            StringObject s = new StringObject("12345");

            Assert.IsFalse(u.Equals(s));
        }
        public bool CheckInProject(string strLocalPath, string strRemotePath, string Comment)   //no use
        {
            List <SDKItemOperatorResult> results = new List <SDKItemOperatorResult>();
            BoolObject   bConflict = new BoolObject();
            StringObject error     = new StringObject();

            return(0 == sdkObject.CheckInFolder("", strRemotePath, true, Comment, null, false, 2, ref results, bConflict, error));
        }
Example #12
0
 private void Awake()
 {
     this.audioSource = this.gameObject.GetComponent <AudioSource> ();
     if (this.emptyString == null)
     {
         Debug.LogError("[LCMusic] Missing EmptyString " + this.name);
     }
     this.stringObj = new StringObject(this as IStringController);
 }
Example #13
0
        public void Evaluate_CanEvalStringExpressions(string input, string expected)
        {
            IObject actual = this.subject.Evaluate(input, this.environment);

            Assert.NotNull(actual);
            StringObject stringResult = this.AssertAndCast <StringObject>(actual);

            Assert.Equal(expected, stringResult.Value);
        }
Example #14
0
        public void StringValuesAreSet()
        {
            var a = new StringObject("Hello world");
            var b = new StringObject("Scott");
            var c = new StringObject("You get a cookie if you read this");

            Assert.AreEqual("Hello world", a.Value);
            Assert.AreEqual("Scott", b.Value);
            Assert.AreEqual("You get a cookie if you read this", c.Value);
        }
Example #15
0
        public void TestCopyStringProperty()
        {
            StringObject source = new StringObject {
                Property = "Test"
            };
            StringObject target = new StringObject();

            target.SetFrom(source);
            Assert.AreEqual("Test", target.Property);
        }
Example #16
0
        public IActionResult ChangeStatus(int requestId, [FromBody] StringObject status)
        {
            if (status.content != RequestStatus.INACTIVE && status.content != RequestStatus.SENDING && status.content != RequestStatus.ACCEPTED && status.content != RequestStatus.REJECTED)
            {
                return(BadRequest());
            }
            var result = _requestService.ChangeStatus(requestId, status.content);

            return(Ok(result));
        }
Example #17
0
        public void DifferentStringObjectsAreNotEqual()
        {
            // Arrange
            var stringObject1 = new StringObject { StringValue = A<string>() };
            var stringObject2 = new StringObject { StringValue = A<string>() };

            // Assert
            stringObject1.GetHashCode().Should().NotBe(stringObject2.GetHashCode());
            stringObject1.Equals(stringObject2).Should().BeFalse();
            (stringObject1 == stringObject2).Should().BeFalse();
        }
Example #18
0
        public void SameStringObjectsAreEqual()
        {
            // Arrange
            var str = A<string>();
            var stringObject1 = new StringObject { StringValue = str };
            var stringObject2 = new StringObject { StringValue = str };

            // Assert
            stringObject1.GetHashCode().Should().Be(stringObject2.GetHashCode());
            stringObject1.Equals(stringObject2).Should().BeTrue();
            (stringObject1 == stringObject2).Should().BeTrue();
        }
Example #19
0
        public void TestStringObjectSerialization()
        {
            PrimitiveTestPatternBuffer patternBuffer = new PrimitiveTestPatternBuffer();
            StringObject stringObject = new StringObject("foobar");

            byte[] bytes = patternBuffer.Energize(stringObject);
            Assert.AreEqual(8, bytes.Length);
            object o = patternBuffer.Energize(bytes);

            Assert.IsTrue(o is StringObject);
            Assert.AreEqual(stringObject.StringValue, ((StringObject)o).StringValue);
            Assert.IsFalse(stringObject == o);
        }
Example #20
0
        public TestLayer(D2D.RenderTarget renderTarget, DxLoadObject settings, OsuModel osuModel) : base(renderTarget, settings, osuModel)
        {
            string ok    = "影翔鼓舞 - Oriental Blossom";
            var    font  = new Gdip.Font("等线", 25, Gdip.FontStyle.Bold);
            var    brush = new Gdip.SolidBrush(Gdip.Color.White);

            D2D.Bitmap[] bmps = StringUtil.GetCharsBitmap(ok, font, brush).Select(renderTarget.LoadBitmap).ToArray();
            _titleObjs = new StringObject[ok.Length];
            for (var i = 0; i < _titleObjs.Length; i++)
            {
                _titleObjs[i] = new StringObject(RenderTarget, bmps[i], Origin.TopLeft, new Mathe.RawPoint(0, 0));
            }
        }
        public SAWItemInfo GetFileInfo(string file, int ver)
        {
            SAWItemInfo  ItemInfo = new SAWItemInfo();
            LongObject   version  = new LongObject();
            DateTime     time     = new DateTime();
            LongObject   size     = new LongObject();
            StringObject comment  = new StringObject();
            StringObject error    = new StringObject();

            file = SAWCommon.ConvertPath(file);
            if (0 != sdkObject.GetFileGeneralInfo(strRepositoryName, file, version, ref time, size, comment, error))
            {
                string errorIfFolder = "File \"" + file + "\" not found.";
                if (errorIfFolder == error.GetValue())
                {
                    IntObject iobjSubFoldersNotDeletedCount = new IntObject();
                    IntObject iobjSubFoldersDeletedCount    = new IntObject();
                    IntObject iobjFileNotDeletedCount       = new IntObject();
                    IntObject iobjFilesDeletedCount         = new IntObject();
                    List <SDKDeletedItemGeneralInfo> listDeletedItemGeneralInfo = new List <SDKDeletedItemGeneralInfo>();
                    IntObject iobjRight = new IntObject();
                    if (0 == sdkObject.GetFolderGeneralInfo(strRepositoryName, file, iobjSubFoldersNotDeletedCount, iobjSubFoldersDeletedCount, iobjFileNotDeletedCount, iobjFilesDeletedCount, version, ref time, comment, ref listDeletedItemGeneralInfo, iobjRight, error))
                    {
                        ItemInfo.comment = comment.GetValue();
                        ItemInfo.name    = file;
                        ItemInfo.size    = 0;
                        ItemInfo.version = (int)version.GetValue();
                        ItemInfo.date    = time;
                        ItemInfo.isdir   = true;
                        ItemInfo.type    = EnumActionType.Enum_ActionTypeNull;
                        ItemInfo.user    = "";
                        return(ItemInfo);
                    }
                }
                return(null);
            }
            else
            {
                ItemInfo.comment = comment.GetValue();
                ItemInfo.name    = file;
                ItemInfo.size    = (int)size.GetValue();
                ItemInfo.version = (int)version.GetValue();
                ItemInfo.date    = time;
                ItemInfo.isdir   = false;
                ItemInfo.type    = EnumActionType.Enum_ActionTypeNull;
                ItemInfo.user    = "";
                return(ItemInfo);
            }
        }
Example #22
0
        public void DifferentStringObjectsAreNotEqual()
        {
            // Arrange
            var stringObject1 = new StringObject {
                StringValue = A <string>()
            };
            var stringObject2 = new StringObject {
                StringValue = A <string>()
            };

            // Assert
            stringObject1.GetHashCode().Should().NotBe(stringObject2.GetHashCode());
            stringObject1.Equals(stringObject2).Should().BeFalse();
            (stringObject1 == stringObject2).Should().BeFalse();
        }
Example #23
0
        public ConfirmControl(Device device, Sprite sprite)
        {
            state           = State.notappeared;
            resource        = new Dictionary <string, ImageResource>();
            confirm         = new EffectObject("img\\default\\confirm.etd", 400, 225, resource, device);
            confirm.Finish += new EventHandler(confirm_Finish);
            ImageResource p = new ImageResource("img\\default\\black.png", device);

            resource.Add("img\\default\\black.png", p);
            black       = new PictureObject("img\\default\\black.png", 0, 0, resource, device);
            black.Alpha = 0;
            songname    = new StringObject("", 0, 160, 20, 210, new Color4(1, 1, 1, 1), device, sprite);
            difficulty  = new StringObject("", 0, 195, 20, 210, new Color4(1, 1, 1, 1), device, sprite);
            play        = new StringObject("をプレイします", 0, 230, 20, new Color4(1, 1, 1, 1), device, sprite);
        }
Example #24
0
        public void StringPrintAsExpected()
        {
            var a = new StringObject("meow");

            Assert.AreEqual("\"meow\"", a.ToString());

            a = new StringObject("meow imma kitty");
            Assert.AreEqual("\"meow imma kitty\"", a.ToString());

            a = new StringObject("chargin\"lazar");
            Assert.AreEqual("\"chargin\\\"lazar\"", a.ToString());

            a = new StringObject("123\n!");
            Assert.AreEqual("\"123\\n!\"", a.ToString());
        }
Example #25
0
        public void SameStringObjectsAreEqual()
        {
            // Arrange
            var str           = A <string>();
            var stringObject1 = new StringObject {
                StringValue = str
            };
            var stringObject2 = new StringObject {
                StringValue = str
            };

            // Assert
            stringObject1.GetHashCode().Should().Be(stringObject2.GetHashCode());
            stringObject1.Equals(stringObject2).Should().BeTrue();
            (stringObject1 == stringObject2).Should().BeTrue();
        }
Example #26
0
 public override void Measure()
 {
     if (_titleObjs.All(t => t.IsFinished))
     {
         string       ok    = "影翔鼓舞 - Oriental Blossom";
         var          font  = new Gdip.Font("等线", 25, Gdip.FontStyle.Bold);
         var          brush = new Gdip.SolidBrush(Gdip.Color.White);
         D2D.Bitmap[] bmps  = StringUtil.GetCharsBitmap(ok, font, brush).Select(RenderTarget.LoadBitmap).ToArray();
         _titleObjs = new StringObject[ok.Length];
         for (var i = 0; i < _titleObjs.Length; i++)
         {
             _titleObjs[i] = new StringObject(RenderTarget, bmps[i], Origin.Centre, new Mathe.RawPoint(0, 0));
         }
         LogUtil.LogInfo("Refresh");
     }
 }
Example #27
0
        public void BackUntil()
        {
            var parse =
                FSBuilder
                .Skip <StringObject>(6)
                .Take(1, "Raw1")
                .Back("hello")
                .TakeRest("Raw2")
                .Seal();

            var obj = new StringObject();

            parse("123helloworld", obj);

            Assert.AreEqual("l", obj.Raw1);
            Assert.AreEqual("world", obj.Raw2);
        }
        public List <SAWItemInfo> GetFileHistory(string path)
        {
            List <SDKHistory> history = new List <SDKHistory>();
            StringObject      error   = new StringObject();

            path = SAWCommon.ConvertPath(path);
            List <string> listUsers = new List <string>();
            List <SHistorySortOrderBy> listFilterHistorySortOrderBy = new List <SHistorySortOrderBy>();

            //SHistorySortOrderBy HistorySortOrderBy = new SHistorySortOrderBy();
            //listFilterHistorySortOrderBy.Add(HistorySortOrderBy);
            if (0 != sdkObject.GetFileHistory(strRepositoryName, path, listUsers, int.MaxValue, false, "", listFilterHistorySortOrderBy, ref history, true, error))
            {
                if (error.GetValue().Contains("The operation can not be performed on folder"))
                {
                    List <string> listFileExtensions = new List <string>();
                    List <string> listFileSubStrings = new List <string>();
                    if (0 != sdkObject.GetFolderHistoryByItem(strRepositoryName, path, false, listUsers, listFileExtensions, listFileSubStrings, int.MaxValue, false, "", listFilterHistorySortOrderBy, new System.DateTime(), System.DateTime.Now, ref history, error))
                    {
                        return(null);
                    }
                }
                else
                {
                    return(null);
                }
            }

            List <SAWItemInfo> ItemHistoryInfoset = new List <SAWItemInfo>();

            foreach (SDKHistory ItemHistory in history)
            {
                SAWItemInfo ItemInfo = new SAWItemInfo();
                ItemInfo.comment = ItemHistory.m_strComment;
                ItemInfo.name    = ItemHistory.m_strItemFullName;
                ItemInfo.size    = (int)ItemHistory.m_lFileSize;
                ItemInfo.version = (int)ItemHistory.m_lChangeSetID; //GetLastestVersionNum(ItemHistory.m_strItemFullName);
                ItemInfo.date    = ItemHistory.m_dtCheckin;
                ItemInfo.isdir   = IsItemAFolder(ItemHistory.m_enumItemType);
                ItemInfo.type    = ConvertActionType(ItemHistory.m_enumActionType);
                ItemInfo.user    = ItemHistory.m_strUserName;
                ItemHistoryInfoset.Add(ItemInfo);
            }
            return(ItemHistoryInfoset);
        }
Example #29
0
        public void TestWrite(RequirementPolicy requirementPolicy, string value, Type expectedExceptionType)
        {
            CborOptions options = new CborOptions();

            options.Registry.ObjectMappingRegistry.Register <StringObject>(objectMapping =>
                                                                           objectMapping
                                                                           .AutoMap()
                                                                           .ClearMemberMappings()
                                                                           .MapMember(o => o.String).SetRequired(requirementPolicy)
                                                                           );

            StringObject obj = new StringObject
            {
                String = value
            };

            Helper.TestWrite(obj, expectedExceptionType, options);
        }
        public void TestWrite(RequirementPolicy requirementPolicy, string value, Type expectedExceptionType)
        {
            JsonSerializerOptions options = new JsonSerializerOptions();

            options.SetupExtensions();
            options.GetObjectMappingRegistry().Register <StringObject>(objectMapping =>
                                                                       objectMapping
                                                                       .AutoMap()
                                                                       .ClearMemberMappings()
                                                                       .MapMember(o => o.String).SetRequired(requirementPolicy)
                                                                       );

            StringObject obj = new StringObject
            {
                String = value
            };

            Helper.TestWrite(obj, options, expectedExceptionType);
        }
    private void Start()
    {
        if (instance == null)
        {
            instance = this;
            DontDestroyOnLoad(this.gameObject);
        }
        else
        {
            //만약 씬 이동이 되었는데 그 씬에도 Hierarchy에 GameMgr이 존재할 수도 있다.
            //그럴 경우엔 이전 씬에서 사용하던 인스턴스를 계속 사용해주는 경우가 많은 것 같다.
            //그래서 이미 전역변수인 instance에 인스턴스가 존재한다면 자신(새로운 씬의 GameMgr)을 삭제해준다.
            Destroy(this.gameObject);
        }

        dic = new StringObject();
        SetDictionary();
        ObjectInitialized();
    }
Example #32
0
        public override void Load()
        {
            resource         = new Dictionary <string, ImageResource>();
            select           = new EffectObject("img\\default\\difficulty.etd", 380, 150, resource, Device);
            select.Alignment = EffectObject.EffectAlignment.TopLeft;
            select.PlayType  = Effect2D.EffectManager.PlayType.Loop;
            select.Play();
            ImageResource pic = new ImageResource("img\\default\\difficulty.png", Device);

            resource.Add("img\\default\\difficulty.png", pic);
            selects = new PictureObject[3];
            for (int i = 0; i < 3; i++)
            {
                PictureObject po = new PictureObject("img\\default\\difficulty.png", 380, 150 + 60 * i, resource, Device);
                po.Position = new Vector2(400 - po.Width / 2, po.Position.Y);
                selects[i]  = po;
                switch (i)
                {
                case 0:
                    resume = new StringObject("RESUME", 370, 150 + 60 * i + 5, 20, new Color4(1, 1, 1, 1), Device, Sprite);
                    break;

                case 1:
                    retry = new StringObject("RETRY", 375, 150 + 60 * i + 5, 20, new Color4(1, 1, 1, 1), Device, Sprite);
                    break;

                case 2:
                    retur = new StringObject("RETURN", 370, 150 + 60 * i + 5, 20, new Color4(1, 1, 1, 1), Device, Sprite);
                    break;
                }
            }
            pic = new ImageResource("img\\default\\confirmpause.png", Device);
            resource.Add("img\\default\\confirmpause.png", pic);
            conf = new PictureObject("img\\default\\confirmpause.png", 266, 118, resource, Device);
            pic  = new ImageResource("img\\default\\conftop.png", Device);
            resource.Add("img\\default\\conftop.png", pic);
            top = new PictureObject("img\\default\\conftop.png", 266, 225 - 107, resource, Device);
            pic = new ImageResource("img\\default\\confbottom.png", Device);
            resource.Add("img\\default\\confbottom.png", pic);
            bottom          = new PictureObject("img\\default\\confbottom.png", 266, 225 + 107 - 17, resource, Device);
            select.Position = new Vector2(selects[(int)pausetype].Position.X - 4, selects[(int)pausetype].Position.Y - 4);
            Hidden          = false;
        }
Example #33
0
 internal PushstrStatement(string value)
     : base(5 + value.Length, "PUSHSTR " + StringObject.Escape(value))
 {
     this.value = new StringObject(value);
 }
Example #34
0
        private static bool ParseNestedObject(
            List<AnnotationToken> tokenList, 
            ref int nextToken, 
            ref NestedObject result,
            ref int fareastError)
        {
            int currentToken = nextToken;
            string tokenStr = null;

            if (ReadToken(tokenList, AnnotationTokenType.LeftBrace, ref currentToken, ref tokenStr, ref fareastError))
            {
                string fieldName = null;
                NestedObject fieldValue = null;

                CollectionObject collectionObj = new CollectionObject()
                {
                    Collection = new Dictionary<string, NestedObject>()
                };
                // Field Name can be a NameToken or a DoubleQuotedString 
                if ((ReadToken(tokenList, AnnotationTokenType.DoubleQuotedString, ref currentToken, ref fieldName, ref fareastError) || 
                    ReadToken(tokenList, AnnotationTokenType.NameToken, ref currentToken, ref fieldName, ref fareastError)) &&
                    ReadToken(tokenList, AnnotationTokenType.Colon, ref currentToken, ref tokenStr, ref fareastError) &&
                    ParseNestedObject(tokenList, ref currentToken, ref fieldValue, ref fareastError))
                {
                    collectionObj.Collection[fieldName.ToLower()] = fieldValue;
                }
                else
                {
                    return false;
                }

                while (ReadToken(tokenList, AnnotationTokenType.Comma, ref currentToken, ref tokenStr, ref fareastError) &&
                    (ReadToken(tokenList, AnnotationTokenType.DoubleQuotedString, ref currentToken, ref fieldName, ref fareastError) || 
                    ReadToken(tokenList, AnnotationTokenType.NameToken, ref currentToken, ref fieldName, ref fareastError)) &&
                    ReadToken(tokenList, AnnotationTokenType.Colon, ref currentToken, ref tokenStr, ref fareastError) &&
                    ParseNestedObject(tokenList, ref currentToken, ref fieldValue, ref fareastError))
                {
                    collectionObj.Collection[fieldName.ToLower()] = fieldValue;
                }

                if (!ReadToken(tokenList, AnnotationTokenType.RightBrace, ref currentToken, ref tokenStr, ref fareastError))
                {
                    return false;
                }

                result = collectionObj;
                nextToken = currentToken;
                return true;
            }
            else if (ReadToken(tokenList, AnnotationTokenType.DoubleQuotedString, ref currentToken, ref tokenStr, ref fareastError))
            {
                StringObject stringObj = new StringObject()
                {
                    Value = tokenStr
                };

                result = stringObj;
                nextToken = currentToken;
                return true;
            }
            else
            {
                return false;
            }
        }
Example #35
0
 private bool WriteObject(StringObject obj)
 {
     if (obj == null)
         return false;
     WriteEscapedString(obj.Value, _writer);
     return true;
 }