コード例 #1
0
 private void SaveFriction(float[][] ret)
 {
     try
     {
         var fileName = GetFrictionFileName(SaveFrictionFileName, -1);
         var dirName  = Path.GetDirectoryName(fileName);
         if (dirName == null)
         {
             throw new XTMFRuntimeException(this, $"In {Name} we were unable to get the directory name from the file {fileName}!");
         }
         if (!Directory.Exists(dirName))
         {
             Directory.CreateDirectory(dirName);
         }
         BinaryHelpers.ExecuteWriter(writer =>
         {
             for (int i = 0; i < ret.Length; i++)
             {
                 for (int j = 0; j < ret[i].Length; j++)
                 {
                     writer.Write(ret[i][j]);
                 }
             }
         }, fileName);
     }
     catch (IOException e)
     {
         throw new XTMFRuntimeException(this, "Unable to save distribution cache file!\r\n" + e.Message);
     }
 }
コード例 #2
0
 private void SaveFriction(float[][] ret)
 {
     try
     {
         var fileName = GetFrictionFileName(this.SaveResultFileName);
         var dirName  = Path.GetDirectoryName(fileName);
         if (!Directory.Exists(dirName))
         {
             Directory.CreateDirectory(dirName);
         }
         BinaryHelpers.ExecuteWriter((writer) =>
         {
             for (int i = 0; i < ret.Length; i++)
             {
                 for (int j = 0; j < ret[i].Length; j++)
                 {
                     writer.Write(ret[i][j]);
                 }
             }
         }, fileName);
     }
     catch (IOException e)
     {
         throw new XTMFRuntimeException("Unable to save distribution cache file!\r\n" + e.Message);
     }
 }
コード例 #3
0
 private void SaveData(List <TreeData <float[][]> > value)
 {
     try
     {
         var dir = Path.GetDirectoryName(ResultCacheFile);
         if (!String.IsNullOrWhiteSpace(dir) && !Directory.Exists(dir))
         {
             Directory.CreateDirectory(dir);
         }
         BinaryHelpers.ExecuteWriter(writer =>
         {
             foreach (var tree in value)
             {
                 SaveData(tree, writer);
             }
         }, ResultCacheFile);
     }
     catch (IOException e)
     {
         throw new XTMFRuntimeException(this, e.Message);
     }
 }