internal static extern void LeaderboardManager_FetchScorePage(
     HandleRef self,
      /* from(DataSource_t) */ Types.DataSource data_source,
      /* from(ScorePage_ScorePageToken_t) */ IntPtr token,
      /* from(uint32_t) */ uint max_results,
      /* from(LeaderboardManager_FetchScorePageCallback_t) */ FetchScorePageCallback callback,
      /* from(void *) */ IntPtr callback_arg);
 internal static extern void SnapshotManager_Open(
     HandleRef self,
      /* from(DataSource_t) */ Types.DataSource data_source,
      /* from(char const *) */ string file_name,
      /* from(SnapshotConflictPolicy_t) */ Types.SnapshotConflictPolicy conflict_policy,
      /* from(SnapshotManager_OpenCallback_t) */ OpenCallback callback,
      /* from(void *) */ IntPtr callback_arg);
 public GameFightFighterInformations(int contextualId, Types.EntityLook look, Types.EntityDispositionInformations disposition, sbyte teamId, bool alive, Types.GameFightMinimalStats stats)
     : base(contextualId, look, disposition)
 {
     this.teamId = teamId;
     this.alive = alive;
     this.stats = stats;
 }
Exemple #4
0
 /*
  * Función: CommandNode
  * Descripción: Constructor de un nodo de árbol de comando
  * Autor: Christian Vargas
  * Fecha de creación: 30/07/15
  * Fecha de modificación: --/--/--
  * Entradas: type (Types, el tipo de nodo), text (string, el texto del nodo), code (string, el código del nodo)
  * Salidas: (CommandNode, el nodo de árbol de comando con datos validos)
  */
 public CommandNode(Types type, string text, string code)
 {
     this.type = type;
     this.text = text;
     this.code = code;
     this.children = new LinkedList<CommandNode>();
 }
 public static void UpdateArtCache(Types.PosterWidth pWidth, MainForm form, ProgressState progress)
 {
     int width = Types.GetPosterWidthByEnum(pWidth);
     int i = 0;
     int count = Program.Context.Movies.Count(p => p.Status == Types.ItemStatus.Synced);
     foreach (Movie file in Program.Context.Movies.Include(p => p.Art).Where(p => p.Status == Types.ItemStatus.Synced))
     {
         progress.SetSubText("(" + ((++i) + 1) + "/" + count + ") " + file.Title);
         form.scanningBackgroundWorker.ReportProgress(progress.Value, progress);
         if (file.Art?.WebPath != null && (file.Art.CachePath == null || !File.Exists(file.Art.CachePath) || file.Art.Quality != pWidth))
         {
             if (File.Exists(file.Art.CachePath))
             {
                 File.Delete(file.Art.CachePath);
             }
             using (WebClient webClient = new WebClient())
             {
                 file.Art.Quality = pWidth;
                 try
                 {
                     string url = Program.ImageCacheUrl + @"\" + file.Art.WebPath.GetHashCode() + ".jpg";
                     webClient.DownloadFile(file.Art.WebPath.Replace("V1_SX300.jpg", $"V1_SX{width}.jpg"), url);
                     file.Art.CachePath = url;
                 }
                 catch (Exception)
                 {
                     file.Art.CachePath = null;
                 }
             }
         }
     }
     Program.Context.SaveChanges();
 }
 public ContactLookMessage(int requestId, string playerName, int playerId, Types.EntityLook look)
 {
     this.requestId = requestId;
     this.playerName = playerName;
     this.playerId = playerId;
     this.look = look;
 }
 public ObjectItemMinimalInformation(short objectGID, short powerRate, bool overMax, Types.ObjectEffect[] effects)
 {
     this.objectGID = objectGID;
     this.powerRate = powerRate;
     this.overMax = overMax;
     this.effects = effects;
 }
Exemple #8
0
 /// <summary>
 /// Создание контрола - кнопки
 /// </summary>
 /// <param name="x">X-Координата</param>
 /// <param name="y">Y-Координата</param>
 /// <param name="text">Надпись на кнопке</param>
 public TControl(int x, int y, String text)
 {
     Type = Types.Button;
     X = x;
     Y = y;
     String = text;
 }
 public GuildInAllianceInformations(int guildId, string guildName, Types.GuildEmblem guildEmblem, byte guildLevel, byte nbMembers, bool enabled)
     : base(guildId, guildName, guildEmblem)
 {
     this.guildLevel = guildLevel;
     this.nbMembers = nbMembers;
     this.enabled = enabled;
 }
Exemple #10
0
        public void CreatingSchemaForStatedClassesInTempFile() {
            var types = new Types(typeof(FooRecord), typeof(BarRecord));

            var fileName = "temp.sdf";
            var persistenceConfigurer = new SqlCeDataServicesProvider(fileName).GetPersistenceConfigurer(true/*createDatabase*/);
            ((MsSqlCeConfiguration)persistenceConfigurer).ShowSql();

            var sessionFactory = Fluently.Configure()
                .Database(persistenceConfigurer)
                .Mappings(m => m.AutoMappings.Add(AutoMap.Source(types)))
                .ExposeConfiguration(c => {
                    // This is to work around what looks to be an issue in the NHibernate driver:
                    // When inserting a row with IDENTITY column, the "SELET @@IDENTITY" statement
                    // is issued as a separate command. By default, it is also issued in a separate
                    // connection, which is not supported (returns NULL).
                    c.SetProperty("connection.release_mode", "on_close");
                    new SchemaExport(c).Create(false, true);
                })
                .BuildSessionFactory();

            var session = sessionFactory.OpenSession();
            session.Save(new FooRecord { Name = "Hello" });
            session.Save(new BarRecord { Height = 3, Width = 4.5m });
            session.Close();

            session = sessionFactory.OpenSession();
            var foos = session.CreateCriteria<FooRecord>().List();
            Assert.That(foos.Count, Is.EqualTo(1));
            Assert.That(foos, Has.All.Property("Name").EqualTo("Hello"));
            session.Close();
        }
Exemple #11
0
    public TileData(int x, int y, string name, Types type, int resourceQuantity, int moveCost, float _hp, float _defence, float _attk, float _shield, int nCost)
    {
        tileName = name;

        posX = x;
        posY = y;

        tileType = type;
        maxResourceQuantity = resourceQuantity;
        movementCost = moveCost;

        // MAKING ROCK UNWAKABLE

        if (type != Types.empty && type != Types.water) {
            isWalkable = false;
        }

        tileStats = new TileStats(_hp, _defence, _attk, _shield, nCost);

        //hp = _hp;
        //def = _defence;
        //attk = _attk;
        //shield = _shield;

        //nanoBotCost = nCost;
    }
Exemple #12
0
 /// <summary>
 /// Reading ctor
 /// </summary>
 internal Value(ResReader reader)
 {
     var size = reader.ReadUInt16();
     reader.Skip(1); // res0
     type = (Types)reader.ReadByte();
     data = reader.ReadInt32();
 }
Exemple #13
0
 public FunctionEntry(Level level, Label label, Types.RECORD formals, Types.Type result)
 {
     Level = level;
     Label = label;
     Formals = formals;
     Result = result;
 }
 public GameFightTaxCollectorInformations(int contextualId, Types.EntityLook look, Types.EntityDispositionInformations disposition, sbyte teamId, sbyte wave, bool alive, Types.GameFightMinimalStats stats, short[] previousPositions, short firstNameId, short lastNameId, byte level)
     : base(contextualId, look, disposition, teamId, wave, alive, stats, previousPositions)
 {
     this.firstNameId = firstNameId;
     this.lastNameId = lastNameId;
     this.level = level;
 }
 public PrismFightersInformation(short subAreaId, Types.ProtectedEntityWaitingForHelpInfo waitingForHelpInfo, Types.CharacterMinimalPlusLookInformations[] allyCharactersInformations, Types.CharacterMinimalPlusLookInformations[] enemyCharactersInformations)
 {
     this.subAreaId = subAreaId;
     this.waitingForHelpInfo = waitingForHelpInfo;
     this.allyCharactersInformations = allyCharactersInformations;
     this.enemyCharactersInformations = enemyCharactersInformations;
 }
	    //---------------------------------------------------------------------

	    private Release(Types type,
	                    int   number)
	    {
	        this.type = type;
	        this.number = number;
	        this.build = ((int) type) + number;
	    }
 public void VirtualMachineStart(Types.SuspendPolicy suspendPolicy, RequestId requestId, ThreadId threadId)
 {
     ThreadReference thread = VirtualMachine.GetMirrorOf(threadId);
     EventRequest request = VirtualMachine.EventRequestManager.GetEventRequest(EventKind.VirtualMachineStart, requestId);
     ThreadEventArgs e = new ThreadEventArgs(VirtualMachine, (SuspendPolicy)suspendPolicy, request, thread);
     VirtualMachine.EventQueue.OnVirtualMachineStart(e);
 }
Exemple #18
0
 public Tower(Point pos, Types _type, Texture2D texture)
 {
     level = 1;
     type = _type;
     text = texture;
     boundingBox = new Rectangle(pos.X, pos.Y, Cell.size, Cell.size);
 }
 public SlaveSwitchContextMessage(int summonerId, int slaveId, Types.SpellItem[] slaveSpells, Types.CharacterCharacteristicsInformations slaveStats)
 {
     this.summonerId = summonerId;
     this.slaveId = slaveId;
     this.slaveSpells = slaveSpells;
     this.slaveStats = slaveStats;
 }
 public GameFightResumeMessage(Types.FightDispellableEffectExtendedInformations[] effects, Types.GameActionMark[] marks, short gameTurn, Types.GameFightSpellCooldown[] spellCooldowns, sbyte summonCount, sbyte bombCount)
  : base(effects, marks, gameTurn)
 {
     this.spellCooldowns = spellCooldowns;
     this.summonCount = summonCount;
     this.bombCount = bombCount;
 }
Exemple #21
0
        public List<Types.IssueListingEntry>Issues( Types.Project CurrentProject )
        {
            string Url = CurrentProject.Api_Issues_Url;

            int CurrentPage = 1;
            int TotalPages = 1;

            List<Types.IssueListingEntry> Results = new List<SifterApi.Types.IssueListingEntry>();

            do
            {
                string Data = MakeApiCall( Url );

                JavaScriptSerializer JSS = new JavaScriptSerializer();
                Types.ResponseTypes.IssuesResponse IR = JSS.Deserialize<Types.ResponseTypes.IssuesResponse>( Data );

                Results.AddRange( IR.Issues );

                TotalPages = IR.Total_Pages;
                CurrentPage += 1;
                Url = IR.Next_Page_Url;

                if ( OnProgress != null )
                {
                    OnProgress( TotalPages, CurrentPage );
                }
            }
            while ( CurrentPage <= TotalPages );

            return Results;
        }
 public GameFightEndMessage(int duration, short ageBonus, short lootShareLimitMalus, Types.FightResultListEntry[] results)
 {
     this.duration = duration;
     this.ageBonus = ageBonus;
     this.lootShareLimitMalus = lootShareLimitMalus;
     this.results = results;
 }
 public GameRolePlayTaxCollectorInformations(int contextualId, Types.EntityLook look, Types.EntityDispositionInformations disposition, Types.TaxCollectorStaticInformations identification, byte guildLevel, int taxCollectorAttack)
     : base(contextualId, look, disposition)
 {
     this.identification = identification;
     this.guildLevel = guildLevel;
     this.taxCollectorAttack = taxCollectorAttack;
 }
Exemple #24
0
    public static void AddPoint(float numberPoint, Types type)
    {
        if (LevelManager.player.IsDead ()) // Empêcher de récupérer des sous/xp après la mort
            return;

        Multiplier multiplier;

        // On multiplie s'il y a lieu
        if( multipliers.TryGetValue( type, out multiplier ) ) {
            numberPoint *= multiplier.value;
        }
        else if( Types.All != type && multipliers.TryGetValue( Types.All, out multiplier ) ) {
            numberPoint *= multiplier.value;
        }

        // On ajoute les points au bon endroit
        if (Types.Coin == type) {
            // Tentative de multiplication des points par rapport aux talents
            if (Random.Range (0, 100) < leafDouble) {
                numberPoint *= powerLeafDouble;
            }
            score += numberPoint;
            // On compte une pièce supplémentaire
            leaf++;
        } else if (Types.Experience == type) {
            experience += numberPoint;
        }
    }
Exemple #25
0
        /// <summary>
        /// Creates an <see cref="IntegerType"/> instance.
        /// </summary>
        /// <param name="module"></param>
        /// <param name="name"></param>
        /// <param name="enumerator"></param>
        public IntegerType(IModule module, string name, Symbol type, ISymbolEnumerator symbols)
            : base (module, name)
        {
            Types? t = GetExactType(type);
            type.Assert(t.HasValue, "Unknown symbol for unsigned type!");
            _type = t.Value;

            _isEnumeration = false;

            Symbol current = symbols.NextNonEOLSymbol();
            if (current == Symbol.OpenBracket)
            {
                _isEnumeration = true;
                symbols.PutBack(current);
                _map = Lexer.DecodeEnumerations(symbols);
            }
            else if (current == Symbol.OpenParentheses)
            {
                symbols.PutBack(current);
                _ranges = Lexer.DecodeRanges(symbols);
                current.Assert(!_ranges.IsSizeDeclaration, "SIZE keyword is not allowed for ranges of integer types!");
            }
            else
            {
                symbols.PutBack(current);
            }
        }
 public FightResultTaxCollectorListEntry(short outcome, sbyte wave, Types.FightLoot rewards, int id, bool alive, byte level, Types.BasicGuildInformations guildInfo, int experienceForGuild)
     : base(outcome, wave, rewards, id, alive)
 {
     this.level = level;
     this.guildInfo = guildInfo;
     this.experienceForGuild = experienceForGuild;
 }
 public TaxCollectorMovementMessage(bool hireOrFire, Types.TaxCollectorBasicInformations basicInfos, int playerId, string playerName)
 {
     this.hireOrFire = hireOrFire;
     this.basicInfos = basicInfos;
     this.playerId = playerId;
     this.playerName = playerName;
 }
 public MountClientData(bool sex, bool isRideable, bool isWild, bool isFecondationReady, double id, int model, int[] ancestor, int[] behaviors, string name, int ownerId, double experience, double experienceForLevel, double experienceForNextLevel, sbyte level, int maxPods, int stamina, int staminaMax, int maturity, int maturityForAdult, int energy, int energyMax, int serenity, int aggressivityMax, int serenityMax, int love, int loveMax, int fecondationTime, int boostLimiter, double boostMax, int reproductionCount, int reproductionCountMax, Types.ObjectEffectInteger[] effectList)
 {
     this.sex = sex;
     this.isRideable = isRideable;
     this.isWild = isWild;
     this.isFecondationReady = isFecondationReady;
     this.id = id;
     this.model = model;
     this.ancestor = ancestor;
     this.behaviors = behaviors;
     this.name = name;
     this.ownerId = ownerId;
     this.experience = experience;
     this.experienceForLevel = experienceForLevel;
     this.experienceForNextLevel = experienceForNextLevel;
     this.level = level;
     this.maxPods = maxPods;
     this.stamina = stamina;
     this.staminaMax = staminaMax;
     this.maturity = maturity;
     this.maturityForAdult = maturityForAdult;
     this.energy = energy;
     this.energyMax = energyMax;
     this.serenity = serenity;
     this.aggressivityMax = aggressivityMax;
     this.serenityMax = serenityMax;
     this.love = love;
     this.loveMax = loveMax;
     this.fecondationTime = fecondationTime;
     this.boostLimiter = boostLimiter;
     this.boostMax = boostMax;
     this.reproductionCount = reproductionCount;
     this.reproductionCountMax = reproductionCountMax;
     this.effectList = effectList;
 }
Exemple #29
0
 public Preset(sbyte presetId, sbyte symbolId, bool mount, Types.PresetItem[] objects)
 {
     this.presetId = presetId;
     this.symbolId = symbolId;
     this.mount = mount;
     this.objects = objects;
 }
 public GameFightCompanionInformations(int contextualId, Types.EntityLook look, Types.EntityDispositionInformations disposition, sbyte teamId, sbyte wave, bool alive, Types.GameFightMinimalStats stats, short[] previousPositions, sbyte companionGenericId, byte level, int masterId)
     : base(contextualId, look, disposition, teamId, wave, alive, stats, previousPositions)
 {
     this.companionGenericId = companionGenericId;
     this.level = level;
     this.masterId = masterId;
 }
Exemple #31
0
 public void Update(string labelText, Types type, string format)
 {
     LabelText = labelText;
     Type      = type;
     Format    = format;
 }
Exemple #32
0
        private void Config()
        {
            GridField[] fields = new GridField[24];
            fields[0] = new GridField("QueueName1", QueueName1);
            fields[1] = new GridField("QueueName2", QueueName2);
            fields[2] = new GridField("QueueName3", QueueName3);
            fields[3] = new GridField("QueueName4", QueueName4);

            fields[4] = new GridField("ChannelName1", ChannelName1);
            fields[5] = new GridField("ChannelName2", ChannelName2);
            fields[6] = new GridField("ChannelName3", ChannelName3);
            fields[7] = new GridField("ChannelName4", ChannelName4);

            fields[8]  = new GridField("UseChannels", useChannels);
            fields[9]  = new GridField("MaxUsage", maxUsage);
            fields[10] = new GridField("ConnectionString", cnn);
            fields[11] = new GridField("Interval", interval);
            fields[12] = new GridField("MeterScaleInterval", meterScaleInterval);
            fields[13] = new GridField("MeterScaleMax", meterScaleMax);
            fields[14] = new GridField("LedScaleCount", ledScaleCount);
            fields[15] = new GridField("LedScaleMax", ledScaleMax);
            fields[16] = new GridField("AutoScale", autoScale);
            fields[17] = new GridField("ItemsSource", sqlItems);
            fields[18] = new GridField("ItemsBySenderSource", sqlBySender);
            fields[19] = new GridField("ItemsSummarizeSource", sqlValues);
            fields[20] = new GridField("ChannelsSource", sqlChannels);
            fields[21] = new GridField("TickInterval", tickInterval);
            fields[22] = new GridField("UseDataReader", useDataReader);
            fields[23] = new GridField("FastFirstRows", fastFirstRows);


            fields[0].Description = "Queue Name #1";
            fields[1].Description = "Queue Name #2";
            fields[2].Description = "Queue Name #3";
            fields[3].Description = "Queue Name #4";

            fields[4].Description = "Channel Name #1";
            fields[5].Description = "Channel Name #2";
            fields[6].Description = "Channel Name #3";
            fields[7].Description = "Channel Name #4";

            fields[8].Description  = "Use Channels";
            fields[9].Description  = "Max Usage value for each Queue";
            fields[10].Description = "Connection String to database";
            fields[11].Description = "Interval in millisecondes for Refresh";
            fields[12].Description = "Meter Scale Interval ";
            fields[13].Description = "Meter Scale Max Value";
            fields[14].Description = "Led Scale items Count";
            fields[15].Description = "Led Scale Max value";
            fields[16].Description = "Auto Scale properies";

            fields[17].Description = "Items Source";
            fields[18].Description = "Items By Sender Source";
            fields[19].Description = "Items Summarize Source";
            fields[20].Description = "Channels Source";
            fields[21].Description = "Tick Interval Refreshing";
            fields[22].Description = "Use DataReader to fetch Queue items";
            fields[23].Description = "Number of First row to fetch when use data reader";

            VGridDlg dlg = new VGridDlg();

            dlg.VGrid.SetDataBinding(fields, "Monitor");
            dlg.Width = 400;
            DialogResult dr = dlg.ShowDialog();

            QueueName1         = fields[0].Text;
            QueueName2         = fields[1].Text;
            QueueName3         = fields[2].Text;
            QueueName4         = fields[3].Text;
            ChannelName1       = fields[4].Text;
            ChannelName2       = fields[5].Text;
            ChannelName3       = fields[6].Text;
            ChannelName4       = fields[7].Text;
            useChannels        = Types.ToBool(fields[8].Text, false);
            maxUsage           = Types.ToInt(fields[9].Value, maxUsage);
            cnn                = fields[10].Text;
            interval           = Types.ToInt(fields[11].Value, interval);
            meterScaleInterval = Types.ToInt(fields[12].Value, meterScaleInterval);
            meterScaleMax      = Types.ToInt(fields[13].Value, meterScaleMax);
            ledScaleCount      = Types.ToInt(fields[14].Value, ledScaleCount);
            ledScaleMax        = Types.ToInt(fields[15].Value, ledScaleMax);
            autoScale          = Types.ToBool(fields[16].Text, true);
            sqlItems           = fields[17].Text;
            sqlBySender        = fields[18].Text;
            sqlValues          = fields[19].Text;
            sqlChannels        = fields[20].Text;
            tickInterval       = Types.ToInt(fields[21].Value, meterScaleMax);
            useDataReader      = Types.ToBool(fields[22].Text, true);
            fastFirstRows      = Types.ToInt(fields[22].Value, fastFirstRows);
        }
Exemple #33
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CoNLL02NameSampleStream"/> class.
        /// </summary>
        /// <param name="language">The supported conll language.</param>
        /// <param name="streamFactory">The stream factory.</param>
        /// <param name="types">The conll types.</param>
        /// <exception cref="System.ArgumentOutOfRangeException">language</exception>
        /// <exception cref="System.ArgumentNullException">streamFactory</exception>
        public CoNLL02NameSampleStream(Language language, IInputStreamFactory streamFactory, Types types)
        {
            if (!Enum.IsDefined(typeof(Language), language))
            {
                throw new ArgumentOutOfRangeException("language");
            }

            if (streamFactory == null)
            {
                throw new ArgumentNullException("streamFactory");
            }

            this.language = language;
            lineStream    = new PlainTextByLineStream(streamFactory);
            this.types    = types;
        }
 /// <summary>
 /// Initialize a new SimpleAnimationIndex of the specified type
 /// </summary>
 /// <param name="type"></param>
 public SimpleAnimationIndex(Types type)
     : base(First + (int)type)
 {
     Type = type;
 }
 private Distance(Types type) => Type = type;
 /// <summary>
 /// Initialize a new SimpleAnimationIndex of the specified type
 /// </summary>
 /// <param name="type"></param>
 /// <param name="tileset"></param>
 public TilesetAnimationIndex(Types type, int tileset)
     : base(tileset * Count + (int)type)
 {
     Type    = type;
     Tileset = tileset;
 }
 /// <summary>
 /// Initialize a new PlayerAnimationIndex of the specified type
 /// </summary>
 /// <param name="type"></param>
 public PlayerAnimationIndex(Types type)
     : base(First + (int)type)
 {
     Type = type;
 }
 /// <summary>
 /// Initialize a new DirectionAnimationIndex of the specified
 /// type and direction
 /// </summary>
 /// <param name="type"></param>
 /// <param name="direction"></param>
 public DirectionAnimationIndex(Types type, Directions direction)
     : base(First + (int)direction * Count + (int)type)
 {
     Type      = type;
     Direction = direction;
 }
Exemple #39
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CoNLL02NameSampleStream" /> class.
        /// </summary>
        /// <param name="language">The supported conll language.</param>
        /// <param name="lineStream">The line stream.</param>
        /// <param name="types">The conll types.</param>
        /// <param name="ownsStream"><c>true</c> to indicate that the stream will be disposed when this stream is disposed; <c>false</c> to indicate that the stream will not be disposed when this stream is disposed.</param>
        /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="language" /></exception>
        /// <exception cref="System.ArgumentNullException"><paramref name="lineStream" /></exception>
        /// <exception cref="System.ArgumentException">The specified language is not supported.</exception>
        public CoNLL02NameSampleStream(Language language, IObjectStream <string> lineStream, Types types, bool ownsStream)
        {
            if (!Enum.IsDefined(typeof(Language), language))
            {
                throw new ArgumentOutOfRangeException("language");
            }

            if (lineStream == null)
            {
                throw new ArgumentNullException("lineStream");
            }

            if (!language.In(Language.En, Language.De))
            {
                throw new ArgumentException("The specified language is not supported.");
            }

            this.language   = language;
            this.lineStream = lineStream;
            this.ownsStream = ownsStream;
            this.types      = types;
        }
Exemple #40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CoNLL02NameSampleStream"/> class.
 /// </summary>
 /// <param name="language">The supported conll language.</param>
 /// <param name="lineStream">The line stream.</param>
 /// <param name="types">The conll types.</param>
 /// <exception cref="System.ArgumentOutOfRangeException"><paramref name="language"/></exception>
 /// <exception cref="System.ArgumentNullException"><paramref name="lineStream"/></exception>
 /// <exception cref="System.ArgumentException">The specified language is not supported.</exception>
 public CoNLL02NameSampleStream(Language language, IObjectStream <string> lineStream, Types types) : this(language, lineStream, types, true)
 {
 }
Exemple #41
0
 public StatModifier(StatType targetStat, Types modType, float value)
 {
     _type     = modType;
     _statType = targetStat;
     _value    = value;
 }
Exemple #42
0
        public MainWindow()
        {
            if (currentInstance is null)
            {
                currentInstance = this;
            }

            Types.Initialize(typeof(MainWindow).Assembly,
                             typeof(Content.InternetContent).Assembly,
                             typeof(Content.Images.ImageCodec).Assembly,
                             typeof(Content.Markdown.MarkdownDocument).Assembly,
                             typeof(XML).Assembly,
                             typeof(Content.Xsl.XSL).Assembly,
                             typeof(SensorData).Assembly,
                             typeof(Networking.XMPP.BOSH.HttpBinding).Assembly,
                             typeof(Networking.XMPP.P2P.EndpointSecurity).Assembly,
                             typeof(Networking.XMPP.Provisioning.ProvisioningClient).Assembly,
                             typeof(Networking.XMPP.WebSocket.WebSocketBinding).Assembly,
                             typeof(Database).Assembly,
                             typeof(FilesProvider).Assembly,
                             typeof(Script.Expression).Assembly,
                             typeof(Script.Content.Functions.Encoding.Decode).Assembly,
                             typeof(Script.Graphs.Graph).Assembly,
                             typeof(Script.Fractals.FractalGraph).Assembly,
                             typeof(Script.Persistence.Functions.FindObjects).Assembly,
                             typeof(Script.Statistics.Functions.Beta).Assembly,
                             typeof(Security.IUser).Assembly,
                             typeof(Security.EllipticCurves.PrimeFieldCurve).Assembly);

            appDataFolder = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData);
            if (!appDataFolder.EndsWith(new string(Path.DirectorySeparatorChar, 1)))
            {
                appDataFolder += Path.DirectorySeparatorChar;
            }

            appDataFolder += "IoT Client" + Path.DirectorySeparatorChar;

            if (!Directory.Exists(appDataFolder))
            {
                Directory.CreateDirectory(appDataFolder);
            }

            Task.Run(() =>
            {
                try
                {
                    databaseProvider = new FilesProvider(appDataFolder + "Data", "Default", 8192, 10000, 8192, Encoding.UTF8, 3600000);
                    databaseProvider.RepairIfInproperShutdown(appDataFolder + "Transforms" + Path.DirectorySeparatorChar + "DbStatXmlToHtml.xslt").Wait();
                    databaseProvider.Start().Wait();
                    Database.Register(databaseProvider);

                    Database.Find <Question>(new FilterAnd(new FilterFieldEqualTo("OwnerJID", string.Empty),
                                                           new FilterFieldEqualTo("ProvisioningJID", string.Empty))); // To prepare indices, etc.

                    ChatView.InitEmojis();
                }
                catch (Exception ex)
                {
                    ex = Log.UnnestException(ex);
                    ErrorBox(ex.Message);
                }
            });

            InitializeComponent();

            this.MainView.Load(this);
        }
Exemple #43
0
            public static void RunTimer(Types type)
            {
                float timeinterval = 1f;

                                #if RUST
                timeinterval = 4.5f;
                                #endif

                switch (type)
                {
                case Types.InGameTime:
                    if (InGame != null)
                    {
                        InGame.Destroy();
                    }
                    Plugin.Puts("The InGame timer has started");
                    AllTimers.Add(InGame = Plugin.timer.Repeat(timeinterval, 0, () =>
                    {
                        foreach (var cmd in Plugin.Config["InGameTime-Timer"] as Dictionary <string, object> )
                        {
                            if (Plugin.covalence.Server.Time.ToShortTimeString() == cmd.Key)
                            {
                                Plugin.covalence.Server.Command(cmd.Value.ToString());
                                Plugin.Puts(string.Format("ran CMD: {0}", cmd.Value));
                            }
                        }
                    }
                                                               ));
                    break;

                case Types.RealTime:
                    if (Real != null)
                    {
                        Real.Destroy();
                    }
                    Plugin.Puts("The RealTime timer has started");
                    AllTimers.Add(Real = Plugin.timer.Repeat(1, 0, () =>
                    {
                        foreach (var cmd in Plugin.Config["RealTime-Timer"] as Dictionary <string, object> )
                        {
                            if (System.DateTime.Now.ToString("HH:mm:ss") == cmd.Key.ToString())
                            {
                                Plugin.covalence.Server.Command(cmd.Value.ToString());
                                Plugin.Puts(string.Format("ran CMD: {0}", cmd.Value));
                            }
                        }
                    }
                                                             ));
                    break;

                case Types.Repeater:
                    if (Repeat != null)
                    {
                        Repeat.Destroy();
                    }
                    Plugin.Puts("The Repeat timer has started");
                    foreach (var cmd in Plugin.Config["TimerRepeat"] as Dictionary <string, object> )
                    {
                        Repeat = Plugin.timer.Repeat(Convert.ToSingle(cmd.Value), 0, () => {
                            Plugin.covalence.Server.Command(cmd.Key);
                            Plugin.Puts(string.Format("ran CMD: {0}", cmd.Key));
                        });
                    }
                    AllTimers.Add(Repeat);
                    break;

                case Types.TimerOnce:
                    if (Once != null)
                    {
                        Once.Destroy();
                    }
                    Plugin.Puts("The Timer-Once timer has started");
                    foreach (var cmd in Plugin.Config["TimerOnce"] as Dictionary <string, object> )
                    {
                        Once = Plugin.timer.Once(Convert.ToSingle(cmd.Value), () => {
                            Plugin.covalence.Server.Command(cmd.Key);
                            Plugin.Puts(string.Format("ran CMD: {0}", cmd.Key));
                        });
                    }
                    AllTimers.Add(Once);
                    break;
                }
            }
Exemple #44
0
 public StatModifier()
 {
     _type     = Types.None;
     _value    = 0;
     _statType = StatType.None;
 }
 protected string TypesToUri()
 {
     return(string.Join("|", Types.Select(t => t.ToString().ToLowerInvariant()).ToArray <string>()));
 }
Exemple #46
0
 internal XsdParameters Merge(XsdParameters parameters)
 {
     if (parameters.classes)
     {
         classes = parameters.classes;
     }
     if (parameters.dataset)
     {
         dataset = parameters.dataset;
     }
     if (parameters.language != null)
     {
         language = parameters.language;
     }
     if (parameters.ns != null)
     {
         ns = parameters.ns;
     }
     if (parameters.nologo)
     {
         nologo = parameters.nologo;
     }
     if (parameters.outputdir != null)
     {
         outputdir = parameters.outputdir;
     }
     if (!parameters.optionsDefault)
     {
         options = parameters.options;
     }
     if (parameters.uri != null)
     {
         uri = parameters.uri;
     }
     foreach (string current in parameters.XsdSchemas)
     {
         XsdSchemas.Add(current);
     }
     foreach (string current2 in parameters.XdrSchemas)
     {
         XdrSchemas.Add(current2);
     }
     foreach (string current3 in parameters.Instances)
     {
         Instances.Add(current3);
     }
     foreach (string current4 in parameters.Assemblies)
     {
         Assemblies.Add(current4);
     }
     foreach (string current5 in parameters.Elements)
     {
         Elements.Add(current5);
     }
     foreach (string current6 in parameters.Types)
     {
         Types.Add(current6);
     }
     foreach (string current7 in parameters.SchemaImporterExtensions)
     {
         SchemaImporterExtensions.Add(current7);
     }
     return(this);
 }
        private object EvaluateIterationSumExpression(IterationSumExpression e, VariableContext context)
        {
            int[] values     = new int[e.Variables.Length];
            int[] fromValues = new int[e.Variables.Length];
            int[] toValues   = new int[e.Variables.Length];

            int index = 0;

            foreach (IterationSumVariable variable in e.Variables)
            {
                if (context.HasVariable(variable.Name))
                {
                    throw new Exception(string.Format("Iteration variable {0} is already in use.", variable.Name));
                }


                fromValues[index] = Types.ConvertValue <int>(Evaluate(variable.From, context));
                toValues[index]   = Types.ConvertValue <int>(Evaluate(variable.To, context));

                context.Set(variable.Name, fromValues[index]);
                values[index] = fromValues[index];


                index++;
            }


            double sum = 0;

            while (true)
            {
                double value = Types.ConvertValue <double>(Evaluate(e.Body, context));;

                if (!double.IsNaN(value))
                {
                    sum += value;
                }


                if (!IncreaseIterationValues(values, fromValues, toValues))
                {
                    break;
                }
                else
                {
                    for (int i = 0; i <= e.Variables.Length - 1; i++)
                    {
                        context.Set(e.Variables[i].Name, values[i]);
                    }
                }
            }


            foreach (IterationSumVariable variable in e.Variables)
            {
                context.Remove(variable.Name);
            }


            return(sum);
        }
        private object EvaluteBinaryExpression(BinaryExpression e, VariableContext context, out bool isEvaluated)
        {
            isEvaluated = false;


            bool isTupleValue = e.Right.Type.Name.Contains("Tuple");

            if (e.Operator == BinaryOperator.Assign && (e.Left is MultipleVariableExpression || isTupleValue))
            {
                isEvaluated = true;

                object rightValue = Evaluate(e.Right, context);


                if (e.Left is MultipleVariableExpression)
                {
                    MultipleVariableExpression mv = e.Left as MultipleVariableExpression;

                    if (isTupleValue)
                    {
                        int count = mv.Type.GenericTypeArguments.Length;

                        for (int i = 0; i <= count - 1; i++)
                        {
                            context.Set(mv.Variables[i], rightValue.GetType().GetProperty("Item" + (i + 1)).GetValue(rightValue));
                        }
                    }
                    else
                    {
                        context.Set(mv.Variables[0], rightValue);
                    }
                }
                else
                {
                    context.Set((e.Left as VariableExpression).VariableName, rightValue.GetType().GetProperty("Item1").GetValue(rightValue));
                }


                return(rightValue);
            }
            else if (e.Operator == BinaryOperator.Add)
            {
                if (e.Left.Type == typeof(Matrix) && e.Right.Type == typeof(Matrix))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Matrix).Add(Evaluate(e.Right, context) as Matrix));
                }
                else if (e.Left.Type == typeof(Matrix) && Types.IsNumberType(e.Right.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Matrix).Add(Types.ConvertValue <double>(Evaluate(e.Right, context))));
                }
                else if (e.Right.Type == typeof(Matrix) && Types.IsNumberType(e.Left.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Right, context) as Matrix).Add(Types.ConvertValue <double>(Evaluate(e.Left, context))));
                }
                else if (e.Left.Type == typeof(Vector) && Types.IsNumberType(e.Right.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Vector).Add(Types.ConvertValue <double>(Evaluate(e.Right, context))));
                }
                else if (e.Right.Type == typeof(Vector) && Types.IsNumberType(e.Left.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Right, context) as Vector).Add(Types.ConvertValue <double>(Evaluate(e.Left, context))));
                }
            }
            else if (e.Operator == BinaryOperator.Subtract)
            {
                if (e.Left.Type == typeof(Matrix) && e.Right.Type == typeof(Matrix))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Matrix).Add((Evaluate(e.Right, context) as Matrix).ToNegative()));
                }
                else if (e.Left.Type == typeof(Matrix) && Types.IsNumberType(e.Right.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Matrix).Subtract(Types.ConvertValue <double>(Evaluate(e.Right, context))));
                }
                else if (e.Right.Type == typeof(Matrix) && Types.IsNumberType(e.Left.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Right, context) as Matrix).Subtract(Types.ConvertValue <double>(Evaluate(e.Left, context))).GetNegative());
                }
                else if (e.Left.Type == typeof(Vector) && Types.IsNumberType(e.Right.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Vector).Subtract(Types.ConvertValue <double>(Evaluate(e.Right, context))));
                }
                else if (e.Right.Type == typeof(Vector) && Types.IsNumberType(e.Left.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Right, context) as Vector).Subtract(Types.ConvertValue <double>(Evaluate(e.Left, context))).GetNegative());
                }
            }
            else if (e.Operator == BinaryOperator.Multiply)
            {
                if (e.Left.Type == typeof(Matrix) && e.Right.Type == typeof(Matrix))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Matrix).Multiply(Evaluate(e.Right, context) as Matrix));
                }
                else if (e.Left.Type == typeof(Matrix))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Matrix).Multiply(Convert.ToDouble(Evaluate(e.Right, context))));
                }
                else if (e.Right.Type == typeof(Matrix))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Right, context) as Matrix).Multiply(Convert.ToDouble(Evaluate(e.Left, context))));
                }
                else if (e.Left.Type == typeof(Vector) && Types.IsNumberType(e.Right.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Vector).Multiply(Types.ConvertValue <double>(Evaluate(e.Right, context))));
                }
                else if (e.Right.Type == typeof(Vector) && Types.IsNumberType(e.Left.Type))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Right, context) as Vector).Multiply(Types.ConvertValue <double>(Evaluate(e.Left, context))).GetNegative());
                }
            }
            else if (e.Operator == BinaryOperator.Divide)
            {
                if (e.Left.Type == typeof(Matrix) && e.Right.Type == typeof(Matrix))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Matrix).Divide((Evaluate(e.Right, context) as Matrix)));
                }
                else if (e.Left.Type == typeof(Matrix))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Matrix).Multiply(1 / Convert.ToDouble(Evaluate(e.Right, context))));
                }
                else if (e.Right.Type == typeof(Matrix))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Right, context) as Matrix).ElementInvert().Multiply(Convert.ToDouble(Evaluate(e.Left, context))));
                }
                if (e.Left.Type == typeof(Vector))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Left, context) as Vector).Multiply(1 / Convert.ToDouble(Evaluate(e.Right, context))));
                }
                else if (e.Right.Type == typeof(Vector))
                {
                    isEvaluated = true;
                    return((Evaluate(e.Right, context) as Vector).ElementInvert().Multiply(Convert.ToDouble(Evaluate(e.Left, context))));
                }
            }


            return(null);
        }
Exemple #49
0
 public Message()
 {
     m_type     = Types.INFO;
     m_sMessage = string.Empty;
 }
Exemple #50
0
 public Message(Types type, string sMessage)
 {
     m_type     = type;
     m_sMessage = (sMessage == null ? string.Empty : sMessage);
 }
Exemple #51
0
 public Request(Types type, byte[] data)
 {
     this.Key  = null;
     this.Type = type;
     this.Data = data;
 }
Exemple #52
0
 public Request(Types type, string key, byte[] data)
 {
     this.Key  = key;
     this.Type = type;
     this.Data = data;
 }
Exemple #53
0
    /// <summary>
    /// AnimationClipに関連付いているイベント情報一覧表示
    /// </summary>
    void ShowAnimationClipEventList(AnimationClip clip)
    {
        var secPerFrame = 1 / clip.frameRate;

        EditorGUILayout.LabelField("イベントリスト");
        EditorGUILayout.BeginHorizontal();
        // 新規イベント追加
        if (GUILayout.Button("+", GUILayout.Width(20)))
        {
            Undo.RecordObject(this, "add new event info");
            var eventList = TargetEvents.ToList();
            eventList.Add(new AnimationEvent());
            TargetEvents = eventList.OrderBy(event_info => event_info.time).ToArray();
            IsDirty      = true;
        }
        GUILayout.Button(string.Empty, GUI.skin.label, GUILayout.Width(20));
        GUILayout.Button(string.Empty, GUI.skin.label, GUILayout.Width(20));
        EditorGUILayout.LabelField("関数名", GUILayout.MaxWidth(150));
        EditorGUILayout.LabelField("frame(" + clip.frameRate + ")", GUILayout.MaxWidth(100));
        EditorGUILayout.LabelField("整数値", GUILayout.MaxWidth(100));
        EditorGUILayout.LabelField("数値(小数点)", GUILayout.MaxWidth(100));
        EditorGUILayout.LabelField("文字列");
        EditorGUILayout.EndHorizontal();
        var deleteIdx = -1;

        for (var eventIdx = 0; eventIdx < TargetEvents.Length; ++eventIdx)
        {
            var eventInfo = TargetEvents[eventIdx];
            EditorGUILayout.BeginHorizontal(GUI.skin.box);
            GUI.color = Color.red;
            // イベント削除
            if (GUILayout.Button("―", GUILayout.Width(20)))
            {
                deleteIdx = eventIdx;
            }
            GUI.color = Color.white;
            // コピー中イベントを貼り付け
            if (GUILayout.Button("P", GUILayout.Width(20)))
            {
                if (AnimationExtensionData.EventInfoInCopy != null)
                {
                    // Undoされない…
                    // Undo.RecordObject(this, "paste event info");
                    AnimationExtensionData.PasteEventInfo(toEventInfo: eventInfo);
                    IsDirty = true;
                }
            }
            // コピー中イベントにする
            if (GUILayout.Button("C", GUILayout.Width(20)))
            {
                AnimationExtensionData.CopyEventInfo(fromEventInfo: eventInfo);
            }
            EditorGUILayout.LabelField(string.IsNullOrEmpty(eventInfo.functionName) ? "(指定なし)" : eventInfo.functionName, GUILayout.MaxWidth(150));
            var frame    = eventInfo.time <= 0.0f ? 0 : SecToFrame(eventInfo.time, secPerFrame);
            var inputInt = EditorGUILayout.IntField(frame, GUILayout.MinWidth(100), GUILayout.MaxWidth(100));
            if (inputInt != frame)
            {
                eventInfo.time = inputInt * secPerFrame;
                IsDirty        = true;
            }
            inputInt = EditorGUILayout.IntField(eventInfo.intParameter, GUILayout.MinWidth(100), GUILayout.MaxWidth(100));
            if (inputInt != eventInfo.intParameter)
            {
                eventInfo.intParameter = inputInt;
                IsDirty = true;
            }
            var inputFloat = EditorGUILayout.FloatField(eventInfo.floatParameter, GUILayout.MinWidth(100), GUILayout.MaxWidth(100));
            if (inputFloat != eventInfo.floatParameter)
            {
                eventInfo.floatParameter = inputFloat;
                IsDirty = true;
            }
            var inputString = GUILayout.TextField(eventInfo.stringParameter);
            if (inputString != eventInfo.stringParameter)
            {
                eventInfo.stringParameter = inputString;
                IsDirty = true;
            }
            EditorGUILayout.EndHorizontal();
        }
        if (deleteIdx != -1)
        {
            Undo.RecordObject(this, "delete event info");
            var eventList = TargetEvents.ToList();
            eventList.RemoveAt(deleteIdx);
            TargetEvents = eventList.ToArray();
            deleteIdx    = -1;
            IsDirty      = true;
        }
        // 変更時のみボタンを有効に
        GUI.enabled = IsDirty;
        if (GUILayout.Button("適用", GUILayout.MaxWidth(50)))
        {
            Undo.RecordObject(clip, "apply event info");
            TargetEvents = TargetEvents.OrderBy(event_info => event_info.time).ToArray();
            AnimationUtility.SetAnimationEvents(clip, TargetEvents);
            IsDirty = false;

            // 他ウィンドウの再描画を促す
            var animEventWindows = Resources.FindObjectsOfTypeAll <AnimationEventWindow>();
            foreach (var window in animEventWindows)
            {
                window.Repaint();
            }
            var animationWindowType = Types.GetType("UnityEditor.AnimationWindow", "UnityEditor.dll");
            var animWindows         = Resources.FindObjectsOfTypeAll(animationWindowType) as EditorWindow[];
            foreach (var window in animWindows)
            {
                window.Repaint();
            }
        }
        GUI.enabled = true;
    }
Exemple #54
0
 public Request(Types type)
 {
     this.Key  = null;
     this.Type = type;
     this.Data = null;
 }
 public NoneTransition(Types type) : base(type)
 {
 }
        public void ImportXML(Stream fileStream)
        {
            // Load XML and add loaded data to set data
            var  xml   = XDocument.Load(fileStream);
            uint objID = 0; // For Object elements with no ID attribute.

            foreach (var objElem in xml.Root.Elements("Object"))
            {
                // Generate Object
                var typeAttr  = objElem.Attribute("type");
                var objIDAttr = objElem.Attribute("id");
                if (typeAttr == null)
                {
                    continue;
                }

                var obj = new SetObject()
                {
                    ObjectType = typeAttr.Value,
                    ObjectID   = (objIDAttr == null) ?
                                 objID : Convert.ToUInt32(objIDAttr.Value),
                };

                // Assign CustomData to Object
                var customDataElem = objElem.Element("CustomData");
                if (customDataElem != null)
                {
                    foreach (var customData in customDataElem.Elements())
                    {
                        obj.CustomData.Add(customData.Name.LocalName,
                                           LoadParam(customData));
                    }
                }

                // Assign Parameters to Object
                var parametersElem = objElem.Element("Parameters");
                if (parametersElem != null)
                {
                    foreach (var paramElem in parametersElem.Elements())
                    {
                        obj.Parameters.Add(LoadParam(paramElem));
                    }
                }

                // Assign Transforms to Object
                var transformsElem = objElem.Element("Transforms");
                if (transformsElem != null)
                {
                    var transforms     = transformsElem.Elements("Transform");
                    int transformCount = transforms.Count();

                    if (transformCount > 0)
                    {
                        uint i = 0;
                        obj.Children = new SetObjectTransform[transformCount - 1];

                        foreach (var transformElem in transforms)
                        {
                            var transform = LoadTransform(transformElem);
                            if (i > 0)
                            {
                                obj.Children[i - 1] = transform;
                            }
                            else
                            {
                                obj.Transform = transform;
                            }

                            ++i;
                        }
                    }
                }

                ++objID;
                Objects.Add(obj);
            }

            // Sub-Methods
            SetObjectParam LoadParam(XElement paramElem)
            {
                // Groups
                var dataTypeAttr = paramElem.Attribute("type");

                if (dataTypeAttr == null)
                {
                    var  padAttr = paramElem.Attribute("padding");
                    uint?padding = null;

                    if (uint.TryParse(padAttr?.Value, out var pad))
                    {
                        padding = pad;
                    }

                    var group      = new SetObjectParamGroup(padding);
                    var parameters = group.Parameters;

                    foreach (var param in paramElem.Elements())
                    {
                        parameters.Add(LoadParam(param));
                    }

                    return(group);
                }

                // Parameters
                var    dataType = Types.GetTypeFromString(dataTypeAttr.Value);
                object data     = null;

                if (dataType == typeof(Vector2))
                {
                    data = Helpers.XMLReadVector2(paramElem);
                }
                else if (dataType == typeof(Vector3))
                {
                    data = Helpers.XMLReadVector3(paramElem);
                }
                else if (dataType == typeof(Vector4))
                {
                    data = Helpers.XMLReadVector4(paramElem);
                }
                else if (dataType == typeof(Quaternion))
                {
                    data = Helpers.XMLReadQuat(paramElem);
                }
                else if (dataType == typeof(uint[]))
                {
                    var  countAttr = paramElem.Attribute("count");
                    uint arrLength = 0;

                    if (countAttr != null)
                    {
                        uint.TryParse(countAttr.Value, out arrLength);
                    }

                    var values = paramElem.Value.Split(',');
                    var arr    = new uint[arrLength];
                    for (uint i = 0; i < arrLength; ++i)
                    {
                        if (i >= values.Length)
                        {
                            break;
                        }

                        uint.TryParse(values[i], out arr[i]);
                    }

                    data = arr;
                }
                else if (dataType == typeof(ForcesSetData.ObjectReference[]))
                {
                    var  countAttr = paramElem.Attribute("count");
                    uint arrLength = 0;

                    if (countAttr != null)
                    {
                        uint.TryParse(countAttr.Value, out arrLength);
                    }

                    uint i   = 0;
                    var  arr = new ForcesSetData.ObjectReference[arrLength];

                    foreach (var refElem in paramElem.Elements("ForcesObjectReference"))
                    {
                        var objRef = new ForcesSetData.ObjectReference();
                        objRef.ImportXML(refElem);
                        arr[i] = objRef;
                        ++i;
                    }

                    data = arr;
                }
                else if (dataType == typeof(ForcesSetData.ObjectReference))
                {
                    var objRef = new ForcesSetData.ObjectReference();
                    objRef.ImportXML(paramElem);
                    data = objRef;
                }
                else
                {
                    data = Convert.ChangeType(paramElem.Value, dataType);
                }

                return(new SetObjectParam(dataType, data));
            }

            SetObjectTransform LoadTransform(XElement elem)
            {
                var posElem   = elem.Element("Position");
                var rotElem   = elem.Element("Rotation");
                var scaleElem = elem.Element("Scale");

                return(new SetObjectTransform()
                {
                    Position = Helpers.XMLReadVector3(posElem),
                    Rotation = Helpers.XMLReadQuat(rotElem),
                    Scale = Helpers.XMLReadVector3(scaleElem)
                });
            }
        }
Exemple #57
0
        public override void ExecuteInternal(RPNStack rpn, Types dataType)
        {
            double d1 = rnd.NextDouble();

            rpn.Push(d1.ToString(), Types.Float);
        }
Exemple #58
0
        public void Parse()
        {
            UriBuilder uriBuilder = new UriBuilder(webserv.Url);

            uriBuilder.Query = "WSDL";
            HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(uriBuilder.Uri);

            webRequest.ContentType = "text/xml;charset=\"utf-8\"";
            webRequest.Method      = "GET";
            webRequest.Accept      = "text/xml";

            ServiceDescription serviceDescription;

            using (WebResponse response = webRequest.GetResponse())
            {
                using (Stream stream = response.GetResponseStream())
                {
                    serviceDescription = ServiceDescription.Read(stream);
                }
            }

            var oldfuncs = (from q in new XPQuery <WebFunctions>(XpoDefault.Session)
                            where q.Service.Oid == webserv.Oid
                            select q).ToList();



            if (serviceDescription != null && serviceDescription.Services.Count > 0)
            {
                ServiceDescriptionImporter importer = new ServiceDescriptionImporter();
                importer.ProtocolName = "Soap11";
                importer.AddServiceDescription(serviceDescription, null, null);
                importer.Style = ServiceDescriptionImportStyle.Client;
                importer.CodeGenerationOptions = CodeGenerationOptions.GenerateProperties;

                Service service = serviceDescription.Services[0];

                this.Namespace   = serviceDescription.TargetNamespace;
                this.ServiceName = service.Name;

                webserv.ServiceName = service.Name;
                webserv.NameSpace   = serviceDescription.TargetNamespace;
                webserv.UpdateDate  = DateTime.Now;

                for (int i = webserv.SoapClasses.Count - 1; i >= 0; i--)
                {
                    webserv.SoapClasses[i].Delete();
                }

                #region Operation
                List <string> operationNames = new List <string>();
                //Loop through the port types in the service description and list all of the
                //web service's operations and each operations input/output

                PortType portType = serviceDescription.PortTypes[0];
                //foreach (PortType portType in serviceDescription.PortTypes)
                {
                    int FunctionIndex = 0;
                    this.Functions = new List <WebFunctions>();
                    foreach (Operation operation in portType.Operations)
                    {
                        WebFunctions newFunc = new WebFunctions();
                        newFunc.Service = webserv;
                        var oldfunc = oldfuncs.Where(x => x.Name == operation.Name).FirstOrDefault();
                        if (oldfunc != null)
                        {
                            newFunc.Output = oldfunc.Output;
                        }
                        newFunc.Name       = operation.Name;
                        newFunc.SoapAction = this.Namespace + operation.Name;
                        operationNames.Add(operation.Name);

                        foreach (var message in operation.Messages)
                        {
                            if (message is OperationInput)
                            {
                                foreach (Message messagePart in serviceDescription.Messages)
                                {
                                    if (messagePart.Name != ((OperationMessage)message).Message.Name)
                                    {
                                        continue;
                                    }

                                    foreach (MessagePart part in messagePart.Parts)
                                    {
                                        newFunc.InputType = part.Element.Name;
                                    }
                                }
                            }
                            if (message is OperationOutput)
                            {
                                foreach (Message messagePart in serviceDescription.Messages)
                                {
                                    if (messagePart.Name != ((OperationMessage)message).Message.Name)
                                    {
                                        continue;
                                    }

                                    foreach (MessagePart part in messagePart.Parts)
                                    {
                                        newFunc.OutputType = part.Element.Name;
                                    }
                                }
                            }
                        }
                        newFunc.Save();
                        this.Functions.Add(newFunc);
                        FunctionIndex++;
                    }
                } //End listing of types

                for (int i = oldfuncs.Count - 1; i >= 0; i--)
                {
                    oldfuncs[i].Delete();
                }

                #endregion

                #region Types

                Types     types     = serviceDescription.Types;
                XmlSchema xmlSchema = types.Schemas[0];

                foreach (object item in xmlSchema.Items)
                {
                    XmlSchemaComplexType _complexType  = item as System.Xml.Schema.XmlSchemaComplexType;
                    XmlSchemaElement     schemaElement = item as XmlSchemaElement;
                    XmlSchemaComplexType complexType   = item as XmlSchemaComplexType;

                    if (schemaElement != null && JavaTypeConverter.IsComplexType(schemaElement.Name))
                    {
                        SoapClasses newClass = this.GetClass(schemaElement.Name);
                        newClass.Name           = schemaElement.Name;
                        newClass.Service        = webserv;
                        newClass.Type           = ClassType.Unknown;
                        newClass.SuperClassType = string.Empty;
                        newClass.Output         = false;

                        if (_complexType != null)
                        {
                            XmlSchemaContentModel   model   = _complexType.ContentModel;
                            XmlSchemaComplexContent complex = model as XmlSchemaComplexContent;
                            if (complex != null)
                            {
                                XmlSchemaComplexContentExtension extension = complex.Content as XmlSchemaComplexContentExtension;
                                if (extension != null)
                                {
                                    newClass.SuperClassType = extension.BaseTypeName.Name;
                                }
                            }
                        }

                        XmlSchemaType        schemaType        = schemaElement.SchemaType;
                        XmlSchemaComplexType schemaComplexType = schemaType as XmlSchemaComplexType;


                        if (schemaComplexType != null)
                        {
                            XmlSchemaParticle particle = schemaComplexType.Particle;
                            XmlSchemaSequence sequence = particle as XmlSchemaSequence;
                            if (sequence != null)
                            {
                                foreach (XmlSchemaElement childElement in sequence.Items)
                                {
                                    SoapClassProperties newProp = new SoapClassProperties(XpoDefault.Session);
                                    newProp.Name = childElement.Name;

                                    newProp.PropertyClassType = childElement.SchemaTypeName.Name;
                                    newProp.IsArray           = childElement.SchemaTypeName.Name.StartsWith("ArrayOf");
                                    newClass.Properties.Add(newProp);
                                }
                            }
                        }

                        newClass.Save();
                        //this.ComplexTypes.Add(newClass);
                    }
                    else if (complexType != null)
                    {
                        OutputElements(complexType.Particle, complexType.Name);

                        if (complexType.Particle == null)
                        {
                            GetProperties(xmlSchema, complexType.Name);
                        }
                    }
                }

                #region enums
                foreach (object xItem in xmlSchema.SchemaTypes.Values)
                {
                    XmlSchemaSimpleType item2 = xItem as XmlSchemaSimpleType;
                    if (item2 != null)
                    {
                        GetEnum(xmlSchema, item2.Name);
                    }
                }
                #endregion

                #endregion
            }

            webserv.Save();
        }
Exemple #59
0
 public Module(Types moduleType, Item item, bool equipped)
 {
     ModuleType = moduleType;
     Item       = item;
     Equipped   = equipped;
 }
Exemple #60
0
        private async void SetHandler(object Sender, IqEventArgs e)
        {
            try
            {
                string ServiceToken = XML.Attribute(e.Query, "st");
                string DeviceToken  = XML.Attribute(e.Query, "dt");
                string UserToken    = XML.Attribute(e.Query, "ut");

                LinkedList <IThingReference>    Nodes          = null;
                SortedDictionary <string, bool> ParameterNames = this.provisioningClient == null ? null : new SortedDictionary <string, bool>();
                LinkedList <ControlOperation>   Operations     = new LinkedList <ControlOperation>();
                ControlParameter Parameter;
                DataForm         Form = null;
                XmlElement       E;
                string           Name;

                foreach (XmlNode N in e.Query.ChildNodes)
                {
                    E = N as XmlElement;
                    if (E == null)
                    {
                        continue;
                    }

                    switch (E.LocalName)
                    {
                    case "nd":
                        if (Nodes == null)
                        {
                            Nodes = new LinkedList <IThingReference>();
                        }

                        string NodeId    = XML.Attribute(E, "id");
                        string SourceId  = XML.Attribute(E, "src");
                        string Partition = XML.Attribute(E, "pt");

                        if (this.OnGetNode == null)
                        {
                            Nodes.AddLast(new ThingReference(NodeId, SourceId, Partition));
                        }
                        else
                        {
                            IThingReference Ref = await this.OnGetNode(NodeId, SourceId, Partition);

                            if (Ref == null)
                            {
                                throw new ItemNotFoundException("Node not found.", e.IQ);
                            }

                            Nodes.AddLast(Ref);
                        }
                        break;

                    case "b":
                    case "cl":
                    case "d":
                    case "dt":
                    case "db":
                    case "dr":
                    case "e":
                    case "i":
                    case "l":
                    case "s":
                    case "t":
                        if (ParameterNames != null)
                        {
                            ParameterNames[XML.Attribute(E, "n")] = true;
                        }
                        break;

                    case "x":
                        Form = new DataForm(this.client, E, null, null, e.From, e.To);
                        if (Form.Type != FormType.Submit)
                        {
                            ParameterBadRequest(e);
                            return;
                        }

                        if (ParameterNames != null)
                        {
                            foreach (Field Field in Form.Fields)
                            {
                                ParameterNames[Field.Var] = true;
                            }
                        }
                        break;

                    default:
                        ParameterBadRequest(e);
                        return;
                    }
                }

                foreach (XmlNode N in e.Query.ChildNodes)
                {
                    E = N as XmlElement;
                    if (E == null)
                    {
                        continue;
                    }

                    switch (E.LocalName)
                    {
                    case "b":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            BooleanControlParameter BooleanControlParameter = Parameter as BooleanControlParameter;
                            if (BooleanControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new BooleanControlOperation(Node, BooleanControlParameter, XML.Attribute(E, "v", false), e));
                        }
                        break;

                    case "cl":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            ColorControlParameter ColorControlParameter = Parameter as ColorControlParameter;
                            if (ColorControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new ColorControlOperation(Node, ColorControlParameter, XML.Attribute(E, "v"), e));
                        }
                        break;

                    case "d":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            DateControlParameter DateControlParameter = Parameter as DateControlParameter;
                            if (DateControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new DateControlOperation(Node, DateControlParameter, XML.Attribute(E, "v", DateTime.MinValue), e));
                        }
                        break;

                    case "dt":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            DateTimeControlParameter DateTimeControlParameter = Parameter as DateTimeControlParameter;
                            if (DateTimeControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new DateTimeControlOperation(Node, DateTimeControlParameter, XML.Attribute(E, "v", DateTime.MinValue), e));
                        }
                        break;

                    case "db":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            DoubleControlParameter DoubleControlParameter = Parameter as DoubleControlParameter;
                            if (DoubleControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new DoubleControlOperation(Node, DoubleControlParameter, XML.Attribute(E, "v", 0.0), e));
                        }
                        break;

                    case "dr":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            DurationControlParameter DurationControlParameter = Parameter as DurationControlParameter;
                            if (DurationControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new DurationControlOperation(Node, DurationControlParameter, XML.Attribute(E, "v", Duration.Zero), e));
                        }
                        break;

                    case "e":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            string StringValue = XML.Attribute(E, "v");

                            if (Parameter is EnumControlParameter EnumControlParameter)
                            {
                                Type T = Types.GetType(XML.Attribute(E, "t"));
                                if (T == null)
                                {
                                    e.IqError("<error type='modify'><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><paramError xmlns=\"" +
                                              ControlClient.NamespaceControl + "\" n=\"" + Name + "\">Type not found.</paramError></error>");
                                    return;
                                }

                                if (!T.GetTypeInfo().IsEnum)
                                {
                                    e.IqError("<error type='modify'><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><paramError xmlns=\"" +
                                              ControlClient.NamespaceControl + "\" n=\"" + Name + "\">Type is not an enumeration.</paramError></error>");
                                    return;
                                }

                                Enum Value;

                                try
                                {
                                    Value = (Enum)Enum.Parse(T, StringValue);
                                }
                                catch (Exception)
                                {
                                    e.IqError("<error type='modify'><bad-request xmlns=\"urn:ietf:params:xml:ns:xmpp-stanzas\"/><paramError xmlns=\"" +
                                              ControlClient.NamespaceControl + "\" n=\"" + Name + "\">Value not valid element of enumeration.</paramError></error>");
                                    return;
                                }

                                Operations.AddLast(new EnumControlOperation(Node, EnumControlParameter, Value, e));
                            }
                            else if (Parameter is StringControlParameter StringControlParameter)
                            {
                                Operations.AddLast(new StringControlOperation(Node, StringControlParameter, StringValue, e));
                            }
                            else if (Parameter is MultiLineTextControlParameter MultiLineTextControlParameter)
                            {
                                Operations.AddLast(new MultiLineTextControlOperation(Node, MultiLineTextControlParameter, StringValue, e));
                            }
                            else
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }
                        }
                        break;

                    case "i":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            Int32ControlParameter Int32ControlParameter = Parameter as Int32ControlParameter;
                            if (Int32ControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new Int32ControlOperation(Node, Int32ControlParameter, XML.Attribute(E, "v", 0), e));
                        }
                        break;

                    case "l":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            Int64ControlParameter Int64ControlParameter = Parameter as Int64ControlParameter;
                            if (Int64ControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new Int64ControlOperation(Node, Int64ControlParameter, XML.Attribute(E, "v", 0L), e));
                        }
                        break;

                    case "s":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            if (Parameter is StringControlParameter StringControlParameter)
                            {
                                Operations.AddLast(new StringControlOperation(Node, StringControlParameter, XML.Attribute(E, "v"), e));
                            }
                            else if (Parameter is MultiLineTextControlParameter MultiLineTextControlParameter)
                            {
                                Operations.AddLast(new MultiLineTextControlOperation(Node, MultiLineTextControlParameter, XML.Attribute(E, "v"), e));
                            }
                            else
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }
                        }
                        break;

                    case "t":
                        Name = XML.Attribute(E, "n");
                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameter = await this.GetParameter(Node, Name, e);

                            if (Parameter == null)
                            {
                                return;
                            }

                            TimeControlParameter TimeControlParameter = Parameter as TimeControlParameter;
                            if (TimeControlParameter == null)
                            {
                                ParameterWrongType(Name, e);
                                return;
                            }

                            Operations.AddLast(new TimeControlOperation(Node, TimeControlParameter, XML.Attribute(E, "v", TimeSpan.Zero), e));
                        }
                        break;

                    case "x":
                        Dictionary <string, ControlParameter> Parameters;

                        foreach (IThingReference Node in Nodes ?? NoNodes)
                        {
                            Parameters = await this.GetControlParametersByName(Node);

                            if (Parameters == null)
                            {
                                NotFound(e);
                                return;
                            }

                            foreach (Field Field in Form.Fields)
                            {
                                if (!Parameters.TryGetValue(Field.Var, out Parameter))
                                {
                                    ParameterNotFound(Field.Var, e);
                                    return;
                                }

                                Operations.AddLast(new FormControlOperation(Node, Parameter, Field.ValueString, e));
                            }
                        }
                        break;
                    }
                }

                if (this.provisioningClient != null)
                {
                    string[] ParameterNames2 = new string[ParameterNames.Count];
                    ParameterNames.Keys.CopyTo(ParameterNames2, 0);

                    this.provisioningClient.CanControl(e.FromBareJid, Nodes, ParameterNames2,
                                                       ServiceToken.Split(space, StringSplitOptions.RemoveEmptyEntries),
                                                       DeviceToken.Split(space, StringSplitOptions.RemoveEmptyEntries),
                                                       UserToken.Split(space, StringSplitOptions.RemoveEmptyEntries),
                                                       (sender2, e2) =>
                    {
                        if (e2.Ok && e2.CanControl)
                        {
                            LinkedList <ControlOperation> Operations2 = null;
                            bool Restricted;

                            if (e2.Nodes != null || e2.ParameterNames != null)
                            {
                                Dictionary <IThingReference, bool> AllowedNodes = null;
                                Dictionary <string, bool> AllowedParameterNames = null;

                                Operations2 = new LinkedList <ControlOperation>();
                                Restricted  = false;

                                if (e2.Nodes != null)
                                {
                                    AllowedNodes = new Dictionary <IThingReference, bool>();
                                    foreach (IThingReference Node in e2.Nodes)
                                    {
                                        AllowedNodes[Node] = true;
                                    }
                                }

                                if (e2.ParameterNames != null)
                                {
                                    AllowedParameterNames = new Dictionary <string, bool>();
                                    foreach (string ParameterName in e2.ParameterNames)
                                    {
                                        AllowedParameterNames[ParameterName] = true;
                                    }
                                }

                                foreach (ControlOperation Operation in Operations)
                                {
                                    if (AllowedNodes != null && !AllowedNodes.ContainsKey(Operation.Node ?? ThingReference.Empty))
                                    {
                                        Restricted = true;
                                        continue;
                                    }

                                    if (AllowedParameterNames != null && !AllowedParameterNames.ContainsKey(Operation.ParameterName))
                                    {
                                        Restricted = true;
                                        continue;
                                    }

                                    Operations2.AddLast(Operation);
                                }
                            }
                            else
                            {
                                Restricted = false;
                            }

                            if (Restricted)
                            {
                                this.PerformOperations(Operations2, e, e2.Nodes, e2.ParameterNames);
                            }
                            else
                            {
                                this.PerformOperations(Operations, e, null, null);
                            }
                        }
                        else
                        {
                            e.IqError("<error type='cancel'><forbidden xmlns='urn:ietf:params:xml:ns:xmpp-stanzas'/>" +
                                      "<text xmlns='urn:ietf:params:xml:ns:xmpp-stanzas' xml:lang='en'>Access denied.</text></error>");
                        }
                    }, null);
                }
                else
                {
                    this.PerformOperations(Operations, e, null, null);
                }
            }
            catch (Exception ex)
            {
                e.IqError(ex);
            }
        }