Пример #1
0
        /// <summary>
        /// Gets the link deformations.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="name">The name.</param>
        /// <param name="itemType">LoadType of the item.</param>
        /// <returns>List&lt;Tuple&lt;ObjectResultsIdentifier, Deformations&gt;&gt;.</returns>
        public static List <Tuple <ObjectResultsIdentifier, Deformations> > GetLinkDeformations(
            IResults app,
            string name,
            eItemTypeElement itemType = eItemTypeElement.ObjectElement)
        {
            app.LinkDeformation(name,
                                itemType,
                                out var objectNames,
                                out var elementNames,
                                out var loadCases,
                                out var stepTypes,
                                out var stepNumbers,
                                out var forces);

            return(loadCases.Select((t, i) => new ObjectResultsIdentifier()
            {
                LoadCase = t,
                ObjectName = objectNames[i],
                ElementName = elementNames[i],
                StepType = stepTypes[i],
                StepNumber = stepNumbers[i]
            })
                   .Select((result, i) => new Tuple <ObjectResultsIdentifier, Deformations>(result, forces[i]))
                   .ToList());
        }
Пример #2
0
        public void Report(IResults results, int start, int end)
        {
            if (Init())
            {
                // training svm
                Training(results, start, end);

                // predicting probability
                List <IProbScoreProxy> probabilities = new List <IProbScoreProxy>();
                for (int scanNum = start; scanNum <= end; scanNum++)
                {
                    if (results.Contains(scanNum))
                    {
                        probabilities.AddRange(Predicting(results, scanNum));
                    }
                }
                double scoreCutoff = GetScoreCutoff(probabilities, start, end);

                // report
                //List<IProbScoreProxy> scores = probabilities.
                //    Where(score => !(score as IFDRScoreProxy).IsDecoy()).ToList();
                List <IProbScoreProxy> scores = probabilities;
                ReportLines(scores, scoreCutoff);

                Exit();
            }
        }
Пример #3
0
        private void duStuff(ILoads rLoads, double mult, int i, ref ErrorInfo[] err, ref ICalculation calc)
        {
            ILoadCase          lCase = rLoads.GetLoadCase(1, ItemAt.AtNo);
            AnalysisParameters param = new AnalysisParameters();

            param.ModifyLoadingByFactor = true;
            param.LoadingFactor         = mult;
            param.Method = AnalysisMethodType.SecondOrder;

            //Loads
            //lc.PrepareModification();
            rLoads.PrepareModification();
            try
            {
                lCase.SetAnalysisParameters(ref param);
            }
            finally
            {
                rLoads.FinishModification();
                //lc.FinishModification();
                lCase = null;
            }

            err = calc.Calculate(LoadingType.LoadCaseType, 1);
            if (err.Length == 0)
            {
                IResults       res   = calc.GetResultsInFeNodes(LoadingType.LoadCaseType, 1);
                MaximumResults max   = res.GetMaximum();
                Point3D        point = max.Displacement;
                double         value = Math.Sqrt(Math.Pow(point.X, 2) + Math.Pow(point.Y, 2) + Math.Pow(point.Z, 2));
                chart1.Series["deflection"].Points.AddXY(i, value);
            }
        }
Пример #4
0
        public List <IProbScoreProxy> Predicting(IResults results, int scanNum)
        {
            List <IScore>          scores         = results.GetResult(scanNum);
            ISpectrum              spectrum       = results.GetSpectrum(scanNum);
            List <double[]>        estimationList = new List <double[]>();
            List <IProbScoreProxy> probabilities  = new List <IProbScoreProxy>();

            foreach (IScore score in scores)
            {
                List <SVMNode> X = new List <SVMNode>();
                // store score value in X
                int idx = 0;
                foreach (MassType type in types)
                {
                    SVMNode node = new SVMNode();
                    node.Index = idx;
                    node.Value = score.GetScore(type);
                    X.Add(node);
                    idx++;
                }
                testingProblem.X.Add(X.ToArray());
            }
            // prediction
            double[] target = testingProblem.PredictProbability(model, out estimationList);
            testingProblem.X.Clear();
            // create new scores
            for (int i = 0; i < scores.Count; i++)
            {
                probabilities.Add(new ProbScoreProxy(scores[i], spectrum, estimationList[i][1]));
            }
            return(probabilities);
        }
Пример #5
0
 public IndexPageModule(ITournament tournament, ISubmittedBets bets, IResults actual)
 {
     Get["/"] = _ =>
     {
         return(View["frontpage.sshtml", new IndexPageViewModel(tournament, bets, actual)]);
     };
 }
Пример #6
0
        public void Training(IResults results, int start, int end)
        {
            for (int scanNum = start; scanNum <= end; scanNum++)
            {
                if (results.Contains(scanNum))
                {
                    List <IScore> scores = results.GetResult(scanNum);
                    foreach (IScore score in scores)
                    {
                        double         y = (score as FDRScoreProxy).IsDecoy() ? 0 : 1;
                        List <SVMNode> X = new List <SVMNode>();
                        // store score value in X
                        int idx = 0;
                        foreach (MassType type in types)
                        {
                            SVMNode node = new SVMNode();
                            node.Index = idx;
                            node.Value = score.GetScore(type);
                            X.Add(node);
                            idx++;
                        }
                        problem.Add(X.ToArray(), y);
                    }
                }
            }

            // training
            SVMParameter parameter = new SVMParameter();

            parameter.Probability = true;
            model = problem.Train(parameter);
        }
Пример #7
0
 public void UpdateTask(IResults result)
 {
     lock (resultLock)
     {
         results.Merge(result);
     }
 }
Пример #8
0
        public IResults SearchSite(string query)
        {
            NameValueCollection parameters = new NameValueCollection();

            parameters.Add("search", Helpers.Search.FormatParameters(query));
            parameters.Add("x", "0");
            parameters.Add("y", "0");

            byte[] response = Helpers.Downloader.Instance.UploadValues(new Uri("https://www.mangaupdates.com/search.html"), parameters);

            IResults results = null;

            if (response.Length > 0)
            {
                ////string resp = Encoding.UTF8.GetString(response);


                ////results.StartIndex = 0;
                ////results.TotalResults = 0;
                ////results.itemsPerPage = 0;

                ////IResultItem item = new Item()
                ////{
                ////    Id = 5
                ////};

                // Todo: Uncomment
                //results = new SerializeResultsSiteSearch().Serialize(response);
            }


            return(results);
        }
Пример #9
0
        /// <summary>
        /// Gets the panel zone forces.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="name">The name.</param>
        /// <param name="itemType">LoadType of the item.</param>
        /// <returns>List&lt;Tuple&lt;ElementPointResultsIdentifier, Forces&gt;&gt;.</returns>
        public static List <Tuple <ElementPointResultsIdentifier, Forces> > GetPanelZoneForces(
            IResults app,
            string name,
            eItemTypeElement itemType = eItemTypeElement.ObjectElement)
        {
            app.PanelZoneForce(name,
                               itemType,
                               out var elementNames,
                               out var pointNames,
                               out var loadCases,
                               out var stepTypes,
                               out var stepNumbers,
                               out var forces);

            return(loadCases.Select((t, i) => new ElementPointResultsIdentifier()
            {
                LoadCase = t,
                PointName = pointNames[i],
                ElementName = elementNames[i],
                StepType = stepTypes[i],
                StepNumber = stepNumbers[i]
            })
                   .Select((result, i) => new Tuple <ElementPointResultsIdentifier, Forces>(result, forces[i]))
                   .ToList());
        }
Пример #10
0
        /// <summary>
        /// Gets the modal load participation ratios.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <returns>List&lt;Tuple&lt;ModalLoadParticipationResultsIdentifier, ModalLoadParticipationRatio&gt;&gt;.</returns>
        public static List <Tuple <ModalLoadParticipationResultsIdentifier, ModalLoadParticipationRatio> > GetModalLoadParticipationRatios(
            IResults app)
        {
            app.ModalLoadParticipationRatios(
                out var loadCases,
                out var itemTypes,
                out var items,
                out var percentStaticLoadParticipationRatio,
                out var percentDynamicLoadParticipationRatio);

            List <Tuple <ModalLoadParticipationResultsIdentifier, ModalLoadParticipationRatio> > resultItems = new List <Tuple <ModalLoadParticipationResultsIdentifier, ModalLoadParticipationRatio> >();

            for (int i = 0; i < loadCases.Length; i++)
            {
                ModalLoadParticipationResultsIdentifier identifier =
                    new ModalLoadParticipationResultsIdentifier
                {
                    LoadCase = loadCases[i],
                    ItemType = itemTypes[i],
                    Item     = items[i]
                };

                ModalLoadParticipationRatio results = new ModalLoadParticipationRatio
                {
                    PercentStaticLoadParticipationRatio  = percentStaticLoadParticipationRatio[i],
                    PercentDynamicLoadParticipationRatio = percentDynamicLoadParticipationRatio[i]
                };

                resultItems.Add(new Tuple <ModalLoadParticipationResultsIdentifier, ModalLoadParticipationRatio>(identifier, results));
            }

            return(resultItems);
        }
Пример #11
0
 public LegendPageModule(IResults actual)
 {
     Get["/legend"] = _ =>
     {
         return(View["legend.sshtml", new LegendPageViewModel(actual)]);
     };
 }
Пример #12
0
        private IResults CreateResults(string sql)
        {
            try {
                //Commandオブジェクトを生成する
                DbCommand aDbCommand = this.CreateDbCommand(sql, _aDbConnection, _aDbTransaction);
                //ResultsオブジェクトがDisposeされていなければ、Disposeする
                this.DisposeResults();

                //時間計測開始
                if (_debugPrint)
                {
                    _stopwatch.Reset();
                    _stopwatch.Start();
                }

                //SQLを実行しDataReaderオブジェクトをaResultsオブジェクトに格納して返す
                _aResults = new Results(aDbCommand.ExecuteReader());

                //時間計測終了
                if (_debugPrint)
                {
                    _stopwatch.Stop();
                    Trace.WriteLine("[" + _stopwatch.ElapsedMilliseconds.ToString() + "ms]" + Environment.NewLine);
                }

                aDbCommand.Dispose();
                return(_aResults);
            } catch (Exception ex) {
                throw new DbAccessException("SELECT文の実行に失敗しました", sql, ex);
            }
        }
Пример #13
0
 private void Close()
 {
     //aResultsを破棄する
     if (_aResults != null)
     {
         _aResults.Dispose();
         _aResults = null;
     }
     //トランザクションを終了する(Dispose()のみ行う)
     if (_aDbTransaction != null)
     {
         _aDbTransaction.Dispose();
         //DbTransactionを解放する
         _h_DbTransaction.Free();
         _aDbTransaction = null;
     }
     //DBから切断する
     if (_aDbConnection != null)
     {
         _aDbConnection.Close();
         _aDbConnection.Dispose();
         //DbConnectionを解放する
         _h_DbConnection.Free();
         _aDbConnection = null;
     }
 }
Пример #14
0
        /// <summary>
        /// Gets the area joint force shell.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="name">The name.</param>
        /// <param name="itemType">LoadType of the item.</param>
        /// <returns>List&lt;Tuple&lt;ObjectPointResultsIdentifier, AnalysisLoads&gt;&gt;.</returns>
        public static List <Tuple <ObjectPointResultsIdentifier, AnalysisLoads> > GetAreaJointForceShell(
            IResults app,
            string name,
            eItemTypeElement itemType = eItemTypeElement.ObjectElement)
        {
            app.AreaJointForceShell(name, itemType,
                                    out var objectNames,
                                    out var elementNames,
                                    out var pointNames,
                                    out var loadCases,
                                    out var stepTypes,
                                    out var stepNumbers,
                                    out var jointForces);

            List <Tuple <ObjectPointResultsIdentifier, AnalysisLoads> > resultItems = new List <Tuple <ObjectPointResultsIdentifier, AnalysisLoads> >();

            for (int i = 0; i < loadCases.Length; i++)
            {
                ObjectPointResultsIdentifier identifier =
                    new ObjectPointResultsIdentifier
                {
                    LoadCase    = loadCases[i],
                    StepType    = stepTypes[i],
                    StepNumber  = stepNumbers[i],
                    ObjectName  = objectNames[i],
                    ElementName = elementNames[i],
                    PointName   = pointNames[i]
                };

                resultItems.Add(new Tuple <ObjectPointResultsIdentifier, AnalysisLoads>(identifier, jointForces[i]));
            }

            return(resultItems);
        }
Пример #15
0
        /// <summary>
        /// Sums the total mmbtu amounts of all upstream resources from a specified pathway
        /// </summary>
        /// <param name="pathway">The specified pathway</param>
        /// <returns>A double indicating the sum of all of the emissions.</returns>
        public double getSumAllLifeCycleResources(IResults pathway)
        {
            // 13 - Nuclear Energy
            // 12 - SKIPPED!!
            // 11 - Renewable (Solar, Hydro, Wind, Geothermal
            // 10 - Wind Power
            //  9 - Geothermal
            //  8 - Hydroelectric
            //  7 - Solar
            //  6 - Forest Residue
            //  5 - Farmed Trees or Switchgrass -- unconfirmed which is which
            //  4 - Farmed Trees or Switchgrass -- unconfirmed which is which
            //  3 - Coal Average
            //  2 - Bituminous Oil
            //  1 - Crude Oil
            //  0 - Natural Gas

            double sum = 0;

            for (int i = 0; i <= 13; i++)
            {
                if (i == 12)
                {
                    continue;
                }
                sum += pathway.WellToProductResources().ElementAt(i).Value.Value;
            }
            return(sum);
        }
Пример #16
0
 public ImageRecognizer(DirectoryInfo inputDir, IResults res = null)
 {
     foreach (var file in inputDir.GetFiles())
     {
         fullNames.Add(file.FullName);
     }
     ires = res;
 }
Пример #17
0
 public IndexPageViewModel(ITournament t, ISubmittedBets sb, IResults actual)
 {
     _tournament = t;
     CreateGroups();
     CreateBetterlist(sb.GetBetters(), sb, actual);
     MarkWinnerIfFinished(actual);
     TimeStamp = actual.GetTimeStamp();
 }
Пример #18
0
        public MultiThreadSearch(Counter counter, IContainer container, IResults results)
        {
            this.results   = results;
            this.counter   = counter;
            this.container = container;

            tasks = new Queue <Tuple <int, int> >();
            GenerateTasks();
        }
Пример #19
0
 public void Merge(IResults results)
 {
     foreach (int scan in results.GetScans())
     {
         List <IScore> scores = results.GetResult(scan);
         spectrumTable[scan] = results.GetSpectrum(scan);
         scoreTable[scan]    = scores;
     }
 }
Пример #20
0
        void MarkWinnerIfFinished(IResults actual)
        {
            List <Better> betters = _betters.OrderByDescending(b => b.Score).ToList();

            if (actual.HasFinal() && betters.Count > 0)
            {
                betters[0].RowClass = "success";
            }
        }
Пример #21
0
        public void TestGetSingleBet_ShouldReturnTypeFullStageOne()
        {
            var bets = CreateCompleteBet();

            bets.LoadAll("data");
            IResults bet = bets.GetSingleBet("AGiailoglou");

            Assert.That(bet.GetStageOne().results.Length, Is.EqualTo(8));
        }
Пример #22
0
        public CopyFrbdkToReleaseFolder(IResults results)
            : base(
                @"Copy all FRBDK .exe files, EditorObjects.dll, and the engine to ReleaseFiles\FRBDK For Zip\ (Auto)", results)
        {
            _excludedDirs = new List <string>();
            _excludeFiles = new List <string>();

            _excludedDirs.Add(@".svn\");
            _excludeFiles.Add(@"Thumbs.db");
        }
Пример #23
0
        public List <RFNodalSupportForces> GetRFNodalSupportForces(IResults results, IModelData data)
        {
            var myForces = new List <RFNodalSupportForces>();

            foreach (var nodalsupportforce in results.GetAllNodalSupportForces(false))
            {
                myForces.Add(new RFNodalSupportForces(nodalsupportforce, data));
            }
            return(myForces);
        }
Пример #24
0
 public BetterPageModule(ITournament tournament, ISubmittedBets bets, IResults actual)
 {
     Get["/{better}"] = _ =>
     {
         // disable once ConvertToLambdaExpression
         return(View["betterpage.sshtml", new BetterPageViewModel(tournament,
                                                                  bets.GetSingleBet(_.better),
                                                                  actual)]);
     };
 }
Пример #25
0
        private void comparerWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            IResults results = (IResults)e.Result;

            _frmCompareResults               = new frmCompareResults();
            _frmCompareResults.Results       = results;
            _frmCompareResults.mainReference = this;
            this.Hide();
            _frmCompareResults.Show();
        }
        public CopyFrbdkToReleaseFolder(IResults results)
            : base(
                @"Copy all FRBDK .exe files, EditorObjects.dll, and the engine to ReleaseFiles\FRBDK For Zip\ (Auto)", results)
        {
            
            _excludedDirs = new List<string>();
            _excludeFiles = new List<string>();

            _excludedDirs.Add(@".svn\");
            _excludeFiles.Add(@"Thumbs.db");
        }
Пример #27
0
        public List <RFNodalSupportForces> GetRFNodalSupportForces(IResults results, IModelData data, ref HashSet <ResultsValueType> types, bool local)
        {
            var myForces = new List <RFNodalSupportForces>();

            foreach (var nodalsupportforce in results.GetAllNodalSupportForces(local))
            {
                myForces.Add(new RFNodalSupportForces(nodalsupportforce, data));
                types.Add(nodalsupportforce.Type);
            }
            return(myForces);
        }
Пример #28
0
        public void PerformCopy(IResults results, string message)
        {
            System.IO.File.Copy(SourceFile, DestinationFile, true);

            if (!string.IsNullOrEmpty(Namespace))
            {
                ReplaceNamespace(DestinationFile, Namespace);
            }

            results.WriteMessage(message);
        }
Пример #29
0
        private void comparerWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            ITwoPassComparer   comparer          = new RecursiveComparer(this);
            IDirectoryComparer recursiveComparer = new RecursiveDirectoryComparer(comparer);
            IResults           results           = recursiveComparer.CompareDirectories();

            this.ReportProgress(100);

            Thread.Sleep(1000);

            e.Result = results;
        }
Пример #30
0
        /// <summary>
        /// Gets the area stress shell layered.
        /// </summary>
        /// <param name="app">The application.</param>
        /// <param name="name">The name.</param>
        /// <param name="itemType">LoadType of the item.</param>
        /// <returns>List&lt;Tuple&lt;ObjectPointResultsIdentifier, LayeredShellStress&gt;&gt;.</returns>
        public static List <Tuple <ObjectPointResultsIdentifier, LayeredShellStress> > GetAreaStressShellLayered(
            IResults app,
            string name,
            eItemTypeElement itemType = eItemTypeElement.ObjectElement)
        {
            app.AreaStressShellLayered(name, itemType,
                                       out var objectNames,
                                       out var elementNames,
                                       out var pointNames,
                                       out var loadCases,
                                       out var stepTypes,
                                       out var stepNumbers,
                                       out var stresses,
                                       out var s13Avg,
                                       out var s23Avg,
                                       out var sMaxAvg,
                                       out var sAngleAvg,
                                       out var layers,
                                       out var integrationPointNumbers,
                                       out var integrationPointLocations);

            List <Tuple <ObjectPointResultsIdentifier, LayeredShellStress> > resultItems = new List <Tuple <ObjectPointResultsIdentifier, LayeredShellStress> >();

            for (int i = 0; i < loadCases.Length; i++)
            {
                ObjectPointResultsIdentifier identifier =
                    new ObjectPointResultsIdentifier
                {
                    LoadCase    = loadCases[i],
                    StepType    = stepTypes[i],
                    StepNumber  = stepNumbers[i],
                    ObjectName  = objectNames[i],
                    ElementName = elementNames[i],
                    PointName   = pointNames[i]
                };

                LayeredShellStress results = new LayeredShellStress
                {
                    Stress    = stresses[i],
                    S13Avg    = s13Avg[i],
                    S23Avg    = s23Avg[i],
                    SMaxAvg   = sMaxAvg[i],
                    SAngleAvg = sAngleAvg[i],
                    Layer     = layers[i],
                    IntegrationPointNumber   = integrationPointNumbers[i],
                    IntegrationPointLocation = integrationPointLocations[i]
                };

                resultItems.Add(new Tuple <ObjectPointResultsIdentifier, LayeredShellStress>(identifier, results));
            }

            return(resultItems);
        }
Пример #31
0
            //論理式を評価する
            public bool ExecExp(DbConn aDbConn
                                , string expression, IEnumerable <string> usedTables
                                , Tran.CacheStrategy aCacheStrategy = Tran.CacheStrategy.UseCache)
            {
                //式評価用SELECT文を作成する
                string sql = aDbConn.MakeExpEvalSql(expression);

                //トランザクション、状態遷移、エラー処理は、ExecSelect()で処理される
                using (IResults aResults = this.ExecSelect(aDbConn, sql, usedTables, aCacheStrategy)) {
                    return(aResults.MoveNext() && aResults.GetValueOf(0).ToString() == "1");
                }
            }
Пример #32
0
        public static void CreateZip(IResults results, string destinationDirectory, string directoryWithContentsToZip, string zipFileName)
        {
            var containedObjects = new List<string>();

            string fullZipFileName = directoryWithContentsToZip + "\\" + zipFileName + ".zip";

            if (File.Exists(fullZipFileName))
            {
                File.Delete(fullZipFileName);
            }

            var directories = Directory.GetDirectories(directoryWithContentsToZip, "*", SearchOption.TopDirectoryOnly);

            containedObjects.AddRange(directories);

            for (int i = 0; i < containedObjects.Count; i++)
            {
                containedObjects[i] = containedObjects[i] + "\\";
            }


            containedObjects.AddRange(Directory.GetFiles(directoryWithContentsToZip, "*", SearchOption.TopDirectoryOnly));

            using (var zip = new ZipFile())
            {
                foreach (string containedObject in containedObjects)
                {

                    if (containedObject.EndsWith("\\"))
                    {
                        string relativeDirectory = FileManager.MakeRelative(containedObject, directoryWithContentsToZip);
                        zip.AddDirectory(containedObject, relativeDirectory);
                    }
                    else
                    {
                        zip.AddFile(containedObject, "");
                    }

                }

                zip.Save(fullZipFileName);

                File.Copy(fullZipFileName, destinationDirectory + zipFileName + ".zip", true);
            }

            results.WriteMessage("Zipped directory " + directoryWithContentsToZip + " into " + zipFileName);
        }
Пример #33
0
        /// <summary>
        /// Invoked when a pathway is selected in order to represent the life cycle results
        /// for the product produced by this pathway and defined as it's main output (which is
        /// equivalent to the main output of the last process in the pathway)
        /// </summary>
        /// <param name="name">Name of the pathway, will simply be displayed as is</param>
        /// <param name="results">Result object from the pathway for the desired productID</param>
        /// <param name="productID">ProductID represents the ID of a resource in the IData.Resources</param>
        /// <returns>Returns 0 if succeed</returns>
        public int SetResults(string name, IResults results, int productID)
        {
            //Check that the resuls object is non null
            if (results == null)
                return -1;

            //Set the label text as the name of the pathway
            this.labelName.Text = name;

            //Get an instance of the data object that we are going to use to look for a Resource
            IData data = ResultsAccess.controler.CurrentProject.Data;

            //Set the label text as the Resource.Name for the produced product of the pathway
            //i.e. If the pathway is producing Gasoline, we're going to get the Resource object using the value productID
            //which should correspond to the Gasoline resource object in the database
            if (data.Resources.KeyExists(productID))
                this.labelProduct.Text = data.Resources.ValueForKey(productID).Name;
            else
                this.labelProduct.Text = "Product ID not found: " + productID;

            //Dictionary of emission group, indexed by IEmissionGroup.Id
            //Emission groups may be created by the user and contains a couple of default group such as "Greenhouse Gases", "Criteria Pollutants"
            //In this case we are going to use the GHGs group and display the life cycle results for this pathway
            Dictionary<int, IValue> emissionGroups = results.WellToProductEmissionsGroups(ResultsAccess.controler.CurrentProject.Data);
            if (emissionGroups != null && emissionGroups.ContainsKey(ghgGroupID))
            {
                IValue quantity = emissionGroups[ghgGroupID];
                //Format the value nicely using the quantity and the unit as well as the preferences defined by the user in the main UI GREET preferences
                this.labelGHGs.Text = ResultsAccess.controler.FormatValue(quantity.Value, quantity.Unit, 0)
                    + " or " + ResultsAccess.controler.FormatValue(quantity.Value, quantity.Unit, 1, false);
            }

            //Displays the functional unit for this results, very important in order to know if we are looking at results
            //per joule of product, or per cubic meters of product, or per kilograms of prododuct
            this.labelFunctionalUnit.Text = "Per " + results.FunctionalUnit;
            //If the user wants to see results in a different functional unit, the IValue quantity must be converted to the desired functional unit

            return 0;
        }
Пример #34
0
        public UploadFilesToFrbServer(IResults results, UploadType uploadType)
            : base(
            @"Upload files to daily build location", results)
        {
            int number = 1;
            string fileName = "build_" + DateTime.Now.ToString("yyyy") + "_" + DateTime.Now.ToString("MM") + "_" +
                DateTime.Now.ToString("dd") + "_";

            switch (uploadType)
            {
                case UploadType.Monthly:
                    _deleteBeforeDate = DateTime.MinValue;
                    _ftpFolder += "MonthlyBackups/";
                    _backupFolder += "MonthlyBackups/";
                    break;
                case UploadType.Weekly:
                    _deleteBeforeDate = DateTime.Now.AddMonths(-1);
                    _ftpFolder += "WeeklyBackups/";
                    _backupFolder += "WeeklyBackups/";
                    break;
                default:
                    _deleteBeforeDate = DateTime.Now.AddDays(-7);
                    _ftpFolder += "DailyBackups/";
                    _backupFolder += "DailyBackups/";
                    _ftpCopyToFolder = "flatredball.com/content/FrbXnaTemplates/DailyBuild/";
                    break;
            }

            while (FolderExists(_ftpFolder + fileName + number.ToString("00")))
            {
                number++;
            }
            _ftpFolder += fileName + number.ToString("00") + "/";

            CleanUpBackups();
        }
Пример #35
0
 public UnzipToInstaller(IResults results)
     : base(
         "Unzip files to installer", results)
 { }
 /// <summary>
 /// Grabs the entire WTP emissions total of a resource in a pathway per 1 mmbtu
 /// </summary>
 /// <param name="pathway">The specified pathway</param>
 /// <param name="res_id">The specified resource ID</param>
 /// <returns>A double with units g/mmbtu</returns>
 public double getResourceWTPEmissions(IResults pathway, int res_id)
 {
     return (pathway.LifeCycleEmissions().ElementAt(res_id).Value.Value * JOULES_PER_MMBTU * GRAMS_PER_KILOGRAM);
 }
        /// <summary>
        /// Sums the total mmbtu amounts of all upstream resources from a specified pathway
        /// </summary>
        /// <param name="pathway">The specified pathway</param>
        /// <returns>A double indicating the sum of all of the emissions.</returns>
        public double getSumAllLifeCycleResources(IResults pathway)
        {

            // 13 - Nuclear Energy
            // 12 - SKIPPED!!
            // 11 - Renewable (Solar, Hydro, Wind, Geothermal
            // 10 - Wind Power
            //  9 - Geothermal                
            //  8 - Hydroelectric                
            //  7 - Solar
            //  6 - Forest Residue
            //  5 - Farmed Trees or Switchgrass -- unconfirmed which is which
            //  4 - Farmed Trees or Switchgrass -- unconfirmed which is which
            //  3 - Coal Average
            //  2 - Bituminous Oil
            //  1 - Crude Oil
            //  0 - Natural Gas

            double sum = 0;
            for (int i = 0; i <= 13; i++ )
            {
                if (i == 12) { continue; }
                sum += pathway.LifeCycleResources().ElementAt(i).Value.Value;
            }
            return sum;
        }
        public CopyBuiltEnginesToTemplateFolder(IResults results)
            : base(
            @"Copy all built engine files (.dll) to templates", results)
        {

        }
Пример #39
0
        public void PerformCopy(IResults results, string message)
        {

            System.IO.File.Copy(SourceFile, DestinationFile, true);

            if(!string.IsNullOrEmpty(Namespace))
            {
                ReplaceNamespace(DestinationFile, Namespace);
            }

            results.WriteMessage(message);

        }
Пример #40
0
 public void ProcessResults(IResults results)
 {
     List<DataItem> ldi = results.Results;
     foreach (DataItem di in ldi)
     {
         di.Dispose();
         //Log.WriteMessage(string.Format("\t{0}\n", di.ToString()), Log.eMessageType.Debug);
     }
     c += ldi.Count;
     if (res.EndQuery)
         tsComplete = (DateTime.Now - dtStart);
 }
Пример #41
0
 public ZipFrbdk(IResults results)
     : base(
         @"Zip copied FRBDK files", results)
 { }
Пример #42
0
 public ZipTemplates(IResults results)
     : base(
         @"Zip Templates", results)
 { }
Пример #43
0
 public ProcessStep(string message, IResults results)
 {
     _message = message;
     _results = results;
 }
        public CopyBuiltEnginesToReleaseFolder(IResults results)
            : base(
            @"Copy all built engine files (.dll) to release folder", results)
        {

        }
Пример #45
0
        public UploadFilesToFrbServer(IResults results, UploadType uploadType)
            : base(
            @"Upload files to daily build location", results)
        {
            int number = 1;
            string fileName = "build_" + DateTime.Now.ToString("yyyy") + "_" + DateTime.Now.ToString("MM") + "_" +
                DateTime.Now.ToString("dd") + "_";

            switch (uploadType)
            {
                case UploadType.Monthly:
                    _deleteBeforeDate = DateTime.MinValue;
                    _ftpFolder += "MonthlyBackups/";
                    _backupFolder += "MonthlyBackups/";
                    break;
                case UploadType.Weekly:
                    _deleteBeforeDate = DateTime.Now.AddMonths(-1);
                    _ftpFolder += "WeeklyBackups/";
                    _backupFolder += "WeeklyBackups/";
                    break;
                default:
                    _deleteBeforeDate = DateTime.Now.AddDays(-7);
                    _ftpFolder += "DailyBackups/";
                    _backupFolder += "DailyBackups/";
                    _ftpCopyToFolder = "files.flatredball.com/content/FrbXnaTemplates/DailyBuild/";
                    break;
            }

            while (FolderExists(_ftpFolder + fileName + number.ToString("00")))
            {
                number++;
            }
            _ftpFolder += fileName + number.ToString("00") + "/";

            // who cares about cleaning up backups? We have infinite storage, this takes time, and it's crashing as oif
            // December 12, 2015
            //CleanUpBackups();
        }
Пример #46
0
        // Initialization function every parameter must be set before API use
        public static void Initialize(uint maxConcurrentDownloads, string downloadFileNameFormat, string baseDownloadDirectory, ILog logger, IResults results,
			IProgress progress)
        {
            MaxConcurrentDownloads = maxConcurrentDownloads;
            DownloadFileNameFormat = downloadFileNameFormat;
            BaseDownloadDirectory = baseDownloadDirectory;
            Logger = logger;
            Results = results;
            Progress = progress;
        }
Пример #47
0
        private PublicationSlice GetPublicationSlice(IResults<Publication> result)
        {
            var listAvailableSet = new List<AvaiableSlice>();
            var listAppliedSlice = new List<Slice>();

            foreach (Slice appliedSlice in result.VisibleAppliedFilters)
            {
                string localize = appliedSlice.Name.Localize();
                appliedSlice.Name = localize;
                listAppliedSlice.Add(appliedSlice);
            }

            foreach (FilterGroup filterGroup in result.FilterGroups)
            {
                listAvailableSet = GetListAvailableSlice(filterGroup, listAvailableSet);
            }

            return new PublicationSlice(listAppliedSlice, listAvailableSet);
        }
Пример #48
0
 public UpdateAssemblyVersions(IResults results) : base("Updates the AssemblyVersion in all FlatRedBall projects.", results)
 {
 }
Пример #49
0
 public ZipEngine(IResults results)
     : base(
         @"Zip copied Engine files", results)
 { }
Пример #50
0
 public ResultsHandler(string n, IResults r)
 {
     res = r;
     c = 0;
     res.DataArrived += new DataEvent(ProcessResults);
     name = n;
 }