Пример #1
0
 public TransferCenter(State state)
 {
     State = state;
       var myDirectory = Application.StartupPath;
       IncomingDirectory = myDirectory + "\\Incoming";
       IncomingDirectoryInfo = Directory.CreateDirectory(IncomingDirectory);
 }
Пример #2
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
              Application.SetCompatibleTextRenderingDefault(false);
              String installedDirectory = Application.StartupPath;
              State state = new State();
              if (0 < args.Length) {
            var parsed = ParseArgs(args);
            state.Side = parsed.ContainsKey("side") ? parsed["side"] : "left";
            string remoteHost = parsed.ContainsKey("remoteHost") ? parsed["remoteHost"] : GetDefaultSetting("remoteHost", state.Side);
            string remotePort = parsed.ContainsKey("remotePort") ? parsed["remotePort"] : GetDefaultSetting("remotePort", state.Side);
            string localPort = parsed.ContainsKey("localPort") ? parsed["localPort"] : GetDefaultSetting("localPort", state.Side);
            string localHost = parsed.ContainsKey("localHost") ? parsed["localHost"] : GetDefaultSetting("localHost", state.Side);

            if (localHost == null) {
              state.LocalAddress = IPAddress.Any;
            } else {
              try {
            state.LocalAddress = Parse(localHost);
              } catch (Exception) {
            MessageBox.Show("Could not resolve --localHost " + localHost + "\n" +
                            "Your IP is " + GetMyIPs() + "\n" +
                            "Specify it, or drop the --localHost argument completely\n");
            return;
              }
            }
            if (remoteHost == null) {

              MessageBox.Show("You must specify --remoteHost \n" +
                          "Your IP is " + GetMyIPs() + "\n" +
                          "Provide this as the --remoteHost on the other machine\n");
              return;
            } else {
              try {
            state.RemoteAddress = Parse(remoteHost);
              } catch (Exception) {
            MessageBox.Show("Could not resolve remoteHost: " + remoteHost);
            return;
              }
            }
            try {
              state.RemotePort = Int32.Parse(remotePort);
            } catch (Exception) {
              MessageBox.Show("Could not parse --remotePort " + remotePort);
            }
            try {

              state.LocalPort = Int32.Parse(localPort);
            } catch (Exception) {
              MessageBox.Show("Could not parse --localPort " + localPort);
            }
            Application.Run(new SharedgeForm(state));
              } else {

              }
        }
Пример #3
0
        public SharedgeForm(State state)
        {
            this.TheState = state;
              InitializeComponent();

              FakeCursor = new TransparentControl();
              this.Controls.Add(FakeCursor);
              FakeCursor.BringToFront();
              FakeCursor.Visible = false;

              switch(TheState.Side){
            case "right":
              LayoutStrategy = new RightSideLayoutStrategy(this);
              break;
            default:
              LayoutStrategy = new LeftSideLayoutStrategy(this);
              break;
              }
        }