示例#1
0
        public static QsiTableNode VisitCommonSelectStatement(CommonSelectStatementContext context)
        {
            var node = new CqlDerivedTableNode
            {
                IsJson         = context.IsJson,
                IsDistinct     = context.IsDistinct,
                AllowFiltering = context.AllowFiltering
            };

            node.Columns.SetValue(VisitSelectors(context.Selectors));
            node.Source.SetValue(VisitColumnFamilyName(context.FromSource));

            if (context.WhereClause != null)
            {
                var whereContext = new ParserRuleContextWrapper <WhereClauseContext>
                                   (
                    context.WhereClause,
                    context.WhereStart,
                    context.WhereClause.Stop
                                   );

                node.Where.SetValue(ExpressionVisitor.CreateWhere(whereContext));
            }

            if (!ListUtility.IsNullOrEmpty(context.GroupByClauses))
            {
                var groupingContext = new ParserRuleContextWrapper <GroupByClauseContext[]>
                                      (
                    context.GroupByClauses,
                    context.GroupByStart,
                    context.GroupByClauses[^ 1].Stop
示例#2
0
    static void ShowMachineConfig(MachineTestConfig config)
    {
        EditorGUILayout.LabelField("----- machine config -----");
        const int countPerRow = 2;
        int       rowNum      = (CoreDefine.AllMachineNames.Length + countPerRow - 1) / countPerRow;

        for (int i = 0; i < rowNum; i++)
        {
            EditorGUILayout.BeginHorizontal();
            for (int k = 0; k < countPerRow; k++)
            {
                int index = i * countPerRow + k;
                if (index < CoreDefine.AllMachineNames.Length)
                {
                    string m = CoreDefine.AllMachineNames[index];
                    config._selectMachines[index] = EditorGUILayout.Toggle(m, config._selectMachines[index]);
                }
            }
            EditorGUILayout.EndHorizontal();
        }

        if (GUILayout.Button("Select all machines", GUILayout.Width(160.0f)))
        {
            ListUtility.FillElements(config._selectMachines, true);
        }
        if (GUILayout.Button("Deselect all machines", GUILayout.Width(160.0f)))
        {
            ListUtility.FillElements(config._selectMachines, false);
        }
    }
 public void FindIndexBadArguments()
 {
     Assert.Throws <ArgumentNullException>(delegate
                                           { ListUtility.FindIndex <object>(null, n => true); });
     Assert.Throws <ArgumentNullException>(delegate
                                           { ListUtility.FindIndex(new object[] { }, null); });
 }
示例#4
0
        public static QsiExpressionNode VisitTermMultiplication(TermMultiplicationContext context)
        {
            MultiplicationOperatorContext[] operators = context.multiplicationOperator();
            var left = VisitTermGroup(context.left);

            if (ListUtility.IsNullOrEmpty(operators))
            {
                return(left);
            }

            TermGroupContext[] rights = context.termGroup();

            for (int i = 0; i < operators.Length; i++)
            {
                var node = new QsiBinaryExpressionNode
                {
                    Operator = operators[i].GetText()
                };

                node.Left.SetValue(left);
                node.Right.SetValue(VisitTermGroup(rights[i + 1]));

                left = node;

                var leftSpan  = CqlTree.Span[node.Left.Value];
                var rightSpan = CqlTree.Span[node.Right.Value];

                CqlTree.Span[node] = new Range(leftSpan.Start, rightSpan.End);
            }

            return(left);
        }
示例#5
0
        public static List <Graph> LoadGraphs(string path, int n)
        {
            var lll = Load(path);

            var gs = new List <Graph>();

            foreach (var ll in lll)
            {
                var g = Choosability.Graphs.C(n);
                foreach (var l in ll)
                {
                    if (l.Count <= 1)
                    {
                        continue;
                    }

                    foreach (var pair in ListUtility.EnumerateSublists(l, 2))
                    {
                        g = g.AddEdge(pair[0], pair[1]);
                    }
                }

                g.VertexWeight = g.Vertices.ToList();
                gs.Add(g);
            }
            return(gs);
        }
示例#6
0
        /// <summary>
        /// Comentario: Este método nos permite generar un tablero aleatorio. El tablero contendrá cofres, una puerta, el personaje
        /// del jugador y un alien.
        /// </summary>
        private void tableroAleatorio()
        {
            Random random = new Random();
            int    numeroCasillasVacias = 62 - (_numbersOfChest + _numbersOfDoors);
            int    numRandom;

            for (int i = 0; i < numeroCasillasVacias; i++)  //Generamos las casillas vacías del tablero
            {
                numRandom = random.Next(1, 16);
                _tablero.Add(new ClsCasilla("/Assets/floor" + numRandom + ".png", "/Assets/floor" + numRandom + "dark.png", "", 0));//0 significa que la casilla esta vacía
                //_tablero.Add(new ClsCasilla("/Assets/floor" + numRandom + ".png", "", "", 0));//0 significa que la casilla esta vacía
            }

            for (int i = 1; i <= 3; i++)
            {
                numRandom = random.Next(1, 16);
                _tablero.Add(new ClsCasilla("/Assets/chestclosed.png", "/Assets/floor" + numRandom + "dark.png", "", 3, new ClsCofre(i, false)));//Contiene la llave
            }

            _tablero.Add(new ClsCasilla("/Assets/trapdoor.png", "/Assets/floor1dark.png", "", 2));                          //2 significa que la casilla contiene una puerta

            ListUtility.ShuffleList(ref _tablero);                                                                          //Nos permite mezclar las casillas del tablero

            _tablero.Insert(0, new ClsCasilla("/Assets/floor1.png", "/Assets/floor1dark.png", "/Assets/personaje.gif", 1)); //1 significa que la casilla contiene un personaje
            _tablero.Add(new ClsCasilla("/Assets/floor1.png", "/Assets/floor1dark.png", "/Assets/canina.gif", 4));          //4 significa que la casilla contiene un alien
        }
示例#7
0
        public IQsiDefinitionNode VisitViewStmt(ViewStmt stmt)
        {
            var node = new PgViewDefinitionNode
            {
                Identifier  = IdentifierVisitor.VisitRangeVar(stmt.view[0]),
                Source      = { Value = TableVisitor.Visit(stmt.query[0]) },
                CheckOption = stmt.withCheckOption?.ToString()
            };

            if (stmt.replace ?? false)
            {
                node.ConflictBehavior = QsiDefinitionConflictBehavior.Replace;
            }

            // stmt.options: DefElem[]
            // Syntax: WITH ( key=<value_expression> [, ...] )

            if (!ListUtility.IsNullOrEmpty(stmt.aliases))
            {
                node.Columns.Value = new QsiColumnsDeclarationNode();
                node.Columns.Value.Columns.AddRange(TableVisitor.CreateSequentialColumnNodes(stmt.aliases.Cast <PgString>()));
            }

            return(node);
        }
示例#8
0
        public IQsiDefinitionNode VisitViewStatementBody(ViewStatementBody viewStatementBody)
        {
            if (viewStatementBody is not(CreateViewStatement or CreateOrAlterViewStatement))
            {
                throw TreeHelper.NotSupportedTree(viewStatementBody);
            }

            var node = new SqlServerViewDefinitionNode
            {
                IsAlter         = viewStatementBody is CreateOrAlterViewStatement,
                IsMaterialiazed = viewStatementBody.IsMaterialized,
                WithCheckOption = viewStatementBody.WithCheckOption,
                ViewOptions     = viewStatementBody.ViewOptions?.Select(option => option.OptionKind.ToString()).ToArray(),
                Identifier      = IdentifierVisitor.CreateQualifiedIdentifier(viewStatementBody.SchemaObjectName)
            };

            if (ListUtility.IsNullOrEmpty(viewStatementBody.Columns))
            {
                node.Columns.SetValue(TreeHelper.CreateAllColumnsDeclaration());
            }
            else
            {
                var columnsDeclaration = new QsiColumnsDeclarationNode();
                columnsDeclaration.Columns.AddRange(TableVisitor.CreateSequentialColumnNodes(viewStatementBody.Columns));
                node.Columns.SetValue(columnsDeclaration);
            }

            node.Source.SetValue(TableVisitor.VisitSelectStatement(viewStatementBody.SelectStatement));

            SqlServerTree.PutFragmentSpan(node, viewStatementBody);

            return(node);
        }
示例#9
0
        private void ReleaseExtension(IBundle bundle)
        {
            Func <Extension, bool>                 comparer   = null;
            Func <ExtensionPoint, bool>            func2      = null;
            Dictionary <string, List <Extension> > dictionary = new Dictionary <string, List <Extension> >();
            List <ExtensionPoint> list = new List <ExtensionPoint>();

            using (ReaderWriterLockHelper.CreateWriterLock(this._locker))
            {
                foreach (KeyValuePair <string, List <Extension> > pair in this.Extensions)
                {
                    if (comparer == null)
                    {
                        comparer = item => item.Owner == bundle;
                    }
                    dictionary[pair.Key] = ListUtility.RemoveAll <Extension>(pair.Value, comparer);
                }
                if (func2 == null)
                {
                    func2 = item => item.Owner == bundle;
                }
                list = ListUtility.RemoveAll <ExtensionPoint>(this.ExtensionPoints, func2);
            }
            foreach (KeyValuePair <string, List <Extension> > pair2 in dictionary)
            {
                this.FireExtensionsChanged(pair2.Key, CollectionChangedAction.Remove, pair2.Value);
            }
            foreach (ExtensionPoint point in list)
            {
                this.FireExtensionPointChanged(CollectionChangedAction.Remove, point);
            }
        }
示例#10
0
        public static bool DegreeCondition(this Graph g, List <long> stacks, long pot, Func <List <int>, int> missingEdges = null)
        {
            if (missingEdges == null)
            {
                missingEdges = Y => 0;
            }

            var colorGraphs = GetColorGraphs(stacks, pot);

            foreach (var X in ListUtility.EnumerateSublists(g.Vertices))
            {
                var e = g.EdgesOn(X) - missingEdges(X);

                if (e <= 0)
                {
                    continue;
                }

                var value = colorGraphs.Sum(cg => cg.IntersectionCount(X) / 2);

                if (value < e)
                {
                    return(false);
                }
            }

            return(true);
        }
示例#11
0
        private static List <FileSystemItem> GetSubfolderDirectly(List <string> rootFolders)
        {
            if (ListUtility.IsNullOrEmpty(rootFolders))
            {
                rootFolders = DirectoryUtility.GetHardDriveRootFolders();
            }

            List <FileSystemItem> subfolders = new List <FileSystemItem>();

            foreach (string rootFolder in rootFolders)
            {
                DirectoryInfo rootFolderInfo;
                try
                {
                    rootFolderInfo = new DirectoryInfo(rootFolder);
                }
                catch
                {
                    //Not enough permissions.
                    continue;
                }

                subfolders.AddRange(GetFoldersRecursively(rootFolderInfo));

                FileSystemItem rootItem = GetFileSystemItem(rootFolderInfo);
                if (rootItem != null)
                {
                    subfolders.Add(rootItem);
                }
            }

            return(subfolders);
        }
示例#12
0
        private void DeparseLockingNode(ScriptWriter writer, MySqlLockingNode node)
        {
            if (node.TableLockType == MySqlTableLockType.ShareMode)
            {
                writer.Write("LOCK IN SHARE MODE");
            }
            else
            {
                writer.Write("FOR ");
                writer.Write(node.TableLockType == MySqlTableLockType.Update ? "UPDATE" : "SHARE");

                if (!ListUtility.IsNullOrEmpty(node.Tables))
                {
                    writer.WriteSpace();
                    writer.Write("OF ");
                    writer.WriteJoin(", ", node.Tables);
                }

                if (node.RowLockType.HasValue)
                {
                    writer.WriteSpace();
                    writer.Write(node.RowLockType == MySqlRowLockType.SkipLocked ? "SKIP LOCKED" : "NOWAIT");
                }
            }
        }
        public void BinarySearchNullCompare()
        {
            int nIndex;
            List <SearchData> list = new List <SearchData>();

            Assert.Throws <ArgumentNullException>(() => ListUtility.BinarySearchForKey(list, 1, null !, out nIndex));
        }
    int GetSpinCountBeforeLuckyZero(List <MachineTestRoundResult> roundResults)
    {
        int index = ListUtility.Find(roundResults, (MachineTestRoundResult r) => {
            return(r._input._lucky == 0);
        });

        return(index);
    }
        private void ResetProperties()
        {
            Title = OriginalTitle;


            TimesheetId = OriginalTimesheetId;


            // Unhook propertyChanged eventhandlers for ProjectTimeItems
            if (ProjectTimeItems != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(ProjectTimeItems, ProjectTimeItems_Item_PropertyChanged, attach: false);
            }
            ProjectTimeItems = OriginalProjectTimeItems == null ? null : GenericCopier <ObservableCollection <ObservableProjectTaskTimesheetItem> > .DeepCopy(OriginalProjectTimeItems);

            // Hookup propertyChanged eventhandlers for ProjectTimeItems
            if (ProjectTimeItems != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(ProjectTimeItems, ProjectTimeItems_Item_PropertyChanged, attach: true);
            }


            // Unhook propertyChanged eventhandlers for NonProjectActivityItems
            if (NonProjectActivityItems != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(NonProjectActivityItems, NonProjectActivityItems_Item_PropertyChanged, attach: false);
            }
            NonProjectActivityItems = OriginalNonProjectActivityItems == null ? null : GenericCopier <ObservableCollection <ObservableProjectTaskTimesheetItem> > .DeepCopy(OriginalNonProjectActivityItems);

            // Hookup propertyChanged eventhandlers for NonProjectActivityItems
            if (NonProjectActivityItems != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(NonProjectActivityItems, NonProjectActivityItems_Item_PropertyChanged, attach: true);
            }


            RequiredHours = OriginalRequiredHours == null ? null : GenericCopier <ObservableCollection <TimeSpan> > .DeepCopy(OriginalRequiredHours);


            TotalRequiredHours = OriginalTotalRequiredHours;


            // Unhook propertyChanged eventhandlers for DummyTimeEntry
            if (DummyTimeEntry != null)
            {
                DummyTimeEntry.PropertyChanged -= DummyTimeEntry_PropertyChanged;
            }
            DummyTimeEntry = OriginalDummyTimeEntry == null ? null : GenericCopier <ObservableTimeEntry> .DeepCopy(OriginalDummyTimeEntry);

            // Hookup propertyChanged eventhandlers for DummyTimeEntry
            if (DummyTimeEntry != null)
            {
                DummyTimeEntry.PropertyChanged += DummyTimeEntry_PropertyChanged;
            }


            DummyValueTypeCollection = OriginalDummyValueTypeCollection == null ? null : GenericCopier <ObservableCollection <int> > .DeepCopy(OriginalDummyValueTypeCollection);
        }
示例#16
0
        /// <summary>
        /// Lấy tất cả danh sách overtime bởi store hrm_att_sp_get_WorkDay
        /// </summary>
        /// <returns></returns>
        public IQueryable <Att_Workday> GetWorkDays(ListQueryModel model)
        {
            ParamaterModle param = ListUtility.ParseParam(model, ConstantSql.hrm_att_sp_get_WorkDay);
            var            data  = this.UnitOfWork.Context.Database
                                   .SqlQuery <Att_Workday>(param.SqlQuery, param.Params)
                                   .ToList <Att_Workday>().AsQueryable();

            return(data);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="Header"/> class.
        /// </summary>
        /// <param name="headerItem">The item from this header.</param>
        /// <exception cref="ArgumentNullException">
        /// <paramref name="headerItem"/> is <see langword="null"/>.
        /// </exception>
        public Header(HeaderItem headerItem)
        {
            if (headerItem == null)
            {
                throw new ArgumentNullException(nameof(headerItem), "The header item cannot be null.");
            }

            Items = ListUtility.CreateSingleElementList(headerItem).AsReadOnly();
        }
示例#18
0
    bool IsUserResultPassLimitConfigs(MachineTestUserResult userResult, List <MachineSeedLimitationConfig> limitConfigs)
    {
        bool result = ListUtility.IsAllElementsSatisfied(limitConfigs, (MachineSeedLimitationConfig config) => {
            bool r = IsUserResultPassSingleLimitConfig(userResult, config);
            return(r);
        });

        return(result);
    }
示例#19
0
    public static List <FileInfo> GetUsefulFileInfosFromDir(string path)
    {
        List <FileInfo> fileInfos = GetFileInfosFromDir(path);
        List <FileInfo> result    = ListUtility.FilterList(fileInfos, (FileInfo info) => {
            return(!ListUtility.IsContainElement(_filterFiles, info.Name));
        });

        return(result);
    }
    int GetAverageSpinCountBeforeLuckyZero(List <MachineTestUserResult> userResults)
    {
        float result = ListUtility.FoldList(userResults, 0.0f, (float acc, MachineTestUserResult r) => {
            return(acc + r.AnalysisResult._spinCountBeforeLuckyZero);
        });

        result /= userResults.Count;
        return((int)result);
    }
    int GetSpinCountBeforeReachLuckyThreshold(List <MachineTestRoundResult> roundResults)
    {
        int threshold = CoreConfig.Instance.LuckyConfig.LongLuckyThreshold;
        int index     = ListUtility.Find(roundResults, (MachineTestRoundResult r) => {
            return(r._input._lucky < threshold);
        });

        return(index);
    }
示例#22
0
        public static IEnumerable <Graph> EnumerateClass(List <Graph> excluded, int maxVertices = int.MaxValue)
        {
            excluded.Sort((g1, g2) => g1.N.CompareTo(g2.N));

            if (excluded.Count > 0 && excluded[0].N <= 1)
            {
                yield break;
            }
            yield return(new Graph(new List <int>()));

            var lastLevel = new List <Graph>()
            {
                new Graph(new List <int>())
            };

            while (lastLevel.Count > 0)
            {
                var currentLevel = new List <Graph>();

                foreach (var G in lastLevel)
                {
                    List <List <int> > neighborSets;

                    if (G.IsComplete())
                    {
                        neighborSets = ListUtility.EnumerateSublists(Enumerable.Range(0, G.N).ToList()).Distinct(_sizeComparer).ToList();
                    }
                    else
                    {
                        neighborSets = ListUtility.GenerateSublists(Enumerable.Range(0, G.N).ToList());
                    }

                    foreach (var neighborSet in neighborSets.Where(l => l.Count > 0))
                    {
                        var H = G.AttachNewVertex(neighborSet);

                        if (currentLevel.Any(W => Graph.Isomorphic(H, W)))
                        {
                            continue;
                        }
                        if (excluded.Any(W => H.ContainsInduced(W)))
                        {
                            continue;
                        }

                        currentLevel.Add(H);
                        yield return(H);
                    }
                }

                if (currentLevel.Count > 0 && currentLevel[0].N >= maxVertices)
                {
                    yield break;
                }
                lastLevel = currentLevel;
            }
        }
示例#23
0
        public void ListUtility_ThrowIfNullOrEmpty_10()
        {
            List <int> first = new List <int> {
                1, 2, 3
            };
            List <int> second = (List <int>)ListUtility.ThrowIfNullOrEmpty(first, "first");

            Assert.AreSame(first, second);
        }
        private static bool IsInRootFolder(FileSystemItem item, List <string> rootFolders)
        {
            if (ListUtility.IsNullOrEmpty(rootFolders))
            {
                return(true);
            }

            return(rootFolders.Any(rf => IsInRootFolder(item.FullPath, rf)));
        }
示例#25
0
    //Note: be careful of the difference between Windows and Mac
    static bool IsContainDirectory(string path, string dir)
    {
        string[] dirs = dir.Split(new char[] { '/' });
        dir = dirs[0];
        string[] paths  = path.Split(Path.DirectorySeparatorChar);
        bool     result = ListUtility.IsContainElement(paths, dir);

        return(result);
    }
示例#26
0
 private void UpdateView(List <KarutaPlayer> karutaPlayers)
 {
     foreach (var(player, index) in karutaPlayers.WithIndex())
     {
         if (ListUtility.TryGetValue(karutaPlayerIndicators, index, out var indicator))
         {
             indicator.UpdateView(player);
         }
     }
 }
示例#27
0
    void GenEffects()
    {
        SymbolSheet symbolSheet = LoadMachineExcelAsset <SymbolSheet, SymbolData>(_config._machineName, "Symbol");
        BasicSheet  basicSheet  = LoadMachineExcelAsset <BasicSheet, BasicData>(_config._machineName, "Basic");

        string srcPath  = "";
        string destName = "";
        string destPath = "";

        //symbol effects
        ListUtility.ForEach(symbolSheet.DataArray, (SymbolData data) => {
            srcPath = Path.Combine(_presetAssetPath, "FX_SymbolEffect_Preset.prefab");

            if (!string.IsNullOrEmpty(data.WinEffect))
            {
                destName = data.WinEffect;
            }
            else if (!string.IsNullOrEmpty(data.WinEffect3D))
            {
                destName = data.WinEffect3D;
            }
            else
            {
                destName = "";
            }

            if (!string.IsNullOrEmpty(destName))
            {
                destPath  = _config._isDownloadMachine ? _effectsPathOfRemoteMachine : _effectsPathOfLocalMachine;
                destPath  = Path.Combine(destPath, destName);
                destPath += ".prefab";

                string dir = Path.GetDirectoryName(destPath);
                if (!Directory.Exists(dir))
                {
                    Directory.CreateDirectory(dir);
                }

                TryCopyAsset(srcPath, destPath);
                SetAssetBundleName(destPath);
            }
        });

        //super symbol
//		string superSymbolName = BasicValueFromKey(basicSheet.DataArray, "SuperSymbolLightEffect");
//		if(!string.IsNullOrEmpty(superSymbolName))
//		{
//			srcPath = Path.Combine(_presetAssetPath, "FX_Spin_SuperSymbol_ReelLight.prefab");
//
//			destPath = _config._isDownloadMachine ? _effectsPathOfRemoteMachine : _effectsPathOfLocalMachine;
//			destPath = Path.Combine(destPath, superSymbolName);
//
//			TryCopyAsset(srcPath, destPath);
//		}
    }
        private void ResetProperties()
        {
            Title = OriginalTitle;


            TimesheetId = OriginalTimesheetId;


            // Unhook propertyChanged eventhandlers for ProjectTimeItems
            if (ProjectTimeItems != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(ProjectTimeItems, ProjectTimeItems_Item_PropertyChanged, attach: false);
            }
            ProjectTimeItems = OriginalProjectTimeItems == null ? null : GenericCopier <ObservableCollection <ObservableProjectTaskTimesheetItem> > .DeepCopy(OriginalProjectTimeItems);

            // Hookup propertyChanged eventhandlers for ProjectTimeItems
            if (ProjectTimeItems != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(ProjectTimeItems, ProjectTimeItems_Item_PropertyChanged, attach: true);
            }


            // Unhook propertyChanged eventhandlers for NonProjectActivityItems
            if (NonProjectActivityItems != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(NonProjectActivityItems, NonProjectActivityItems_Item_PropertyChanged, attach: false);
            }
            NonProjectActivityItems = OriginalNonProjectActivityItems == null ? null : GenericCopier <ObservableCollection <ObservableProjectTaskTimesheetItem> > .DeepCopy(OriginalNonProjectActivityItems);

            // Hookup propertyChanged eventhandlers for NonProjectActivityItems
            if (NonProjectActivityItems != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(NonProjectActivityItems, NonProjectActivityItems_Item_PropertyChanged, attach: true);
            }


            RequiredHours = OriginalRequiredHours == null ? null : GenericCopier <ObservableCollection <TimeSpan> > .DeepCopy(OriginalRequiredHours);


            TotalRequiredHours = OriginalTotalRequiredHours;


            // Unhook propertyChanged eventhandlers for Totals
            if (Totals != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(Totals, Totals_Item_PropertyChanged, attach: false);
            }
            Totals = OriginalTotals == null ? null : GenericCopier <ObservableCollection <ObservableHoursSummary> > .DeepCopy(OriginalTotals);

            // Hookup propertyChanged eventhandlers for Totals
            if (Totals != null)
            {
                ListUtility.AttachPropertyChangedEventHandlers(Totals, Totals_Item_PropertyChanged, attach: true);
            }
        }
示例#29
0
    static void CopyBetweenProjectAndAB(string versionName, ExcelDirType dirType, bool isABToProject)
    {
        string excelTopDir = ExcelConfig.GetTopDir(dirType);

        string abDir = GetCurrentVersionPath(versionName);

        if (!Directory.Exists(abDir))
        {
            Debug.LogError("Error: directory doesn't exist:" + abDir);
            return;
        }

        List <FileInfo> abInfos = BuildAssetBundleHelper.GetUsefulFileInfosFromDir(abDir);

        string          projectPath = Application.dataPath;
        List <FileInfo> allInfos    = BuildAssetBundleHelper.GetUsefulFileInfosFromDir(projectPath);

        foreach (FileInfo abInfo in abInfos)
        {
            bool isExcel = abInfo.Name.EndsWith(".xls");

            FileInfo projectInfo = ListUtility.FindFirstOrDefault(allInfos, (FileInfo i) => {
                //Debug.Log("name:" + i.Name);
                bool result = abInfo.Name == i.Name;
                if (result && isExcel)
                {
                    result = IsContainDirectory(i.FullName, excelTopDir);
                }
                return(result);
            });

            if (projectInfo == null)
            {
                string errStr = "Can't find corresponding project file:" + abInfo.Name;
                Debug.LogError(errStr);
            }
            else
            {
                if (isABToProject)
                {
                    Debug.Log("copy from " + abInfo.FullName);
                    Debug.Log("copy to " + projectInfo.FullName);

                    File.Copy(abInfo.FullName, projectInfo.FullName, true);

                    string relativePath = BuildAssetBundleHelper.TrimToRelativePath(projectInfo.FullName);
                    AssetDatabase.ImportAsset(relativePath);
                }
                else
                {
                    File.Copy(projectInfo.FullName, abInfo.FullName, true);
                }
            }
        }
    }
 public void FindIndex()
 {
     Assert.AreEqual(-1, ListUtility.FindIndex(new object[] { }, n => true));
     Assert.AreEqual(0, ListUtility.FindIndex(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, n => n < 5));
     Assert.AreEqual(5, ListUtility.FindIndex(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, n => n > 5));
     Assert.AreEqual(5, ListUtility.FindIndex(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 5, n => n > 5));
     Assert.AreEqual(6, ListUtility.FindIndex(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 6, n => n > 5));
     Assert.AreEqual(-1, ListUtility.FindIndex(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, 6, n => n == 5));
     Assert.AreEqual(9, ListUtility.FindIndex(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, n => n == 10));
     Assert.AreEqual(-1, ListUtility.FindIndex(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 }, n => n == 11));
 }