Exemplo n.º 1
0
    /// <summary>
    /// データを使用可能な状態に整形する
    /// 曲データ完成後に一度呼ぶ
    /// </summary>
    public void DataFinalize()
    {
        quedata.Sort();
        OneData pre = null;
        Int16   lr  = CdjData.Left;

        foreach (OneData o in quedata)
        {
            o.lr       = lr;
            o.datatype = 0;
            if (pre != null)
            {
                pre.endstep = o.startstep;
            }
            pre = o;
            lr  = (Int16)(-lr);
        }
        pre.endstep = 99999;
        foreach (OneData o in scratchdata)
        {
            foreach (OneData q in quedata)
            {
                if (q.startstep <= o.startstep && o.endstep <= q.endstep)
                {
                    o.lr = (Int16)(-q.lr);
                }
            }
            o.datatype = 1;
            o.SetScratchEndStep();
        }
    }
Exemplo n.º 2
0
    public bool OneFind()
    {
        if (open.Count == 0)
        {
            return(true);
        }

        OneData first = open[0];

        open.Remove(first);
        close.Add(first);
        if (lastFirst != null)
        {
            lastFirst.grid.data.state = Grid.GridState.RoadClose;
            lastFirst.grid.RefreshState();
        }
        first.grid.data.state = Grid.GridState.Start;
        first.grid.RefreshState();
        lastFirst = first;

        if (first.grid.data.ID == goal.data.ID)
        {
            return(true);
        }

        Check(first.grid, -1, 0);
        Check(first.grid, 1, 0);
        Check(first.grid, 0, -1);
        Check(first.grid, 0, 1);
        open.Sort((x, y) => x.dis2Goal.CompareTo(y.dis2Goal));

        return(false);
    }
Exemplo n.º 3
0
    /// <summary>
    /// スクラッチデータ追加
    /// </summary>
    /// <param name="_step"></param>
    /// <param name="values"></param>
    public void AddScratch(int _step, List <int> values)
    {
        OneData o;

        o = new OneData();
        o.SetScratch(_step, values);
        scratchdata.Add(o);
    }
Exemplo n.º 4
0
    /// <summary>
    /// キューイングデータ追加
    /// </summary>
    /// <param name="_step"></param>
    /// <param name="value"></param>
    public void AddQue(int _measno, int _step, int value)
    {
        OneData o;

        o = new OneData();
        o.SetQue(_measno * datacalc.resolution + _step, value);
        quedata.Add(o);
        quedata.Sort();
    }
Exemplo n.º 5
0
    /// <summary>
    /// キューイングデータ追加
    /// </summary>
    /// <param name="_step"></param>
    /// <param name="value"></param>
    public void AddQue(int _step, int value)
    {
        OneData o;

        o = new OneData();
        o.SetQue(_step, value);
        quedata.Add(o);
        quedata.Sort();
    }
Exemplo n.º 6
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="o"></param>
 public ScratchUnit(OneData o)
 {
     startstep  = o.startstep;
     endstep    = o.endstep;
     lr         = o.lr;
     lstscratch = new List <ScratchChip>();
     foreach (Tuple <int, int> d in o.StepList)
     {
         ScratchChip s = new ScratchChip
         {
             judge = EnumJudge.NOTYET,
             step  = d.Item1,
             data  = d.Item2
         };
         lstscratch.Add(s);
     }
 }
Exemplo n.º 7
0
        //excel转化为数据
        private List <OneData> ExcelToDatat(string filePath)
        {
            IWorkbook      wk        = null;
            List <OneData> DataAll   = new List <OneData>();
            string         extension = System.IO.Path.GetExtension(filePath);

            try
            {
                FileStream fs = File.OpenRead(filePath);
                if (extension.Equals(".xls"))
                {
                    //把xls文件中的数据写入wk中
                    wk = new HSSFWorkbook(fs);
                }
                else
                {
                    //把xlsx文件中的数据写入wk中
                    wk = new XSSFWorkbook(fs);
                }
                fs.Close();
                //读取当前表数据
                ISheet sheet = wk.GetSheetAt(0);

                IRow row = sheet.GetRow(0); //读取当前行数据
                                            //LastRowNum 是当前表的总行数-1(注意)
                int nameCol = -1;           //第几列是姓名
                int idCol   = -1;           //第几列是身份证
                for (int i = 0; i <= sheet.LastRowNum; i++)
                {
                    row = sheet.GetRow(i);  //读取当前行数据
                    if (row != null)
                    {
                        OneData data = new OneData();
                        //LastCellNum 是当前行的总列数
                        for (int j = 0; j < row.LastCellNum; j++)
                        {
                            //读取该行的第j列数据,数据为空则为null
                            ICell hssfCell = row.GetCell(j);
                            if (hssfCell == null)
                            {
                                continue;
                            }
                            String name = hssfCell.StringCellValue;
                            if (name.IndexOf("保险人") >= 0 || name.IndexOf("姓名") >= 0 || name.IndexOf("名称") >= 0 || name.IndexOf("名字") >= 0)
                            {
                                nameCol = j;
                            }
                            else if (name.IndexOf("证") >= 0 && name.IndexOf("号码") >= 0)
                            {
                                idCol = j;
                            }
                            else
                            {
                                if (j == nameCol)
                                {
                                    data.name = hssfCell.StringCellValue;
                                }
                                else if (j == idCol)
                                {
                                    data.idCard = hssfCell.StringCellValue;
                                }
                            }
                        }
                        if (data.name != null && data.idCard != null && data.name != "" && data.idCard != "")
                        {
                            DataAll.Add(data);
                        }
                    }
                }
            }

            catch (Exception ex)
            {
                //只在Debug模式下才输出
                //richTextBox1.AppendText(ex.Message + "\n");
            }
            return(DataAll);
        }