Exemple #1
0
        public void TestLongObjectSerialization(long value, int byteCount)
        {
            PrimitiveTestPatternBuffer patternBuffer = new PrimitiveTestPatternBuffer();
            LongObject l1 = new LongObject(value);

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

            Assert.IsTrue(o is LongObject);
            Assert.AreEqual(l1.LongValue, ((LongObject)o).LongValue);
            Assert.IsFalse(l1 == o);
        }
        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);
            }
        }
        public LongObject getContentLength()
        {
            if (null == _entity)
            {
                return null;
            }

            long entityContentLength = _entity.getContentLength();
            if (null == _range)
            {
                return new LongObject(_entity.getContentLength());
            }

            long rangedContentLength = _range.getContentLength(entityContentLength);
            LongObject answer = new LongObject(rangedContentLength);
            return answer;
        }