Beispiel #1
0
        //#region AutoUpdate
        //[HttpGet]
        //[Route( "admin/update" )]
        //public List<AutoUpdaterMessage> AutoUpdate()
        //{
        //    string context = GetContext( nameof( AutoUpdate ) );

        //    try
        //    {
        //        SynapseServer.Logger.Info( context );
        //        return AutoUpdater.Update();
        //    }
        //    catch( Exception ex )
        //    {
        //        SynapseServer.Logger.Error(
        //            Utilities.UnwindException( context, ex, asSingleLine: true ) );
        //        throw;
        //    }
        //}

        //[HttpGet]
        //[Route( "admin/update/logs" )]
        //public List<AutoUpdaterMessage> FetchAutoUpdateLogList()
        //{
        //    string context = GetContext( nameof( FetchAutoUpdateLogList ) );

        //    try
        //    {
        //        SynapseServer.Logger.Debug( context );
        //        return AutoUpdater.FetchLogList();
        //    }
        //    catch( Exception ex )
        //    {
        //        SynapseServer.Logger.Error(
        //            Utilities.UnwindException( context, ex, asSingleLine: true ) );
        //        throw;
        //    }
        //}

        //[HttpGet]
        //[Route( "admin/update/logs/{name}" )]
        //public List<AutoUpdaterMessage> FetchAutoUpdateLog(string name = null)
        //{
        //    string context = GetContext( nameof( FetchAutoUpdateLog ), nameof( name ), name );

        //    try
        //    {
        //        SynapseServer.Logger.Debug( context );
        //        return AutoUpdater.FetchLog( name );
        //    }
        //    catch( Exception ex )
        //    {
        //        SynapseServer.Logger.Error(
        //            Utilities.UnwindException( context, ex, asSingleLine: true ) );
        //        throw;
        //    }
        //}
        //#endregion


        //#region logs
        //[HttpGet]
        //[Route( "admin/logs" )]
        //public List<AutoUpdaterMessage> FetchSynapseLogList()
        //{
        //    string context = GetContext( nameof( FetchSynapseLogList ) );

        //    try
        //    {
        //        SynapseServer.Logger.Debug( context );
        //        return Log4netUtil.FetchLogList();
        //    }
        //    catch( Exception ex )
        //    {
        //        SynapseServer.Logger.Error(
        //            Utilities.UnwindException( context, ex, asSingleLine: true ) );
        //        throw;
        //    }
        //}

        //[HttpGet]
        //[Route( "admin/logs/{name}" )]
        //public netHttp.HttpResponseMessage FetchSynapseLog(string name)
        //{
        //    string context = GetContext( nameof( FetchSynapseLogList ) );

        //    try
        //    {
        //        string path = Log4netUtil.GetLogfilePath( name );
        //        FileStream stream = new FileStream( path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite );

        //        netHttp.HttpResponseMessage msg = new netHttp.HttpResponseMessage( System.Net.HttpStatusCode.OK )
        //        {
        //            Content = new netHttp.StreamContent( stream )
        //        };
        //        msg.Content.Headers.ContentDisposition = new ContentDispositionHeaderValue( "attachment" )
        //        {
        //            FileName = name
        //        };
        //        msg.Content.Headers.ContentType = new MediaTypeHeaderValue( "application/octet-stream" );

        //        return msg;
        //    }
        //    catch( Exception ex )
        //    {
        //        SynapseServer.Logger.Error(
        //            Utilities.UnwindException( context, ex, asSingleLine: true ) );
        //        throw;
        //    }
        //}
        //#endregion


        #region utility methods
        void InitPlanServer()
        {
            if (_server == null)
            {
                _server = new PlanServer();
            }
        }