Example #1
0
    void BuildFileIndex()
    {
        string resPath     = Application.dataPath + "/StreamingAssets/";
        string newFilePath = resPath + fe.ToString() + ".txt";

        if (File.Exists(newFilePath))
        {
            File.Delete(newFilePath);
        }

        FileStream   fs = new FileStream(newFilePath, FileMode.CreateNew);
        StreamWriter sw = new StreamWriter(fs);

        for (int i = 0; i < filePaths.Count; i++)
        {
            string file = filePaths[i];
            string ext  = Path.GetExtension(file);
            if (file.EndsWith(".meta") || file.Contains(".DS_Store"))
            {
                continue;
            }

            string     md5   = Util.md5file(file);
            string     value = file.Replace(resPath, string.Empty);
            FileStream ofs   = new FileStream(file, FileMode.Open);
            sw.WriteLine(value + "|" + md5 + "|" + ofs.Length);
            ofs.Close();
        }
        sw.Close(); fs.Close();
        filePaths.Clear();
    }
Example #2
0
        private void AddBoardRow(string singleNotation, Pieces piece)
        {
            DataRow  dr   = BoardData.NewRow();
            RankEnum rank = GetRank(singleNotation);
            FileEnum file = GetFile(singleNotation);

            dr["r"] = rank.ToString("d");
            dr["f"] = file.ToString("d");
            dr["p"] = piece.ToString("d");

            BoardData.Rows.Add(dr);
        }
Example #3
0
        private DataRow GetBoardDataRow(RankEnum rank, FileEnum file)
        {
            DataRow[] rows = BoardData.Select("r=" + rank.ToString("d") + " AND f=" + file.ToString("d"));

            if (rows.Length > 0)
            {
                return(rows[0]);
            }

            return(null);
        }