Beispiel #1
0
        private void bbEditBook_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            if (_libraryDataAccess == null)
            {
                MessageBox.Show("Load data first");
            }
            else
            {
                LibraryDataSet.BookRow bookRow = viewBooks.GetFocusedDataRow() as LibraryDataSet.BookRow;
                if (bookRow == null)
                {
                    return;
                }

                LibraryDataSet libraryDSCopy = libraryDS.Copy() as LibraryDataSet;
                bookRow = libraryDSCopy.Book.FindById(bookRow.Id);

                if (bookRow == null)
                {
                    return;
                }

                using (FrmEditBook showEdit = new FrmEditBook(libraryDSCopy, bookRow))
                {
                    showEdit.ShowInTaskbar = false;
                    DialogResult result = showEdit.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        libraryDS.Merge(libraryDSCopy);
                    }
                }
            }
        }
Beispiel #2
0
        public Report_Order(LibraryDataSet libraryDataSet, int yr)
        {
            InitializeComponent();
            ReportOrderDS rods = ldas.SelectBooksOrder(yr) as ReportOrderDS;

            this.DataSource = rods;

            if (rods.Order.Count == 0)
            {
                this.beforeYearLabel.Text = "All books are before " + yr.ToString() + "." + System.Environment.NewLine;
                this.txtInfo.DataBindings.Clear();
                this.txtInfo.Text         = " This means " + ldas.SelectLastBooks(Int32.MaxValue).Book.Count + " books. ";
                this.afterYearLabel.Text  = "There are no books in the year " + yr.ToString() + " or after ";
                this.txtTitle.Visible     = false;
                this.txtAuthor.Visible    = false;
                this.txtPublisher.Visible = false;
                this.txtYear.Visible      = false;
                this.bookTable.Visible    = false;
            }
            else
            {
                this.beforeYearLabel.Text = "Books before " + yr.ToString() + ":";
                this.afterYearLabel.Text  = "Books in " + yr.ToString() + " or after:";
            }
        }
Beispiel #3
0
 public FrmAddBook(LibraryDataSet libraryDS)
 {
     InitializeComponent();
     ds  = libraryDS.Clone() as LibraryDataSet;
     lds = libraryDS;
     lookUpAuthor.Properties.DataSource = lds.Author;
     gridChapter.DataSource             = ds.Chapter;
 }
Beispiel #4
0
        public override global::System.Data.DataSet Clone()
        {
            LibraryDataSet cln = ((LibraryDataSet)(base.Clone()));

            cln.InitVars();
            cln.SchemaSerializationMode = this.SchemaSerializationMode;
            return(cln);
        }
Beispiel #5
0
        public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs)
        {
            LibraryDataSet ds = new LibraryDataSet();

            global::System.Xml.Schema.XmlSchemaComplexType type     = new global::System.Xml.Schema.XmlSchemaComplexType();
            global::System.Xml.Schema.XmlSchemaSequence    sequence = new global::System.Xml.Schema.XmlSchemaSequence();
            global::System.Xml.Schema.XmlSchemaAny         any      = new global::System.Xml.Schema.XmlSchemaAny();
            any.Namespace = ds.Namespace;
            sequence.Items.Add(any);
            type.Particle = sequence;
            global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
            if (xs.Contains(dsSchema.TargetNamespace))
            {
                global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
                global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
                try {
                    global::System.Xml.Schema.XmlSchema schema = null;
                    dsSchema.Write(s1);
                    for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext();)
                    {
                        schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                        s2.SetLength(0);
                        schema.Write(s2);
                        if ((s1.Length == s2.Length))
                        {
                            s1.Position = 0;
                            s2.Position = 0;
                            for (; ((s1.Position != s1.Length) &&
                                    (s1.ReadByte() == s2.ReadByte()));)
                            {
                                ;
                            }
                            if ((s1.Position == s1.Length))
                            {
                                return(type);
                            }
                        }
                    }
                }
                finally {
                    if ((s1 != null))
                    {
                        s1.Close();
                    }
                    if ((s2 != null))
                    {
                        s2.Close();
                    }
                }
            }
            xs.Add(dsSchema);
            return(type);
        }
Beispiel #6
0
        public LibraryDataSet GetAllData(SourceType sourceType, string targetFile)
        {
            this.getSourceType = sourceType;
            this.targetFile    = targetFile;

            if (sourceType == SourceType.XML)
            {
                this.libraryDataSet.ReadXml(targetFile);
                return(libraryDataSet);
            }

            this.libraryTables = new DataTable[]
            {
                this.libraryDataSet.Items,
                this.libraryDataSet.Authors,
                this.libraryDataSet.Books,
                this.libraryDataSet.Borrows,
                this.libraryDataSet.Copies,
                this.libraryDataSet.Magazines,
                this.libraryDataSet.Articles,
                this.libraryDataSet.ArticlesInMagazines,
                this.libraryDataSet.Users
            };
            this.tablesNames = new string[] { "Items", "Authors", "Books", "Borrows", "Copies",
                                              "Magazines", "Articles", "ArticlesInMagazines", "Users" };

            this.libraryDataAdapters = new SqlDataAdapter[tablesNames.Length];

            SqlConnection connection = new SqlConnection(targetFile);

            for (int i = 0; i < tablesNames.Length; i++)
            {
                this.libraryDataAdapters[i] = new SqlDataAdapter("SELECT * FROM" + this.tablesNames[i], connection);

                SqlCommandBuilder commandBLD = new SqlCommandBuilder(libraryDataAdapters[i]);
            }
            try
            {
                for (int i = 0; i < libraryDataAdapters.Length; i++)
                {
                    libraryDataAdapters[i].Fill(libraryTables[i]);
                }
            }
            catch
            {
                this.libraryDataSet = null;
            }

            return(libraryDataSet);
        }
 public void WriteLibraryEditChapter(LibraryDataSet ds)
 {
     using (chapterDA.UpdateCommand.Connection = new SqlConnection(connection_string))
     {
         chapterDA.UpdateCommand.Connection.Open();
         try
         {
             chapterDA.Update(ds.Chapter.Select(null, null, DataViewRowState.ModifiedCurrent));
         }
         catch (SqlException)
         {
             MessageBox.Show("Error: Could not modify database. Try again!");
         }
     }
 }
 public void WriteLibraryInsertBook(LibraryDataSet ds)
 {
     using (bookDA.InsertCommand.Connection = new SqlConnection(connection_string))
     {
         bookDA.InsertCommand.Connection.Open();
         try
         {
             bookDA.Update(ds.Book.Select(null, null, DataViewRowState.Added));
         }
         catch (SqlException)
         {
             MessageBox.Show("Error: Could not modify database. Try again!");
         }
     }
 }
Beispiel #9
0
 private void bbBookTimeline_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (_libraryDataAccess == null)
     {
         MessageBox.Show("Load data first");
     }
     else
     {
         LibraryDataSet libraryDSCopy = libraryDS.Copy() as LibraryDataSet;
         using (FrmChooseYear fcy = new FrmChooseYear(libraryDSCopy))
         {
             fcy.ShowInTaskbar = false;
             fcy.ShowDialog();
         }
     }
 }
 public void WriteLibraryDeleteChapter(LibraryDataSet ds)
 {
     using (SqlConnection connection = new SqlConnection(connection_string))
     {
         connection.Open();
         UpdateAdapters(connection);
         try
         {
             chapterDA.Update(ds.Chapter.Select(null, null, DataViewRowState.Deleted));
         }
         catch (SqlException)
         {
             MessageBox.Show("Error: Could not modify database. Try again!");
         }
     }
 }
        public LibraryDataSet ReadLibraryData()
        {
            LibraryDataSet libraryDS = new LibraryDataSet();

            using (SqlConnection connection = new SqlConnection(connection_string))
            {
                connection.Open();
                InitializeAdapters();
                UpdateAdapters(connection);

                authorDA.Fill(libraryDS.Author);
                bookDA.Fill(libraryDS.Book);
                chapterDA.Fill(libraryDS.Chapter);
            }

            return(libraryDS);
        }
        public void WriteData(LibraryDataSet ds)
        {
            using (SqlConnection connection = new SqlConnection(connection_string))
            {
                connection.Open();
                InitializeAdapters();
                UpdateAdapters(connection);

                WriteLibraryInsertAuthor(ds);
                WriteLibraryInsertBook(ds);
                WriteLibraryInsertChapter(ds);
                WriteLibraryEditAuthor(ds);
                WriteLibraryEditBook(ds);
                WriteLibraryEditChapter(ds);
                WriteLibraryDeleteBook(ds);
                WriteLibraryDeleteAuthor(ds);
            }
        }
Beispiel #13
0
        public FrmEditBook(LibraryDataSet _libraryDS, LibraryDataSet.BookRow bookRow)
        {
            InitializeComponent();
            libraryDS = _libraryDS;
            bkr       = bookRow;
            if (bookRow != null)
            {
                txtTitle.EditValue                 = bookRow.Title;
                txtYear.EditValue                  = bookRow.Year.ToString();
                txtPublisher.EditValue             = bookRow.Publisher;
                lookUpAuthor.Properties.DataSource = libraryDS.Author;

                lookUpAuthor.EditValue = bookRow.AuthorRow.Id;

                int bookId = bookRow.Id;
                gridChapters.DataSource = libraryDS.Chapter.Where(row => row.IdBook == bookId).AsDataView();
            }
        }
 public void WriteLibraryInsertAuthor(LibraryDataSet libraryDS)
 {
     libraryDS.EnforceConstraints = false;
     using (authorDA.InsertCommand.Connection = new SqlConnection(connection_string))
     {
         authorDA.InsertCommand.Connection.Open();
         try
         {
             authorDA.Update(libraryDS.Author.Select(null, null, DataViewRowState.Added));
         }
         catch (SqlException)
         {
             MessageBox.Show("Error: Could not modify database. Try again!");
         }
         finally
         {
             libraryDS.EnforceConstraints = true;
         }
     }
 }
Beispiel #15
0
 private void bbAddBook_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     if (_libraryDataAccess == null)
     {
         MessageBox.Show("Load data first");
     }
     else
     {
         LibraryDataSet libraryDSCopy = libraryDS.Copy() as LibraryDataSet;
         using (FrmAddBook show = new FrmAddBook(libraryDSCopy))
         {
             show.ShowInTaskbar = false;
             DialogResult result = show.ShowDialog();
             if (result == DialogResult.OK)
             {
                 libraryDS.Merge(libraryDSCopy);
             }
         }
     }
 }
Beispiel #16
0
        private void ReportForm_Load(object sender, EventArgs e)
        {
            WindowState = FormWindowState.Maximized;

            LibraryDataSet dataSet = new LibraryDataSet();

            switch (reportType)
            {
            case BOOK_ASSESSMENT_REPORT:
                var bookAdapter = new LibraryDataSetTableAdapters.BookAssessmentListTableAdapter();
                bookAdapter.Fill(dataSet.BookAssessmentList);

                BookAssessmentReport bookReport = new BookAssessmentReport();
                bookReport.SetDataSource(dataSet);
                reportViewer.ReportSource = bookReport;
                break;

            case MEMBER_DETAIL_REPORT:
                var memberAdapter = new LibraryDataSetTableAdapters.MemberDetailListTableAdapter();
                memberAdapter.Fill(dataSet.MemberDetailList);

                MemberDetailReport memberReport = new MemberDetailReport();
                memberReport.SetDataSource(dataSet);
                reportViewer.ReportSource = memberReport;
                break;

            case CHART_REPORT:
                var subjectAdapter = new LibraryDataSetTableAdapters.BooksBySubjectTableAdapter();
                subjectAdapter.Fill(dataSet.BooksBySubject);

                ChartReport chartReport = new ChartReport();
                chartReport.SetDataSource(dataSet);
                reportViewer.ReportSource = chartReport;
                break;

            default:
                break;
            }
        }
Beispiel #17
0
        public FrmShowBook(LibraryDataSet bookSet, LibraryDataSet.BookRow bookRow)
        {
            InitializeComponent();

            if (bookRow != null)
            {
                txtTitle.EditValue     = bookRow.Title;
                txtYear.EditValue      = bookRow.Year.ToString();
                txtPublisher.EditValue = bookRow.Publisher;
                String author = "none";
                foreach (LibraryDataSet.AuthorRow authrow in bookSet.Author)
                {
                    if (authrow.Id == bookRow.IdAuthor)
                    {
                        author = authrow.FirstName + " " + authrow.LastName;
                    }
                }
                txtAuthor.EditValue = author;
                int bookId = bookRow.Id;

                gridShowChapter.DataSource = bookSet.Chapter.Where(row => row.IdBook == bookId).AsDataView();
            }
        }
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     LibraryDataSet ds = new LibraryDataSet();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
 public FrmChooseAuthor(LibraryDataSet libraryDataSet)
 {
     InitializeComponent();
     libraryDS = libraryDataSet;
     lookUpAuthor.Properties.DataSource = libraryDS.Author;
 }
Beispiel #20
0
        private static void Run(TextWriter logFile)
        {
            Log.LogWriters.Add(Console.Out);

            if (logFile != null)
            {
                Log.LogWriters.Add(logFile);
            }


            var openSimBinPath = OpenOpenSimBinPath();


            var firestormScriptLibraries = OpenFirestormScriptLibrarys();


            IDocumentationProvider docProvider = null;


            foreach (var lib in firestormScriptLibraries)
            {
                var p = new FirestormDocumentationScraper(lib);
                if (docProvider == null)
                {
                    docProvider = p;
                }
                else
                {
                    docProvider = new CompoundDocumentationScraper(docProvider, p);
                }
            }


            var llsdKeywordsFile = OpenKeywordsFile();


            if (docProvider == null)
            {
                docProvider = new LLSDDocumentationScraper(llsdKeywordsFile);
            }
            else
            {
                docProvider = new CompoundDocumentationScraper(docProvider, new LLSDDocumentationScraper(llsdKeywordsFile));
            }


            var llsdData = new LLSDLibraryData(llsdKeywordsFile, new[] { "lsl" });



            var openSimLibraryReflectedTypeData = new OpenSimLibraryReflectedTypeData(openSimBinPath);

            var openSimData = new OpenSimDirectLibraryData(openSimLibraryReflectedTypeData);


            openSimData.IncludeScriptConstantContainerClass(openSimLibraryReflectedTypeData.ScriptBaseClass, new[] { "os-lsl" });
            openSimData.IncludeFunctionContainingInterface("ICM_Api", new[] { "os-country" });
            openSimData.IncludeFunctionContainingInterface("ILS_Api", new[] { "os-lightshare" });
            openSimData.IncludeFunctionContainingInterface("ILSL_Api", new[] { "os-lsl" });
            openSimData.IncludeFunctionContainingInterface("IOSSL_Api", new[] { "ossl" });
            openSimData.IncludeFunctionContainingInterface("IMOD_Api", new[] { "os-mod-api" });
            openSimData.IncludeAttributedModuleClass("ExtendedPhysics", new[] { "os-bullet-physics" });
            openSimData.IncludeAttributedModuleClass("JsonStoreScriptModule", new[] { "os-json-store" });

            //no longer has a script invocation attribute, so its there but wont be detected.
            //stuff like this is why the scraper program is so ugly and I don't spend to much time improving it.
            //openSimData.IncludeAttributedModuleClass("TempAttachmentsModule", new[] { "os-attach-temp" });



            var openSim = new LibraryDataSet(openSimData);

            //meh
            openSim.FunctionSet.Add(new LSLLibraryFunctionSignature(LSLType.Integer, "llAttachToAvatarTemp",
                                                                    new[] { new LSLParameterSignature(LSLType.Integer, "attachmentPoint", false) }));


            var activeLibrarySubsets = SubsetDescriptions.Select(x => x.Subset).ToList();


            var provider = new LSLXmlLibraryDataProvider(activeLibrarySubsets);

            provider.AddSubsetDescriptions(SubsetDescriptions);



            var wikiData = new SecondlifeWikiLibraryData(new[] { "lsl" });


            foreach (var func in wikiData.LSLFunctions())
            {
                Log.WriteLineWithHeader("[NOTICE, LSL WIKI FUNCTION ADDED]:",
                                        "The function {0}; was found on the LSL Wiki that was in not in the current set of functions, adding it.",
                                        func.SignatureString);


                IReadOnlyGenericArray <LSLLibraryFunctionSignature> overloads;
                if (openSim.OverloadsHashMap.TryGetValue(func.Name, out overloads))
                {
                    if (overloads.Any(x => x.SignatureEquivalent(func)))
                    {
                        func.Subsets.Add("os-lsl");
                    }
                }

                func.DocumentationString = docProvider.DocumentFunction(func);
                provider.DefineFunction(func);
            }


            foreach (var con in openSim.LSLFunctions())
            {
                var x = provider.GetLibraryFunctionSignatures(con.Name);

                if (x != null && x.Any(y => y.SignatureEquivalent(con)))
                {
                    continue;
                }

                con.DocumentationString = docProvider.DocumentFunction(con);


                provider.DefineFunction(con);
            }

            //the wiki is just wrong, the constant values are wrong there to much for comfort.
            foreach (var con in llsdData.LSLConstants())
            {
                if (openSim.LSLConstantExist(con.Name))
                {
                    var consant = openSim.LSLConstant(con.Name);

                    if (consant.Type == con.Type && consant.ValueString == con.ValueString)
                    {
                        con.Subsets.Add("os-lsl");
                    }
                }

                Log.WriteLineWithHeader("[NOTICE, LSL WIKI CONSTANT ADDED]:",
                                        "The constant {0}; was found on the LSL Wiki that was not in the current set of constants, adding it.",
                                        con.SignatureString);

                con.DocumentationString = docProvider.DocumentConstant(con);
                provider.DefineConstant(con);
            }


            foreach (var con in openSim.LSLConstants())
            {
                var consant = provider.GetLibraryConstantSignature(con.Name);
                if (consant != null)
                {
                    if (consant.Type == con.Type && consant.ValueString == con.ValueString)
                    {
                        continue;
                    }
                }

                con.DocumentationString = docProvider.DocumentConstant(con);
                provider.DefineConstant(con);
            }



            foreach (var ev in wikiData.LSLEvents())
            {
                Log.WriteLineWithHeader("[NOTICE, LSL WIKI EVENT ADDED]:",
                                        "The event {0}; was found on the LSL Wiki that was not in the current set of events, adding it.",
                                        ev.SignatureString);


                if (openSimLibraryReflectedTypeData.EventNames.Contains(ev.Name))
                {
                    ev.Subsets.AddSubsets("os-lsl");
                }


                ev.DocumentationString = docProvider.DocumentEvent(ev);
                provider.DefineEventHandler(ev);
            }


            foreach (var c in llsdData.LSLFunctions())
            {
                if (provider.LibraryFunctionExist(c.Name))
                {
                    continue;
                }

                if (openSim.LSLFunctionExist(c.Name))
                {
                    var overloads = openSim.LSLFunctionOverloads(c.Name).Where(x => x.ParameterCount == c.ParameterCount).ToList();

                    if (overloads.Any())
                    {
                        var osFunc = overloads.First();

                        c.Subsets.AddSubsets(osFunc.Subsets);
                        c.ModInvoke = osFunc.ModInvoke;
                    }
                }

                provider.DefineFunction(c);
            }


            foreach (var c in llsdData.LSLEvents())
            {
                if (provider.EventHandlerExist(c.Name))
                {
                    continue;
                }

                if (openSimLibraryReflectedTypeData.EventNames.Contains(c.Name))
                {
                    c.Subsets.AddSubsets("os-lsl");
                }

                provider.DefineEventHandler(c);
            }



            foreach (var c in openSim.LSLConstants().Where(x => !provider.LibraryConstantExist(x.Name)))
            {
                Log.WriteLineWithHeader("[NOTICE, OPENSIM CONSTANT ADDED]:",
                                        "The constant {0}; was found in the OpenSim binaries but was not in the current set of constants, adding it to the current set of data.",
                                        c.SignatureString);

                c.DocumentationString = docProvider.DocumentConstant(c);
                provider.DefineConstant(c);
            }



            MessageBox.Show("Select a place to save the generated LibLSLCC library data.",
                            "Select Library Data Save Path", MessageBoxButtons.OK, MessageBoxIcon.Information);

retrySave:



            var libraryDataWritterSettings = new XmlWriterSettings
            {
                Indent      = true,
                Encoding    = Encoding.Unicode,
                CloseOutput = true
            };


            var saveGeneratedLibraryDataDialog = new SaveFileDialog
            {
                CreatePrompt    = true,
                Filter          = "Library Data (*.xml) | *.xml",
                OverwritePrompt = true,
                Title           = "Select a place to save the library data",
                FileName        = "LibLSLCC_LibraryData.xml"
            };

            string libraryDataOutputFilePath = null;

            if (saveGeneratedLibraryDataDialog.ShowDialog() != DialogResult.OK || string.IsNullOrWhiteSpace(saveGeneratedLibraryDataDialog.FileName))
            {
                var dialogResult =
                    MessageBox.Show(
                        "Are you sure you wish to discard the generated library data? you did not select a file to save it in.",
                        "Discard Data?", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);

                if (dialogResult == DialogResult.No)
                {
                    goto retrySave;
                }
            }
            else
            {
                libraryDataOutputFilePath = saveGeneratedLibraryDataDialog.FileName;

                using (var file = XmlWriter.Create(saveGeneratedLibraryDataDialog.OpenFile(), libraryDataWritterSettings))
                {
                    provider.WriteXml(file, true);
                }
            }



            var runDiffDialogResult =
                MessageBox.Show(
                    "Would you like to DIFF the generated data with another set of LibLSLCC Library Data? (The data you just generated will be the 'Left' file).",
                    "Run Library Data DIFF", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (runDiffDialogResult == DialogResult.No)
            {
                return;
            }



            MessageBox.Show("Select a LibLSLCC Library Data XML File to be on the Right side of the DIFF.", "Select the 'Right' Library File",
                            MessageBoxButtons.OK, MessageBoxIcon.Information);



retrySelectRightDiffOutput:

            var selectRightDialog = new OpenFileDialog
            {
                Filter          = "LibLSLCC Library Data (*.xml) | *.xml",
                CheckFileExists = true,
                Title           = "Select a LibLSLCC Library data file"
            };



            if (selectRightDialog.ShowDialog() != DialogResult.OK || string.IsNullOrWhiteSpace(selectRightDialog.FileName))
            {
                var dialogResult =
                    MessageBox.Show(
                        "You must select a LibLSLCC Library data file to be on the right side of the DIFF, " +
                        "click Retry to select again or Cancel to exit the program.",
                        "File Required", MessageBoxButtons.RetryCancel, MessageBoxIcon.Stop);

                if (dialogResult == DialogResult.Retry)
                {
                    goto retrySelectRightDiffOutput;
                }

                return;
            }


            var rightDiffLibraryDataProvider = new LSLXmlLibraryDataProvider(activeLibrarySubsets);

            rightDiffLibraryDataProvider.AddSubsetDescriptions(SubsetDescriptions);


            using (var file = XmlReader.Create(selectRightDialog.OpenFile(),
                                               new XmlReaderSettings {
                CloseInput = true
            }))
            {
                rightDiffLibraryDataProvider.FillFromXml(file);
            }

            var diff = new LibraryDataDiff(provider, rightDiffLibraryDataProvider, SubsetDescriptions);

            diff.Diff();


            var saveNotRightButInLeft =
                MessageBox.Show(
                    "Would you like to save a library data file representing what was in the generated data, but not in the Right DIFF File?",
                    "Save Added Library Element Data", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (saveNotRightButInLeft == DialogResult.Yes)
            {
retryNotInRightSave:

                var saveFileLibraryData = new SaveFileDialog
                {
                    CreatePrompt    = true,
                    Filter          = "LibLSLCC Library Data (*.xml) | *.xml",
                    OverwritePrompt = true,
                    Title           = "Select a place to save the added library elements data.",
                    FileName        = "GeneratedDataNotIn_" + selectRightDialog.SafeFileName
                };

                if (libraryDataOutputFilePath != null)
                {
                    saveFileLibraryData.FileName =
                        "DataIn_"
                        + Path.GetFileNameWithoutExtension(libraryDataOutputFilePath) +
                        "_ButNotIn_"
                        + selectRightDialog.SafeFileName;
                }
                else
                {
                    saveFileLibraryData.FileName =
                        "DataIn_GeneratedData_ButNotIn_" + selectRightDialog.SafeFileName;
                }


                if (saveFileLibraryData.ShowDialog() != DialogResult.OK || string.IsNullOrWhiteSpace(saveFileLibraryData.FileName))
                {
                    var dialogResult =
                        MessageBox.Show(
                            "Are you sure you wish to discard the DIFF file representing elements added to the generated library data? " +
                            "you did not select a file to save it in.",
                            "Discard Data?", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);

                    if (dialogResult == DialogResult.No)
                    {
                        goto retryNotInRightSave;
                    }
                }
                else
                {
                    using (var file = XmlWriter.Create(saveFileLibraryData.OpenFile(), libraryDataWritterSettings))
                    {
                        diff.NotInRight.WriteXml(file, true);
                    }
                }
            }



            var saveNotLeftButInRight =
                MessageBox.Show(
                    "Would you like to save a library data file representing what was in the Right DIFF file, but not in the generated library data?",
                    "Save Removed Library Element Data", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (saveNotLeftButInRight == DialogResult.Yes)
            {
retryNotInLeftSave:

                var saveFileLibraryData = new SaveFileDialog
                {
                    CreatePrompt    = true,
                    Filter          = "LibLSLCC Library Data (*.xml) | *.xml",
                    OverwritePrompt = true,
                    Title           = "Select a place to save the removed library elements data."
                };

                if (libraryDataOutputFilePath != null)
                {
                    saveFileLibraryData.FileName =
                        "DataIn_"
                        + Path.GetFileNameWithoutExtension(selectRightDialog.SafeFileName) +
                        "_ButNotIn_"
                        + Path.GetFileNameWithoutExtension(libraryDataOutputFilePath) + ".xml";
                }
                else
                {
                    saveFileLibraryData.FileName =
                        "DataIn_"
                        + Path.GetFileNameWithoutExtension(selectRightDialog.FileName) +
                        "_ButNotIn_GeneratedData" + ".xml";
                }

                if (saveFileLibraryData.ShowDialog() != DialogResult.OK || string.IsNullOrWhiteSpace(saveFileLibraryData.FileName))
                {
                    var dialogResult =
                        MessageBox.Show(
                            "Are you sure you wish to discard the DIFF file representing elements removed from the generated library data? " +
                            "you did not select a file to save it in.",
                            "Discard Data?", MessageBoxButtons.YesNo, MessageBoxIcon.Stop);

                    if (dialogResult == DialogResult.No)
                    {
                        goto retryNotInLeftSave;
                    }
                }
                else
                {
                    using (var file = XmlWriter.Create(saveFileLibraryData.OpenFile(), libraryDataWritterSettings))
                    {
                        diff.NotInLeft.WriteXml(file, true);
                    }
                }
            }
        }
Beispiel #21
0
 public DataAccess(SourceType dataType, string targetData)
 {
     libraryDataSet = provider.GetAllData(dataType, targetData);
 }
Beispiel #22
0
 public FrmChooseYear(LibraryDataSet libraryDataSet)
 {
     InitializeComponent();
     libraryDS = libraryDataSet;
 }
Beispiel #23
0
 public Report_Author(LibraryDataSet lds, int id)
 {
     InitializeComponent();
     this.DataSource = ldas.SelectAuthorInfo(id) as AuthorInfo;
 }
Beispiel #24
0
 public FrmAuthor(LibraryDataSet libraryDS)
 {
     InitializeComponent();
     libraryDaS            = libraryDS;
     gridAuthor.DataSource = libraryDaS.Author;
 }