예제 #1
0
        protected virtual object commandSaveExecute(object parameter)
        {
            if (PathList != null)
            {
                //Clear item with empty information
                for (int i = PathList.Count - 1; i >= 0; i--)
                {
                    PathItem item = PathList[i];
                    if (String.IsNullOrWhiteSpace(item.Name) || String.IsNullOrWhiteSpace(item.Path))
                    {
                        PathList.RemoveAt(i);
                        continue;
                    }
                    item.Path = item.Path.TrimEnd('\\');
                }

                //Order list to save
                IList <PathItem> orderList = (from p in PathList
                                              orderby p.Name
                                              select p).ToList <PathItem>();
                PathList.Clear();
                foreach (var item in orderList)
                {
                    PathList.Add(item);
                }

                //Save XML File
                if (GlobalHelper.SaveFolderFile(orderList, GlobalHelper.FOLDERS_FILE_PATH))
                {
                    MessageBox.Show(Resources.AddFolderPathVM_commandSaveExecute_SuccessMessage, Resources.AddFolderPathVM_commandSaveExecute_SuccessTitle, MessageBoxButton.OK, MessageBoxImage.Information);
                    ListChanged = true;
                }
            }
            return(null);
        }
예제 #2
0
        internal void Reset()
        {
            GremlinVariable inputVariable = null;

            if (VariableList.First() is GremlinContextVariable)
            {
                inputVariable = VariableList.First();
            }

            PivotVariable = null;
            Predicates    = null;
            VariableList.Clear();
            TableReferences.Clear();
            PathList.Clear();
            StepList.Clear();
            IsPopulateGremlinPath = false;
            CurrentContextPath    = null;
            ProjectVariablePropertiesList.Clear();
            ProjectedProperties.Clear();

            //reserve the InputVariable
            if (inputVariable != null)
            {
                VariableList.Add(inputVariable);
            }
        }
예제 #3
0
 /* public */
 public void Load()
 {
     if (File.Exists(FilePath))
     {
         PathList.Clear();
         Sys.Load(this, FilePath);
     }
 }
예제 #4
0
        public void PathListRefresh()
        {
            // 갯수만 동일하고 내용물이 다를 경우가 있어 버그를 유발하였음...
            //if (PathList.Count == TLKs.Count) return;

            PathList.Clear();

            foreach (var item in TLKs)
            {
                PathList.Add(item.FilePath);
            }
        }
예제 #5
0
 internal void Reset()
 {
     PivotVariable = null;
     Predicates    = null;
     VariableList.Clear();
     TableReferences.Clear();
     PathList.Clear();
     StepList.Clear();
     IsPopulateGremlinPath = false;
     CurrentContextPath    = null;
     ProjectVariablePropertiesList.Clear();
     ProjectedProperties.Clear();
 }
예제 #6
0
    public void init(ref INode[,] map)
    {
        this.map = map;

        foreach (INode node in map)
        {
            if (node.property == nodeProp.START)
            {
                start = node;
            }
            if (node.property == nodeProp.GOAL)
            {
                goal = node;
            }
        }

        curTile       = null;
        isCalculating = false;

        if (OpenList == null)
        {
            OpenList = new List <INode>();
        }
        else
        {
            OpenList.Clear();
        }

        if (CloseList == null)
        {
            CloseList = new List <INode>();
        }
        else
        {
            CloseList.Clear();
        }

        if (PathList == null)
        {
            PathList = new List <INode>();
        }
        else
        {
            PathList.Clear();
        }
    }
예제 #7
0
        protected virtual object commandSaveExecute(object parameter)
        {
            if (PathList != null)
            {
                //Clear item with empty information
                for (int i = PathList.Count - 1; i >= 0; i--)
                {
                    PathItem item = PathList[i];
                    if (String.IsNullOrWhiteSpace(item.Name) || String.IsNullOrWhiteSpace(item.Path))
                    {
                        PathList.RemoveAt(i);
                        continue;
                    }
                    item.Path = item.Path.TrimEnd('\\');
                }

                //Order list to save
                IList <PathItem> orderList = (from p in PathList
                                              orderby p.Name
                                              select p).ToList <PathItem>();
                PathList.Clear();
                foreach (var item in orderList)
                {
                    PathList.Add(item);
                }

                //Save XML File
                string path = Constants.FOLDERS_FILE_PATH;

                try
                {
                    DataService.SaveFolderFile(orderList, path);
                    MessageBox.Show(Resources.AddFolderPathVM_commandSaveExecute_SuccessMessage, Resources.AddFolderPathVM_commandSaveExecute_SuccessTitle, MessageBoxButton.OK, MessageBoxImage.Information);
                    ListChanged = true;
                }
                catch (Exception ex)
                {
                    string message = String.Format((string)Resources.GlobalHelper_SaveFolderFile_Error_Text, path, ex.Message);
                    MessageBox.Show(message, Resources.GlobalHelper_SaveFolderFile_Error_Title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                }
            }
            return(null);
        }
예제 #8
0
        private void SearchAction(object param)
        {
            log.Info("SearchAction has been called...");

            PathList.Clear();

            if (File.Exists(PathText))
            {
                // This path is a file
                ProcessFile(PathText);
            }
            else if (Directory.Exists(PathText))
            {
                // This path is a directory
                ProcessDirectory(PathText);
            }
            else
            {
                log.Info($"{PathText} is not a valid file or directory.");
            }
        }
예제 #9
0
    //分析路径状态 核心算法
    private static void AnalysisPath(List <MapGrid> list, ref List <PathData> PathList, GridSpace StartGS)
    {
        if (PathList == null)
        {
            PathList = new List <PathData> ();
        }
        PathList.Clear();
        RoleState PreState   = RoleState.WALK;
        RoleState state      = RoleState.WALK;
        RoleState next       = RoleState.WALK;
        WalkDir   dir        = WalkDir.WALKSTOP;
        WalkDir   ndir       = WalkDir.WALKSTOP;
        WalkDir   PreDir     = WalkDir.WALKSTOP;
        int       TimeCycle  = 1;
        int       nTimeCycle = 1;
        //
        GridSpace currentgs = StartGS;

        if (list == null || list.Count == 0)
        {
            return;
        }
        List <MapGrid> l = new List <MapGrid> ();

        TerrainAI(list, ref l, jump_distance);

        /*if (TerrainAI (list, ref  l, jump_distance) == false)
         *      return;*/
                #if UNITY_EDITOR_LOG
        string str = "SearchPath " + g_SceneID + ",";
        if (l.Count > 0)
        {
            for (int i = 0; i < l.Count; i++)
            {
                str += l[i].GridPos + "," + l[i].Type + ",";
            }
            //Debug.Log(str);
        }
        FileLog.write(g_SceneID, str, true);
                #endif
        if (l == null || l.Count == 0)
        {
            return;
        }
        else if (l.Count == 1)
        {
            AddPathRoad(ref PathList, l[0], WalkDir.WALKSTOP, WalkDir.WALKSTOP, RoleState.WALK, RoleState.WALK, RoleState.WALK, 1, StartGS);
            PathRoadStateEx(ref PathList, l[0], l[0]);
            return;
        }
        else if (l.Count == 2)
        {
            state = MapGrid.GetRoleState(l[0], l[1], ref dir, ref TimeCycle, g_IsHandstand, ref currentgs);
            AddPathRoad(ref PathList, l[0], dir, WalkDir.WALKSTOP, RoleState.WALK, state, RoleState.WALK, TimeCycle, StartGS);
            AddPathRoad(ref PathList, l[1], WalkDir.WALKSTOP, dir, state, RoleState.WALK, RoleState.WALK, 1, StartGS);

            PathRoadStateEx(ref PathList, l[0], l[1]);

            return;
        }
        else          // > 3
        {
            for (int i = 0; i < l.Count - 2; i++)
            {
                state = MapGrid.GetRoleState(l[i], l[i + 1], ref dir, ref TimeCycle, g_IsHandstand, ref currentgs);
                GridSpace temp = currentgs;
                next      = MapGrid.GetRoleState(l[i + 1], l[i + 2], ref ndir, ref nTimeCycle, g_IsHandstand, ref currentgs);
                currentgs = temp;
                AddPathRoad(ref PathList, l[i], dir, PreDir, PreState, state, next, TimeCycle, StartGS);
                PreState = state;
                PreDir   = dir;
            }

            //最后2个点

            if (state == RoleState.FALL)
            {
                state = RoleState.FALLDOWN;
            }
            else
            {
                state = MapGrid.GetRoleState(l[l.Count - 2], l[l.Count - 1], ref dir, ref TimeCycle, g_IsHandstand, ref currentgs);
            }
            AddPathRoad(ref PathList, l[l.Count - 2], dir, PreDir, PreState, state, RoleState.WALK, TimeCycle, StartGS);
            AddPathRoad(ref PathList, l[l.Count - 1], WalkDir.WALKSTOP, dir, state, RoleState.WALK, RoleState.WALK, 1, StartGS);

            PathRoadStateEx(ref PathList, l[0], l[1]);

            return;
        }
    }
예제 #10
0
        public void Full_test()
        {
            var fileList = new PathList <UoeFileToCompile>();

            for (int i = 0; i < 1000; i++)
            {
                fileList.Add(new UoeFileToCompile(i.ToString()));
            }

            var j = 0;

            foreach (var compile in fileList)
            {
                Assert.AreEqual(j.ToString(), compile.Path);
                j++;
            }

            Assert.AreEqual(1000, fileList.Count);

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(i.ToString(), fileList[i.ToString()].Path);
            }

            j = 0;
            foreach (var compile in fileList)
            {
                Assert.AreEqual(j.ToString(), fileList[compile].Path);
                j++;
            }

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(true, fileList.Contains(i.ToString()));
            }

            j = 0;
            foreach (var compile in fileList)
            {
                Assert.AreEqual(true, fileList.Contains(compile));
                j++;
            }

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(false, fileList.TryAdd(new UoeFileToCompile(i.ToString())));
            }

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(true, fileList.Remove(new UoeFileToCompile(i.ToString())));
            }

            for (int i = 0; i < 1000; i++)
            {
                Assert.AreEqual(true, fileList.TryAdd(new UoeFileToCompile(i.ToString())));
            }

            fileList.Clear();

            Assert.AreEqual(0, fileList.Count);

            var tempList = new List <UoeFileToCompile>();

            for (int i = 0; i < 1000; i++)
            {
                tempList.Add(new UoeFileToCompile(i.ToString()));
            }
            fileList.AddRange(tempList);

            Assert.AreEqual(1000, fileList.Count);
        }
예제 #11
0
파일: ImageListView.cs 프로젝트: sgww/cozy
 public void ImageClear()
 {
     Items.Clear();
     PathList.Clear();
     ImgList.Images.Clear();
 }