Exemple #1
0
 public Main_Menu(global_vars vars, Game1 game)
     : base(game)
 {
     this.game = game;
     thisMain = this;
     selection_delay = vars.MENU_DELAY;
     current_delay = selection_delay;
     variables = vars;
     optionselected = option.campaign;
     deviceSelected = false;
 }
        public candidate ChooseAndApplyCarboxOptionBestAngle(candidate cand)
        {
            var    options   = GetCarboxylOptions(cand);
            option bestOpt   = null;
            var    bestAngle = .0;

            foreach (var opt in options)
            {
                var evalcand = CopyAndApplyOption(opt, cand, true);
                var mol      = OBFunctions.designgraphtomol(evalcand.graph);
                var angle    = CalAngle(mol);
                if (angle > 180)
                {
                    Console.WriteLine(angle + " too large");
                    Environment.Exit(0);
                }
                if (angle > bestAngle)
                {
                    bestAngle = angle;
                    bestOpt   = opt;
                }
            }
            return(bestOpt == null ? null : CopyAndApplyOption(bestOpt, cand, true));
        }
Exemple #3
0
        static void Main(string[] args)
        {
            gamelist hootGames;

            game[]    vermouthGames;
            ArrayList vermouthGameList = new ArrayList();

            option    midioutMixOption;
            ArrayList optionsList;

            XmlSerializer serializer;

            string xmlSourceFolder = Path.GetFullPath(args[0]);

            // get files
            string[] xmlSourceFiles = Directory.GetFiles(xmlSourceFolder, "*.xml");



            hootGames  = new gamelist();
            serializer = new XmlSerializer(typeof(gamelist));

            midioutMixOption       = new option();
            midioutMixOption.name  = "midiout_mix";
            midioutMixOption.value = "0x80";

            // loop over xml files
            foreach (string xmlSourceFile in xmlSourceFiles)
            {
                // get game list from file
                using (FileStream xmlFs = File.OpenRead(xmlSourceFile))
                {
                    using (XmlTextReader textReader = new XmlTextReader(xmlFs))
                    {
                        hootGames = (gamelist)serializer.Deserialize(textReader);
                    }
                }

                // loop over the games
                foreach (game g in hootGames.Items)
                {
                    if (g.options != null && g.options.option != null)
                    {
                        optionsList = new ArrayList(g.options.option);

                        // check for 'midiout' option;
                        foreach (option o in optionsList)
                        {
                            // midiout_type: 4 (GS), 8 (GM)
                            if (o.name.Equals("midiout_type") &&
                                (o.value.Equals("4") || o.value.Equals("8")))
                            {
                                // convert to vermouth type
                                o.value = "6";

                                // add midiout_mix
                                optionsList.Add(midioutMixOption);

                                // replace existing options
                                g.options.option = (option[])optionsList.ToArray(typeof(option));

                                // update title
                                g.name += " (Vermouth, Gravis Ultrasound simulation)";

                                // add to vermouth game list
                                vermouthGameList.Add(g);

                                break;
                            }
                        }
                    }
                }
            }



            int x = 1;

            // write output file


            if (vermouthGameList.Count > 0)
            {
                vermouthGames = (game[])vermouthGameList.ToArray(typeof(game));

                XmlWriterSettings settings = new XmlWriterSettings();
                settings.Encoding         = System.Text.Encoding.UTF8;
                settings.Indent           = true;
                settings.IndentChars      = "\t";
                settings.NewLineChars     = Environment.NewLine;
                settings.ConformanceLevel = ConformanceLevel.Document;

                // Use to suppress namespace attributes
                XmlSerializerNamespaces namespaceSerializer = new XmlSerializerNamespaces();
                namespaceSerializer.Add("", "");


                string outputPath = Path.Combine(Path.GetDirectoryName((Application.ExecutablePath)), XML_OUTPUT_NAME);

                serializer = new XmlSerializer(vermouthGames.GetType());

                using (XmlWriter xmlWriter = XmlTextWriter.Create(outputPath, settings))
                {
                    serializer.Serialize(xmlWriter, vermouthGames, namespaceSerializer);
                }
            }
        }
 public void SetTextAndLink(option opt, GlobalSettings settings)
 {
     _opt      = opt;
     _settings = settings;
     Text      = opt.ruleNumber.ToString(CultureInfo.InvariantCulture);
 }
Exemple #5
0
 Ensure(ncDeviceGetOption(Handle, option, Unsafe.AsPointer(ref data), &size));
Exemple #6
0
 public void NextOption()
 {
     switch (optionselected)
     {
         case option.campaign:
             {
                 optionselected = option.deathmatch;
                 return;
             }
         case option.deathmatch:
             {
                 optionselected = option.upgrade;
                 return;
             }
         case option.upgrade:
             {
                 optionselected = option.credits;
                 return;
             }
         case option.credits:
             {
                 optionselected = option.campaign;
                 return;
             }
     }
 }
Exemple #7
0
        private static seriesCatalogTypeSeries row2Series(UsgsDbDailyValues.seriesCatalogRow aRow)
        {
            if (aRow.IsVariableCodeNull())
            {
                return(null);
            }

            string VariableCode = aRow.VariableCode;

            string      VariableName             = null;
            string      VariableUnitName         = null;
            string      VariableUnitAbrreviation = null;
            string      VariableUnitCode         = null;
            string      sampleMedium             = null;
            string      dataType = null;
            string      valueType = null;
            string      generalCategory = null;
            W3CDateTime?beginDateTime = null, endDateTime = null;
            int?        valueCount              = null;
            bool?       valueCountIsEstimated   = null;
            int?        TimeInterval            = null;
            string      TimeIntervalUnits       = null;
            bool        isRealTime              = false;
            string      QualityControlLevelTerm = null;
            string      methodName              = null;
            string      organization            = null;
            string      sourceDescription       = null;

            if (!aRow.IsVariableNameNull())
            {
                VariableName = aRow.VariableName;
            }

            if (!aRow.IsVariableUnitsAbbreviationNull())
            {
                VariableUnitAbrreviation = aRow.VariableUnitsAbbreviation;
            }
            if (!aRow.IsVariableUnitsNameNull())
            {
                VariableUnitName = aRow.VariableUnitsName;
            }

            if (!aRow.IsDataTypeNull())
            {
                dataType = aRow.DataType;
            }
            if (!aRow.IsValueTypeNull())
            {
                valueType = aRow.ValueType;
            }
            if (!aRow.IsGeneralCategoryNull())
            {
                generalCategory = aRow.GeneralCategory;
            }

            if (!aRow.IsSampleMediumNull())
            {
                sampleMedium = aRow.SampleMedium;
            }
            if (!aRow.IsMethodNameNull())
            {
                methodName = aRow.MethodName;
            }



            if (!aRow.IsSourceDescriptionNull())
            {
                sourceDescription = aRow.SourceDescription;
            }
            if (!aRow.IsOrganizationNull())
            {
                organization = aRow.Organization;
            }

            if (!aRow.IsValueCountNull())
            {
                int v;
                if (Int32.TryParse(aRow.ValueCount, out v))
                {
                    valueCount = v;
                }
            }


            if (!aRow.IsBeginDateTimeNull())
            {
                beginDateTime = new W3CDateTime(aRow.BeginDateTime);
            }
            if (!aRow.IsEndDateTimeNull())
            {
                endDateTime = new W3CDateTime(aRow.EndDateTime);
            }

            if (!aRow.IsTimeSupportNull())
            {
                TimeInterval = aRow.TimeSupport;
                if (!aRow.IsTimeUnitsNameNull())
                {
                    TimeIntervalUnits = aRow.TimeUnitsName;
                }
            }



// public static seriesCatalogTypeSeries CreateSeriesRecord(
//           string VariableCode,
//           string VariableName,
//           string VariableUnitName,
//           string VariableUnitAbrreviation,
//           string VariableUnitCode,
//           string sampleMedium,
//           string dataType,
//           string valueType,
//           string generalCategory,
//           W3CDateTime? beginDateTime, W3CDateTime? endDateTime,
//           int? valueCount,  bool? valueCountIsEstimated,
//           string TimeInterval,
//           string TimeIntervalUnits,
//           bool isRealTime,
//           string QualityControlLevelTerm,
//           string methodName,
//           string organization, string sourceDescription

//)
            seriesCatalogTypeSeries aSeries = CoreBuilder.CreateSeriesRecord(
                VariableCode,
                VariableName,
                VariableUnitName,
                VariableUnitAbrreviation,
                VariableUnitCode,
                sampleMedium,
                dataType,
                valueType,
                generalCategory,
                beginDateTime, endDateTime,
                valueCount, valueCountIsEstimated,
                TimeInterval,
                TimeIntervalUnits,
                isRealTime,
                QualityControlLevelTerm,
                methodName,
                organization,
                sourceDescription, "NWIS");

            // add usgs statistic code options
            if (!aRow.Isusgs_stat_cdNull())
            {
                List <option> opts = new List <option>(1);
                option        opt  = new option();
                opt.name       = "statistic";
                opt.optionCode = aRow.usgs_stat_cd;
                opts.Add(opt);
                aSeries.variable.options = opts.ToArray();
            }
            return(aSeries);
        }
Exemple #8
0
 => (new OptionKey2(option, _language), codeStyle);
Exemple #9
0
 private void AMMenuItem_Click(object sender, EventArgs e)
 {
     currentState = option.AM;
 }
Exemple #10
0
            public part(XmlNode x)
            {
                text = getText(x);

                options = new List<option>();
                XmlElement qs = x["options"];
                if(qs!=null)
                foreach (XmlNode n in qs.ChildNodes)
                {
                    option o = new option(n);
                    options.Add(o);
                }
                shuffle = getshuffle(qs, options.Count);
            }
Exemple #11
0
 internal static List <Component> AddSecondHyperToOption(AssemblyCandidate child, option opt)
 {
     foreach (
         var sepHy in
         child.graph.hyperarcs.Where(
             a =>
             a.localLabels.Contains(DisConstants.SeperateHyperarcs) &&
             opt.Nodes.All(n => a.nodes.Contains(n))))         //
     {
         return(sepHy.nodes.Where(n => !opt.Nodes.Contains(n)).Cast <Component>().ToList());
     }
     return(null);
 }
        public async Task <bool> Start()
        {
            TotalSpaceCanBeRecoveredSafe       = "..";
            TotalSpaceCanBeRecoveredMorderate  = "..";
            TotalSpaceCanBeRecoveredAggressive = "..";

            CommandLogic_Delete_CalculateSpace.ApplicationCache_SafeCleaning_Space            = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_SafeCleaning_FilesCount       = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_SafeCleaning_Space                 = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_SafeCleaning_FilesCount            = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_SafeCleaning_Space                = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_SafeCleaning_FilesCount           = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_MordrateCleaning_Space        = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_MordrateCleaning_FilesCount   = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_MordrateCleaning_Space             = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_MordrateCleaning_FilesCount        = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_MordrateCleaning_Space            = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_MordrateCleaning_FilesCount       = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_AggressiveCleaning_Space      = 0;
            CommandLogic_Delete_CalculateSpace.ApplicationCache_AggressiveCleaning_FilesCount = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_AggressiveCleaning_Space           = 0;
            CommandLogic_Delete_CalculateSpace.WindowsTemp_AggressiveCleaning_FilesCount      = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_AggressiveCleaning_Space          = 0;
            CommandLogic_Delete_CalculateSpace.BrowserCache_AggressiveCleaning_FilesCount     = 0;
            CommandLogic_Delete_CalculateSpace.RecycleBin_FileCount = 0;
            CommandLogic_Delete_CalculateSpace.RecycleBin_Space     = 0;

            foreach (string file in Directory.EnumerateFiles("C:\\$RECYCLE.BIN", "*.*", SearchOption.AllDirectories))
            {
                FileInfo fi = new FileInfo(file);
                CommandLogic_Delete_CalculateSpace.RecycleBin_Space += fi.Length;
                CommandLogic_Delete_CalculateSpace.RecycleBin_FileCount++;
                bgWorker.ReportProgress(1);
            }

            foreach (TreeNode node in CleanerML.CleanersCollection)
            {
                if (node.Name == "Deep Scan")
                {
                    continue;
                }

                foreach (TreeNode child in node.Children)
                {
                    option o = (option)child.Tag;

                    string last_Log = string.Empty;

                    foreach (action _a in o.action)
                    {
                        COMMANDS cmd = (COMMANDS)StringEnum.Parse(typeof(COMMANDS), _a.command);

                        iActions axn = null;

                        switch (cmd)
                        {
                        case COMMANDS.delete:
                            axn = new CommandLogic_Delete_CalculateSpace();
                            break;
                        }

                        if (axn != null)
                        {
                            axn.Action = _a;
                            axn.Enqueue(); // execute for queueing
                        }
                        bgWorker.ReportProgress(1);
                    }
                }
            }

            return(true);
        }
        protected override void LoadContent()
        {
            ressource.loadcontent(Content);
            spriteBatch = new SpriteBatch(GraphicsDevice);

            gameover = new GameOverScreen(this, spriteBatch, ressource.ecriture, ressource.gameover);
            Components.Add(gameover);
            gameover.hide();

            edm = new EDM(this, spriteBatch);
            Components.Add(edm);
            edm.hide();

            pause = new menudepause(this, spriteBatch, ressource.ecriture, ressource.pixel);
            Components.Add(pause);
            pause.hide();

            menu = new menu(this, spriteBatch, Content.Load<SpriteFont>("SpriteFont"), ressource.templar);
            Components.Add(menu);
            menu.hide();

            menudujeu = new menudujeu(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.th);
            Components.Add(menudujeu);
            menudujeu.hide();

            option = new option(this, spriteBatch, Content.Load<SpriteFont>("spriteFont"), ressource.option);
            Components.Add(option);
            option.hide();

            main = new gamemain(this, spriteBatch, activeScreen);
            Components.Add(main);
            main.hide();

            activeScreen = menu;
            activeScreen.Show();

            MediaPlayer.Play(ressource.menu);
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Volume = 0;

            SoundEffect.MasterVolume = 0.05f;

            ecran = false;
        }
    void Start()
    {
        // story_number_assign=new int[story_count];
        player       = FindObjectOfType <Animationcontorler>();
        player_check = GameObject.Find("player").gameObject.transform.GetChild(0).gameObject.GetComponent <DialogueHolder_player>();
        talk         = NPCcontroller_test.ins.gameObject.GetComponent <NPCcontroller_test>();
        msgSys       = GameObject.Find("talkmanager").GetComponent <ES_MessageSystem>();

        option_0 = GameObject.Find("talkmanager").GetComponent <option>();


        // pass_text=this.GetComponent<test>();
        //
        M      = Resources.Load <Sprite>("NPC/mom_idle_257x396_00");
        Flower = Resources.Load <Sprite>("NPC/flower_idle_257x396_anim_00");
        // Fu2 = Resources.Load<Sprite>("NPC/FU_character_0");
        //
        M_anim      = Resources.Load <RuntimeAnimatorController>("animator/mon_combine_257x396");
        Flower_anim = Resources.Load <RuntimeAnimatorController>("animator/flower_anim_257x396");
        Fu2_anim    = Resources.Load <RuntimeAnimatorController>("animator/FU2_anim");
        //
        txt_mom    = Resources.Load <TextAsset>("txt/ui2");
        txt_flower = Resources.Load <TextAsset>("txt/ui_flower");
        txt_Fu2    = Resources.Load <TextAsset>("txt/ui_Fu2");
        txt_TV     = Resources.Load <TextAsset>("txt/ui_TV");
        txt_book   = Resources.Load <TextAsset>("txt/ui_book");
        txt_fish   = Resources.Load <TextAsset>("txt/ui_fish");
        //一開始先用程式打好資料放在格子裡面
        if (who == "NPC_mom")
        {
            anim = M_anim;
            cha  = M;
            txt  = txt_mom;
        }
        else if (who == "NPC_flower")
        {
            anim = Flower_anim;
            cha  = Flower;
            txt  = txt_flower;
        }
        else if (who == "NPC_fu2")
        {
            anim = Fu2_anim;
            cha  = Fu2;
            txt  = txt_Fu2;
        }
        else if (who == "TV")
        {
            //anim=Flower_anim;
            // cha=Flower;
            txt = txt_TV;
        }
        else if (who == "book")
        {
            txt = txt_book;
        }
        else if (who == "fish")
        {
            txt = txt_fish;
        }

        story_check = new bool[5];
        check_big_image();
        pass_test(txt);//用box,遇到誰,誰的資料就會轉換 輸出log
    }
Exemple #15
0
        internal void SetTextAndLink(option opt)
        {
            _opt = opt;
            var remLocNames  = new List <string>();
            var remRuleNames = new List <string>();
            var LStr         = "";
            var KStr         = "";
            var RStr         = "";

            for (var i = 0; i < opt.nodes.Count; i++)
            {
                var elt = opt.nodes[i];
                if (elt == null)
                {
                    continue;
                }
                remLocNames.Add("n:" + elt.name);
                remRuleNames.Add("n:" + opt.rule.L.nodes[i].name);
            }
            for (var i = 0; i < opt.arcs.Count; i++)
            {
                var elt = opt.arcs[i];
                if (elt == null)
                {
                    continue;
                }
                remLocNames.Add("a:" + elt.name);
                remRuleNames.Add("a:" + opt.rule.L.arcs[i].name);
            }
            for (var i = 0; i < opt.hyperarcs.Count; i++)
            {
                var elt = opt.hyperarcs[i];
                if (elt == null)
                {
                    continue;
                }
                remLocNames.Add("h:" + elt.name);
                remRuleNames.Add("h:" + opt.rule.L.hyperarcs[i].name);
            }
            foreach (node n in opt.rule.R.nodes)
            {
                var temp = "n:" + n.name;
                if (remRuleNames.Contains(temp))
                {
                    var i = remRuleNames.FindIndex(s => s.Equals(temp));
                    KStr += " " + remLocNames[i] + ",";
                    remLocNames.RemoveAt(i);
                    remRuleNames.RemoveAt(i);
                }
                else
                {
                    RStr += " " + temp + ",";
                }
            }
            foreach (arc a in opt.rule.R.arcs)
            {
                var temp = "a:" + a.name;
                if (remRuleNames.Contains(temp))
                {
                    var i = remRuleNames.FindIndex(s => s.Equals(temp));
                    KStr += " " + remLocNames[i] + ",";
                    remLocNames.RemoveAt(i);
                    remRuleNames.RemoveAt(i);
                }
                else
                {
                    RStr += " " + temp + ",";
                }
            }
            foreach (hyperarc h in opt.rule.R.hyperarcs)
            {
                var temp = "h:" + h.name;
                if (remRuleNames.Contains(temp))
                {
                    var i = remRuleNames.FindIndex(s => s.Equals(temp));
                    KStr += " " + remLocNames[i] + ",";
                    remLocNames.RemoveAt(i);
                    remRuleNames.RemoveAt(i);
                }
                else
                {
                    RStr += " " + temp + ",";
                }
            }
            foreach (string s in remLocNames)
            {
                LStr += " " + s + ",";
            }

            if (opt.rule.L.globalLabels.Count > 0)
            {
                if (opt.rule.OrderedGlobalLabels)
                {
                    LStr += " gl(" + opt.globalLabelStartLoc + "):";
                }
                else
                {
                    LStr += " gl:";
                }
                foreach (string g in opt.rule.L.globalLabels)
                {
                    LStr += g + ",";
                }
            }

            foreach (string g in opt.rule.R.globalLabels)
            {
                var temp = " gl:" + g + ",";
                if (LStr.Contains(temp))
                {
                    LStr  = LStr.Replace(temp, "");
                    KStr += temp;
                }
                else
                {
                    RStr += temp;
                }
            }
            LStr = LStr.Length == 0 ? " " : LStr.Remove(LStr.Length - 1);
            KStr = KStr.Length == 0 ? " " : KStr.Remove(KStr.Length - 1);
            RStr = RStr.Length == 0 ? " " : RStr.Remove(RStr.Length - 1);

            StrLocation = "<" + LStr + " [" + KStr + " >" + RStr + " ]";
            Inlines.Add(new Bold(new Run("<")));
            Inlines.Add(new Run(LStr));
            Inlines.Add(new Bold(new Run(" [")));
            Inlines.Add(new Run(KStr));
            Inlines.Add(new Bold(new Run(" >")));
            Inlines.Add(new Run(RStr));
            Inlines.Add(new Bold(new Run(" ]")));
        }
Exemple #16
0
 private void FFTMenuItem_Click(object sender, EventArgs e)
 {
     currentState = option.FFT;
 }
Exemple #17
0
 /* Given that the rule has now been chosen, determine the values needed by the
  * rule to properly apply it to the candidate, cand. The array of double is to
  * be determined by parametric apply rules written in complement C# files for
  * the ruleSet being used. */
 public abstract double[] choose(option RC, candidate cand);
 join option in application.GetOptions() on FormatPropertyName(property, suffixIndex) equals FormatOptionName(option)
 select((PropertyInfo)null, property, option);
Exemple #19
0
      public ConvertibleZeroCouponBond(Exercise exercise,
                                        double conversionRatio,
                                        DividendSchedule dividends,
                                        CallabilitySchedule callability,
                                        Handle<Quote> creditSpread,
                                        Date issueDate,
                                        int settlementDays,
                                        DayCounter dayCounter,
                                        Schedule schedule,
                                        double redemption = 100)
         : base(exercise, conversionRatio, dividends, callability, creditSpread, issueDate, settlementDays,schedule, redemption) 
      {

         cashflows_ = new List<CashFlow>();

        // !!! notional forcibly set to 100
        setSingleRedemption(100.0, redemption, maturityDate_);

        option_ = new option(this, exercise, conversionRatio, dividends, callability, creditSpread, cashflows_, dayCounter, schedule,
                             issueDate, settlementDays, redemption);
    }
Exemple #20
0
        private VariableInfoType RowToVariable(UsgsDbDailyValues.VariablesRow vRow)
        {
            VariableInfoType vit;
            String           vCode = vRow.IsVariableCodeNull() ? null : vRow.VariableCode;
            String           vName = vRow.IsVariableNameNull() ? null : vRow.VariableName;
            //String vDescr =
            String uName   = vRow.IsUnitsNull() ? null : vRow.Units;
            String uAbbrev = vRow.IsUnitAbbreviationNull() ? null : vRow.UnitAbbreviation;
            String uType   = vRow.IsUnitTypeNull() ? null : vRow.UnitType;
            String uCode   = null; // ID is code

            if (!vRow.IsVariableUnitsIDNull())
            {
                uCode = vRow.VariableUnitsID.ToString();
            }

            UnitsTypeEnum uTypeEnum = (UnitsTypeEnum)CoreBuilder.GetTextAsEnum(uType, typeof(UnitsTypeEnum));

            units vUnit = CuahsiBuilder.CreateUnitsElement(
                uTypeEnum,
                uCode, uAbbrev, uName);

            /* this needs to be fixed to accept value type and data type
             *  and time options
             */
            vit = CuahsiBuilder.CreateVariableInfoType(
                null,   // don't want variable ID exposed in the NWIS service
                "NWIS",
                vRow.VariableCode,
                vRow.VariableName,
                null,
                vUnit // units
                );

            CoreBuilder.SetEnumFromText(vit, vRow, "valueType", typeof(valueTypeEnum));
            CoreBuilder.SetEnumFromText(vit, vRow, "dataType", typeof(dataTypeEnum));

            // add usgs statistic code options
            if (!vRow.Isstat_cdNull())
            {
                List <option> opts = new List <option>(1);
                option        opt  = new option();
                opt.name       = "statistic";
                opt.optionCode = vRow.stat_cd;
                opts.Add(opt);
                vit.options = opts.ToArray();
            }

            if (!vRow.IsisRegularNull() && vRow.isRegular)
            {
                vit.timeSupport                    = new VariableInfoTypeTimeSupport();
                vit.timeSupport.isRegular          = vRow.isRegular;
                vit.timeSupport.isRegularSpecified = true;

                // add time support

                // check to be sure we've got some vaild stuff
                if (!vRow.IsTimeSupportNull())
                {
                    int timeInterval;
                    if (Int32.TryParse(vRow.TimeSupport, out timeInterval))
                    {
                        vit.timeSupport.timeInterval          = timeInterval;
                        vit.timeSupport.timeIntervalSpecified = true;
                    }
                }
                if (!vRow.IsTimeUnitsIDNull())
                {
                    vit.timeSupport.unit                  = new UnitsType();
                    vit.timeSupport.unit.UnitID           = 104;
                    vit.timeSupport.unit.UnitIDSpecified  = true;
                    vit.timeSupport.unit.UnitDescription  = "day";
                    vit.timeSupport.unit.UnitAbbreviation = "d";
                    vit.timeSupport.unit.UnitType         = (UnitsTypeEnum)CoreBuilder.GetTextAsEnum("Time", typeof(UnitsTypeEnum));;
                }
            }

            return(vit);
        }
Exemple #21
0
      public ConvertibleFloatingRateBond( Exercise exercise,
                                          double conversionRatio,
                                          DividendSchedule dividends,
                                          CallabilitySchedule callability,
                                          Handle<Quote> creditSpread,
                                          Date issueDate,
                                          int settlementDays,
                                          IborIndex index,
                                          int fixingDays,
                                          List<double> spreads,
                                          DayCounter dayCounter,
                                          Schedule schedule,
                                          double redemption = 100)
         : base(exercise, conversionRatio, dividends, callability, creditSpread, issueDate, settlementDays, schedule, redemption) 

      {
        // !!! notional forcibly set to 100
        cashflows_ = new IborLeg(schedule, index)
                        .withPaymentDayCounter(dayCounter)
                        .withFixingDays(fixingDays)
                        .withSpreads(spreads)
                        .withNotionals(100.0)
                        .withPaymentAdjustment(schedule.businessDayConvention());

        addRedemptionsToCashflows(new List<double>{redemption});

        Utils.QL_REQUIRE( redemptions_.Count == 1, () => "multiple redemptions created" );

        option_ = new option(this, exercise, conversionRatio, dividends, callability, creditSpread, cashflows_, dayCounter, schedule,
                             issueDate, settlementDays, redemption);
    
      }
Exemple #22
0
        public static option AddWindowsLogsCleaner()
        {
            option o = new option()
            {
                id          = "windows_logs",
                label       = "Windows Logs",
                description = "Delete the logs",
                level       = 1,
                action      = new List <action>()
            };

            string[] paths = new string[] {
                "$ALLUSERSPROFILE\\Application Data\\Microsoft\\Dr Watson\\*.log",
                "$ALLUSERSPROFILE\\Application Data\\Microsoft\\Dr Watson\\user.dmp",
                "$LocalAppData\\Microsoft\\Windows\\WER\\ReportArchive\\*\\*",
                "$LocalAppData\\Microsoft\\Windows\\WER\\ReportQueue\\*\\*",
                "$programdata\\Microsoft\\Windows\\WER\\ReportArchive\\*\\*",
                "$programdata\\Microsoft\\Windows\\WER\\ReportQueue\\*\\*",
                "$localappdata\\Microsoft\\Internet Explorer\\brndlog.bak",
                "$localappdata\\Microsoft\\Internet Explorer\\brndlog.txt",
                "$windir\\*.log",
                "$windir\\imsins.BAK",
                "$windir\\OEWABLog.txt",
                "$windir\\SchedLgU.txt",
                "$windir\\ntbtlog.txt",
                "$windir\\setuplog.txt",
                "$windir\\REGLOCS.OLD",
                "$windir\\Debug\\*.log",
                "$windir\\Debug\\Setup\\UpdSh.log",
                "$windir\\Debug\\UserMode\\*.log",
                "$windir\\Debug\\UserMode\\ChkAcc.bak",
                "$windir\\Debug\\UserMode\\userenv.bak",
                "$windir\\Microsoft.NET\\Framework\\*\\*.log",
                "$windir\\pchealth\\helpctr\\Logs\\hcupdate.log",
                "$windir\\security\\logs\\*.log",
                "$windir\\security\\logs\\*.old",
                "$windir\\system32\\TZLog.log",
                "$windir\\system32\\config\\systemprofile\\Application Data\\Microsoft\\Internet Explorer\\brndlog.bak",
                "$windir\\system32\\config\\systemprofile\\Application Data\\Microsoft\\Internet Explorer\\brndlog.txt",
                "$windir\\system32\\LogFiles\\AIT\\AitEventLog.etl.???",
                "$windir\\system32\\LogFiles\\Firewall\\pfirewall.log*",
                "$windir\\system32\\LogFiles\\Scm\\SCM.EVM*",
                "$windir\\system32\\LogFiles\\WMI\\Terminal*.etl",
                "$windir\\system32\\LogFiles\\WMI\\RTBackup\\EtwRT.*etl",
                "$windir\\system32\\wbem\\Logs\\*.lo_",
                "$windir\\system32\\wbem\\Logs\\*.log"
            };

            foreach (string path in paths)
            {
                o.action.Add(new action()
                {
                    command       = "delete",
                    search        = "glob",
                    path          = path,
                    parent_option = o
                });
            }

            return(o);
        }
Exemple #23
0
        public SubAssembly Update(option opt, List <Component> rest, Dictionary <string, TVGLConvexHull> convexHullForParts)
        {
            Part refAssembly, movingAssembly;
            //if (ActionIsAssemblyByAssembly())
            //{
            //    //var node0 = (Component)opt.nodes[0];
            //    //var node1 = (Component)opt.nodes[1];
            //    //var node0name = node0.name;
            //    //var node1name = node1.name;
            //    //refAssembly = Subassemblies.FirstOrDefault(subasm => subasm.PartNames.Contains(node0name));
            //    //if (refAssembly == null)
            //    //    refAssembly = new Part(node0name, GetPartMass(node0), GetPartVolume(node0),
            //    //        convexHullForParts[node0name], GetPartCenterOfMass(node0));
            //    //else Subassemblies.Remove((SubAssembly) refAssembly);
            //    //movingAssembly = Subassemblies.FirstOrDefault(subasm => subasm.PartNames.Contains(node1name));
            //    //if (movingAssembly == null)
            //    //    movingAssembly = new Part(node1name, GetPartMass(node1), GetPartVolume(node1),
            //    //        convexHullForParts[node1name], GetPartCenterOfMass(node0));
            //    //else Subassemblies.Remove((SubAssembly) movingAssembly);
            //}
            //else if (ActionIsRemoveSCC())
            //{
            var movingNodes    = opt.Nodes.Cast <Component>().ToList();
            var newSubAsmNodes = rest;

            if (movingNodes.Count == 1)
            {
                var nodeName = movingNodes[0].name;
                movingAssembly = new Part(nodeName,
                                          GetPartMass(movingNodes[0]), GetPartVolume(movingNodes[0]),
                                          convexHullForParts[nodeName], GetPartCenterOfMass(movingNodes[0]));
            }
            else
            {
                var combinedCVXHullM = CreateCombinedConvexHull2(movingNodes, convexHullForParts);
                var VolumeM          = GetSubassemblyVolume(movingNodes);
                var MassM            = GetSubassemblyMass(movingNodes);
                var centerOfMass     = GetSubassemblyCenterOfMass(movingNodes);
                movingAssembly = new SubAssembly(new HashSet <Component>(movingNodes), combinedCVXHullM, MassM, VolumeM, centerOfMass);
            }

            var referenceHyperArcnodes = new List <Component>();

            referenceHyperArcnodes = newSubAsmNodes.Where(a => !movingNodes.Contains(a)).ToList();
            if (referenceHyperArcnodes.Count == 1)
            {
                var nodeName = referenceHyperArcnodes[0].name;
                refAssembly = new Part(nodeName,
                                       GetPartMass(referenceHyperArcnodes[0]), GetPartVolume(referenceHyperArcnodes[0]),
                                       convexHullForParts[nodeName], GetPartCenterOfMass(referenceHyperArcnodes[0]));
            }
            else
            {
                var combinedCVXHullR = CreateCombinedConvexHull2(referenceHyperArcnodes, convexHullForParts);
                var VolumeR          = GetSubassemblyVolume(referenceHyperArcnodes);
                var MassR            = GetSubassemblyMass(referenceHyperArcnodes);
                var centerOfMass     = GetSubassemblyCenterOfMass(referenceHyperArcnodes);
                refAssembly = new SubAssembly(new HashSet <Component>(referenceHyperArcnodes), combinedCVXHullR, MassR, VolumeR, centerOfMass);
            }
            //}
            //else throw new Exception("Only install rules in assembly at this point.");
            TVGLConvexHull combinedCVXHull = CreateCombinedConvexHull(
                refAssembly.CVXHull, movingAssembly.CVXHull);
            //List<PolygonalFace> refFacesInCombined, movingFacesInCombined;
            var InstallCharacter = shouldReferenceAndMovingBeSwitched(refAssembly, movingAssembly, combinedCVXHull,
                                                                      out refFacesInCombined, out movingFacesInCombined);

            if ((int)InstallCharacter < 0)
            {
                var tempASM = refAssembly;
                refAssembly        = movingAssembly;
                movingAssembly     = tempASM;
                refFacesInCombined = movingFacesInCombined; // no need to use temp here, as the movingFaces in the
                // combined convex hull are not needed.
                InstallCharacter = (InstallCharacterType)(-((int)InstallCharacter));
            }
            string refName        = NameMaker(refAssembly);
            string movName        = NameMaker(movingAssembly);
            var    newSubassembly = new SubAssembly(refAssembly, movingAssembly, combinedCVXHull, InstallCharacter,
                                                    refFacesInCombined);

            //newSubassembly.Name = refName +"   on   "+movName;
            newSubassembly.CenterOfMass = CombinedCenterOfMass(newSubassembly);
            // instead of adding to Subassemblies, newSubassembly must be added to its preceeding subassembly (to its parent)
            Subassemblies.Add(newSubassembly);
            return(newSubassembly);
        }
 /// <summary>
 ///   A necessary function when multiple (more than one) application of a rule is applied
 ///   to a host. The function reads in the child graph (often a copy of the current),
 ///   the current graph, and the Lmapping. The Lmapping is changed but the child and current are
 ///   unaffected.
 /// </summary>
 /// <param name = "child">The child.</param>
 /// <param name = "current">The current.</param>
 /// <param name = "Lmapping">The lmapping.</param>
 public static void transferLmappingToChild(designGraph child, designGraph current, option Lmapping)
 {
     transferLmappingToChild(child, current, Lmapping.nodes, Lmapping.arcs, Lmapping.hyperarcs);
 }
        static void Main(string[] args)
        {
            ServicePointManager.SecurityProtocol = Tls12;

            // Your username and password are imported from the following file
            // CPCWS_Rating_DotNet_Samples\REST\rating\user.xml
            var username = ConfigurationSettings.AppSettings["username"];
            var password = ConfigurationSettings.AppSettings["password"];

            var url = "https://qa.soa-gw.canadapost.ca/rs/ship/option/DC"; // REST URL

            var    method           = "GET";                               // HTTP Method
            String responseAsString = ".NET Framework " + Environment.Version.ToString() + "\r\n\r\n";

            try
            {
                // Create REST Request
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url);
                request.Method = method;

                // Set Basic Authentication Header using username and password variables
                string auth = "Basic " + Convert.ToBase64String(Encoding.Default.GetBytes(username + ":" + password));
                request.Headers = new WebHeaderCollection();
                request.Headers.Add("Authorization", auth);
                request.Headers.Add("Accept-Language", "en-CA");
                request.Accept = "application/vnd.cpc.ship.rate-v4+xml";

                // Execute REST Request
                HttpWebResponse response = (HttpWebResponse)request.GetResponse();

                // Deserialize response to option object
                XmlSerializer serializer = new XmlSerializer(typeof(option));
                TextReader    reader     = new StreamReader(response.GetResponseStream());
                option        option     = (option)serializer.Deserialize(reader);

                // Retrieve values from option object
                responseAsString += "Option Name: " + option.optionname + "\r\n";
                responseAsString += "Option Code: " + option.optioncode + "\r\n";
                responseAsString += "Option Class: " + option.optionclass + "\r\n";
                responseAsString += "Print on Label: " + option.printsonlabel + "\r\n";
                responseAsString += "Qualifier Required: " + option.qualifierrequired + "\r\n\r\n";
            }
            catch (WebException webEx)
            {
                HttpWebResponse response = (HttpWebResponse)webEx.Response;

                if (response != null)
                {
                    responseAsString += "HTTP  Response Status: " + webEx.Message + "\r\n";

                    // Retrieve errors from messages object
                    try
                    {
                        // Deserialize xml response to messages object
                        XmlSerializer serializer = new XmlSerializer(typeof(messages));
                        TextReader    reader     = new StreamReader(response.GetResponseStream());
                        messages      myMessages = (messages)serializer.Deserialize(reader);


                        if (myMessages.message != null)
                        {
                            foreach (var item in myMessages.message)
                            {
                                responseAsString += "Error Code: " + item.code + "\r\n";
                                responseAsString += "Error Msg: " + item.description + "\r\n";
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        // Misc Exception
                        responseAsString += "ERROR: " + ex.Message;
                    }
                }
                else
                {
                    // Invalid Request
                    responseAsString += "ERROR: " + webEx.Message;
                }
            }
            catch (Exception ex)
            {
                // Misc Exception
                responseAsString += "ERROR: " + ex.Message;
            }

            Console.WriteLine(responseAsString);
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey(true);
        }
Exemple #26
0
 public override double[] choose(option RC, candidate cand)
 {
     return(null);
 }
Exemple #27
0
      public ConvertibleFixedCouponBond( Exercise exercise,
                                         double conversionRatio,
                                         DividendSchedule dividends,
                                         CallabilitySchedule callability,
                                         Handle<Quote> creditSpread,
                                         Date issueDate,
                                         int settlementDays,
                                         List<double> coupons,
                                         DayCounter dayCounter,
                                         Schedule schedule,
                                         double redemption = 100)
         : base(exercise, conversionRatio, dividends, callability, creditSpread, issueDate, settlementDays, schedule, redemption) 
      {

        // !!! notional forcibly set to 100
        cashflows_ = new FixedRateLeg(schedule)
                           .withCouponRates(coupons, dayCounter)
                           .withNotionals(100.0)
                           .withPaymentAdjustment(schedule.businessDayConvention());

        addRedemptionsToCashflows(new List<double>(){redemption});

        Utils.QL_REQUIRE(redemptions_.Count == 1, "multiple redemptions created");

        option_ = new option(this, exercise, conversionRatio, dividends, callability, creditSpread, cashflows_, dayCounter, schedule,
                             issueDate, settlementDays, redemption);
    }