Inheritance: Unit
コード例 #1
0
 public SingleBarrierOption(Flag flag, SingleBarrierFlag barrierFlag, double s, double x, double k, double h, double r, double b, double t, double sigma)
     : base(flag, s, x, r, b, t, sigma)
 {
     this.h = h;
     this.k = k;
     this.barrierFlag = barrierFlag;
 }
コード例 #2
0
ファイル: scrLot.cs プロジェクト: amberene3d/Survival
 // FLAGS
 // clearing: Removing rubble and preparing to build. Lots must be cleared before building.
 void AddFlag(string flag, int duration)
 {
     Flag f = new Flag ();
     f.name = flag;
     f.duration = duration;
     flags.Add (f);
 }
コード例 #3
0
ファイル: Face.cs プロジェクト: jane22th/Project_SSL
 public void executeAnimation(Flag.Face.FlagFaceState f)
 {
     switch (f) {
         case Flag.Face.FlagFaceState.STATE_BLINK:
             animator.SetTrigger("blink");
             break;
         case Flag.Face.FlagFaceState.STATE_ATTACK:
             animator.SetTrigger("attack");
             break;
         case Flag.Face.FlagFaceState.STATE_CHARGE:
             animator.SetTrigger("charge");
             break;
         case Flag.Face.FlagFaceState.STATE_DANGER:
             animator.SetTrigger("danger");
             break;
         case Flag.Face.FlagFaceState.STATE_HIT:
             animator.SetTrigger("hit");
             break;
         case Flag.Face.FlagFaceState.STATE_TELL:
             animator.SetTrigger("tell");
             break;
         default:
             break;
     }
 }
コード例 #4
0
 public TalkTree()
 {
     m_nodeId = "";
     m_npcText = "";
     m_pcReplies = null;
     m_flag = null;
 }
コード例 #5
0
ファイル: Account.cs プロジェクト: jiowchern/Regulus
 public Account()
 {
     Competnces = new Flag<COMPETENCE>();
     Guid = Guid.NewGuid();
     Name = Id.ToString();
     Password = Id.ToString();
 }
コード例 #6
0
ファイル: MainThreadTask.cs プロジェクト: fengqk/Art
	/// <summary>
	/// 异步调用函数并等待其完成 (有死锁风险)
	/// </summary>
	/// <param name="action">欲调用的函数</param>
	public static void RunUntilFinish(Action action, Flag cancelFlag=null)
	{
		if (IsMainThread())
			action();
		else
			RunUntilFinish(MakeCoroutineFromAction(action), cancelFlag);
	}
コード例 #7
0
 public YNode(int depth,object key,object o,int rf,Flag flags) {
     Depth=depth;
     Key=key;
     O=o;
     Ref=rf;
     Flags=flags;
 }
コード例 #8
0
		public string FlagData(Flag flag)
		{
			string data = "";
			if (FlagUsed(flag))
				data = (string)flagUsed[flag];
			return data;
		}
コード例 #9
0
ファイル: FlagTest.cs プロジェクト: jiowchern/Regulus
        public void TestCustomFlag2()
        {
            var flags = new Flag<TESTENUM>(TESTENUM._1, TESTENUM._3);

            Assert.AreEqual(false, flags[TESTENUM._2]);
            Assert.AreEqual(true, flags[TESTENUM._3]);
        }
コード例 #10
0
ファイル: Rss.cs プロジェクト: Mr-Zoidberg/CommandParser
        private string[,] getRssData(string channel)
        {
            Console.WriteLine("LOADING FEED... Please wait.");
            XmlNodeList items;
            try
            {
                WebRequest request = WebRequest.Create(channel);
                WebResponse responce = request.GetResponse();
                Stream rssStream = responce.GetResponseStream();
                XmlDocument rssDoc = new XmlDocument();
                rssDoc.Load(rssStream);
                items = rssDoc.SelectNodes("rss/channel/item");
            }
            catch (UriFormatException)
            {
                Console.Clear();

                    Console.WriteLine("\n");
                    Console.WriteLine($"Error: {channel} doesn't seem to be a valid feed URL. Exiting.");
                    Thread.Sleep(1500);

                Console.Clear();
                Flag flag = new Flag("-help");
                flag.Do();
                return null;
            }
            catch (Exception ex)
            {
                Console.Clear();

                    Console.WriteLine("\n");
                    Console.WriteLine($"Cannot load feed. Why? {ex.Message}");
                    Thread.Sleep(1500);

                Console.Clear();
                Flag flag = new Flag("-help");
                flag.Do();
                return null;
            }

            string[,] tempRssData = new string[items.Count, 3];
            for (int i = 0; i < items.Count; i++)
            {
                XmlNode rssNode;

                rssNode = items.Item(i).SelectSingleNode("title");

                if (rssNode != null) tempRssData[i, 0] = rssNode.InnerText;
                else tempRssData[i, 0] = "";

                rssNode = items.Item(i).SelectSingleNode("description");
                if (rssNode != null) tempRssData[i, 1] = rssNode.InnerText;
                else tempRssData[i, 1] = "";

                rssNode = items.Item(i).SelectSingleNode("link");
                if (rssNode != null) tempRssData[i, 2] = rssNode.InnerText;
                else tempRssData[i, 2] = "";
            }
            return tempRssData;
        }
コード例 #11
0
ファイル: GapOption.cs プロジェクト: gmarklow87/OptionLib
 /// <summary>
 /// Creates a new instance of GapOption
 /// </summary>
 /// <param name="flag">Call/Put flag</param>
 /// <param name="s">Asset price</param>
 /// <param name="x">Strike price</param>
 /// <param name="x">Strike price 2</param>
 /// <param name="r">Risk-free interest rate</param>
 /// <param name="b">Yield</param>
 /// <param name="t">Time to expiry in years</param>
 /// <param name="sigma">Asset volatility</param>
 public GapOption(Flag flag, double s, double x1, double x2, double r, double b, double t, double sigma)
     : base(flag, s, x1, r, b, t, sigma)
 {
     this.x2 = x2;
     d1 = (Math.Log(s / x) + (r - b + (0.5 * Math.Pow(sigma, 2))) * t) / (sigma * Math.Sqrt(t));
     d2 = d1 - sigma * Math.Sqrt(t);
 }
コード例 #12
0
ファイル: Glyf.cs プロジェクト: RainsSoft/NRasterizer
 private static short[] ReadCoordinates(BinaryReader input, int pointCount, Flag[] flags, Flag isByte, Flag signOrSame)
 {
     var xs = new short[pointCount];
     int x = 0;
     for (int i = 0; i < pointCount; i++)
     {
         int dx;
         if (flags[i].HasFlag(isByte))
         {
             var b = input.ReadByte();
             dx = flags[i].HasFlag(signOrSame) ? b : -b;
         }
         else
         {
             if (flags[i].HasFlag(signOrSame))
             {
                 dx = 0;
             }
             else
             {
                 dx = input.ReadInt16();
             }
         }
         x += dx;
         xs[i] = (short)x; // TODO: overflow?
     }
     return xs;
 }
コード例 #13
0
        public String CreateFlagsXML(Flag[] flags, String personID)
        {
            // Create the xml document
            XmlDocument doc = new XmlDocument();// Create the XML Declaration, and append it to XML document
            XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-8", null);
            doc.AppendChild(dec);// Create the root element
            XmlElement root = doc.CreateElement("UpdateFlags");
            doc.AppendChild(root);
            // Note that to set the text inside the element,
            // you use .InnerText instead of .Value (which will throw an exception).
            // You use SetAttribute to set attribute
            foreach (Domain.Flag curFlag in flags)
            {
                if (curFlag != null)
                {
                    XmlElement Flag = doc.CreateElement("Flag");
                    XmlElement FlagValue = doc.CreateElement("FlagValue");
                    XmlElement FlagNumber = doc.CreateElement("FlagNumber");
                    XmlElement Person_ID = doc.CreateElement("PersonID");
                    FlagValue.InnerText = curFlag.FlagValue;
                    FlagNumber.InnerText = curFlag.FlagNumber.ToString();
                    Person_ID.InnerText = personID;
                    Flag.AppendChild(FlagValue);
                    Flag.AppendChild(FlagNumber);
                    Flag.AppendChild(Person_ID);
                    root.AppendChild(Flag);
                }
            }

            string xmlOutput = doc.OuterXml;
            return xmlOutput;
        }
コード例 #14
0
 public void Unpack()
 {
     CommandId          = (UInt16)(Buffer[1] | (((UInt16)Buffer[2]) << 8));
     Flags              = (Flag)Buffer[3];
     PacketInterval     = Buffer[4];
     KeepAliveIntervalMs= (UInt16)(Buffer[5] | (((UInt16)Buffer[6]) << 8));
 }
コード例 #15
0
	public FlaggedUsersDetails(FlaggedUsersViewModel viewModel, Flag flag)
    {
      InitializeComponent();
	  Icon = "badge.png";
		viewModel.Flag = flag;
		Title = flag.AlertLevel.ToString();
	  BindingContext = this.viewModel = viewModel;
    }
コード例 #16
0
        /**
         * Adds a flag
         */
        public static Flag AddFlag(string name, bool state = false)
        {
            Flag newFlag = new Flag(name, state);

            GetInstance().flags.Add(newFlag);

            return newFlag;
        }
コード例 #17
0
 protected HotRodOperation(Codec codec, Flag[] flags, byte[] cacheName, int topologyId)
 {
     this.flags = flags;
     this.cacheName = cacheName;
     this.topologyId = topologyId;
     this.codec = codec;
     logger = LogManager.GetLogger("Hot Rod Operation");
 }
コード例 #18
0
 public DoubleBarrierOption(Flag flag, DoubleBarrierFlag barrierFlag, double s, double x, double l, double u, double r, double b, double t, double sigma, double delta1 = 0, double delta2 = 0)
     : base(flag, s, x, r, b, t, sigma)
 {
     this.l = l;
     this.u = u;
     this.delta1 = delta1;
     this.delta2 = delta2;
     this.barrierFlag = barrierFlag;
 }
コード例 #19
0
ファイル: parse-code.cs プロジェクト: firda-cze/bee
		protected void FullExpr( Flag flags )
		{
			var mark = Cgen.ExprStart();
			if( ((flags & Flag.Noexpr) == 0) || (!Noexpr( flags )) )
			{
				Expression( flags & (~Flag.Noexpr) );
			}
			Cgen.ExprEnd( mark );
		}//FullExpr
コード例 #20
0
 //private readonly IdCardClient idCardClient;
 public AddFlagsPresenter(Flag[] flags, String personID)
 {
     String xml = CreateFlagsXML(flags, personID);
     //MessageBoxResult result = MessageBox.Show("personID: " + personID);
     System.Text.ASCIIEncoding encoding = new System.Text.ASCIIEncoding();
     Byte[] bytes = System.Text.Encoding.UTF8.GetBytes(xml);
     IdCardClient idCardClient = new IdCardClient();
     idCardClient.UpdateFlags(bytes, STAGE_HOST, new WSSessionAuthenticationProvider());
 }
コード例 #21
0
 public SensorConfig()
 {
     this.CommandId = 0;
     this.Flags = 0;
     this.PacketInterval = 0;
     this.KeepAliveIntervalMs = 0;
     Array.Clear(Buffer, 0, 0);
     Buffer[0] = 2;
 }
コード例 #22
0
        public OperationResult Run(Flag flag = Flag.All)
        {
            RPCEvent = new AutoResetEvent(false);
            ErrorOccurred = false;

            if ((flag & Flag.PublicSummonerData) != Flag.None)
                Counter++;
            if ((flag & Flag.PlayerStats) != Flag.None)
                Counter++;
            if ((flag & Flag.AggregatedStats) != Flag.None)
                Counter++;
            if ((flag & Flag.RecentGames) != Flag.None)
                Counter++;

            try
            {

                if ((flag & Flag.PublicSummonerData) != Flag.None)
                    RPC.GetAllPublicSummonerDataByAccountAsync(AccountId,
                                                               new Responder<AllPublicSummonerDataDTO>(GetPublicSummonerData, Error));

                if ((flag & Flag.PlayerStats) != Flag.None)
                    RPC.RetrievePlayerStatsByAccountIDAsync(AccountId, "CURRENT",
                                                            new Responder<PlayerLifeTimeStats>(GetLifeTimeStatistics, Error));

                if ((flag & Flag.AggregatedStats) != Flag.None)
                    RPC.GetAggregatedStatsAsync(AccountId, "CLASSIC", "CURRENT",
                                                new Responder<AggregatedStats>(GetAggregatedStatistics, Error));

                if ((flag & Flag.RecentGames) != Flag.None)
                    RPC.GetRecentGamesAsync(AccountId, new Responder<RecentGames>(GetRecentGameData, Error));

                if(RPCEvent.WaitOne(RPCTimeout))
                {
                    if (ErrorOccurred)
                    {
                        //This is not correct - it should really return some error state but I can't be bothered to change the JavaScript handling of error enums right now
                        return OperationResult.NotFound;
                    }
                    else if (
                        (((flag & Flag.PublicSummonerData) != Flag.None) && (PublicSummonerData == null)) ||
                        (((flag & Flag.PlayerStats) != Flag.None) && (LifeTimeStatistics == null)) ||
                        (((flag & Flag.AggregatedStats) != Flag.None) && (AggregatedStatistics == null)) ||
                        (((flag & Flag.RecentGames) != Flag.None) && (RecentGameData == null)) )
                        return OperationResult.NotFound;
                    else
                        return OperationResult.Success;
                }
                else
                    return OperationResult.Timeout;
            }
            catch (RPCNotConnectedException)
            {
                return OperationResult.NotConnected;
            }
        }
コード例 #23
0
	void Behave() {
		int randAction = UnityEngine.Random.Range(0, 2);
		int randLane = UnityEngine.Random.Range(0, 3);
		Command command = randAction == 0 ? Command.Attack : Command.Defense;
		Argument argument = randAction == 0 ? Argument.Virus : Argument.Firewall;
		Flag[] flags = new Flag[1];
		flags[0] = (Flag)randLane;
		var commandGroup = new CommandGroup(command, argument, flags, 0);
		processor.Process(commandGroup, Side.Right);
	}
コード例 #24
0
ファイル: FlagTest.cs プロジェクト: jiowchern/Regulus
        public void TestCustomFlagSerializer()
        {
            var flags = new Flag<TESTENUM>(TESTENUM._1, TESTENUM._3);

            var buffer = TypeHelper.Serializer(flags);
            var flags2 = TypeHelper.Deserialize<Flag<TESTENUM>>(buffer);

            Assert.AreEqual(false, flags2[TESTENUM._2]);
            Assert.AreEqual(true, flags2[TESTENUM._3]);
        }
コード例 #25
0
ファイル: FlagTest.cs プロジェクト: jiowchern/Regulus
        public void TestCustomFlagConvert()
        {
            var flags = new Flag<TESTENUM>(TESTENUM._1, TESTENUM._3);
            var objs = (from e in flags select (object)e).ToArray();

            Flag<TESTENUM> flag2 = objs;

            Assert.AreEqual(false, flag2[TESTENUM._2]);
            Assert.AreEqual(true, flag2[TESTENUM._3]);
        }
コード例 #26
0
ファイル: FlagTest.cs プロジェクト: jiowchern/Regulus
        public void TestCustomFlag1()
        {
            var flags = new Flag<TESTENUM>();
            flags[TESTENUM._1] = false;
            flags[TESTENUM._2] = true;
            flags[TESTENUM._3] = false;

            Assert.AreEqual(true, flags[TESTENUM._2]);
            Assert.AreEqual(false, flags[TESTENUM._3]);
        }
コード例 #27
0
        public LookbackOptionBase(Flag flag, double s, double? s_min, double? s_max, double x, double r, double b, double t, double sigma)
            : base(flag, s, x, r, b, t, sigma)
        {
            if ((flag == Flag.Call && s_min == null) || (flag == Flag.Put && s_max == null))
            {
                throw new Exception("Lookback option error. Call options should have a minimum strike. Put options should have a maximum strike.");
            }

            this.s_min = s_min;
            this.s_max = s_max;
        }
コード例 #28
0
ファイル: ImageManager.cs プロジェクト: koxerion/HentaiHeroes
 public static string getRandomImage(string name, Flag flag)
 {
     List<string> imageList = new List<string>();
     foreach(CharacterImage characterImage in images[name])
     {
         if (characterImage.flag == flag)
             imageList.Add(characterImage.imagePath);
     }
     int randomNumber = (int)UnityEngine.Random.Range(0, imageList.Count);
     return imageList[randomNumber];
 }
コード例 #29
0
ファイル: FlagTests.cs プロジェクト: dataartisan/Project2C
 public void FlagConstructorTest()
 {
     f = new Flag { Enter = true };
     Assert.AreEqual(f.Enter, true);
     f = new Flag { GreenFlag = true };
     Assert.AreEqual(f.GreenFlag, true);
     f = new Flag { Left = true };
     Assert.AreEqual(f.Left, true);
     f = new Flag { RedFlag = true };
     Assert.AreEqual(f.RedFlag, true);
 }
コード例 #30
0
ファイル: FlagTest.cs プロジェクト: jiowchern/Regulus
        public void TestToArray()
        {
            var flags = new Flag<TESTENUM>();
            flags[TESTENUM._1] = true;
            flags[TESTENUM._2] = false;
            flags[TESTENUM._3] = true;

            var array = flags.ToArray();

            Assert.AreNotEqual(TESTENUM._2, array[0]);
            Assert.AreNotEqual(TESTENUM._2, array[1]);
        }
コード例 #31
0
ファイル: Converters.cs プロジェクト: acdvorak/MPF
        /// <summary>
        /// Get the string representation of the Flag enum values
        /// </summary>
        /// <param name="command">Flag value to convert</param>
        /// <returns>String representing the value, if possible</returns>
        public static string LongName(Flag flag)
        {
            switch (flag)
            {
            // Boolean flags
            case Flag.Adler32:
                return(FlagStrings.Adler32Long);

            case Flag.Clear:
                return(FlagStrings.ClearLong);

            case Flag.ClearAll:
                return(FlagStrings.ClearAllLong);

            case Flag.CRC16:
                return(FlagStrings.CRC16Long);

            case Flag.CRC32:
                return(FlagStrings.CRC32Long);

            case Flag.CRC64:
                return(FlagStrings.CRC64Long);

            case Flag.Debug:
                return(FlagStrings.DebugLong);

            case Flag.DiskTags:
                return(FlagStrings.DiskTagsLong);

            case Flag.DuplicatedSectors:
                return(FlagStrings.DuplicatedSectorsLong);

            case Flag.Eject:
                return(FlagStrings.EjectLong);

            case Flag.ExtendedAttributes:
                return(FlagStrings.ExtendedAttributesLong);

            case Flag.Filesystems:
                return(FlagStrings.FilesystemsLong);

            case Flag.FirstPregap:
                return(FlagStrings.FirstPregapLong);

            case Flag.FixOffset:
                return(FlagStrings.FixOffsetLong);

            case Flag.FixSubchannel:
                return(FlagStrings.FixSubchannelLong);

            case Flag.FixSubchannelCrc:
                return(FlagStrings.FixSubchannelCrcLong);

            case Flag.FixSubchannelPosition:
                return(FlagStrings.FixSubchannelPositionLong);

            case Flag.Fletcher16:
                return(FlagStrings.Fletcher16Long);

            case Flag.Fletcher32:
                return(FlagStrings.Fletcher32Long);

            case Flag.Force:
                return(FlagStrings.ForceLong);

            case Flag.GenerateSubchannels:
                return(FlagStrings.GenerateSubchannelsLong);

            case Flag.Help:
                return(FlagStrings.HelpLong);

            case Flag.LongFormat:
                return(FlagStrings.LongFormatLong);

            case Flag.LongSectors:
                return(FlagStrings.LongSectorsLong);

            case Flag.MD5:
                return(FlagStrings.MD5Long);

            case Flag.Metadata:
                return(FlagStrings.MetadataLong);

            case Flag.Partitions:
                return(FlagStrings.PartitionsLong);

            case Flag.Persistent:
                return(FlagStrings.PersistentLong);

            case Flag.Private:
                return(FlagStrings.PrivateLong);

            case Flag.Resume:
                return(FlagStrings.ResumeLong);

            case Flag.RetrySubchannel:
                return(FlagStrings.RetrySubchannelLong);

            case Flag.SectorTags:
                return(FlagStrings.SectorTagsLong);

            case Flag.SeparatedTracks:
                return(FlagStrings.SeparatedTracksLong);

            case Flag.SHA1:
                return(FlagStrings.SHA1Long);

            case Flag.SHA256:
                return(FlagStrings.SHA256Long);

            case Flag.SHA384:
                return(FlagStrings.SHA384Long);

            case Flag.SHA512:
                return(FlagStrings.SHA512Long);

            case Flag.SkipCdiReadyHole:
                return(FlagStrings.SkipCdiReadyHoleLong);

            case Flag.SpamSum:
                return(FlagStrings.SpamSumLong);

            case Flag.StopOnError:
                return(FlagStrings.StopOnErrorLong);

            case Flag.Tape:
                return(FlagStrings.TapeLong);

            case Flag.Trim:
                return(FlagStrings.TrimLong);

            case Flag.Verbose:
                return(FlagStrings.VerboseLong);

            case Flag.VerifyDisc:
                return(FlagStrings.VerifyDiscLong);

            case Flag.VerifySectors:
                return(FlagStrings.VerifySectorsLong);

            case Flag.Version:
                return(FlagStrings.VersionLong);

            case Flag.WholeDisc:
                return(FlagStrings.WholeDiscLong);

            // Int8 flags
            case Flag.Speed:
                return(FlagStrings.SpeedLong);

            // Int16 flags
            case Flag.RetryPasses:
                return(FlagStrings.RetryPassesLong);

            case Flag.Width:
                return(FlagStrings.WidthLong);

            // Int32 flags
            case Flag.BlockSize:
                return(FlagStrings.BlockSizeLong);

            case Flag.Count:
                return(FlagStrings.CountLong);

            case Flag.MediaLastSequence:
                return(FlagStrings.MediaLastSequenceLong);

            case Flag.MediaSequence:
                return(FlagStrings.MediaSequenceLong);

            case Flag.Skip:
                return(FlagStrings.SkipLong);

            // Int64 flags
            case Flag.Length:
                return(FlagStrings.LengthLong);

            case Flag.Start:
                return(FlagStrings.StartLong);

            // String flags
            case Flag.Comments:
                return(FlagStrings.CommentsLong);

            case Flag.Creator:
                return(FlagStrings.CreatorLong);

            case Flag.DriveManufacturer:
                return(FlagStrings.DriveManufacturerLong);

            case Flag.DriveModel:
                return(FlagStrings.DriveModelLong);

            case Flag.DriveRevision:
                return(FlagStrings.DriveRevisionLong);

            case Flag.DriveSerial:
                return(FlagStrings.DriveSerialLong);

            case Flag.Encoding:
                return(FlagStrings.EncodingLong);

            case Flag.FormatConvert:
                return(FlagStrings.FormatConvertLong);

            case Flag.FormatDump:
                return(FlagStrings.FormatDumpLong);

            case Flag.ImgBurnLog:
                return(FlagStrings.ImgBurnLogLong);

            case Flag.MediaBarcode:
                return(FlagStrings.MediaBarcodeLong);

            case Flag.MediaManufacturer:
                return(FlagStrings.MediaManufacturerLong);

            case Flag.MediaModel:
                return(FlagStrings.MediaModelLong);

            case Flag.MediaPartNumber:
                return(FlagStrings.MediaPartNumberLong);

            case Flag.MediaSerial:
                return(FlagStrings.MediaSerialLong);

            case Flag.MediaTitle:
                return(FlagStrings.MediaTitleLong);

            case Flag.MHDDLog:
                return(FlagStrings.MHDDLogLong);

            case Flag.Namespace:
                return(FlagStrings.NamespaceLong);

            case Flag.Options:
                return(FlagStrings.OptionsLong);

            case Flag.OutputPrefix:
                return(FlagStrings.OutputPrefixLong);

            case Flag.ResumeFile:
                return(FlagStrings.ResumeFileLong);

            case Flag.Subchannel:
                return(FlagStrings.SubchannelLong);

            case Flag.XMLSidecar:
                return(FlagStrings.XMLSidecarLong);

            case Flag.NONE:
            default:
                return("");
            }
        }
コード例 #32
0
ファイル: CARS.cs プロジェクト: worm202/OpenIII
 public CARSType8(int id, string modelName, string txdName, string type, string handlingId, string gxtKey, string anims, string vehicleClass, int frequency, int flags, Flag comprules, int wheelId, double wheelScaleFront, double wheelScaleRear, int wheelUpgradeClass)
 {
     this.Id                = id;
     this.ModelName         = modelName;
     this.TxdName           = txdName;
     this.Type              = type;
     this.HandlingId        = handlingId;
     this.GXTKey            = gxtKey;
     this.Anims             = anims;
     this.VehicleClass      = vehicleClass;
     this.Frequency         = frequency;
     this.Flags             = flags;
     this.Comprules         = comprules;
     this.WheelId           = wheelId;
     this.WheelScaleFront   = wheelScaleFront;
     this.WheelScaleRear    = wheelScaleRear;
     this.WheelUpgradeClass = wheelUpgradeClass;
 }
コード例 #33
0
ファイル: AppFreeCanUnn.cs プロジェクト: thisiscam/formula
        /// <summary>
        /// Attempts to compute the canonical form.
        /// </summary>
        internal bool Canonize(string myName, List <Flag> flags, CancellationToken cancel, Symbol myself = null)
        {
            if (typeExpr == null)
            {
                return(true);
            }

            //// Step 1. Replace all unions with their expansions and all
            //// Con/Map symbols with their corresponding sorts.
            var processed = new Set <Symbol>(Symbol.Compare);
            var stack     = new Stack <UserSymbol>();

            if (myself != null)
            {
                elements.Remove(myself);
                processed.Add(myself);
            }

            foreach (var s in elements)
            {
                if (s.Kind == SymbolKind.ConSymb ||
                    s.Kind == SymbolKind.MapSymb ||
                    s.Kind == SymbolKind.UnnSymb)
                {
                    processed.Add(s);
                    stack.Push((UserSymbol)s);
                }
            }

            AppFreeCanUnn otherCanUnn;
            UserSymbol    n;

            while (stack.Count > 0)
            {
                n = stack.Pop();
                elements.Remove(n);

                if (n.Kind == SymbolKind.ConSymb)
                {
                    elements.Add(((ConSymb)n).SortSymbol);
                }
                else if (n.Kind == SymbolKind.MapSymb)
                {
                    elements.Add(((MapSymb)n).SortSymbol);
                }
                else if (n.CanonicalForm != null)
                {
                    elements.UnionWith(n.CanonicalForm[0].elements);
                    intervals.UnionWith(n.CanonicalForm[0].intervals);
                }
                else
                {
                    otherCanUnn = (AppFreeCanUnn)n.Definitions.First <AST <Node> >().Node.CompilerData;
                    intervals.UnionWith(otherCanUnn.intervals);
                    foreach (var sp in otherCanUnn.elements)
                    {
                        if (processed.Contains(sp))
                        {
                            continue;
                        }

                        if (sp.Kind == SymbolKind.ConSymb ||
                            sp.Kind == SymbolKind.MapSymb ||
                            sp.Kind == SymbolKind.UnnSymb)
                        {
                            processed.Add(sp);
                            stack.Push((UserSymbol)sp);
                        }
                        else
                        {
                            elements.Add(sp);
                        }
                    }
                }
            }

            //// Step 2. Apply a set of simplification rules to canonize combinations of base sorts
            var realSort = table.GetSortSymbol(BaseSortKind.Real);
            var intSort  = table.GetSortSymbol(BaseSortKind.Integer);
            var natSort  = table.GetSortSymbol(BaseSortKind.Natural);
            var negSort  = table.GetSortSymbol(BaseSortKind.NegInteger);
            var posSort  = table.GetSortSymbol(BaseSortKind.PosInteger);
            var strSort  = table.GetSortSymbol(BaseSortKind.String);

            //// PosInteger + {0} = Natural
            if (elements.Contains(posSort) && intervals.Contains(BigInteger.Zero, BigInteger.Zero))
            {
                elements.Add(natSort);
            }

            //// Natural + NegInteger = Integer
            if (elements.Contains(negSort) && elements.Contains(natSort))
            {
                elements.Add(intSort);
            }

            //// Removed subsumed sorts.
            if (elements.Contains(realSort))
            {
                intervals.Clear();
                elements.Remove(intSort);
                elements.Remove(natSort);
                elements.Remove(negSort);
                elements.Remove(posSort);
            }
            else if (elements.Contains(intSort))
            {
                intervals.Clear();
                elements.Remove(natSort);
                elements.Remove(negSort);
                elements.Remove(posSort);
            }

            if (elements.Contains(natSort))
            {
                BigInteger min, max;
                if (intervals.GetExtrema(out min, out max))
                {
                    intervals.Remove(BigInteger.Zero, BigInteger.Max(BigInteger.Zero, max));
                }

                elements.Remove(posSort);
            }
            else if (elements.Contains(posSort))
            {
                BigInteger min, max;
                if (intervals.GetExtrema(out min, out max))
                {
                    intervals.Remove(BigInteger.One, BigInteger.Max(BigInteger.One, max));
                }
            }

            if (elements.Contains(negSort))
            {
                BigInteger min, max;
                if (intervals.GetExtrema(out min, out max))
                {
                    intervals.Remove(BigInteger.Min(BigInteger.MinusOne, min), BigInteger.MinusOne);
                }
            }

            if (elements.Contains(strSort))
            {
                var dropList = new List <Symbol>();
                foreach (var e in elements)
                {
                    if (e.Kind == SymbolKind.BaseCnstSymb && ((BaseCnstSymb)e).CnstKind == CnstKind.String)
                    {
                        dropList.Add(e);
                    }
                }

                foreach (var e in dropList)
                {
                    elements.Remove(e);
                }
            }

            if (elements.Count == 0 && intervals.Count == 0)
            {
                var flag = new Flag(
                    SeverityKind.Error,
                    typeExpr.Node,
                    Constants.BadTypeDecl.ToString(myName, "it has no members"),
                    Constants.BadTypeDecl.Code);
                flags.Add(flag);
                return(false);
            }
            else
            {
                if (intervals.Count > 0)
                {
                    ContainsConstants = true;
                }
                else
                {
                    foreach (var e in elements)
                    {
                        if (e.Kind == SymbolKind.BaseCnstSymb ||
                            e.Kind == SymbolKind.UserCnstSymb ||
                            e.Kind == SymbolKind.BaseSortSymb)
                        {
                            ContainsConstants = true;
                            break;
                        }
                    }
                }
            }

            return(true);
        }
コード例 #34
0
 public async Task <IActionResult> ShowCreateFlagFormAsync(int labId, Flag flag = null)
 {
     return(await RenderAsync(ViewType.Create, labId, flag));
 }
コード例 #35
0
ファイル: CARS.cs プロジェクト: worm202/OpenIII
 public CARSType9(int id, string modelName, string txdName, string type, string handlingId, string gxtKey, string anims, string vehicleClass, int frequency, int flags, Flag comprules)
 {
     this.Id           = id;
     this.ModelName    = modelName;
     this.TxdName      = txdName;
     this.Type         = type;
     this.HandlingId   = handlingId;
     this.GXTKey       = gxtKey;
     this.Anims        = anims;
     this.VehicleClass = vehicleClass;
     this.Frequency    = frequency;
     this.Flags        = flags;
     this.Comprules    = comprules;
 }
コード例 #36
0
 public Int32 i_Double(Int32 arg)
 {
     Flag.Add(1); return(arg * 2);
 }
コード例 #37
0
 public OverlayFlag(Flag flag, string path, double x, double y, double width, double height, int maximumX, int maximumY)
     : base(Colors.White, x, y, width, height, maximumX, maximumY)
 {
     Flag = flag;
     Path = path;
 }
コード例 #38
0
 public static Int32 s_Double(Int32 arg)
 {
     Flag.Add(1); return(arg * 2);
 }
コード例 #39
0
 public static Int32 s_Negate(Int32 arg)
 {
     Flag.Add(10); return(-arg);
 }
コード例 #40
0
 public ClassWithPrivateCtor3(int i)
 {
     Flag.Increase(300);
 }
コード例 #41
0
 private ClassWithPrivateCtor3()
 {
     Flag.Increase(200);
 }
コード例 #42
0
 static ClassWithPrivateCtor3()
 {
     Flag.Reset(100);
 }
コード例 #43
0
 public State(AnimData current)
 {
     this.elapsed = 0;
     this.flag    = Flag.None;
     this.current = current;
 }
コード例 #44
0
 public Int32 i_Negate(Int32 arg)
 {
     Flag.Add(10); return(-arg);
 }
コード例 #45
0
 public OverlayFlag(Flag flag, string path, int maximumX, int maximumY)
     : base(maximumX, maximumY)
 {
     Flag = flag;
     Path = path;
 }
コード例 #46
0
 public Int32 i_Square(Int32 arg)
 {
     Flag.Add(100); return(arg * arg);
 }
コード例 #47
0
ファイル: FlagLogic.cs プロジェクト: pnm563/Flags
 public void AddFlag(Flag Flag)
 {
     Flag.ID = Guid.NewGuid();
     _dataAccess.AddFlag(Flag);
 }
コード例 #48
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            if (sender == bgwWorker)
            {
                Flag idx = Flag.IDLE;
                try
                {
                    idx = (Flag)e.Argument;
                    if (idx != Flag.IDLE)
                    {
                        switch (idx)
                        {
                        case Flag.FormLoading:
                            if (Templates != null)
                            {
                                Templates.Clear();
                            }

                            Templates = MasterModule.Handler.RepositoryV2.Get <Template1Dto>()
                                        .Where(m => m.Status == 1 &&
                                               m.Entity.Equals(Entity) &&
                                               m.Type.Equals(WizardType.Import)).ToList();
                            Templates.Insert(0, new Template1Dto
                            {
                                Description = string.Format(MasterModule.Handler.Resources.GetString("Select_Item"), "template")
                            });

                            ExistEmployees = MasterModule.Handler.RepositoryV2.Get <EmployeeDto>()
                                             .Where(m => m.Status == 1).ToList();

                            e.Cancel = false;
                            e.Result = idx;
                            break;

                        case Flag.DataSaving:
                            try
                            {
                                TResult  = MasterModule.Handler.RepositoryV2.Insert <EmployeeDto>(Data);
                                e.Cancel = false;
                                e.Result = idx;
                            }
                            catch (Exception ex)
                            {
                                e.Cancel = true;
                                e.Result = ex.Message;
                            }
                            break;

                        case Flag.TemplateSaving:
                            try
                            {
                                TResult = MasterModule.Handler.RepositoryV2.Insert <Template1Dto>(Template);
                                if (TResult.Equals("0"))
                                {
                                    TResult = MasterModule.Handler.RepositoryV2.Insert <Template2Dto>(FieldsTemplate);
                                }

                                e.Cancel = false;
                                e.Result = idx;
                            }
                            catch (Exception ex)
                            {
                                e.Cancel = true;
                                e.Result = ex.Message;
                            }
                            break;

                        default:
                            e.Cancel = false;
                            e.Result = idx;
                            break;
                        }
                    }
                }
                catch (Exception ex)
                {
                    e.Cancel = true;
                    e.Result = ex.Message;
                }
            }
        }
コード例 #49
0
 public override string ToString()
 {
     return(Flag.ToString());
 }
コード例 #50
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BackgroundWorker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (sender == bgwWorker)
            {
                if (!e.Cancelled)
                {
                    Flag idx = Flag.IDLE;

                    try
                    {
                        idx = (Flag)e.Result;
                        if (idx != Flag.IDLE)
                        {
                            switch (idx)
                            {
                            case Flag.FormLoading:
                                btnBrowse.Enabled   = true;
                                tspProgress.Visible = false;
                                tsxStatus.Text      = MasterModule.Handler.Resources.GetString("Ready");
                                break;

                            case Flag.FileLoading:
                                cmbSheet.DataSource    = new BindingSource(Processor.GetSheets(), null);
                                cmbSheet.DisplayMember = "Value";
                                cmbSheet.ValueMember   = "Key";
                                cmbSheet.SelectedIndex = 0;
                                break;

                            case Flag.SheetLoading:
                                if (HeaderFile != null)
                                {
                                    HeaderFile.Clear();
                                }
                                HeaderFile = Processor.GetHeaders(cmbSheet.SelectedValue.ToString());
                                HeaderFile.Insert(0, string.Format(MasterModule.Handler.Resources.GetString("Select_Item"), string.Empty));

                                cmbOldCodeField.DataSource = new List <string>(HeaderFile);
                                cmbNameField.DataSource    = new List <string>(HeaderFile);
                                cmbAdd1Field.DataSource    = new List <string>(HeaderFile);
                                cmbAdd2Field.DataSource    = new List <string>(HeaderFile);
                                cmbCityField.DataSource    = new List <string>(HeaderFile);
                                cmbZipCodeField.DataSource = new List <string>(HeaderFile);
                                cmbPhone1Field.DataSource  = new List <string>(HeaderFile);
                                cmbPhone2Field.DataSource  = new List <string>(HeaderFile);
                                cmbEmailField.DataSource   = new List <string>(HeaderFile);

                                cmbTemplate.DataSource = Templates;
                                //cmbTemplate.ValueMember = "Code";

                                if (Templates.Count == 1)
                                {
                                    if (!string.IsNullOrWhiteSpace(Templates[0].Code))
                                    {
                                        cmbTemplate.Enabled = true;
                                    }
                                }
                                else
                                {
                                    cmbTemplate.Enabled = true;
                                }
                                cmbTemplate.SelectedIndex = 0;

                                cmbSheet.Enabled        = pnlField.Enabled = btnShowData.Enabled = true;
                                crlFieldLoading.Visible = false;
                                break;

                            case Flag.TemplateLoading:
                                ReadTemplate();
                                break;

                            case Flag.DataLoading:
                                if (MappingValid())
                                {
                                    if (MappingValue())
                                    {
                                        dgvData.DataSource = null;
                                        dgvData.DataSource = new BindingList <EmployeeDto>(Data);
                                        pnlData.Enabled    = true;

                                        if (Data.Count != 0)
                                        {
                                            btnSave.Enabled = true;
                                        }

                                        MappingTemplate();
                                    }
                                }
                                else
                                {
                                    pnlData.Enabled = false;
                                }
                                pnlField.Enabled          = btnShowData.Enabled = true;
                                crlDataLoadinging.Visible = false;
                                break;

                            case Flag.DataSaving:
                                if (TResult.Equals("0"))
                                {
                                    if (cmbTemplate.SelectedIndex == 0)
                                    {
                                        if (MessageBox.Show(this,
                                                            "Do you want to save this template?",
                                                            MasterModule.Name,
                                                            MessageBoxButtons.YesNo,
                                                            MessageBoxIcon.Question) == DialogResult.Yes)
                                        {
                                            TResult             = string.Empty;
                                            tsxStatus.Text      = "Saving Template...";
                                            tspProgress.Visible = true;
                                            tspProgress.Value   = 0;

                                            if (!bgwWorker.IsBusy)
                                            {
                                                bgwWorker.RunWorkerAsync(Flag.TemplateSaving);
                                            }
                                        }
                                        else
                                        {
                                            this.Close();
                                        }
                                    }
                                    else
                                    {
                                        this.Close();
                                    }
                                }
                                break;

                            case Flag.TemplateSaving:
                                if (TResult.Equals("0"))
                                {
                                    tsxStatus.Text      = "Complete all task";
                                    tspProgress.Visible = false;

                                    try
                                    {
                                        Thread.Sleep(1000);
                                    }
                                    catch { }
                                    this.Close();
                                }
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.Message);
                    }
                }
                else
                {
                    MessageBox.Show(e.Result.ToString());
                }
            }
        }
コード例 #51
0
ファイル: CARS.cs プロジェクト: worm202/OpenIII
 public CARSType1(int id, string modelName, string txdName, string type, string handlingId, string gxtKey, string vehicleClass, int frequency, int level, Flag comprules, int wheelModelId, double wheelScale)
 {
     this.Id           = id;
     this.ModelName    = modelName;
     this.TxdName      = txdName;
     this.Type         = type;
     this.HandlingId   = handlingId;
     this.GXTKey       = gxtKey;
     this.VehicleClass = vehicleClass;
     this.Frequency    = frequency;
     this.Level        = level;
     this.Comprules    = comprules;
     this.WheelModelId = wheelModelId;
     this.WheelScale   = wheelScale;
 }
コード例 #52
0
ファイル: FlagManager.cs プロジェクト: bmjoy/Unity2DRPG
    public void SetFlag(string flagName, bool value)
    {
        Flag flag = GetFlag(flagName);

        flag.value = value;
    }
コード例 #53
0
ファイル: CARS.cs プロジェクト: worm202/OpenIII
 public CARSType4(int id, string modelName, string txdName, string type, string handlingId, string gxtKey, string anims, string vehicleClass, int frequency, int level, Flag comprules, int lodModelId)
 {
     this.Id           = id;
     this.ModelName    = modelName;
     this.TxdName      = txdName;
     this.Type         = type;
     this.HandlingId   = handlingId;
     this.GXTKey       = gxtKey;
     this.Anims        = anims;
     this.VehicleClass = vehicleClass;
     this.Frequency    = frequency;
     this.Level        = level;
     this.Comprules    = comprules;
     this.LODModelId   = lodModelId;
 }
コード例 #54
0
        /*
         *      public static bool ViewerMayWatchPerson (int viewingPersonId, int watchedPersonId)
         *      {
         *              Authority authority = GetPersonAuthority(viewingPersonId);
         *
         *              int[] resultingList = FilterPersonList(new int[] { watchedPersonId }, authority);
         *
         *              resultingList = FilterUnlistedPeople(resultingList);
         *
         *              if (resultingList.Length == 0)
         *              {
         *                      return false;
         *              }
         *
         *              return true;
         *      }*/


        /// <summary>
        /// Checks for authorization for a specific activity.
        /// </summary>
        /// <param name="permissionsNeeded">The permissions to allow or disallow.</param>
        /// <param name="organizationId">The organization the activity is applied to.</param>
        /// <param name="geographyId">The node the activity is applied to, or zero for world.</param>
        /// <param name="checkedPersonId">The person performing the activity (NOT the victim of it).</param>
        /// <returns>True if allowed under current authority.</returns>
        public static bool CheckAuthorization(PermissionSet permissionsNeeded, int organizationId, int geoNodeId, int checkedPersonId, Flag flags)
        {
            return(CheckAuthorization(permissionsNeeded, organizationId, geoNodeId, GetPersonAuthority(checkedPersonId), flags));
        }
コード例 #55
0
ファイル: AppFreeCanUnn.cs プロジェクト: thisiscam/formula
        private UserSymbol Resolve(Id id, List <Flag> flags, bool isTypeId)
        {
            UserSymbol other;
            var        symbol = table.Resolve(id.Name, out other);

            if (symbol == null)
            {
                var flag = new Flag(
                    SeverityKind.Error,
                    id,
                    Constants.UndefinedSymbol.ToString(isTypeId ? "type id" : "constant", id.Name),
                    Constants.UndefinedSymbol.Code);
                flags.Add(flag);
            }
            else if (other != null)
            {
                var flag = new Flag(
                    SeverityKind.Error,
                    id,
                    Constants.AmbiguousSymbol.ToString(
                        isTypeId ? "type id" : "constant",
                        id.Name,
                        string.Format("({0}, {1}): {2}",
                                      symbol.Definitions.First <AST <Node> >().Node.Span.StartLine,
                                      symbol.Definitions.First <AST <Node> >().Node.Span.StartCol,
                                      symbol.FullName),
                        string.Format("({0}, {1}): {2}",
                                      other.Definitions.First <AST <Node> >().Node.Span.StartLine,
                                      other.Definitions.First <AST <Node> >().Node.Span.StartCol,
                                      other.FullName)),
                    Constants.AmbiguousSymbol.Code);
                flags.Add(flag);
            }
            else if (isTypeId &&
                     symbol.Kind != SymbolKind.ConSymb &&
                     symbol.Kind != SymbolKind.MapSymb &&
                     symbol.Kind != SymbolKind.BaseSortSymb &&
                     symbol.Kind != SymbolKind.UnnSymb)
            {
                var flag = new Flag(
                    SeverityKind.Error,
                    id,
                    Constants.BadId.ToString(symbol.Name, "type id"),
                    Constants.BadId.Code);
                flags.Add(flag);
            }
            else if (!isTypeId && (symbol.Kind != SymbolKind.UserCnstSymb || symbol.IsVariable))
            {
                var flag = new Flag(
                    SeverityKind.Error,
                    id,
                    Constants.BadId.ToString(symbol.PrintableName, "constant"),
                    Constants.BadId.Code);
                flags.Add(flag);
            }
            else
            {
                return(symbol);
            }

            return(null);
        }
コード例 #56
0
        /// <summary>
        /// Checks for authorization for a specific activity.
        /// </summary>
        /// <param name="permissionsNeeded">The permissions to allow or disallow.</param>
        /// <param name="organizationId">The organization the activity is applied to.</param>
        /// <param name="geographyId">The node the activity is applied to, or zero for world.</param>
        /// <param name="authority">The authority to test against.</param>
        /// <returns>True if allowed under current authority.</returns>
        public static bool CheckAuthorization(PermissionSet permissionsNeeded, int organizationId, int geoNodeId, Authority authority, Flag flags)
        {
            if (permissionsNeeded == null)
            {
                return(false);
            }
            Geography currentGeo = null;

            if (geoNodeId > 0)
            {
                try { currentGeo = Geography.FromIdentity(geoNodeId); }
                catch { }
            }

            Organization currentOrg = null;

            if (organizationId > 0)
            {
                try { currentOrg = Organization.FromIdentity(organizationId); }
                catch { }
            }


            foreach (PermissionSet.Item perm in permissionsNeeded)
            {
                int          thisFound       = 0;
                Geography    innerCurrentGeo = null;
                Organization innerCurrentOrg = null;

                if (perm.geographyId > 0)
                {
                    try { innerCurrentGeo = Geography.FromIdentity(perm.geographyId); }
                    catch { }
                }
                else
                {
                    innerCurrentGeo = currentGeo;
                }

                if (perm.orgId > 0)
                {
                    try { innerCurrentOrg = Organization.FromIdentity(perm.orgId); }
                    catch { }
                }
                else
                {
                    innerCurrentOrg = currentOrg;
                }

                RoleType[] rolesForPerm = new RoleType[] { };
                if (PermissonsDict.ContainsKey(perm.perm))
                {
                    rolesForPerm = PermissonsDict[perm.perm];
                }

                if (perm.perm == Permission.CanSeeSelf)
                {
                    thisFound = 1;
                }
                else if (rolesForPerm.Length > 0)
                {
                    thisFound = CheckSpecificValidRoles(authority, rolesForPerm, innerCurrentGeo, innerCurrentOrg, thisFound, flags);
                }


                if (permissionsNeeded.NeedOne && thisFound == 1)
                {
                    return(true);
                }
                if (permissionsNeeded.NeedAll && thisFound == -1)
                {
                    return(false);
                }
            }

            //If Need all and not already returned, no false one was found
            if (permissionsNeeded.NeedAll)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #57
0
 private bool FlagNotSet(Flag flag)
 {
     return(!FlagIsSet(flag));
 }
コード例 #58
0
 public OverlayFlag(int maximumX, int maximumY)
     : base(maximumX, maximumY)
 {
     Flag = new Flag("flag", new Ratio(2, 3), new Ratio(2, 3), new DivisionGrid(Colors.White, Colors.Black, 2, 2), new List <Overlay>());
 }
コード例 #59
0
 public void resume() => this.flag = Flag.Running;
コード例 #60
0
 public void pause() => this.flag  = Flag.Paused;