Пример #1
0
        public InitCommand(string clientid, string id, string clientLocalIP, IPAddress requestedServerAddress, Runtime.Caching.ClientInfo clientInfo, int operationTimeout)
        {
            _initCommand = new Alachisoft.NCache.Common.Protobuf.InitCommand();


            _currentVersion                     = Alachisoft.NCache.Common.ProductVersion.ProductInfo;
            _initCommand.cacheId                = id;
            _initCommand.clientId               = clientid;
            _initCommand.isDotnetClient         = true;
            _initCommand.requestId              = base.RequestId;
            _initCommand.clientInfo             = new ClientInfo();
            _initCommand.clientInfo.machineName = clientInfo.MachineName;
            _initCommand.clientInfo.processId   = clientInfo.ProcessID;
            _initCommand.clientInfo.appName     = clientInfo.AppName;
            _initCommand.clientVersion          = clientInfo.ClientVersion;
            _initCommand.clientInfo.clientId    = clientInfo.ClientID;


            //Protobuf. Product Version is assigned values
            if (_initCommand.productVersion == null)
            {
                _initCommand.productVersion = new Common.Protobuf.ProductVersion();
            }

            _initCommand.productVersion.AddiotionalData = _currentVersion.AdditionalData;
            _initCommand.productVersion.EditionID       = _currentVersion.EditionID;
            _initCommand.productVersion.MajorVersion1   = this.ParseToByteArray(_currentVersion.MajorVersion1);
            _initCommand.productVersion.MajorVersion2   = this.ParseToByteArray(_currentVersion.MajorVersion2);
            _initCommand.productVersion.MinorVersion1   = this.ParseToByteArray(_currentVersion.MinorVersion1);
            _initCommand.productVersion.MinorVersion2   = this.ParseToByteArray(_currentVersion.MinorVersion2);
            _initCommand.productVersion.ProductName     = _currentVersion.ProductName;

            _initCommand.operationTimeout = operationTimeout;
            _initCommand.clientVersion    = 5000;
            _initCommand.OperationSystem  = GetOSPlatform().ToString();
        }
Пример #2
0
        public int CompareTo(object obj)
        {
            int result = -1;

            if (obj != null && obj is ProductVersion)
            {
                ProductVersion other = (ProductVersion)obj;

                if (_editionID == other.EditionID)
                {
                    if (_majorVersion1 == other.MajorVersion1)
                    {
                        if (_majorVersion2 == other.MajorVersion2)
                        {
                            if (_minorVersion1 == other.MinorVersion1)
                            {
                                if (_minorVersion2 == other._minorVersion2)
                                {
                                    result = 0;
                                }
                                else if (_minorVersion2 < other.MinorVersion2)
                                {
                                    result = -1;
                                }
                                else
                                {
                                    result = 1;
                                }
                            }
                            else if (_minorVersion1 < other.MinorVersion1)
                            {
                                result = -1;
                            }
                            else
                            {
                                result = 1;
                            }
                        }
                        else if (_majorVersion2 < other.MajorVersion2)
                        {
                            result = -1;
                        }
                        else
                        {
                            result = 1;
                        }
                    }
                    else if (_majorVersion1 < other.MajorVersion1)
                    {
                        result = -1;
                    }
                    else
                    {
                        result = 1;
                    }
                }
                else
                {
                    result = -1;
                }
            }
            return(result);
        }
Пример #3
0
        public int CompareTo(object obj)
        {
            int result = -1;

            if (obj != null && obj is ProductVersion)
            {
                ProductVersion other = (ProductVersion)obj;

                if (_editionID == other.EditionID)
                {
                    if (_majorVersion1 == other.MajorVersion1)
                    {
                        if (_majorVersion2 == other.MajorVersion2)
                        {
                            if (_minorVersion1 == other.MinorVersion1)
                            {
                                if (_minorVersion2 == other._minorVersion2)
                                {
                                    result = 0;
                                }
                                else if (_minorVersion2 < other.MinorVersion2)
                                {
                                    result = -1;
                                }
                                else
                                {
                                    result = 1;
                                }
                            }
                            else if (_minorVersion1 < other.MinorVersion1)
                            {
                                result = -1;
                            }
                            else
                            {
                                result = 1;
                            }
                        }
                        else if (_majorVersion2 < other.MajorVersion2)
                        {
                            result = -1;
                        }
                        else
                        {
                            result = 1;
                        }
                    }
                    else if (_majorVersion1 < other.MajorVersion1)
                    {
                        result = -1;
                    }
                    else
                    {
                        result = 1;
                    }
                }
                else
                {
                    result = -1;
                }
                // Suggestion- Incase of invalid type an exception should be thrown!!
            }
            return(result);
        }