예제 #1
0
파일: ArcDef.cs 프로젝트: plutext/robin.net
		internal bool ExactlyEqual(ArcDef def)
		{
			return ConsolFun == def.ConsolFun && Xff == def.Xff &&
			       Steps == def.Steps && Rows == def.Rows;
		}
예제 #2
0
		/// <summary>
		/// <p>Adds one more archive to a RRD file.</p>
		/// <p>WARNING: This method is potentialy dangerous! It will modify your RRD file.
		/// It is highly recommended to preserve the original RRD file (<i>saveBackup</i>
		/// should be set to <code>true</code>). The backup file will be created in the same
		/// directory as the original one with <code>.bak</code> extension added to the
		/// original name.</p>
		/// <p>Before applying this method, be sure that the specified RRD file is not in use
		/// (not open)</p>
		/// </summary>
		/// <param name="sourcePath">path to a RRD file to add datasource to.</param>
		/// <param name="newArchive">Archive definition to be added to the RRD file</param>
		/// <param name="saveBackup">true, if backup of the original file should be created;false, otherwise</param>
		public static void AddArchive(String sourcePath, ArcDef newArchive, bool saveBackup)
		{
			String destPath = Util.GetTmpFilename();
			AddArchive(sourcePath, destPath, newArchive);
			CopyFile(destPath, sourcePath, saveBackup);
		}
예제 #3
0
파일: RrdDef.cs 프로젝트: plutext/robin.net
		/// <summary>
		/// Adds single archive definition represented with object of class <code>ArcDef</code>.
		/// </summary>
		/// <param name="arcDef">Archive definition.</param>
		public void AddArchive(ArcDef arcDef)
		{
			if (arcDef == null) throw new ArgumentNullException("arcDef");

			if (arcDefs.Contains(arcDef))
			{
				throw new RrdException("Archive already defined: " + arcDef.Dump());
			}
			arcDefs.Add(arcDef);
		}
예제 #4
0
		/// <summary>
		/// Creates a new RRD file with one more archive in it. RRD file is created based on the
		/// existing one (the original RRD file is not modified at all). All data from
		/// the original RRD file is copied to the new one.
		/// </summary>
		/// <param name="sourcePath">path to a RRD file to import data from (will not be modified)</param>
		/// <param name="destPath">path to a new RRD file (will be created)</param>
		/// <param name="newArchive">Archive definition to be added to the new RRD file</param>
		public static void AddArchive(String sourcePath, String destPath, ArcDef newArchive)
		{
			if (Util.SameFilePath(sourcePath, destPath))
			{
				throw new RrdException("Source and destination paths are the same");
			}
			using (RrdDb rrdSource = RrdDb.Open(sourcePath))
			{
				RrdDef rrdDef = rrdSource.GetRrdDef();
				rrdDef.Path = destPath;
				rrdDef.AddArchive(newArchive);
				using (RrdDb rrdDest = RrdDb.Create(rrdDef))
				{
					rrdSource.CopyStateTo(rrdDest);
				}
			}
		}