コード例 #1
0
ファイル: Excel.cs プロジェクト: hnordquist/INCC6
 public static bool ExcelPresent(LMLoggers.LognLM optlog = null)
 {
     try
     {
         if (Type.GetTypeFromProgID("Excel.Application") != null)
             return true;
     }
     catch (Exception e)
     {
         if (optlog != null)
             optlog.TraceException(e);
     }
     return false;
 }
コード例 #2
0
ファイル: RateGateAnalysis.cs プロジェクト: tempbottle/INCC6
        public AnalysisDefs.RateResult GetResult(LMLoggers.LognLM log)
        {
            AnalysisDefs.RateResult result;
            RateAccumulator aBlock;
            UInt32 i, j, blockOffset, index;

            result = new AnalysisDefs.RateResult(RawAnalysisProperties.ChannelCount);

            try
            {
                result.gateWidthInTics = this.gateWidth;
                result.numCompletedGates = this.presentDataZeroGateIndexOffset + this.presentData.numCompletedGates;
                result.neutronsPerGate = new UInt32[result.numCompletedGates];
                result.neutronsPerGatePerChannel = new UInt32[result.numCompletedGates][];

                aBlock = this.gateStack;
                blockOffset = 0;
                //copy data from all but the last block
                while (aBlock.next != null)
                {
                    for (i = 0; i < RawAnalysisProperties.rateGatesPerAccumulator; i++)
                    {
                        index = i + blockOffset;
                        result.neutronsPerGate[index] = aBlock.neutronsPerGate[i];
                        result.neutronsPerGatePerChannel[index] = new UInt32[RawAnalysisProperties.ChannelCount];
                        for (j = 0; j < RawAnalysisProperties.ChannelCount; j++)
                        {
                            result.neutronsPerGatePerChannel[index][j] = aBlock.neutronsPerGatePerChannel[i][j];
                        }
                    }
                    blockOffset += RawAnalysisProperties.rateGatesPerAccumulator;
                    aBlock = aBlock.next;
                }
                //copy data from the last block
                for (i = 0; i < aBlock.numCompletedGates; i++)
                {
                    index = i + blockOffset;
                    result.neutronsPerGate[index] = aBlock.neutronsPerGate[i];
                    result.neutronsPerGatePerChannel[index] = new UInt32[RawAnalysisProperties.ChannelCount];
                    for (j = 0; j < RawAnalysisProperties.ChannelCount; j++)
                    {
                        result.neutronsPerGatePerChannel[index][j] = aBlock.neutronsPerGatePerChannel[i][j];
                    }
                }
            }
            catch (System.OutOfMemoryException oom)
            {
                GC.Collect();
                if (log != null) log.TraceException(oom);
            }
            return (result);
        }