示例#1
0
        private static int getMatchingDatasourceIndex(RrdDb rrd1, int dsIndex, RrdDb rrd2)
        {
            String dsName = rrd1.getDatasource(dsIndex).DsName;

            try
            {
                return(rrd2.getDsIndex(dsName));
            }
            catch (ArgumentException e)
            {
                return(-1);
            }
        }
示例#2
0
文件: Archive.cs 项目: mujing/rrd4net
 private static int getMatchingDatasourceIndex(RrdDb rrd1, int dsIndex, RrdDb rrd2)
 {
    String dsName = rrd1.getDatasource(dsIndex).DsName;
    try
    {
       return rrd2.getDsIndex(dsName);
    }
    catch (ArgumentException e)
    {
       return -1;
    }
 }
示例#3
0
文件: Model.cs 项目: mujing/rrd4net
      public void UpdateDataSource(DatabaseData srcDatabase, DsDef updatedDsDef, DsDef originalDsDef)
      {
         RrdDb database = null;

         try
         {
            database = new RrdDb(srcDatabase.Definition.Path, false);
            Datasource datasource = database.getDatasource(originalDsDef.getDsName());
            if (datasource == null)
               throw new ArgumentException(updatedDsDef.getDsName() + " datasource don't exist");
            if (datasource.DsName != updatedDsDef.DsName)
               datasource.setDsName(updatedDsDef.getDsName());
            datasource.setDsType(updatedDsDef.getDsType());
            datasource.setHeartbeat(updatedDsDef.getHeartbeat());
            datasource.setMaxValue(updatedDsDef.getMaxValue(), true);
            datasource.setMinValue(updatedDsDef.getMinValue(), true);

         }
         catch (FileNotFoundException ex)
         {
            Logger.Error("Update datasource failed", ex);
            throw new ApplicationException("Can't update datasource until database saved!", ex);
         }
         finally
         {
            if (database != null)
               database.close();
         }
      }