コード例 #1
0
ファイル: Form1.cs プロジェクト: mustnap/DMS-Viewer
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Data Mover Data Files|*.dat;*.DAT";
            var result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                currentDmsPath = openFileDialog1.FileName;

                Stopwatch sw = new Stopwatch();
                sw.Start();
                try
                {
                    dmsFile = DMSReader.Read(currentDmsPath);
                }
                catch (FormatException fe)
                {
                    MessageBox.Show(this, fe.Message, "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                toolStripStatusLabel1.Text = "File: " + currentDmsPath;
                /* Set the file name */
                dmsFile.FileName = new FileInfo(currentDmsPath).Name;

                sw.Stop();

                UpdateUI();
                tableList.Items[0].Selected = true;
            }
        }
コード例 #2
0
        private void GetDATFile(bool isLeft)
        {
            openFileDialog1.Filter = @"Data Mover Data Files|*.dat;*.DAT";
            var result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                DMSFile dmsFile = null;

                try
                {
                    dmsFile = DMSReader.Read(openFileDialog1.FileName);
                }catch (FormatException fe)
                {
                    MessageBox.Show(this, fe.Message, "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                /* Set the file name */
                dmsFile.FileName = new FileInfo(openFileDialog1.FileName).Name;

                if (isLeft)
                {
                    leftFile = dmsFile;
                    leftPath = openFileDialog1.FileName;
                }
                else
                {
                    rightFile = dmsFile;
                    rightPath = openFileDialog1.FileName;
                }
            }
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: githubmarker/DMS-Viewer
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Data Mover Data Files|*.dat;*.DAT";
            var result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                currentDmsPath = openFileDialog1.FileName;

                Stopwatch sw = new Stopwatch();
                sw.Start();
                dmsFile = DMSReader.Read(currentDmsPath);
                sw.Stop();

                UpdateUI();
            }
        }
コード例 #4
0
        public DATCompareDialog(string initialPath)
        {
            InitializeComponent();
            if (initialPath?.Length > 0)
            {
                try
                {
                    leftFile = DMSReader.Read(initialPath);
                }catch (FormatException fe)
                {
                    MessageBox.Show(this, fe.Message, "File Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                leftFile.FileName = new FileInfo(initialPath).Name;
                leftPath          = initialPath;
            }

            UpdateUI(true);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: cfazzini/DMS-Viewer
        private void openToolStripMenuItem_Click(object sender, EventArgs e)
        {
            openFileDialog1.Filter = "Data Mover Data Files|*.dat;*.DAT";
            var result = openFileDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                currentDmsPath = openFileDialog1.FileName;

                Stopwatch sw = new Stopwatch();
                sw.Start();
                dmsFile = DMSReader.Read(currentDmsPath);
                toolStripStatusLabel1.Text = "File: " + currentDmsPath;
                /* Set the file name */
                dmsFile.FileName = new FileInfo(currentDmsPath).Name;

                sw.Stop();

                UpdateUI();
                tableList.Items[0].Selected = true;
            }
        }
コード例 #6
0
ファイル: DMSRebuilder.cs プロジェクト: mustnap/DMS-Viewer
        private static void RebuildFiles(List <string> files, string outputFolder, string scriptName)
        {
            Console.WriteLine("  Beginning rebuild of " + files.Count + " files.");

            Dictionary <string, List <string> > results = new Dictionary <string, List <string> >();
            FileStream   fs = new FileStream(outputFolder + Path.DirectorySeparatorChar + scriptName + "_EXP.dms", FileMode.Create, FileAccess.Write, FileShare.None);
            StreamWriter sw = new StreamWriter(fs);

            foreach (var file in files)
            {
                DMSFile dmsFile = null;
                try
                {
                    dmsFile = DMSReader.Read(file);
                }catch (FormatException fe)
                {
                    /* invalid DAT file found... skip */
                    continue;
                }
                Console.WriteLine("  Processing file: " + dmsFile.FileName);
                Console.WriteLine("    Table count: " + dmsFile.Tables.Count);
                Console.WriteLine("    Total rows: " + dmsFile.Tables.Sum(t => t.Rows.Count));
                foreach (var table in dmsFile.Tables)
                {
                    if (table.Rows.Count == 0)
                    {
                        continue;
                    }

                    if (results.ContainsKey(table.Name) == false)
                    {
                        results.Add(table.Name, new List <string>());
                    }
                    if (results[table.Name].Contains(table.WhereClause) == false)
                    {
                        results[table.Name].Add(table.WhereClause);
                    }
                }
            }
            Console.WriteLine("  All Files processed, generating unified scripts.");

            sw.WriteLine("-- Rebuilt with DMSUtils -- ");
            sw.WriteLine();
            sw.WriteLine("SET OUTPUT " + scriptName + "_EXP.dat;");
            sw.WriteLine("SET LOG " + scriptName + "_EXP.log;");
            sw.WriteLine("");
            foreach (var key in results.Keys)
            {
                var whereList = results[key];
                whereList.Sort();
                foreach (var where in whereList)
                {
                    if (results[key].Contains("") && where.Equals("") == false)
                    {
                        sw.Write("-- EXPORT " + key);
                    }
                    else
                    {
                        sw.Write("EXPORT " + key);
                    }

                    if (where.Trim().Length != 0)
                    {
                        sw.WriteLine(" WHERE " + where + ";");
                    }
                    else
                    {
                        sw.WriteLine(";");
                    }
                }
                sw.WriteLine();
            }
            sw.Flush();
            sw.Close();

            sw = new StreamWriter(new FileStream(outputFolder + Path.DirectorySeparatorChar + scriptName + "_IMP.dms", FileMode.Create, FileAccess.Write, FileShare.None));
            sw.WriteLine("-- Rebuilt with DMSUtils -- ");
            sw.WriteLine();
            sw.WriteLine("SET INPUT " + scriptName + "_EXP.dat;");
            sw.WriteLine("SET LOG " + scriptName + "_IMP.log;");
            sw.WriteLine();
            foreach (var key in results.Keys)
            {
                sw.WriteLine("IMPORT " + key + ";");
                sw.WriteLine();
            }
            sw.Flush();
            sw.Close();

            Console.WriteLine("Script generation complete.");
        }