Exemple #1
0
        public WordLaunch(ServerInfo targetserver)
        {
            InitializeComponent();
            this.targetserver = targetserver;
            plugin = new PluginRpc(targetserver.conn.URL);
            medsize = plugin.GetMediumSize();

            txt_Content.NativeInterface.SetCodePage((int)Constants.SC_CP_UTF8);

            CategoryFullInfo[] cfi = targetserver.conn.GetCategories(0, targetserver.username, targetserver.password);
            foreach (CategoryFullInfo cf in cfi)
            {
                CheckBox cb = new CheckBox();
                cb.Name = "cb_" + cf.categoryName;
                cb.Text = cf.categoryName;
                cb.Tag = cf;
                flow_Categories.Controls.Add(cb);
            }

            postResources = GetNextAvailableDir();
            Directory.CreateDirectory(postResources);

            var module = new FileModule();
            webserv = new Server();
            module.Resources.Add(new FileResources("/",postResources));
            webserv.Add(module);
            webserv.Add(new MultiPartDecoder());
            webserv.RequestReceived+=new EventHandler<RequestEventArgs>(webserv_RequestReceived);

            // use one http listener.
            webserv.Add(HttpListener.Create(System.Net.IPAddress.Any, webservport));
            webserv.Start(5);

            // Find a valid post to use
            url = targetserver.conn.URL.Replace("xmlrpc.php", "?p=2147483646");
        }
        void UpdateServerListFromFile()
        {
            listBox1.Items.Clear();
            UserdataFileFormat udf;

            udf = ReadUserData();
            foreach (var entry in udf.entries)
            {
                ServerInfo si = new ServerInfo(entry.Name, new WPConnection(entry.URL), entry.Username, entry.Password);
                listBox1.Items.Add(si);
            }
        }
 private void start_Click(object sender, EventArgs e)
 {
     info = (ServerInfo)listBox1.SelectedItem;
     this.Close();
 }
Exemple #4
0
        private FileUploadReturnInfo UploadFile(ImageInformation ii, ServerInfo si)
        {
            FileUploadInfo fui = new FileUploadInfo();
            fui.overwrite = true;
            fui.name = ii.filename;
            fui.type = Mimetypes.MimeType(ii.filename);

            BinaryReader br = new BinaryReader(File.Open(ii.fullpath, FileMode.Open));
            byte[] bytes = new byte[br.BaseStream.Length];
            br.Read(bytes, 0, (int)br.BaseStream.Length);
            br.Close();
            fui.bits = bytes;

            try
            {
                FileUploadReturnInfo retval = si.conn.UploadFile(0, si.username, si.password, fui);
                return retval;
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return null;
            }
        }