예제 #1
0
        /* ----------------------------------------------------------------- */
        ///
        /// Set
        ///
        /// <summary>
        /// Sets values based on the specified arguments.
        /// </summary>
        ///
        /// <param name="src">Program arguments.</param>
        ///
        /* ----------------------------------------------------------------- */
        public void Set(ArgumentCollection src)
        {
            var op = src.Options;

            if (op.TryGetValue(nameof(MachineName), out var pc))
            {
                MachineName = pc;
            }
            if (op.TryGetValue(nameof(UserName), out var user))
            {
                UserName = user;
            }
            if (op.TryGetValue(nameof(DocumentName), out var doc))
            {
                DocumentName = new DocumentName(doc, Assembly.Product, IO);
            }
            if (op.TryGetValue(nameof(Digest), out var digest))
            {
                Digest = digest;
            }
            if (op.TryGetValue("InputFile", out var input))
            {
                Value.Source = input;
            }

            var dest = IO.Get(IO.Combine(Value.Destination, DocumentName.Name));
            var name = dest.NameWithoutExtension;
            var ext  = Value.Format.GetExtension();

            Value.Destination  = IO.Combine(dest.DirectoryName, $"{name}{ext}");
            Value.DeleteSource = op.ContainsKey("DeleteOnClose");
            Value.SkipUi       = op.ContainsKey("SkipUI");
        }
예제 #2
0
 /* ----------------------------------------------------------------- */
 ///
 /// SettingsFolder
 ///
 /// <summary>
 /// Initializes a new instance of the SettingsFolder class with the
 /// specified arguments.
 /// </summary>
 ///
 /// <param name="format">Serialization format.</param>
 /// <param name="path">Path to save settings.</param>
 /// <param name="io">I/O handler.</param>
 ///
 /* ----------------------------------------------------------------- */
 public SettingsFolder(Cube.DataContract.Format format, string path, IO io) :
     base(System.Reflection.Assembly.GetExecutingAssembly(), format, path, io)
 {
     AutoSave       = false;
     MachineName    = Environment.MachineName;
     UserName       = Environment.UserName;
     DocumentName   = new DocumentName(string.Empty, Assembly.Product, IO);
     WorkDirectory  = GetWorkDirectory();
     Version.Digit  = 3;
     Version.Suffix = $"RC{Assembly.Version.Revision}";
     UpdateChecker  = IO.Combine(Assembly.DirectoryName, "CubeChecker.exe");
 }