当前位置: 首页>>代码示例>>C#>>正文


C# List.Count方法代码示例

本文整理汇总了C#中Common.List.Count方法的典型用法代码示例。如果您正苦于以下问题:C# List.Count方法的具体用法?C# List.Count怎么用?C# List.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Common.List的用法示例。


在下文中一共展示了List.Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LogisticMap

        public LogisticMap(double mu, double r0, double rmax, double dr)
        {
            mapData.ChartType = SeriesChartType.Point ;
            mapData.MarkerSize = 1;
            mapData.MarkerColor = Color.Black;

            int numberOfThreadsInMap =1 ;
            List<double> activeThreadValues;
            double eps = .005;
            for(double r = r0; r < rmax; r+= dr ){
                activeThreadValues = new List<double>();
                Func<double, double> log = i => r * i * (1 - Math.Pow(i, mu));
                for (int i = 150; i < 260; i++) {
                    var A = new Sequence(log,	.2).GetElementAt(i);
                    if (A > double.MaxValue || A < double.MinValue) {
                        break;
                    }
                    if (activeThreadValues.Where(j => j < A + eps && j > A - eps).Count() == 0)
                        activeThreadValues.Add(A);
                    mapData.Points.AddXY(r, A);
                }
                if (activeThreadValues.Count > numberOfThreadsInMap) {
                    Console.WriteLine("Bifurcation point: " + r.ToString() + " " + activeThreadValues.Count.ToString() + " threads.");
                    numberOfThreadsInMap = activeThreadValues.Count();
                    eps /= numberOfThreadsInMap;
                }
            }
        }
开发者ID:Amichai,项目名称:ComputationalPhysics,代码行数:28,代码来源:LogisticMap.cs

示例2: WriteFileToGK

		public void WriteFileToGK(XDevice gkDevice)
		{
			var bytesList = new List<byte>();
			var gkFileInfo = new GKFileInfo();
			gkFileInfo.Initialize(XManager.DeviceConfiguration, gkDevice);
			bytesList.AddRange(gkFileInfo.InfoBlock);
			var sendResult = SendManager.Send(gkDevice, 0, 21, 0);
			if (sendResult.HasError)
				{ Error = "Невозможно начать процедуру записи "; return; }
            bytesList.AddRange(gkFileInfo.FileBytes);
			var progressCallback = GKProcessorManager.StartProgress("Запись файла в " + gkDevice.PresentationName, null, bytesList.Count / 256, true, GKProgressClientType.Administrator);
			for (var i = 0; i < bytesList.Count; i += 256)
			{
				if (progressCallback.IsCanceled)
					{ Error = "Операция отменена"; return; }
				GKProcessorManager.DoProgress("Запись блока данных " + i + 1, progressCallback);
				var bytesBlock = BitConverter.GetBytes((uint)(i / 256 + 1)).ToList();
				bytesBlock.AddRange(bytesList.GetRange(i, Math.Min(256, bytesList.Count - i)));
				sendResult = SendManager.Send(gkDevice, (ushort)bytesBlock.Count(), 22, 0, bytesBlock);
				if (sendResult.HasError)
				{
					Error = "Невозможно записать блок данных " + i;
					break;
				}
			}
			var endBlock = BitConverter.GetBytes((uint) (bytesList.Count()/256 + 1)).ToList();
			sendResult = SendManager.Send(gkDevice, 0, 22, 0, endBlock);
			if (sendResult.HasError)
				{ Error = "Невозможно завершить запись файла "; }
		}
开发者ID:saeednazari,项目名称:Rubezh,代码行数:30,代码来源:GKFileReaderWriter.cs

示例3: GetOrgList

 /// <summary>
 /// 获取OrgList
 /// </summary>
 /// <param name="orgidList"></param>
 /// <returns></returns>
 public List<Org> GetOrgList(List<Guid> orgidList)
 {
     List<Org> orgList = new List<Org>(orgidList.Count());
     foreach (Guid item in orgidList)
     {
         orgList.Add(orgHandler.GetOrgByID(item));
     }
     return orgList;
 }
开发者ID:GHY-ORG,项目名称:Firewood,代码行数:14,代码来源:OrgService.cs

示例4: ExecuteCommand

        public override void ExecuteCommand()
        {
            string searchId = base.Arguments[0];
            PrepareSources();
            PrepareDestinations();

            Console.WriteLine("Copying all packages with '{0}' from {1} to {2}.", searchId, Source.Count == 0 ? "any source" : string.Join(";", Source), string.Join(";", Destination));

            IEnumerable<IPackage> packages = new List<IPackage>();
            try
            {
                packages = GetPackages(searchId);
                Console.WriteLine("Retrieved {0} packages, not counting dependencies for copying from one or more sources to one or more destinations.", packages.Count());
            }
            catch (Exception)
            {
                Console.WriteError("Oopsy!");
                throw;
            }

            Copy copy = new Copy(_repositoryFactory, _sourceProvider);
            copy.Console = this.Console;
            copy.ApiKey = ApiKey;
            foreach (string src in Source)
            {
                copy.Sources.Add(src);
            }
            foreach (string dest in Destination)
            {
                copy.Destinations.Add(dest);
            }

            IList<string> report = new List<string>();

            foreach (IPackage package in packages)
            {
                copy.Arguments.Clear();
                copy.Arguments.Add(package.Id);
                copy.Version = package.Version.ToString();
                try
                {
                    copy.Execute();
                }
                catch (Exception ex)
                {
                    string message = string.Format("Had an error getting package '{0} - {1}': {2}", package.Id, package.Version.ToString(), ex.Message);
                    Console.WriteError(message);
                    report.Add(message);
                }
            }

            PrintReport(searchId, report);
        }
开发者ID:chappoo,项目名称:nuget.copy.extension,代码行数:53,代码来源:CopySearch.cs

示例5: TestForTokenInference

 public static Token TestForTokenInference(List<Token> tokens, Token tokenToAdd)
 {
     if (tokens.Count() > 0) {
         //When a minus or plus sign is read as a negative number, add a plus sign before the number
         //IE: 4 -5 becomes 4 + -5
         TokenizerRules.CharInfo lastTknInfo = TokenizerRules.CharacterInfo.GetCharInfo(tokens.Last().TokenString);
         TokenizerRules.CharInfo currentTknInfo = TokenizerRules.CharacterInfo.GetCharInfo(tokenToAdd.TokenString);
         TokenizerRules.CharInfo lastCharInfo = TokenizerRules.CharacterInfo.GetCharInfo(tokenToAdd.TokenString[0].ToString());
         if ((tokenToAdd.TokenType == TokenType.numberLiteral)
             && (tokens.Last().TokenType == TokenType.numberLiteral
                     || (lastTknInfo != null && lastTknInfo.Type == TokenizerRules.CharType.closedBrace))
                     || ((Keywords.KeywordLookup.ContainsKey(tokens.Last().TokenString.ToLower()) && Keywords.KeywordLookup[tokens.Last().TokenString.ToLower()].TokenType == TokenType.numberLiteral)
             && (lastCharInfo != null && lastCharInfo.Type == TokenizerRules.CharType.plusMinus))) {
             return new Token("+", TokenType.operatorOrPunctuation);
         }
         //Infer a multiplication sign between two sets of parenthesis
         //IE: (3)(5) becomes (3)*(5)
         if ((TokenizerRules.CharacterInfo.ContainsKey(tokenToAdd.TokenString) && TokenizerRules.CharacterInfo.ContainsKey(tokens.Last().TokenString))
             && TokenizerRules.CharacterInfo[tokenToAdd.TokenString].Type == TokenizerRules.CharType.openBrace
             && TokenizerRules.CharacterInfo[tokens.Last().TokenString].Type == TokenizerRules.CharType.closedBrace) {
                 return new Token("*", TokenType.operatorOrPunctuation);
         }
         //Infer a multiplication sign between parenthesis and a number (that doesn't start with a minus sign)
         //IE: 3(4) becomes 3*(4)
         if (TokenizerRules.CharacterInfo.ContainsKey(tokenToAdd.TokenString)
             && TokenizerRules.CharacterInfo[tokenToAdd.TokenString].Type == TokenizerRules.CharType.openBrace
             && tokens.Last().TokenType == TokenType.numberLiteral) {
             return new Token("*", TokenType.operatorOrPunctuation);
         }
         //IE: (4)3 becomes (4)*3
         if (TokenizerRules.CharacterInfo.ContainsKey(tokens.Last().TokenString)
             && tokenToAdd.TokenType == TokenType.numberLiteral
             && TokenizerRules.CharacterInfo[tokens.Last().TokenString].Type == TokenizerRules.CharType.closedBrace
             && tokenToAdd.TokenString[0] != '-') {
             return new Token("*", TokenType.operatorOrPunctuation);
         }
     }
     return null;
 }
开发者ID:Amichai,项目名称:OpenPadProject,代码行数:39,代码来源:OperatorInferenceRules.cs

示例6: GetBlobContentFromSnapshot

        public void GetBlobContentFromSnapshot()
        {
            SetupTestContainerAndBlob();

            try
            {
                List<ICloudBlob> blobs = new List<ICloudBlob>();
                int minSnapshot = 1;
                int maxSnapshot = 5;
                int snapshotCount = random.Next(minSnapshot, maxSnapshot);

                for (int i = 0; i < snapshotCount; i++)
                {
                    ICloudBlob blob = ((CloudBlockBlob)Blob).CreateSnapshot();
                    blobs.Add(blob);
                }

                blobs.Add(Blob);

                List<IListBlobItem> blobLists = Container.ListBlobs(string.Empty, true, BlobListingDetails.All).ToList();
                Test.Assert(blobLists.Count == blobs.Count, string.Format("container {0} should contain {1} blobs, and actually it contain {2} blobs", ContainerName, blobs.Count, blobLists.Count));

                FileUtil.CleanDirectory(downloadDirRoot);

                ((PowerShellAgent)agent).AddPipelineScript(string.Format("Get-AzureStorageContainer {0}", ContainerName));
                ((PowerShellAgent)agent).AddPipelineScript("Get-AzureStorageBlob");
                Test.Assert(agent.GetAzureStorageBlobContent(string.Empty, downloadDirRoot, string.Empty, true), "download blob should be successful");
                Test.Assert(agent.Output.Count == blobs.Count, "Get-AzureStroageBlobContent should download {0} blobs, and actully it's {1}", blobs.Count, agent.Output.Count);

                for (int i = 0, count = blobs.Count(); i < count; i++)
                {
                    ICloudBlob blob = blobLists[i] as ICloudBlob;
                    string path = Path.Combine(downloadDirRoot, blobUtil.ConvertBlobNameToFileName(blob.Name, string.Empty, blob.SnapshotTime));

                    Test.Assert(File.Exists(path), string.Format("local file '{0}' should exists after downloading.", path));

                    string localMd5 = Helper.GetFileContentMD5(path);
                    string convertedName = blobUtil.ConvertBlobNameToFileName(blob.Name, string.Empty);
                    Test.Assert(localMd5 == blob.Properties.ContentMD5, string.Format("blob content md5 should be {0}, and actualy it's {1}", localMd5, blob.Properties.ContentMD5));
                }
            }
            finally
            {
                FileUtil.CleanDirectory(downloadDirRoot);
                CleanupTestContainerAndBlob();
            }
        }
开发者ID:EmmaZhu,项目名称:azure-sdk-tools,代码行数:47,代码来源:GetBlobContent.cs

示例7: Edit

        /// <summary>
        /// 编辑一个人员
        /// </summary>
        /// <param name="validationErrors">返回的错误信息</param>
        /// <param name="db">数据上下文</param>
        /// <param name="entity">一个人员</param>
        /// <returns>是否编辑成功</returns>
        public bool Edit(ref ValidationErrors validationErrors, SysEntities db, SysPerson entity)
        {
            /*
                           * 不操作 原有 现有
                           * 增加   原没 现有
                           * 删除   原有 现没
                           */
            if (entity == null)
            {
                return false;
            }
            if (CheckName(entity))
            {
                validationErrors.Add("用户名已被占用,请换一个新的用户名");
                return false;
            }

            int count = 1;
            SysPerson editEntity = repository.Edit(db, entity);

            List<string> addSysRoleId = new List<string>();
            List<string> deleteSysRoleId = new List<string>();
            DataOfDiffrent.GetDiffrent(entity.SysRoleId.GetIdSort(), entity.SysRoleIdOld.GetIdSort(), ref addSysRoleId, ref deleteSysRoleId);
            if (addSysRoleId != null && addSysRoleId.Count() > 0)
            {
                foreach (var item in addSysRoleId)
                {
                    SysRole sys = new SysRole { Id = item };
                    db.SysRole.Attach(sys);
                    editEntity.SysRole.Add(sys);
                    count++;
                }
            }
            if (deleteSysRoleId != null && deleteSysRoleId.Count() > 0)
            {
                List<SysRole> listEntity = new List<SysRole>();
                foreach (var item in deleteSysRoleId)
                {
                    SysRole sys = new SysRole { Id = item };
                    listEntity.Add(sys);
                    db.SysRole.Attach(sys);
                }
                foreach (SysRole item in listEntity)
                {
                    editEntity.SysRole.Remove(item);//查询数据库
                    count++;
                }
            }

            if (count == repository.Save(db))
            {
                return true;
            }
            else
            {
                validationErrors.Add("编辑人员出错了");
            }
            return false;
        }
开发者ID:Bryanlhx,项目名称:permisson,代码行数:66,代码来源:SysPersonBLL.cs

示例8: ListToBytes

 /// <summary>
 /// list[]转换成byte[]
 /// </summary>
 /// <param name="listTemp"></param>
 /// <returns></returns>
 public static byte[] ListToBytes(List<byte> listTemp)
 {
     if (listTemp == null)
     {
         return null;
     }
     if (listTemp.Count <= 0)
     {
         return null;
     }
     int length = listTemp.Count();
     byte[] bytes = new byte[length];
     for (int i = 0; i < length; i++)
     {
         bytes[i] = listTemp[i];
     }
     return bytes;
 }
开发者ID:mildrock,项目名称:SerialProtocol,代码行数:23,代码来源:Common.cs

示例9: ScanSource

 public void ScanSource(bool includeSubDirectories, bool generateCovers)
 {
     if (_source == null)
     {
         return;
     }
     _generateCovers = generateCovers;
     var option = includeSubDirectories == false ? SearchOption.TopDirectoryOnly : SearchOption.AllDirectories;
     _foundPdfFiles = Directory.GetFiles(_source.SourceDirectoryUrl, FileTypes.PDF, option).ToList();
     Logger.Log.Debug(
         $"Found {_foundPdfFiles.Count()} files in {_source.SourceDirectoryUrl} with an extension of {FileTypes.PDF}");
     Logger.Log.Debug(
         $"Importing from {_source.SourceDirectoryUrl}: Subdirectories {includeSubDirectories}: Generate Covers: {generateCovers}");
     OnProgressStarted();
     Worker.RunWorkerAsync();
 }
开发者ID:nathanashton,项目名称:Bookie,代码行数:16,代码来源:Importer.cs

示例10: SetSysMenu

        /// <summary>
        /// 设置一个菜单
        /// </summary>
        /// <param name="validationErrors">返回的错误信息</param>
        /// <param name="entity">一个菜单</param>
        /// <returns>是否设置成功</returns>
        public bool SetSysMenu(ref ValidationErrors validationErrors, SysOperation entity)
        {
            bool bResult = false;
            int count = 0;
            using (TransactionScope transactionScope = new TransactionScope())
            {
                try
                {
                    SysOperation editEntity = repository.GetById(db, entity.Id);

                    List<string> addSysMenuId = new List<string>();
                    List<string> deleteSysMenuId = new List<string>();
                    if (entity.SysMenuId != null)
                    {
                        addSysMenuId = entity.SysMenuId.Split(',').ToList();
                    }
                    if (entity.SysMenuIdOld != null)
                    {
                        deleteSysMenuId = entity.SysMenuIdOld.Split(',').ToList();
                    }
                    DataOfDiffrent.GetDiffrent(addSysMenuId, deleteSysMenuId, ref addSysMenuId, ref deleteSysMenuId);

                    if (addSysMenuId != null && addSysMenuId.Count() > 0)
                    {
                        foreach (var item in addSysMenuId)
                        {
                            SysMenu sys = new SysMenu { Id = item };
                            db.SysMenu.Attach(sys);
                            editEntity.SysMenu.Add(sys);
                            count++;
                        }
                    }
                    if (deleteSysMenuId != null && deleteSysMenuId.Count() > 0)
                    {
                        List<SysMenu> listEntity = new List<SysMenu>();
                        foreach (var item in deleteSysMenuId)
                        {
                            SysMenu sys = new SysMenu { Id = item };
                            listEntity.Add(sys);
                            db.SysMenu.Attach(sys);
                        }
                        foreach (SysMenu item in listEntity)
                        {
                            editEntity.SysMenu.Remove(item);//查询数据库
                            count++;
                        }
                    }

                    if (count > 0 && count == repository.Save(db))
                    {
                       transactionScope.Complete();
                       bResult = true;
                    }
                    else if(count == 0 )
                    {
                        validationErrors.Add("数据没有改变");
                    }
                }
                catch (Exception ex)
                {
                    Transaction.Current.Rollback();
                    ExceptionsHander.WriteExceptions(ex);
                    validationErrors.Add("编辑出错了。原因"+ex.Message);
                }
            }

            return bResult;
        }
开发者ID:vipsms,项目名称:right,代码行数:74,代码来源:SysOperationBLL.cs

示例11: GetNewCategoryList

        /// <summary>
        /// 重置分类OrderStr
        /// </summary>
        private void GetNewCategoryList(List<CategoryModel> orderlst, ref List<CategoryModel> newlst, string parentId)
        {
            List<CategoryModel> tmplist = new List<CategoryModel>();
            foreach (CategoryModel c in orderlst)
            {
                if (c.ParentId == parentId)
                {
                    CategoryModel category = c;
                    category.OrderId = (newlst.Count() + 1).ToString();
                    newlst.Add(category);

                    if (Utils.StrToInt(c.SubCount) > 0)
                    {
                        GetNewCategoryList(orderlst, ref newlst, c.CateId);
                    }
                    continue;
                }
            }
        }
开发者ID:lujw,项目名称:MVCQuestionOnlineGIT,代码行数:22,代码来源:AdminController.cs

示例12: Edit

        /// <summary>
        /// 编辑一个菜单
        /// </summary>
        /// <param name="validationErrors">返回的错误信息</param>
        /// <param name="db">数据上下文</param>
        /// <param name="entity">一个菜单</param>
        /// <returns>是否编辑成功</returns>
        public bool Edit(ref ValidationErrors validationErrors, SysEntities db, SysMenu entity)
        {  /*                       
                           * 不操作 原有 现有
                           * 增加   原没 现有
                           * 删除   原有 现没
                           */
            if (entity == null)
            {
                return false;
            }
            int count = 1;
            SysMenu editEntity = repository.Edit(db, entity);

            List<string> addSysOperationId = new List<string>();
            List<string> deleteSysOperationId = new List<string>();
            DataOfDiffrent.GetDiffrent(entity.SysOperationId.GetIdSort(), entity.SysOperationIdOld.GetIdSort(), ref addSysOperationId, ref deleteSysOperationId);
            if (addSysOperationId != null && addSysOperationId.Count() > 0)
            {
                foreach (var item in addSysOperationId)
                {
                    SysOperation sys = new SysOperation { Id = item };
                    db.SysOperation.Attach(sys);
                    editEntity.SysOperation.Add(sys);
                    count++;
                }
            }
            if (deleteSysOperationId != null && deleteSysOperationId.Count() > 0)
            {
                List<SysOperation> listEntity = new List<SysOperation>();
                foreach (var item in deleteSysOperationId)
                {
                    SysOperation sys = new SysOperation { Id = item };
                    listEntity.Add(sys);
                    db.SysOperation.Attach(sys);
                }
                foreach (SysOperation item in listEntity)
                {
                    editEntity.SysOperation.Remove(item);//查询数据库
                    count++;
                }
            }

            if (count == repository.Save(db))
            {
                //修改后重置菜单编码
                List<int> flags = new List<int>();//层级
                GetMenus2(null, flags);
                db.SaveChanges();
                return true;
            }
            else
            {
                validationErrors.Add("编辑菜单出错了");
            }
            return false;
        }
开发者ID:RukaiYu,项目名称:EnterpriseDevelopmentFx,代码行数:63,代码来源:SysMenuBLL.cs

示例13: GetUserPage

        public PagerDTO<UserDTO> GetUserPage(string searchString, int page, int pageSize, int roleId)
        {
            List<User> users = new List<User>();

            if (!String.IsNullOrEmpty(searchString))
            {
                users.AddRange(
                    uOW.UserRepo.Get()
                        .Where(s => (s.UserName.ToLower()).Contains(searchString.ToLower())
                                    || (s.Email.ToLower()).Contains(searchString.ToLower()))
                    );
            }
            else
            {
                users.AddRange(uOW.UserRepo.Get());
            }

            if (roleId > 0)
            {
                users = users.Where(s => (s.RoleId == roleId)).ToList();
            }

            var pageCount = (double) users.Count()/pageSize;

            var model = new PagerDTO<UserDTO>
            {
                CurrentPage = page,
                PageCount = (int) Math.Ceiling(pageCount)
            };

            // if asked page is greater then avilable ones
            if (model.PageCount < page)
            {
                return model;
            }

            var skip = pageSize*(page - 1);
            var resultList = Mapper.Map<IEnumerable<UserDTO>>(users.Skip(skip).Take(pageSize)).ToList();

            model.Data = resultList;

            return model;
        }
开发者ID:CH033dotNET,项目名称:Taxi,代码行数:43,代码来源:UserManager.cs

示例14: IterativeFunctionApplication

 public static Signal IterativeFunctionApplication(List<double> seedVals, int iterations)
 {
     Signal newValues = new Signal(seedVals.Count() + iterations);
     for (int i = 0; i < seedVals.Count(); i++) {
         newValues.Add(Math.Log10(seedVals[i]));
     }
     for (int i = 0; i < iterations; i++) {
         double first = Math.Pow(10,Math.Abs(newValues[i]));
         double second = Math.Abs(newValues[i + 1]);
         double third = Math.Abs(newValues[i + 2]);
         switch ((int)first % 4) {
             case 0:
                 newValues.Add(Math.Log10(second + third));
                 break;
             case 1:
                 newValues.Add(Math.Log10(second * third));
                 break;
             case 2:
                 newValues.Add(Math.Log10(second / (third + 1)));
                 break;
             case 3:
                 newValues.Add(Math.Log10(Math.Abs(second - third)));
                 break;
         }
     }
     return newValues;
 }
开发者ID:Amichai,项目名称:ComplexSystems,代码行数:27,代码来源:SignalGenerator.cs

示例15: WriteFileToGK

		public void WriteFileToGK(GKDevice gkControllerDevice, Guid clientUID)
		{
			using (var gkLifecycleManager = new GKLifecycleManager(gkControllerDevice, "Запись файла в ГК"))
			{
				gkLifecycleManager.AddItem("Формирование хэша");
				var gkFileInfo = new GKFileInfo();
				gkFileInfo.Initialize(gkControllerDevice);
				var bytesList = new List<byte>();
				bytesList.AddRange(gkFileInfo.InfoBlock);
				bytesList.AddRange(gkFileInfo.FileBytes);

				gkLifecycleManager.AddItem("Перевод в режим записи файла");
				var sendResult = SendManager.Send(gkControllerDevice, 0, 21, 0);
				if (sendResult.HasError)
				{
					Error = "Невозможно начать процедуру записи ";
					gkLifecycleManager.AddItem("Ошибка");
					return;
				}

				var progressCallback = GKProcessorManager.StartProgress("Запись файла в " + gkControllerDevice.PresentationName, null, bytesList.Count / 256, false, GKProgressClientType.Administrator, clientUID);
				for (var i = 0; i < bytesList.Count; i += 256)
				{
					gkLifecycleManager.Progress(i + 1, bytesList.Count);
					GKProcessorManager.DoProgress("Запись блока данных " + i + 1, progressCallback, clientUID);

					var bytesBlock = BitConverter.GetBytes((uint)(i / 256 + 1)).ToList();
					bytesBlock.AddRange(bytesList.GetRange(i, Math.Min(256, bytesList.Count - i)));
					for (int j = 0; j < 10; j++)
					{
						sendResult = SendManager.Send(gkControllerDevice, (ushort)bytesBlock.Count(), 22, 0, bytesBlock);
						var result = sendResult.Bytes.Count > 0 && sendResult.Bytes[0] == 1;
						if (!sendResult.HasError && result)
							break;
						if (j == 9)
						{
							Error = "Невозможно записать блок данных " + i;
							gkLifecycleManager.AddItem("Ошибка");
							return;
						}
					}
				}
				gkLifecycleManager.AddItem("Запись последнего блока данных");
				var endBlock = BitConverter.GetBytes((uint)(bytesList.Count() / 256 + 1)).ToList();
				sendResult = SendManager.Send(gkControllerDevice, 0, 22, 0, endBlock);
				var endResult = sendResult.Bytes.Count > 0 && sendResult.Bytes[0] == 0;
				if (sendResult.HasError || !endResult)
				{
					Error = "Невозможно завершить запись файла ";
					gkLifecycleManager.AddItem("Ошибка");
				}
				var sendResultRead = SendManager.Send(gkControllerDevice, 4, 23, 256, new List<byte>(BitConverter.GetBytes(1)));
				if (!gkFileInfo.InfoBlock.SequenceEqual(sendResultRead.Bytes))
				{
					Error = "Не удалось корректно записать информационный блок ";
					gkLifecycleManager.AddItem("Ошибка");
				}
			}
		}
开发者ID:xbadcode,项目名称:Rubezh,代码行数:59,代码来源:GKFileReaderWriter.cs


注:本文中的Common.List.Count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。