Exemplo n.º 1
0
 public void RemoveAt(int index)
 {
     if (_nodes == null || index < 0 || index >= _nodes.Count)
     {
         throw new System.ArgumentOutOfRangeException("index");
     }
     _nodes[index].index = -1;
     _nodes.RemoveAt(index);
     for (; index < _nodes.Count; index++)
     {
         _nodes[index].index = index;
     }
 }
Exemplo n.º 2
0
        public void RemoveLine(Line line)
        {
            if (line.parent != this)
            {
                return;
            }

            lines.RemoveAt(line.index);
            for (int i = line.index, iN = lines.Count; i < iN; i++)
            {
                lines[i].index = i;
            }

            line.parent = null;
            line.index  = 0;
        }
Exemplo n.º 3
0
 public void RemoveAt(int index)
 {
     if (this.isreadonly)
     {
         throw new System.NotSupportedException("This collection is readonly.");
     }
     if (_nodes == null || index < 0 || index >= _nodes.Count)
     {
         throw new System.ArgumentOutOfRangeException("index");
     }
     _nodes[index].index = -1;
     _nodes.RemoveAt(index);
     for (; index < _nodes.Count; index++)
     {
         _nodes[index].index = index;
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// 指定したパスを結合し、.. や . 等の指定を含む場合にはそれらを解決します。
        /// </summary>
        /// <param name="path1">先に来るパスを指定します。</param>
        /// <param name="path2">後にくるパスを指定します。</param>
        /// <returns>結合した後のパスを返します。</returns>
        public static string Combine(string path1, string path2)
        {
            string path0 = System.IO.Path.Combine(path1, path2);

            if (path0.IndexOf("..") < 0)
            {
                return(path0);
            }

            //-- 正規化
            string[]           paths  = path0.TrimEnd('\\', '/').Split('\\', '/');
            Gen::List <string> paths2 = new Gen::List <string>();

            System.Text.StringBuilder r = new System.Text.StringBuilder();
            for (int i = 0; i < paths.Length; i++)
            {
                if (paths[i] == "..")
                {
                    if (paths2.Count == 0)
                    {
                        r.Append(@"..\");
                    }
                    else
                    {
                        paths2.RemoveAt(paths2.Count - 1);
                    }
                }
                else if (paths[i] != ".")
                {
                    paths2.Add(paths[i]);
                }
            }
            foreach (string x in paths2.ToArray())
            {
                r.Append(x); r.Append(@"\");
            }
            ;

            string r2 = r.ToString();

            return(r2 == ""?".":r2.TrimEnd('\\'));
        }
Exemplo n.º 5
0
        //===========================================================
        //		細かい関数
        //===========================================================
        private static void RemoveNullDeclaration(string name, Gen::List <IStatement> yields)
        {
            for (int i = 0, iM = yields.Count; i < iM; i++)
            {
                IExpressionStatement state_exp = yields[i] as IExpressionStatement;
                if (state_exp == null)
                {
                    continue;
                }

                IVariableDeclarationExpression exp_var;

                IAssignExpression exp_assign = state_exp.Expression as IAssignExpression;
                if (exp_assign != null)
                {
                    // T value=nullptr; の場合
                    ILiteralExpression exp_lit = exp_assign.Expression as ILiteralExpression;
                    if (exp_lit == null || exp_lit.Value != null)
                    {
                        continue;
                    }
                    exp_var = exp_assign.Target as IVariableDeclarationExpression;
                }
                else
                {
                    // T value; の場合
                    exp_var = state_exp.Expression as IVariableDeclarationExpression;
                }

                if (exp_var == null || exp_var.Variable.Name != name)
                {
                    continue;
                }

                yields.RemoveAt(i);
                break;
            }
        }