Пример #1
0
        /// <summary>
        /// Returns the number of bytes the literal command's size argument fills
        /// </summary>
        /// <param name="command">The command to find the size for</param>
        /// <returns>The number of bytes the literal command's size argument fills</returns>
        public static int GetLiteralLength(LiteralDeltaCommand command)
        {
            int response;

            switch (command)
            {
            case LiteralDeltaCommand.LiteralSizeByte: {
                response = 1;

                break;
            }

            case LiteralDeltaCommand.LiteralSizeShort: {
                response = 2;

                break;
            }

            case LiteralDeltaCommand.LiteralSizeInt: {
                response = 4;

                break;
            }

            case LiteralDeltaCommand.LiteralSizeLong: {
                response = 8;

                break;
            }

            default: {
                throw new Exception(string.Format(Strings.RDiffBinary.InvalidLiteralCommand, command));
            }
            }

            return(response);
        }
Пример #2
0
 /// <summary>
 /// Returns the number of bytes the literal command's size argument fills
 /// </summary>
 /// <param name="command">The command to find the size for</param>
 /// <returns>The number of bytes the literal command's size argument fills</returns>
 public static int GetLiteralLength(LiteralDeltaCommand command)
 {
     switch (command)
     {
         case LiteralDeltaCommand.LiteralSizeByte:
             return 1;
         case LiteralDeltaCommand.LiteralSizeShort:
             return 2;
         case LiteralDeltaCommand.LiteralSizeInt:
             return 4;
         case LiteralDeltaCommand.LiteralSizeLong:
             return 8;
         default:
             throw new Exception(string.Format(Strings.RDiffBinary.InvalidLiteralCommand, command));
     }
 }