Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            _smb = new SMB();
            string hostname = Environment.MachineName + "-MTP";

            linkLabel1.Text = string.Format(@"\\{0}\mtpdevices", hostname);
            _smb.Start(hostname, 16384, NetFlag.ListenAllNetworkCards, 8, "");
        }
Exemplo n.º 2
0
 public void StopServer()
 {
     if (CIFS != null)
     {
         CIFS.Stop(false, 1000);
         CIFS = null;
     }
     unmapDrive();
     Trace.WriteLine("-------------- End of Trace --------------");
     Trace.Flush();
     Debug.Flush();
 }
Exemplo n.º 3
0
        //That is the main part of the program
        private void startCIFSServer()
        {
            // Check if the server is already running
            if (RunAlready())
            {
                Trace.WriteLine("Fatal->The server is already running, this instance is beeing stopped.");
                throw new ApplicationException("Server must only run in one instance.");
            }

            const int SMBNameLength = 15;

            // Start SMB server
            try
            {
                string HostName = System.Windows.Forms.SystemInformation.ComputerName.ToUpper();

                if (HostName.Length > SMBNameLength)
                {
                    HostName = HostName.Substring(0, SMBNameLength);
                }

                string ServerName       = "iPhoneDrive"; // oder fester Name
                string DomainController = string.Empty;  //  Name of the domain controller, is used for validating users, set it null to accept everybody

                CIFS = new SMB();

                CIFS.Start(
                    ServerName,
                    (ushort)16384,
                    NetFlag.Announce | NetFlag.RemoteAccess | NetFlag.ListenAllNetworkCards,
                    5, // Anzahl der gleichzeitigen Anfragen
                    DomainController);
            }
            catch (Exception ex)
            {
                throw new ApplicationException("CIFS server could not be started.", ex);
            }
        }
Exemplo n.º 4
0
        public string DistributionPoint(string dpId, string task)
        {
            var smb = new SMB();

            var dp = new DistributionPointServices().GetDistributionPoint(Convert.ToInt32(dpId));

            smb.SharePath   = "//" + StringManipulationServices.PlaceHolderReplace(dp.Server) + "/" + dp.ShareName;
            smb.Domain      = dp.Domain;
            smb.DisplayName = dp.DisplayName;
            smb.IsPrimary   = dp.IsPrimary == 1 ? "true" : "false";
            if (task.Contains("upload"))
            {
                smb.Username = dp.RwUsername;
                smb.Password = new EncryptionServices().DecryptText(dp.RwPassword);
            }
            else
            {
                smb.Username = dp.RoUsername;
                smb.Password = new EncryptionServices().DecryptText(dp.RoPassword);
            }

            return(JsonConvert.SerializeObject(smb));
        }
Exemplo n.º 5
0
 public SMBTest()
 {
     _smb = new SMB(machine.CPU);
 }