Example #1
0
 public Versions(ApplicationInterface application, Form parentForm, String selectedhref)
 {
     this.parentForm = parentForm;
     this.application = application;
     this.selectedhref = selectedhref;
     InitializeComponent();
 }
Example #2
0
        public NSave(ApplicationInterface application)
        {
            InitializeComponent();

            this.application = application;

            mainControl1.initApps(application, this);

            String fileName = application.getActiveDocumentName();

            box_filename.Text = fileName;
        }
Example #3
0
 public NOpen(ApplicationInterface application)
 {
     this.application = application;
     InitializeComponent();
     mainControl1.initApps(application, this);
 }
Example #4
0
 static void Main(string[] args)
 {
     var _ = new ApplicationInterface();
 }
Example #5
0
 public Search(ApplicationInterface application)
 {
     this.application = application;
     InitializeComponent();
 }
Example #6
0
 public void initApps(ApplicationInterface application, DialogInterface dialog)
 {
     this.application = application;
     this.dialog = dialog;
 }
Example #7
0
        public static Boolean doGetFile(ApplicationInterface appInterface, String href)
        {
            String contexthref = appInterface.getContext().getContextHref();
            href = href.Substring(contexthref.Length);

            String s_p = appInterface.getCacheFolder();;

            int index1 = href.IndexOf(appInterface.getWorkspaceName());

            int index2 = href.LastIndexOf("/");
            String folder = s_p + href.Substring(index1, index2 - index1);
            folder = folder.Replace("/", "\\");

            if (!Directory.Exists(folder))
            {
                try
                {
                    DirectoryInfo dirinfo = Directory.CreateDirectory(folder);
                }
                catch (Exception ee)
                {
                    MessageBox.Show("Can't create temporary directory! Please check file system permissions!");
                    return false;
                }
            }

            String f_name = href.Substring(href.LastIndexOf("/") + 1);
            String FILE_NAME = folder + "\\" + f_name;

            FILE_NAME = FILE_NAME.Replace("?", "%3F");

            DavContext context = appInterface.getContext();
            try
            {
                GetCommand get = new GetCommand(context);

                get.setResourcePath(href);

                int status = get.execute();
                if (status == DavStatus.OK)
                {
                    byte[] resp = get.getResponseBody();

                    if (File.Exists(FILE_NAME))
                    {
                        File.Delete(FILE_NAME);
                    }
                    Thread.Sleep(200);

                    FileStream fs = new FileStream(FILE_NAME, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite);
                    BinaryWriter w = new BinaryWriter(fs);
                    for (long i = 0; i < resp.Length; i++)
                    {
                        w.Write(resp[i]);
                    }
                    w.Close();
                    fs.Close();
                }
                appInterface.setFileNameForOpen(FILE_NAME);
            }
            catch (IOException rr)
            {
                MessageBox.Show("The file seemed to be already opened", "Error",
                    MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return false;
            }
            catch (Exception ed)
            {
                MessageBox.Show("Can't create temporary directory! Please check file system permissions!");
                return false;
            }
            return true;
        }