Пример #1
0
 public static bool Save(ProgramSetting setting)
 {
     try{
         System.Runtime.Serialization.Formatters.Binary.BinaryFormatter ser
             = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
         using (System.IO.FileStream stream = new System.IO.FileStream(CFGPATH_LIST, System.IO.FileMode.Create))
             using (
                 System.IO.Compression.DeflateStream gzstr = new System.IO.Compression.DeflateStream(
                     stream, System.IO.Compression.CompressionMode.Compress, true)
                 ){
                 ser.Serialize(gzstr, new mwg.Mounter.Serialization.ProgramSettingData001(setting));
             }
         return(true);
     }catch (System.Exception e) {
         System.Console.WriteLine("mwg.Sshfs! 設定の保存に失敗しました");
         System.Console.WriteLine(e.ToString());
         return(false);
     }
 }
Пример #2
0
        public RootFsOperation(ProgramSetting setting)
        {
            rootdir = new FsDirectory("root");
            rootdir.info.Attributes |= System.IO.FileAttributes.System;
            rootdir.info.Attributes |= System.IO.FileAttributes.ReadOnly;

            FsFile file = rootdir.CreateFile("autorun.inf");

            file.info.Attributes |= System.IO.FileAttributes.ReadOnly;
            file.info.Attributes |= System.IO.FileAttributes.Hidden;
            file.info.Attributes |= System.IO.FileAttributes.System;
            file.SetContent("[autorun]\r\nicon=drive.ico\r\n");

            file = rootdir.CreateFile("desktop.ini");
            file.info.Attributes |= System.IO.FileAttributes.ReadOnly;
            file.info.Attributes |= System.IO.FileAttributes.Hidden;
            file.info.Attributes |= System.IO.FileAttributes.System;
            file.SetContent(GetDataFromResource("desktop.ini"));

            file = rootdir.CreateFile("drive.ico");
            file.info.Attributes |= System.IO.FileAttributes.ReadOnly;
            file.info.Attributes |= System.IO.FileAttributes.Hidden;
            file.info.Attributes |= System.IO.FileAttributes.System;
            file.SetContent(GetDataFromResource("DriveIcon.ico"));

            foreach (ISftpAccount acc in setting.accounts)
            {
                if (!acc.Enabled)
                {
                    continue;
                }

                FsMountPoint mnt = new FsMountSftp(acc);
                mnt.info.Attributes |= System.IO.FileAttributes.Offline;
                rootdir.files.Add(acc.Name, mnt);
                mntlist.Add("\\" + acc.Name, mnt);
            }
        }
Пример #3
0
 //==========================================================================
 //	Initializations
 //==========================================================================
 public RootFsOperation() : this(ProgramSetting.Load())
 {
 }