Ejemplo n.º 1
0
        public void Open()
        {
            this.Application = new Excel.Application
            {
                Visible          = false,
                DisplayAlerts    = false,
                AskToUpdateLinks = false
            };
            try
            {
                // テンプレートワークブックのオープン
                this.Template = this.Application.Workbooks.Open(
                    Filename: Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\template.xlsx",
                    UpdateLinks: Excel.XlUpdateLinks.xlUpdateLinksNever,
                    ReadOnly: true,
                    IgnoreReadOnlyRecommended: true
                    );
            }
            catch (Exception)
            {
                throw new ApplicationException("テンプレートファイルを開けませんでした。テンプレートファイルに問題があるか、配置されていません。\r\n実行ファイルと同じディレクトリにtemplate.xlsxを配置して下さい。");
            }

            try
            {
                // コンフィグファイルの読み込み
                this.Config = ConfigSerializer.Deserialize(Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\config.json");
            }
            catch (Exception)
            {
                throw new ApplicationException("設定ファイルを開けませんでした。設定ファイルが正しくないか、配置されていません。\r\n実行ファイルと同じディレクトリにconfig.jsonを配置して下さい。");
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Execute method.
        /// </summary>
        /// <param name="pipe">NamedPipeServerStream</param>
        public override void execute(NamedPipeServerStream pipe)
        {
            ReturnCode       returnCode       = ReturnCode.Success;
            ConfigSerializer configSerializer = new ConfigSerializer();

            byte[] messagebuffer  = new byte[100];
            byte[] originalbuffer = new byte[100];
            int    i = 0;

            do
            {
                pipe.Read(messagebuffer, 0, messagebuffer.Length);
                System.Buffer.BlockCopy(messagebuffer, 0, originalbuffer, i, messagebuffer.Length);
                Array.Resize(ref originalbuffer, originalbuffer.Length + 100);
                messagebuffer = new byte[100];
                i             = i + 100;
            }while (!pipe.IsMessageComplete);

            try
            {
                TypeCobolConfiguration config = new TypeCobolConfiguration();
                config        = configSerializer.Deserialize(originalbuffer);
                config.Format = TypeCobolOptionSet.CreateFormat(config.EncFormat, ref config);
                returnCode    = CLI.runOnce(config); //Try to run TypeCobol ad get status in returnCode
            }
            catch
            {
                returnCode = ReturnCode.FatalError;
            }
            finally
            {
                //Write a "reponse" to the client which is waiting
                pipe.WriteByte((byte)returnCode);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Execute method.
        /// </summary>
        /// <param name="pipe">NamedPipeServerStream</param>
        public override void execute(NamedPipeServerStream pipe)
        {
            ConfigSerializer configSerializer = new ConfigSerializer();

            byte[] messagebuffer  = new byte[100];
            byte[] originalbuffer = new byte[100];
            int    i = 0;

            do
            {
                pipe.Read(messagebuffer, 0, messagebuffer.Length);
                System.Buffer.BlockCopy(messagebuffer, 0, originalbuffer, i, messagebuffer.Length);
                Array.Resize(ref originalbuffer, originalbuffer.Length + 100);
                messagebuffer = new byte[100];
                i             = i + 100;
            }while (!pipe.IsMessageComplete);

            Config config = new Config();

            config        = configSerializer.Deserialize(originalbuffer);
            config.Format = CLI.CreateFormat(config.EncFormat, ref config);

            CLI.runOnce(config);
            //Write a "reponse" to the client which is waiting
            pipe.WriteByte(68);
        }