예제 #1
0
        public static List <DefineDefinition> FindDefines()
        {
            var path = GetAstarPath() + "/defines.csv";

            if (File.Exists(path))
            {
                // Read a file consisting of lines with the format
                // NAME;Description
                // Ignore empty lines and lines which do not contain exactly 1 ';'
                var definePairs = File.ReadAllLines(path)
                                  .Select(line => line.Trim())
                                  .Where(line => line.Length > 0)
                                  .Select(line => line.Split(';'))
                                  .Where(opts => opts.Length == 2);

                return(definePairs.Select(opts => {
                    var def = new DefineDefinition {
                        name = opts[0].Trim(), description = opts[1].Trim()
                    };
                    IsDefineEnabled(def.name, out def.enabled, out def.consistent);
                    return def;
                }).ToList());
            }

            Debug.LogError("Could not find file '" + path + "'");
            return(new List <DefineDefinition>());
        }
예제 #2
0
 public static List<DefineDefinition> FindDefines()
 {
     var path = GetAstarPath()+"/defines.csv";
     if (System.IO.File.Exists (path)) {
         // Read a file consisting of lines with the format
         // NAME;Description
         // Ignore empty lines and lines which do not contain exactly 1 ';'
         var definePairs = System.IO.File.ReadAllLines (path).Select ((line) => line.Trim()).Where ((line) => line.Length > 0).Select ((line) => line.Split (';')).Where ((opts) => opts.Length == 2);
         return definePairs.Select ((opts) => {
             var def = new DefineDefinition {name=opts[0].Trim(), description=opts[1].Trim()};
             IsDefineEnabled (def.name, out def.enabled, out def.consistent);
             return def;
         }).ToList ();
     } else {
         Debug.LogError ("Could not find file '"+path+"'");
         return new List<DefineDefinition>();
     }
 }