예제 #1
0
        /*========================================================*/

        public static FstFile ParseServerFile
        (
            IrbisConnection client,
            string fileName
        )
        {
            FstFile result = new FstFile();

            FileSpecification specification = new FileSpecification
                                              (
                IrbisPath.MasterFile,
                fileName
                                              );
            string content = client.ReadTextFile(specification);

            content = content.Replace("\r", string.Empty);
            foreach (string textLine in content.Split
                     (
                         new[] { '\n' },
                         StringSplitOptions.RemoveEmptyEntries
                     ))
            {
                FstLine fstLine = FstLine.ParseLine(textLine);
                if (fstLine != null)
                {
                    result.Lines.Add(fstLine);
                }
            }

            return(result);
        }
예제 #2
0
        public static IrbisUpperCaseTable FromServer
        (
            [NotNull] IrbisConnection connection,
            [NotNull] string fileName
        )
        {
            Sure.NotNull(connection, "connection");
            Sure.NotNullNorEmpty(fileName, "fileName");

            FileSpecification specification
                = new FileSpecification
                  (
                      IrbisPath.System,
                      fileName
                  );

            string text = connection.ReadTextFile
                          (
                specification
                          );

            if (string.IsNullOrEmpty(text))
            {
                Log.Error
                (
                    "IrbisUpperCaseTable::FromServer: "
                    + "no file "
                    + fileName.ToVisibleString()
                );

                throw new IrbisNetworkException
                      (
                          "No file " + fileName
                      );
            }

            IrbisUpperCaseTable result = ParseText
                                         (
                IrbisEncoding.Ansi,
                text
                                         );

            return(result);
        }
예제 #3
0
        public void ReadFile_NonExistent()
        {
            IrbisConnection connection
                = Connection.ThrowIfNull("Connection");

            string text = connection.ReadTextFile
                          (
                IrbisPath.MasterFile,
                "NOTEXIST.MNU"
                          );

            Write
            (
                IrbisFormat.PrepareFormat
                (
                    text
                )
                .Trim()
            );
        }
예제 #4
0
        public void ReadFile_Existent()
        {
            IrbisConnection connection
                = Connection.ThrowIfNull("Connection");

            string text = connection.ReadTextFile
                          (
                IrbisPath.MasterFile,
                "II.MNU"
                          );

            Write
            (
                IrbisFormat.PrepareFormat
                (
                    text.Substring(0, 50)
                )
                .Trim()
            );
        }