Hello,
There is no specific API for handling dfs0 files, as it is written in the documentation ("DFS_UserGuide.pdf"), but the good news is that you can manage dfs0 files by using [i]DfsFileFactory[/i] class. You also must use the [i]IDfsFile[/i] interface which provides functionality for reading and writing any dfs file.
Example (C#):
// Open the [i]filename.dfs0[/i] file in edit mode.
IDfsFile dfs0File = DfsFileFactory.DfsGenericOpenEdit("filename.dfs0");
// Header information is contained in the IDfsFileInfo.
IDfsFileInfo fileInfo = dfs0File.FileInfo;
// Get the number of items and the number of time steps.
int noItems = dfs0File.ItemInfo.Count;
int noTimeSteps = fileInfo.TimeAxis.NumberOfTimeSteps;
//Lets assume that the data are stored as floats.
IDfsItemData<float> data;
float[,] values = new float[noItems, noTimeSteps];
// Iterate throw all the time steps in all the items,
// multiply each value by 2 and store them in the [i]values[/i] matrix.
for (int i = 0; i < noTimeSteps; i++)
for (int j = 1; j <= noItems; j++)
{
data = (IDfsItemData<float>)dfs0File.ReadItemTimeStep(j, i);
values[j - 1, i] = Convert.ToSingle(data.Data[0] * 2);
}
// Write the updated values.
for (int i = 0; i < noTimeSteps; i++)
for (int j = 1; j <= noItems; j++)
{
dfs0File.WriteItemTimeStep(j, i, 0, new float[] { values[j - 1, i] });
}
dfs0File.Close();
//The End
I suggest you to analyze the example located at "...\DHI\2012\MIKE Zero\Manuals\MIKE_ZERO\FileFormats\Examples\CSharp\ExamplesDfs0.cs" and also the documentation.
Regards,
Aurelian