コード例 #1
0
ファイル: RrdDb.cs プロジェクト: jlkjxyshangli/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);
            }
        }
コード例 #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();
         }
      }