Esempio n. 1
0
        public void MenuFile_LoadLocalFile_1()
        {
            string fileName = Path.Combine
                              (
                TestDataPath,
                "ORG.MNU"
                              );

            MenuFile menu = MenuFile
                            .ParseLocalFile(fileName);

            Assert.AreEqual(9, menu.Entries.Count);

            string actual = menu.GetString("1");

            Assert.AreEqual("RU", actual);
        }
Esempio n. 2
0
        static int Main(string[] args)
        {
            if (args.Length < 1 || args.Length > 2)
            {
                Console.WriteLine("Usage: Mnu2Tre <input> [output]");

                return(1);
            }

            string inputName  = args[0].ThrowIfNull();
            string outputName = args.Length == 1
                ? Path.ChangeExtension(inputName, ".tre")
                : args[1];

            try
            {
                MenuFile menu = MenuFile.ParseLocalFile
                                (
                    inputName,
                    IrbisEncoding.Ansi
                                );
                IrbisTreeFile tree = menu.ToTree();
                tree.SaveToLocalFile
                (
                    outputName,
                    IrbisEncoding.Ansi
                );
            }
            catch (Exception e)
            {
                Console.WriteLine(e);

                return(1);
            }

            return(0);
        }
Esempio n. 3
0
        static void Main()
        {
            try
            {
                _outputBooks = ConfigurationUtility.GetBoolean("books", false);
                string connectionString
                    = IrbisConnectionUtility.GetStandardConnectionString();
                using (_connection = new IrbisConnection(connectionString))
                {
                    _provider = new ConnectedClient(_connection);
                    //_provider = new SemiConnectedClient(_connection);
                    EffectiveReport.Instance = new EffectiveReport(_provider);
                    MenuFile      menu      = MenuFile.ParseLocalFile("ksu.mnu");
                    EffectiveStat totalStat = new EffectiveStat
                    {
                        Description = "Всего по всем КСУ"
                    };
                    bool first = true;

                    foreach (MenuEntry entry in menu.Entries)
                    {
                        if (_outputBooks)
                        {
                            if (!first)
                            {
                                EffectiveReport.AddLine(string.Empty);
                            }

                            first = false;

                            string title = string.Format
                                           (
                                "{0} {1}",
                                entry.Code,
                                entry.Comment
                                           );
                            EffectiveReport.BoldLine(title);
                        }

                        EffectiveStat ksuStat = ProcessKsu(entry);
                        ksuStat.Output(false);
                        totalStat.Add(ksuStat);
                    }

                    EffectiveReport.AddLine(string.Empty);
                    totalStat.Output(false);
                }

                ExcelDriver driver   = new ExcelDriver();
                string      fileName = "output.xlsx";
                FileUtility.DeleteIfExists(fileName);
                driver.OutputFile = fileName;
                EffectiveReport report = EffectiveReport.Instance;
                report.Context.SetDriver(driver);

                report.Render(report.Context);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                throw;
            }
        }