/// <summary> /// Returns a list of user's roles By id /// </summary> /// <param name="userId">The user's id</param> /// <returns></returns> public OneToManyMap <IdentityRole> FindRolesByUser(int memberId, int currentPage, int itemsPerPage, bool isDesc = false) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPage Select COUNT(Role.Name) from MemberRole, Role WITH(NOLOCK) WHERE MemberRole.MemberId=@MemberId AND MemberRole.RoleId = Role.Id Select Role.Id, Role.Name from MemberRole, Role WHERE MemberRole.MemberId=@MemberId AND MemberRole.RoleId = Role.Id ORDER BY Role.Id OFFSET @Start ROWS FETCH NEXT @ItemsPerPage ROWS ONLY "; var sqlResult = db.Connection.QueryMultiple(sqlString, new { MemberId = memberId, CurrentPage = currentPage, ItemsPerPage = itemsPerPage, }); var result = new OneToManyMap <IdentityRole> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <IdentityRole>() }; return(result); }
public OneToManyMap <TUser> FindAllUsers(int currentPage, int itemsPerPages, bool isDesc = false) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPages SELECT COUNT(*) FROM Member WITH(NOLOCK) SELECT * FROM Member ORDER BY Id " + sortType + @" OFFSET @Start ROWS FETCH NEXT @ItemsPerPages ROWS ONLY"; var sqlResult = db.Connection.QueryMultiple(sqlString, new { ItemsPerPages = itemsPerPages, CurrentPage = currentPage, SortType = sortType, }); var result = new OneToManyMap <TUser> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <TUser>() }; return(result); }
private void GetGraphOrder(out OneToManyMap <GraphMap <FeatureVector, WeightMatrix> .ILinkable, Pair <GraphMap <FeatureVector, WeightMatrix> .ILinkable, GraphMap <FeatureVector, WeightMatrix> .Link <WeightMatrix> > > backwards, out Queue <GraphMap <FeatureVector, WeightMatrix> .ILinkable> inputVectors, out Queue <GraphMap <FeatureVector, WeightMatrix> .ILinkable> outputVectors) { backwards = new OneToManyMap <GraphMap <FeatureVector, WeightMatrix> .ILinkable, Pair <GraphMap <FeatureVector, WeightMatrix> .ILinkable, GraphMap <FeatureVector, WeightMatrix> .Link <WeightMatrix> > >(); // Just to keep track of the frontier Queue <GraphMap <FeatureVector, WeightMatrix> .ILinkable> queue = new Queue <GraphMap <FeatureVector, WeightMatrix> .ILinkable>(); // To keep track of the order each output should be evaluated Dictionary <GraphMap <FeatureVector, WeightMatrix> .ILinkable, int> outputPriorities = new Dictionary <GraphMap <FeatureVector, WeightMatrix> .ILinkable, int>(); Dictionary <GraphMap <FeatureVector, WeightMatrix> .ILinkable, int> inputPriorities = new Dictionary <GraphMap <FeatureVector, WeightMatrix> .ILinkable, int>(); foreach (var input in inputs) { queue.Enqueue(input); } int outPriority = 0; while (queue.Count != 0) { var node = queue.Dequeue(); foreach (var edge in node.Edges) { // add next node to the frontier queue.Enqueue((GraphMap <FeatureVector, WeightMatrix> .ILinkable)edge.Key); // put this node in the set of outputs outputPriorities[(GraphMap <FeatureVector, WeightMatrix> .ILinkable)edge.Key] = outPriority++; backwards.Add((GraphMap <FeatureVector, WeightMatrix> .ILinkable)edge.Key, new Pair <GraphMap <FeatureVector, WeightMatrix> .ILinkable, GraphMap <FeatureVector, WeightMatrix> .Link <WeightMatrix> >() { a = node, b = edge.Value }); } } // Vectors that receive outputs outputVectors = new Queue <GraphMap <FeatureVector, WeightMatrix> .ILinkable>(); // Vectors that are inputs inputVectors = new Queue <GraphMap <FeatureVector, WeightMatrix> .ILinkable>(); int inPriority = 0; foreach (var outputPriority in outputPriorities.OrderBy(x => x.Value)) { outputVectors.Enqueue(outputPriority.Key); foreach (var input in backwards[outputPriority.Key]) { inputPriorities[input.a] = inPriority++; } } foreach (var inputPriority in inputPriorities.OrderByDescending(x => x.Value)) { inputVectors.Enqueue(inputPriority.Key); } }
public OneToManyMap <EmployeeT, CompanyT> FindAllByCompanyID(int companyID, int currentPage, int itemsPerPages, bool isDesc = false) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPages SELECT COUNT(*) FROM EmployeeT AS E WITH(NOLOCK) JOIN CompanyT_EmployeeT AS CE ON CE.EmployeeID = E.EmployeeID WHERE CE.CompanyID = @CompanyID SELECT E.[EmployeeID] ,E.[EmployeeName] ,E.[EmployeePosition] ,E.EmployeePhone ,E.[Email] ,E.[BirthdayDate] ,E.[SignInDate] ,E.[ResignedDate] ,E.[IsResigned] ,E.[Salary] ,E.[CreatedDate] ,E.[EditedDate] FROM EmployeeT AS E JOIN CompanyT_EmployeeT AS CE ON CE.EmployeeID = E.EmployeeID WHERE CE.CompanyID = @CompanyID ORDER BY E.EmployeeID " + sortType + @" OFFSET @Start ROWS FETCH NEXT @ItemsPerPages ROWS ONLY SELECT [CompanyID] ,[CompanyName] ,[CompanyCode] ,[TaxID] ,[Phone] ,[Address] ,[WebsiteURL] ,[Owner] ,[CreatedDate] ,[EditedDate] FROM [dbo].[CompanyT] WHERE CompanyID = @CompanyID "; var sqlResult = Connection.QueryMultiple(sqlString, new { ItemsPerPages = itemsPerPages, CurrentPage = currentPage, SortType = sortType, CompanyID = companyID }, transaction: Transaction); var result = new OneToManyMap <EmployeeT, CompanyT> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <EmployeeT>(), MapData = sqlResult.ReadFirstOrDefault <CompanyT>() }; return(result); }
public OneToManyMap <ProductTAndCompanyT> FindAllByProductType(string searchText, int currentPage, int itemsPerPage, bool isDesc = false) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPage SELECT COUNT(*) FROM ProductT AS P JOIN CompanyT_ProductT AS CP ON CP.ProductID = P.ProductID JOIN CompanyT AS C ON C.CompanyID = CP.CompanyID {0} SELECT P.ProductID, P.ProductName, P.ProductType, P.Price, P.Unit, P.CreatedDate, P.EditedDate, C.CompanyName, C.CompanyCode, C.TaxID, C.Phone, C.Address, C.WebsiteURL, C.Owner FROM ProductT AS P JOIN CompanyT_ProductT AS CP ON CP.ProductID = P.ProductID JOIN CompanyT AS C ON C.CompanyID = CP.CompanyID {0} ORDER BY P.ProductID " + sortType + @" OFFSET @Start ROWS FETCH NEXT @ItemsPerPage ROWS ONLY "; if (!string.IsNullOrEmpty(searchText)) { sqlString = string.Format(sqlString, $"WHERE P.ProductType = @ProductType "); } else { sqlString = string.Format(sqlString, string.Empty); } var sqlResult = Connection.QueryMultiple(sqlString, new { ItemsPerPage = itemsPerPage, CurrentPage = currentPage, SortType = sortType, ProductType = searchText }, transaction: Transaction); var result = new OneToManyMap <ProductTAndCompanyT> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <ProductTAndCompanyT>(), }; return(result); }
public TextDecodingParameters() { _offsets = new List<Offset>(); _specialMapping = new OneToManyMap<char, byte>(); _byteSkipAmt = 1; _byteStart = 0; _isValidParameters = false; }
/// <summary> /// Returns the roles for a given TUser and Pagination /// </summary> /// <param name="user"></param> /// <returns></returns> public Jsend <OneToManyMap <IdentityRole> > GetNotInRolesByUser(TUser user, int currentPage, int itemsPerPages, bool isDesc = false) { if (user == null) { throw new ArgumentNullException("user"); } OneToManyMap <IdentityRole> roles = userRolesTable.FindNotInRolesByUser(user.Id, currentPage, itemsPerPages, isDesc); return(JsendResult <OneToManyMap <IdentityRole> > .Success(roles)); }
//public OneToManyMap<ProductT> FindAll(int currentPage, int itemsPerPage, string searchText, bool isDesc = false) //{ // var sortType = isDesc ? "DESC" : "ASC"; // var sqlString = @" // DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPage // SELECT COUNT(*) FROM ProductT AS P // JOIN CompanyT_ProductT AS CP ON CP.ProductID = P.ProductID // JOIN CompanyT AS C ON CP.CompanyID = CompanyID // {0} // SELECT P.ProductID, // P.ProductName, // P.ProductType, // P.Price, // P.Unit, // P.CreatedDate, // P.EditedDate, // C.CompanyID, // C.CompanyName // FROM ProductT AS P // JOIN CompanyT_ProductT AS CP ON CP.ProductID = P.ProductID // JOIN CompanyT AS C ON CP.CompanyID = CompanyID // {0} // ORDER BY P.ProductID " + sortType + @" // OFFSET @Start ROWS // FETCH NEXT @ItemsPerPage ROWS ONLY // "; // if (string.IsNullOrEmpty(searchText)) // { // sqlString = string.Format(sqlString, $" WHERE CompanyID = @SearchText"); // } // else // { // sqlString = string.Format(sqlString, string.Empty); // } // var sqlResult = Connection.QueryMultiple(sqlString, // new // { // ItemsPerPage = itemsPerPage, // CurrentPage = currentPage, // SortType = sortType, // }, transaction: Transaction); // var result = new OneToManyMap<ProductT> // { // TotalCount = sqlResult.ReadSingle<int>(), // List = sqlResult.Read<ProductT>(), // }; // return result; //} public OneToManyMap <ProductT, CompanyT> FindAllByCompanyID(int companyID, int currentPage, int itemsPerPage, bool isDesc = false) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPage SELECT COUNT(*) FROM ProductT AS P WITH(NOLOCK) JOIN CompanyT_ProductT AS CP ON CP.ProductID = P.ProductID WHERE CP.CompanyID = @CompanyID SELECT P.ProductID, P.ProductName, P.ProductType, P.Price, P.Unit, P.CreatedDate, P.EditedDate FROM ProductT AS P JOIN CompanyT_ProductT AS CP ON CP.ProductID = P.ProductID WHERE CP.CompanyID = @CompanyID ORDER BY P.ProductID " + sortType + @" OFFSET @Start ROWS FETCH NEXT @ItemsPerPage ROWS ONLY SELECT [CompanyID] ,[CompanyName] ,[CompanyCode] ,[TaxID] ,[Phone] ,[Address] ,[WebsiteURL] ,[Owner] ,[CreatedDate] ,[EditedDate] FROM [dbo].[CompanyT] WHERE CompanyID = @CompanyID "; var sqlResult = Connection.QueryMultiple(sqlString, new { ItemsPerPage = itemsPerPage, CurrentPage = currentPage, SortType = sortType, CompanyID = companyID }, transaction: Transaction); var result = new OneToManyMap <ProductT, CompanyT> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <ProductT>(), MapData = sqlResult.ReadFirstOrDefault <CompanyT>() }; return(result); }
public OneToManyMap <CompanyT> FindAllByID(int currentPage, int itemsPerPage, string searchText = null, bool isDesc = false) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPage SELECT COUNT(*) FROM CompanyT WITH(NOLOCK) {0} SELECT * FROM CompanyT {0} ORDER BY CompanyID " + sortType + @" OFFSET @Start ROWS FETCH NEXT @ItemsPerPage ROWS ONLY"; int searchId; bool isInt = Int32.TryParse(searchText, out searchId); if (isInt) { sqlString = string.Format(sqlString, $" WHERE CompanyID = @SearchText"); } else if (string.IsNullOrEmpty(searchText)) { sqlString = string.Format(sqlString, string.Empty); } else { return(new OneToManyMap <CompanyT> { TotalCount = 0, List = new List <CompanyT>() }); } var sqlResult = Connection.QueryMultiple(sqlString, new { ItemsPerPage = itemsPerPage, CurrentPage = currentPage, SearchText = searchId, SortType = sortType }, transaction: Transaction); var result = new OneToManyMap <CompanyT> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <CompanyT>() }; return(result); }
public Jsend <OneToManyMap <EmployeeT, CompanyT> > FindCompanyListByID(int id, int current, int itemsPerPages, bool isDesc) { OneToManyMap <EmployeeT, CompanyT> result = null; try { result = _uow.EmployeeTRepository.FindAllByCompanyID(id, current, itemsPerPages, isDesc); _uow.Commit(); } catch (SqlException ex) { _logger.Error(ex); return(JsendResult <OneToManyMap <EmployeeT, CompanyT> > .Error("Queay data occured error")); } return(JsendResult <OneToManyMap <EmployeeT, CompanyT> > .Success(result)); }
public Jsend <OneToManyMap <CompanyT> > FindCompanyListByName(int current, int itemsPerPage, bool isDesc, string searchText) { OneToManyMap <CompanyT> result = null; try { result = _uow.CompanyTRepository.FindAllByName(current, itemsPerPage, searchText, isDesc); _uow.Commit(); } catch (SqlException ex) { _logger.Error(ex); return(JsendResult <OneToManyMap <CompanyT> > .Error("Queay data occured error")); } return(JsendResult <OneToManyMap <CompanyT> > .Success(result)); }
public Jsend <OneToManyMap <ProductTAndCompanyT> > FindAllByProductPrice(int?productPrice, int currentPage, int itemsPerPage, bool isDesc = false) { OneToManyMap <ProductTAndCompanyT> result = null; try { result = _uow.ProductTRepository.FindAllByProductPrice(productPrice, currentPage, itemsPerPage, isDesc); _uow.Commit(); } catch (SqlException ex) { _logger.Error(ex); return(JsendResult <OneToManyMap <ProductTAndCompanyT> > .Error("Queay data occured error")); } return(JsendResult <OneToManyMap <ProductTAndCompanyT> > .Success(result)); }
public Jsend <OneToManyMap <EmployeeTAndCompanyT> > FindAllByEmployeeBirthday(string companyID, string searchText, int currentPage, int itemsPerPage, bool isDesc = false) { OneToManyMap <EmployeeTAndCompanyT> result = null; try { result = _uow.EmployeeTRepository.FindAllByEmployeeBirthday(companyID, searchText, currentPage, itemsPerPage, isDesc); _uow.Commit(); } catch (SqlException ex) { _logger.Error(ex); return(JsendResult <OneToManyMap <EmployeeTAndCompanyT> > .Error("Queay data occured error")); } return(JsendResult <OneToManyMap <EmployeeTAndCompanyT> > .Success(result)); }
public OneToManyMap <TUser> GetUsersByTypeAndLoginState(int memberType, bool isLogined, int currentPage, int itemsPerPage, bool isDesc) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPage SELECT COUNT(*) FROM [dbo].[Member] WHERE MemberType = @MemberType AND IsLogined = @IsLogined SELECT [Id] ,[Email] ,[EmailConfirmed] ,[PasswordHash] ,[SecurityStamp] ,[PhoneNumber] ,[PhoneNumberConfirmed] ,[TwoFactorEnabled] ,[LockoutEndDateUtc] ,[LockoutEnabled] ,[AccessFailedCount] ,[UserName] ,[MemberType] ,[IsLogined] FROM [dbo].[Member] WHERE MemberType = @MemberType AND IsLogined = @IsLogined ORDER BY Id " + sortType + @" OFFSET @Start ROWS FETCH NEXT @ItemsPerPage ROWS ONLY "; var sqlResult = db.Connection.QueryMultiple(sqlString, new { MemberType = memberType, IsLogined = isLogined, ItemsPerPage = itemsPerPage, CurrentPage = currentPage }); var result = new OneToManyMap <TUser> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <TUser>() }; return(result); }
/// <summary> /// Returns a list of user's roles By id /// </summary> /// <param name="userId">The user's id</param> /// <returns></returns> public OneToManyMap <IdentityRole> FindNotInRolesByUser(int memberId, int currentPage, int itemsPerPage, bool isDesc = false) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPage SELECT COUNT(*) FROM [Role] WHERE Id NOT IN( SELECT [RoleId] FROM [dbo].[MemberRole] WHERE MemberId =@MemberId) SELECT * FROM [Role] WHERE Id NOT IN( SELECT [RoleId] FROM [dbo].[MemberRole] WHERE MemberId =@MemberId) ORDER BY Role.Id OFFSET @Start ROWS FETCH NEXT @ItemsPerPage ROWS ONLY "; var sqlResult = db.Connection.QueryMultiple(sqlString, new { MemberId = memberId, CurrentPage = currentPage, ItemsPerPage = itemsPerPage, }); var result = new OneToManyMap <IdentityRole> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <IdentityRole>() }; return(result); }
public OneToManyMap <EmployeeTAndCompanyT> FindAllByEmployeeBirthday(string companyID, string searchText, int currentPage, int itemsPerPage, bool isDesc = false) { var sortType = isDesc ? "DESC" : "ASC"; var sqlString = @" DECLARE @Start int = (@CurrentPage - 1) * @ItemsPerPage SELECT COUNT(*) FROM EmployeeT AS E JOIN CompanyT_EmployeeT AS CE ON CE.EmployeeID = E.EmployeeID JOIN CompanyT AS C ON C.CompanyID = CE.CompanyID {0} SELECT E.EmployeeID, E.EmployeeName, E.EmployeePosition, E.EmployeePhone, E.Email, E.BirthdayDate, E.SignInDate, E.ResignedDate, E.IsResigned, E.Salary, C.CompanyName, C.CompanyCode, C.TaxID, C.Phone, C.Address, C.WebsiteURL, C.Owner FROM EmployeeT AS E JOIN CompanyT_EmployeeT AS CE ON CE.EmployeeID = E.EmployeeID JOIN CompanyT AS C ON C.CompanyID = CE.CompanyID {0} ORDER BY E.EmployeeID " + sortType + @" OFFSET @Start ROWS FETCH NEXT @ItemsPerPage ROWS ONLY "; if (!string.IsNullOrEmpty(searchText)) { sqlString = string.Format(sqlString, @"WHERE E.BirthdayDate = @BirthdayDate {0}"); } if (!string.IsNullOrEmpty(companyID) && !string.IsNullOrEmpty(searchText)) { sqlString = string.Format(sqlString, $"AND C.CompanyID = @CompanyID "); } else if (!string.IsNullOrEmpty(companyID) && string.IsNullOrEmpty(searchText)) { sqlString = string.Format(sqlString, $"WHERE C.CompanyID = @CompanyID "); } else { sqlString = string.Format(sqlString, string.Empty); } var sqlResult = Connection.QueryMultiple(sqlString, new { ItemsPerPage = itemsPerPage, CurrentPage = currentPage, SortType = sortType, BirthdayDate = searchText, CompanyID = companyID }, transaction: Transaction); var result = new OneToManyMap <EmployeeTAndCompanyT> { TotalCount = sqlResult.ReadSingle <int>(), List = sqlResult.Read <EmployeeTAndCompanyT>(), }; return(result); }
public Jsend <OneToManyMap <TUser> > FindAllUsers(int currentPage, int itemsPerPages, bool isDesc = false) { OneToManyMap <TUser> result = userTable.FindAllUsers(currentPage, itemsPerPages, isDesc); return(JsendResult <OneToManyMap <TUser> > .Success(result)); }
private void GetGraphOrder(out OneToManyMap<GraphMap<FeatureVector, WeightMatrix>.ILinkable, Pair<GraphMap<FeatureVector, WeightMatrix>.ILinkable, GraphMap<FeatureVector, WeightMatrix>.Link<WeightMatrix>>> backwards, out Queue<GraphMap<FeatureVector, WeightMatrix>.ILinkable> inputVectors, out Queue<GraphMap<FeatureVector, WeightMatrix>.ILinkable> outputVectors) { backwards = new OneToManyMap<GraphMap<FeatureVector, WeightMatrix>.ILinkable, Pair<GraphMap<FeatureVector, WeightMatrix>.ILinkable, GraphMap<FeatureVector, WeightMatrix>.Link<WeightMatrix>>>(); // Just to keep track of the frontier Queue<GraphMap<FeatureVector, WeightMatrix>.ILinkable> queue = new Queue<GraphMap<FeatureVector, WeightMatrix>.ILinkable>(); // To keep track of the order each output should be evaluated Dictionary<GraphMap<FeatureVector, WeightMatrix>.ILinkable, int> outputPriorities = new Dictionary<GraphMap<FeatureVector, WeightMatrix>.ILinkable, int>(); Dictionary<GraphMap<FeatureVector, WeightMatrix>.ILinkable, int> inputPriorities = new Dictionary<GraphMap<FeatureVector, WeightMatrix>.ILinkable, int>(); foreach (var input in inputs) { queue.Enqueue(input); } int outPriority = 0; while (queue.Count != 0) { var node = queue.Dequeue(); foreach (var edge in node.Edges) { // add next node to the frontier queue.Enqueue((GraphMap<FeatureVector, WeightMatrix>.ILinkable)edge.Key); // put this node in the set of outputs outputPriorities[(GraphMap<FeatureVector, WeightMatrix>.ILinkable)edge.Key] = outPriority++; backwards.Add((GraphMap<FeatureVector, WeightMatrix>.ILinkable)edge.Key, new Pair<GraphMap<FeatureVector, WeightMatrix>.ILinkable, GraphMap<FeatureVector, WeightMatrix>.Link<WeightMatrix>>() { a = node, b = edge.Value }); } } // Vectors that receive outputs outputVectors = new Queue<GraphMap<FeatureVector, WeightMatrix>.ILinkable>(); // Vectors that are inputs inputVectors = new Queue<GraphMap<FeatureVector, WeightMatrix>.ILinkable>(); int inPriority = 0; foreach (var outputPriority in outputPriorities.OrderBy(x => x.Value)) { outputVectors.Enqueue(outputPriority.Key); foreach (var input in backwards[outputPriority.Key]) { inputPriorities[input.a] = inPriority++; } } foreach (var inputPriority in inputPriorities.OrderByDescending(x => x.Value)) { inputVectors.Enqueue(inputPriority.Key); } }
public Jsend <OneToManyMap <TUser> > GetUsersByTypeAndLoginState(int memberType, bool isLogined, int currentPage, int itemsPerPage, bool isDesc) { OneToManyMap <TUser> result = userTable.GetUsersByTypeAndLoginState(memberType, isLogined, currentPage, itemsPerPage, isDesc); return(JsendResult <OneToManyMap <TUser> > .Success(result)); }
public static ConvertByteArrayToString ConvertSwitch(OneToManyMap<byte[], string> dict) { return delegate(byte[] data) { return dict.FindMany(data); }; }
public static ConvertValueToByteArray ConvertSwitch(OneToManyMap<byte[], string> dict) { return delegate(string d) { return dict.FindOne(d); }; }
private Dictionary<string, OneToManyMap<byte[], string>> GetSwitchMaps(HiToTextEntry entry) { Dictionary<string, OneToManyMap<byte[], string>> toReturn = new Dictionary<string, OneToManyMap<byte[], string>>(); if (entry.Header.TextParameters == null) return toReturn; if (entry.Header.TextParameters.SwitchMaps == null) return toReturn; foreach (HiToTextEntryHeaderTextParametersSwitchMapsSwitchMap sMap in entry.Header.TextParameters.SwitchMaps.SwitchMap) { string sDefaultOne = sMap.DefaultOne; string[] sDefaultOnes = sDefaultOne.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < sDefaultOnes.Length; i++) { if (sDefaultOnes[i].Substring(0, 2).Equals("0x")) sDefaultOnes[i] = sDefaultOnes[i].Substring(2); } sDefaultOne = String.Join(string.Empty, sDefaultOnes); byte[] defaultOne = HiConvert.HexStringToByteArray(sDefaultOne); string defaultMany = sMap.DefaultMany; OneToManyMap<byte[], string> map = new OneToManyMap<byte[], string>(); map.AddDefault(defaultOne, defaultMany); foreach (HiToTextEntryHeaderTextParametersSwitchMapsSwitchMapMapping sMapping in sMap.Mapping) { string sOne = sMapping.One; string[] sOnes = sOne.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < sOnes.Length; i++) { if (sOnes[i].Substring(0, 2).Equals("0x")) sOnes[i] = sOnes[i].Substring(2); } sOne = String.Join(string.Empty, sOnes); byte[] bOne = HiConvert.HexStringToByteArray(sOne); map.AddMapping(bOne, sMapping.Many); } toReturn.Add(sMap.Name, map); } return toReturn; }