#region Disclaimer / License // Copyright (C) 2008, Kenneth Skovhede // http://www.hexad.dk, opensource@hexad.dk // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public // License as published by the Free Software Foundation; either // version 2.1 of the License, or (at your option) any later version. // // This library is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public // License along with this library; if not, write to the Free Software // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA // #endregion using System; using System.Collections.Generic; using System.Text; using System.Text.RegularExpressions; namespace Duplicati.Library.Main { /// /// This class is responsible for naming remote files, /// and parsing remote filenames /// internal class FilenameStrategy { private bool m_useShortFilenames; private string m_timeSeperator; private string m_prefix; private Regex m_filenameRegExp; private Regex m_shortRegExp; public FilenameStrategy(Dictionary options) { m_useShortFilenames = options.ContainsKey("short-filenames"); if (options.ContainsKey("time-separator")) m_timeSeperator = options["time-separator"]; else m_timeSeperator = ":"; if (!options.ContainsKey("backup-prefix")) m_prefix = m_useShortFilenames ? "dpl" : "duplicati"; else m_prefix = options["backup-prefix"]; m_shortRegExp = new Regex(@"(?" + m_prefix + @")\-(?(C|S|M))(?(F|I))(?