Esempio n. 1
0
        public ConfigEditor(string PrettyFile)
        {
#if DEBUG
            System.Threading.Thread.CurrentThread.Name = "ConfigEditor";
#endif

            Application.EnableVisualStyles();
            Application.DoEvents();

            this.PrettyFile = PrettyFile;

            InitializeComponent();

            this.Text = PrettyFile + " - Config Editor";

            string FileContents = null;
            try
            {
                System.IO.Stream       dfss = new MySpace.DataMining.DistributedObjects.DfsStream(PrettyFile);
                System.IO.StreamReader sr   = new System.IO.StreamReader(dfss);
                FileContents = sr.ReadToEnd();
                sr.Close();
                dfss.Close();
            }
            catch (System.IO.FileNotFoundException)
            {
                IsNewFile = true;
            }

            if (IsNewFile)
            {
                string ctemp = "";
                {
                    string jobname = PrettyFile;
                    {
                        int ilslash = jobname.LastIndexOf('/'); // Cuts off dfs:// or a dir.
                        if (-1 != ilslash)
                        {
                            jobname = jobname.Substring(ilslash + 1);
                        }
                    }
                    {
                        int ildot = jobname.LastIndexOf('.');
                        if (-1 != ildot)
                        {
                            jobname = jobname.Substring(0, ildot);
                        }
                    }
                    ctemp = "";
                }
                Doc.Text     = ctemp;
                Doc.Modified = true; // !

                SetStatus("New Jobs");
            }
            else
            {
                Doc.Text     = FileContents;
                Doc.Modified = false; // !

                if (IsReadOnly)
                {
                    //Doc.IsReadOnly = IsReadOnly;
                    Doc.IsReadOnly = true;

                    SaveBtn.Enabled = false;

                    SetStatus("Read-only", 300);
                }
                else
                {
                    SetStatus("Open", 300);
                }
            }

            Doc.UndoRedo.EmptyUndoBuffer(); // !
        }
Esempio n. 2
0
        public ConfigEditor(string PrettyFile)
        {
#if DEBUG
            System.Threading.Thread.CurrentThread.Name = "ConfigEditor";
#endif

            Application.EnableVisualStyles();
            Application.DoEvents();

            this.PrettyFile = PrettyFile;

            InitializeComponent();

            this.Text = PrettyFile + " - Config Editor";

            string FileContents = null;
            try
            {
                System.IO.Stream dfss = new MySpace.DataMining.DistributedObjects.DfsStream(PrettyFile);
                System.IO.StreamReader sr = new System.IO.StreamReader(dfss);
                FileContents = sr.ReadToEnd();
                sr.Close();
                dfss.Close();
            }
            catch (System.IO.FileNotFoundException)
            {
                IsNewFile = true;
            }

            if (IsNewFile)
            {
                string ctemp = "";
                {
                    string jobname = PrettyFile;
                    {
                        int ilslash = jobname.LastIndexOf('/'); // Cuts off dfs:// or a dir.
                        if (-1 != ilslash)
                        {
                            jobname = jobname.Substring(ilslash + 1);
                        }
                    }
                    {
                        int ildot = jobname.LastIndexOf('.');
                        if (-1 != ildot)
                        {
                            jobname = jobname.Substring(0, ildot);
                        }
                    }
                    ctemp = "";
                }
                Doc.Text = ctemp;
                Doc.Modified = true; // !

                SetStatus("New Jobs");
            }
            else
            {
                Doc.Text = FileContents;
                Doc.Modified = false; // !

                if (IsReadOnly)
                {
                    //Doc.IsReadOnly = IsReadOnly;
                    Doc.IsReadOnly = true;

                    SaveBtn.Enabled = false;

                    SetStatus("Read-only", 300);
                }
                else
                {
                    SetStatus("Open", 300);
                }
            }

            Doc.UndoRedo.EmptyUndoBuffer(); // !

        }