Esempio n. 1
0
        public override string GetHtml()
        {
            var hg = new HtmlGenerator();

            hg.BeginHtml("s_saved_jobs", HtmlGenerator.HtmlObjectViewStyle);
            hg.Heading("s_saved_jobs", 1);
            foreach (string fn in Directory.GetFiles(Core.JobsDirectory, "*.djb", SearchOption.AllDirectories).Sorted())
            {
                string relfn = IOTool.RelativePathTo(Core.JobsDirectory, fn);
                try
                {
                    Job job = Job.LoadFromFile(fn);
                    hg.Heading(relfn, 2);
                    hg.Write("<a href=\"callback://runjob?job:{0}\">{1}</a>", HttpUtility.UrlEncode(fn), Texts.Get("s_run"));
                    hg.Write(" | <a href=\"callback://deletejob?job:{0}\">{1}</a>", HttpUtility.UrlEncode(fn), Texts.Get("s_delete"));
                    RenderCommand(hg, fn, job.Root);
                    hg.HorizontalRule();
                }
                catch (Exception err)
                {
                    hg.Heading(relfn, 2);
                    hg.Write("{0}:{1}", Texts.Get("s_error"), err.Message);
                }
            }
            hg.EndHtml();
            return(hg.HtmlText);
        }
Esempio n. 2
0
        public override ITreeNode CreateNode(ITreeNode parent)
        {
            var appobj = new FavoriteAppObject {
                FileName = IOTool.RelativePathTo(Core.FavoritesDirectory, m_file.DataDiskPath)
            };

            return(new FavoriteItemTreeNode(parent, this, appobj.LoadHolder()));
        }
Esempio n. 3
0
 public SaveJobForm()
 {
     InitializeComponent();
     foreach (string file in Directory.GetFiles(Core.JobsDirectory, "*.djb", SearchOption.AllDirectories))
     {
         lbxJobs.Items.Add(IOTool.RelativePathTo(Core.JobsDirectory, file));
     }
 }
Esempio n. 4
0
 public void ScheduleJob()
 {
     SystemSchedulerTool.ScheduleTask(
         GetTaskName(),
         System.IO.Path.Combine(Core.ProgramDirectory, "daci.exe"),
         "runjob " + System.IO.Path.ChangeExtension(IOTool.RelativePathTo(Core.JobsDirectory, FileSystemPath), null).Replace("\\", "/")
         );
     CallRefresh();
 }
Esempio n. 5
0
        protected string GetItemName(string file)
        {
            if (file == null)
            {
                return(null);
            }
            string dir     = m_adtype.GetDirectory();
            string relfile = IOTool.RelativePathTo(dir, file);

            return(Path.ChangeExtension(relfile, null));
        }
Esempio n. 6
0
 public static string FileNameToDataTreeName(string filename)
 {
     if (filename == null)
     {
         return(null);
     }
     filename = filename.Replace("/", "\\");
     if (filename != null && IOTool.FileIsInDirectory(filename, Core.DataDirectory))
     {
         return(IOTool.RelativePathTo(Core.DataDirectory, filename).ToLower().Replace("\\", "/"));
     }
     return(null);
 }
Esempio n. 7
0
        public override string CreateHtml(AppObject appobj, ConnectionPack connpack, IDictionary <string, object> outnames)
        {
            var           fav    = (FavoriteAppObject)appobj;
            var           holder = fav.LoadHolder();
            HtmlGenerator gen    = new HtmlGenerator();

            gen.BeginHtml(holder.Name, HtmlGenerator.HtmlObjectViewStyle);
            gen.Heading(holder.Name, 2);
            gen.PropsTableBegin();
            gen.PropTableRow("s_name", IOTool.RelativePathTo(Core.FavoritesDirectory, fav.FileName));
            holder.Favorite.DisplayProps((n, v) => gen.PropTableRow(n, v));
            gen.PropsTableEnd();
            gen.BeginUl();
            gen.Li(String.Format("<a href='callback://open'>{0}</a>", Texts.Get("s_execute")));
            gen.EndUl();
            gen.EndHtml();
            outnames["open"] = (Action) delegate() { holder.Favorite.Open(); };
            return(gen.HtmlText);
        }
Esempio n. 8
0
 private void btbrowse_Click(object sender, EventArgs e)
 {
     if (SelectedDriver == null)
     {
         return;
     }
     if (edfile.Text != "")
     {
         openFileDialog1.FileName = Path.Combine(Core.ProgramDirectory, edfile.Text);
     }
     else
     {
         openFileDialog1.InitialDirectory = Core.ProgramDirectory;
     }
     if (openFileDialog1.ShowDialogEx() == DialogResult.OK)
     {
         m_typesLoaded = false;
         edfile.Text   = IOTool.RelativePathTo(Core.ProgramDirectory, openFileDialog1.FileName);
         SelectedDriver.AssemblyPath = edfile.Text;
     }
 }
Esempio n. 9
0
        public List <IVirtualFile> LoadFiles()
        {
            List <IVirtualFile> res = new List <IVirtualFile>();

            if (!Directory.Exists(m_folderPath))
            {
                return(res);
            }
            foreach (string file in Directory.GetFiles(m_folderPath))
            {
                if (IOTool.FileIsLink(file))
                {
                    if (!IOTool.FileLinkExists(file))
                    {
                        continue;
                    }
                }
                res.Add(new DiskFile(m_fileSystem, IOTool.RelativePathTo(m_fileSystem.RootPath, file)));
            }
            return(res);
        }
Esempio n. 10
0
        public LoadJobCommandForm(Func <JobCommand, bool> filter)
        {
            InitializeComponent();

            m_filter = filter;

            foreach (string file in Directory.GetFiles(Core.JobsDirectory, "*.djb", SearchOption.AllDirectories))
            {
                var job = Job.LoadFromFile(file);
                foreach (var cmd in job.GetAllCommands())
                {
                    if (m_filter != null && !m_filter(cmd))
                    {
                        continue;
                    }
                    var item = listView1.Items.Add(IOTool.RelativePathTo(Core.JobsDirectory, file));
                    item.SubItems.Add(cmd.ToString());
                    item.Tag = new JobCommandWithConnection {
                        Command = cmd, Connection = new JobConnection(file)
                    };
                }
            }
        }
Esempio n. 11
0
        void ReloadConnections()
        {
            lsvConnections.BeginUpdate();
            lsvConnections.ListViewItemSorter = null;
            m_plannedReload = false;
            var groups = new List <string>();
            IPhysicalConnection selected = SelectedConnection;

            lsvConnections.Items.Clear();
            ListViewItem selitem = null;

            foreach (var conn in ConnectionRegister.GetConnections())
            {
                if (!conn.WasUsed)
                {
                    continue;
                }
                if (cbxType.SelectedIndex == 1 && !conn.IsOpened)
                {
                    continue;
                }
                if (!groups.Contains(conn.GetConnKey()))
                {
                    groups.Add(conn.GetConnKey());
                }
                var item = lsvConnections.Items.Add(conn.ToString());
                item.SubItems.Add(conn.IsOpened ? "Opened" : "Closed");
                if (conn.Owner != null)
                {
                    item.SubItems.Add(conn.Owner.ToString());
                }
                else
                {
                    item.SubItems.Add("");
                }
                if (conn.StoredConnection != null && conn.StoredConnection.FileName != null)
                {
                    item.SubItems.Add(IOTool.RelativePathTo(Core.DataDirectory, conn.StoredConnection.FileName));
                }
                else
                {
                    item.SubItems.Add("");
                }
                if (conn.Dialect != null)
                {
                    item.SubItems.Add(conn.Dialect.ToString());
                }
                else
                {
                    item.SubItems.Add("");
                }
                item.SubItems.Add((groups.IndexOf(conn.GetConnKey()) + 1).ToString());
                item.Tag = conn;
                if (selected == conn)
                {
                    item.Selected = true;
                    item.Focused  = true;
                    selitem       = item;
                }
                var state = conn.GetExtendedState();
                item.SubItems.Add(state.QueueLength.ToString());
                item.SubItems.Add(state.ProcessedOkQElements.ToString());
                item.SubItems.Add(state.ProcessedFailQElements.ToString());
            }
            if (selitem != null)
            {
                lsvConnections.EnsureVisible(selitem.Index);
            }
            lsvConnections.EndUpdate();
        }
Esempio n. 12
0
 protected DiskPathBase(string path)
 {
     m_fileSystem = DiskFileSystem.GetForRoot(Path.GetPathRoot(path));
     m_path       = IOTool.RelativePathTo(m_fileSystem.RootPath, path);
 }