コード例 #1
0
ファイル: ExcelMeau.cs プロジェクト: freedomWind/Demos
    public static void toJson()
    {
        var select = Selection.activeObject;
        var path   = AssetDatabase.GetAssetPath(select);
        Dictionary <string, string[]> dic = ExcelTool.ToArrayListFromExcel(path, 1);
        string newPath = path.Replace(path.Substring(path.LastIndexOf(".")), ".json");

        if (System.IO.File.Exists(newPath))
        {
            System.IO.File.Delete(newPath);
        }
        using (System.IO.FileStream fs = System.IO.File.Create(newPath))// file = new System.IO.File())
        {
            System.IO.StreamWriter sw = new System.IO.StreamWriter(fs);
            sw.Write(ExcelTool.ToJsonFromDic(dic));
            sw.Close();
        }
    }