Пример #1
0
        public void ConfigTest1()
        {
            var props = new SharpCifs.Util.Sharpen.Properties();

            props.SetProperty("jcifs.smb.client.username", this.UserName);
            props.SetProperty("jcifs.smb.client.password", this.Password);
            SharpCifs.Config.SetProperties(props);


            var uriString = $"smb://{this.ServerName}/FreeArea/SharpCifsTest/";
            var dir       = new SmbFile(uriString);

            Assert.IsTrue(dir.Exists());

            var list = dir.ListFiles();

            foreach (var file in list)
            {
                var name = file.GetName();
                //Assert.IsTrue(name.IndexOf("filename") >= 0);

                var time      = file.LastModified();
                var dateteime = EpocDate.AddMilliseconds(time).ToLocalTime();

                this.Out(
                    $"Name: {file.GetName()}, isDir?: {file.IsDirectory()}, Date: {dateteime.ToString("yyyy-MM-dd HH:mm:ss")}");
            }
        }
Пример #2
0
 // supress javadoc constructor summary by removing 'protected'
 /// <summary>Set the default properties of the static Properties used by <tt>Config</tt>.
 /// 	</summary>
 /// <remarks>
 /// Set the default properties of the static Properties used by <tt>Config</tt>. This permits
 /// a different Properties object/file to be used as the source of properties for
 /// use by the jCIFS library. The Properties must be set <i>before jCIFS
 /// classes are accessed</i> as most jCIFS classes load properties statically once.
 /// Using this method will also override properties loaded
 /// using the <tt>-Djcifs.properties=</tt> commandline parameter.
 /// </remarks>
 public static void SetProperties(Properties prp)
 {
     Config._prp = new Properties(prp);
     try
     {
         Config._prp.PutAll(Runtime.GetProperties());
     }
     catch (SecurityException)
     {
         if (_log.Level > 1)
         {
             _log.WriteLine("SecurityException: jcifs will ignore System properties");
         }
     }
 }
Пример #3
0
 public Properties(Properties defaultProp): this()
 {
     PutAll(defaultProp._properties);
 }
Пример #4
0
 public Properties(Properties defaultProp) : this()
 {
     PutAll(defaultProp._properties);
 }