Beispiel #1
0
        /// <summary>
        /// Update markets list on form
        /// </summary>
        private void UpdateMarkets(List <string> markets)
        {
            // subs to all markets
            if (smart_subs)
            {
                smart_subs = false;
                foreach (var item in markets)
                {
                    var market = EnumValue.GetEnum <MarketType>(item);

                    if (rbReal.Checked)
                    {
                        socket?.Send(Subs.Balance(SubsType.SubsAndGetNextChange, market));
                    }
                    socket?.Send(Subs.Orders(SubsType.SubsAndGetExist, market, rbReal.Checked ? SysType.Real : SysType.Demo));
                    socket?.Send(Subs.Deals(SubsType.SubsAndGetExist, market, rbReal.Checked ? SysType.Real : SysType.Demo));
                }
            }

            try
            {
                this.BeginInvoke((Action)(() =>
                {
                    lbKeysTime.Text = DateTime.Now.ToString();

                    // load markets
                    lbMarkets.Items.Clear();
                    lbMarkets.Items.AddRange(markets.ToArray());
                }));
            }
            catch { }
        }
Beispiel #2
0
        /// <summary>Stop and remove all subscriptions</summary>
        public async Task Clear()
        {
            await StopAll();

            Subs.Clear();
            Active.Clear();
        }
Beispiel #3
0
    /// <summary>
    /// Returns the next scene name and forwards the current map index.
    /// </returns>
    string getScene()
    {
        var s = Scene_list[current_map];

        current_map = Subs.Add(current_map, 0, Scene_list.Length);
        return(s);
    }
Beispiel #4
0
 public void RemoveIf(Func <Subscription, bool> pred)
 {
     foreach (var sub in Subs.Where(x => pred(x)).ToList())
     {
         Remove(sub);
     }
 }
Beispiel #5
0
        /// <summary>
        /// This method returns the next refill dates according to given date and refill Occurance
        /// </summary>
        /// <param name="subscription_id"></param>
        /// <param name="date"></param>
        /// <param name="Token"></param>
        /// <returns></returns>
        public virtual dynamic PendingRefill(int subscription_id, DateTime date, string Token)
        {
            //Refill fill = new Refill();
            List <RefillDetails> m = new List <RefillDetails>();

            string data = JsonConvert.SerializeObject(subscription_id);

            Uri        baseAddress = new Uri("http://20.193.128.185/api/Subscription/ViewDetails_BySubID/" + subscription_id);
            HttpClient client      = new HttpClient();

            client.BaseAddress = baseAddress;

            client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", Token);

            HttpResponseMessage response = client.GetAsync(client.BaseAddress).Result;
            string freq = "";

            if (response.IsSuccessStatusCode)
            {
                data = response.Content.ReadAsStringAsync().Result;

                Subs s = JsonConvert.DeserializeObject <Subs>(data);
                freq = s.RefillOccurrence;
            }
            List <RefillDetails> Pending_dues = new List <RefillDetails>();

            Pending_dues = Calculation_Dues(subscription_id, freq, date);
            return(Pending_dues);
        }
Beispiel #6
0
 /// <summary>
 /// 通过名字和信息创建新的Line
 /// </summary>
 /// <param name="name">名称</param>
 /// <param name="info">信息 (正常)</param>
 /// <param name="text">文本 在末尾没有结束行号的文本 (正常)</param>
 /// <param name="subs">子类集合</param>
 public Line(string name, string info, string text = "", params Sub[] subs)
 {
     Name = name;
     Info = info;
     Text = text;
     Subs.AddRange(subs);
 }
Beispiel #7
0
        /// <summary>
        /// Takes a local DateTime-struct and returns the Moon's right ascension (RAd), declination (DECLd) and Angular Diameter (AngDiam) in degrees as a MoonStruct.
        /// </summary>
        /// <param name="DT"></param>
        /// <returns></returns>
        public static Structs.Moon MoonTG(Structs.MyDateTime DT, Structs.MyLoc Loc)
        {
            double GDay   = Time.LDTtoGCDay(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double GMonth = Time.LDTtoGCMonth(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double GYear  = Time.LDTtoGCYear(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double UT     = Time.LDTtoUT(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double MLon   = Subs.MoonLong(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double MLat   = Subs.MoonLat(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double NaL    = Subs.NutLong(GDay, GMonth, GYear);
            double CorLon = MLon + NaL;
            double HP     = Subs.MoonHorPar(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double EMdist = 6378.14d / Helpers.Sin(Helpers.toRadians(HP));
            double MS     = Subs.MoonSize(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double Mra    = Subs.EclCoo_RA(CorLon, 0, 0, MLat, 0, 0, GDay, GMonth, GYear);
            double Mdec   = Subs.EclCoo_Dec(CorLon, 0, 0, MLat, 0, 0, GDay, GMonth, GYear);

            double Lon = Loc.Lon;
            double Lat = Loc.Lat;
            double h   = Loc.h;

            double LCT    = Time.UTLct(UT, 0, 0, DT.DS, DT.ZC, GDay, GMonth, GYear);
            double HA     = Subs.RAHA((Mra / 15), 0, 0, LCT, 0, 0, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear, Lon);
            double CorHA  = Subs.ParallaxHA(HA, 0, 0, Mdec, 0, 0, true, Lat, h, HP);
            double CorRA  = Subs.HARA(CorHA, 0, 0, LCT, 0, 0, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear, Lon);
            double CorDec = Subs.ParallaxDec(HA, 0, 0, Mdec, 0, 0, true, Lat, h, HP);

            Structs.Moon result = new Structs.Moon(Mra, Mdec, CorRA, CorDec, MS);

            return(result);
        }
Beispiel #8
0
    /// <summary>
    /// Returns the next scene name and forwards the current map index.
    /// </returns>
    string getNextScene()
    {
        var s = Scene_list[current_scene];

        current_scene = Subs.Add(current_scene, 0, Scene_list.Length);
        return(s);
    }
        /// <summary>
        /// Reset all info (always call before playing next file)
        /// </summary>
        public void ResetInfo()
        {
            AudioCodec = string.Empty;
            VideoCodec = string.Empty;

            // VideoInfo
            HasVideo    = true;
            VideoWidth  = 0;
            VideoHeight = 0;

            Id3Tags = new Id3Tag
            {
                AlbumArtist = string.Empty,
                Encoder     = string.Empty,
                Artist      = string.Empty,
                Genre       = string.Empty,
                Track       = string.Empty,
                Disc        = 0,
                Title       = string.Empty,
                Album       = string.Empty,
                Date        = string.Empty,
                Comment     = string.Empty,
                Description = string.Empty,

                AlbumArtTag = null
            };

            IdInfos.Clear();

            // Tracks
            Subs.Clear();
            Chapters.Clear();
            AudioTracks.Clear();
        }
Beispiel #10
0
        public ActionResult MySubjects()
        {
            int stu_id = int.Parse(Session["StudentID"].ToString());


            var search = from student in db.Students
                         join studentClass in db.StudentClasses on student.StudentID equals studentClass.StudentID
                         join cls in db.Classes on studentClass.ClassID equals cls.ClassID
                         join teacher in db.Teachers on cls.employee_number equals teacher.employee_number
                         where student.StudentID == stu_id
                         select new { cls.subject_name, teacher.title, teacher.name, teacher.surname, cls.ClassID };

            List <Subs> s = new List <Subs>();

            foreach (var item in search)
            {
                Subs subs = new Subs();

                subs.subject = item.subject_name;

                subs.teacher = item.title + " " + item.name + " " + item.surname;

                subs.class_id = item.ClassID;

                s.Add(subs);
            }


            return(View("MySubjects", s));
        }
Beispiel #11
0
 public Linking Disable(bool b = true)
 {
     Disabled = b;
     Subs.OfType <Input>().ForEach(s => s.Disable(b));
     //subs.Select(s => (s is INPUT) ? (s as INPUT).Disabled(b) : s).ToList();
     return(this);
 }
Beispiel #12
0
    /// <summary>
    /// Returns the next scene name and forwards the current map index.
    /// </returns>
    string getNextData()
    {
        var s = Data_list[current_data];

        current_data = Subs.Add(current_data, 0, Data_list.Length);
        return(s);
    }
Beispiel #13
0
    public void UpdateHud()
    {
        string number = "";
        Dictionary <FactionData, int> ships = new Dictionary <FactionData, int>();

        foreach (var s in Data.Ships)
        {
            if (ships.ContainsKey(s.Faction))
            {
                ships[s.Faction]++;
            }
            else
            {
                ships.Add(s.Faction, 1);
            }
        }
        if (ships.Count != 0)
        {
            foreach (var n in ships)
            {
                number += "[" + Subs.ColorToHex(n.Key.Color_) + "]" + n.Value + "\n";
            }
        }
        ship_amount_label.text = number;
    }
Beispiel #14
0
 public void StopAll()
 {
     Debug.Assert(Misc.AssertMainThread());
     foreach (var sub in Subs.Where(x => x.State == Subscription.EState.Running))
     {
         sub.Stop();
     }
 }
Beispiel #15
0
 /// <summary>Start all subscriptions that are not already running</summary>
 public void StartAll()
 {
     Debug.Assert(Misc.AssertMainThread());
     foreach (var sub in Subs.Where(x => x.State == Subscription.EState.Initial))
     {
         sub.Start();
     }
 }
Beispiel #16
0
    // Use this for initialization
    void Start()
    {
        timer = new Timer(0, OnTimer);
        randomizeDelay();

        moving_up = Subs.RandomBool();
        start_pos = transform.position;
    }
Beispiel #17
0
    // Use this for initialization
    void Start()
    {
        BuildingGrid = new GameObject[GridWidth, GridHeight];
        PosGrid      = new bool[GridWidth, GridHeight];
        obs_timer    = new Timer(5000);
        //loading map

        Vector2 map_pos = Vector2.zero;

        for (int m = 0; m < 4; m++)
        {
            map_pos = new Vector2((m % 2) * 5, (m / 2) * 5);

            int angle = Subs.GetRandom(new int[] { 0, 90, 180, 270 });

            var     map  = Subs.GetRandom(Maps);
            int     w    = map.map_data.GetLength(1);
            int     h    = map.map_data.GetLength(0);
            Vector2 size = new Vector2(w, h);
            for (int y = 0; y < h; y++)
            {
                for (int x = 0; x < w; x++)
                {
                    Vector2 pos = new Vector2(x, y);

                    pos = RotateArrayVector2(pos, size, angle);

                    pos.y = h - 1 - pos.y;

                    pos += map_pos;

                    if (map.map_data[y, x] == 1)
                    {
                        AddBuilding((int)pos.x, (int)pos.y);
                    }
                    if (map.map_data[y, x] == 2)
                    {
                        AddCheckPoint((int)pos.x, (int)pos.y);
                    }
                }
            }
        }

        var goal = raceController.CheckPoints[Subs.GetRandom(raceController.CheckPoints.Count)];

        goal.IsGoal             = true;
        raceController.StartPos = goal;

        raceController.CreateCars();

        CameraGo.transform.position =
            new Vector3(raceController.StartPos.transform.position.x,
                        CameraGo.transform.position.x,
                        raceController.StartPos.transform.position.z
                        );

        AStar.Scan();
    }
Beispiel #18
0
 //Добавить строку подтаблицы
 public void AddRow(TablRow row)
 {
     SubNums.Add(row.Num, row);
     if (!row.Code.IsEmpty())
     {
         SubCodes.Add(row.Code, row);
     }
     Subs.Add(row);
 }
Beispiel #19
0
        public DataContext()
        {
            foreach (var chara in Info.Instance().Member)
            {
                if (chara.Value == 0)
                {
                    continue;
                }
                Charactors.Add(new Charactor((chara.Value - 1) * 0x4010 + 0xA8750)
                {
                    Name = chara.Name
                });
            }

            foreach (var info in Info.Instance().Tools)
            {
                Tools.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Mains)
            {
                Mains.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Subs)
            {
                Subs.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Heads)
            {
                Heads.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Bodys)
            {
                Bodys.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Accessorys)
            {
                Accessorys.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Materials)
            {
                Materials.Add(new Item(info, 0xA3D68));
            }
            foreach (var info in Info.Instance().Synthesises)
            {
                Synthesises.Add(new Item(info, 0xA3D68));
            }

            for (uint i = 0; i < 9; i++)
            {
                Party.Add(new SaveDataValue <uint>(0xA3D38 + 4 * i, 4, 0, 9));
            }
        }
Beispiel #20
0
        static void SubTitle(Subs pageCommand)
        {
            var command = pageCommand.command.Split(' ');
            var group   = command.Skip(1).FirstOrDefault();

            using (new ConsoleColourer(White, Black))
                Write($"{group} ");
            using (new ConsoleColourer(Yellow, Black))
                WriteLine("[w(rite) <id> <value>] | [s(tatus) <id>] | [u(a) <group>] | [d(a) <group>] | q(uit)");

            new ConsolePositioner(0, 1, BufferWidth);
            Write("> ");
        }
Beispiel #21
0
 private void PublicAPI_FormClosed(object sender, FormClosedEventArgs e)
 {
     if (socket != null)
     {
         socket.OnDataPairs        -= Socket_OnDataPairs;
         socket.OnDataPairsDetail  -= Socket_OnDataPairsDetail;
         socket.OnDataOrderbook    -= Socket_OnDataOrderbook;
         socket.OnDataRecentTrades -= Socket_OnDataRecentTrades;
         socket.OnDataLastPrice    -= Socket_OnDataLastPrice;
         socket.OnDataPriceByTime  -= Socket_OnDataPriceByTime;
     }
     socket?.Send(Subs.UnsubsAll());
 }
Beispiel #22
0
    // Use this for initialization
    public TileData(Vector3 startpos, int tileGroup)
    {
        tile_group = tileGroup;

        setMovementBounds(0, 0);

        Position = start_pos = move_target = startpos;

        timer        = new Timer(1000, OnTimerRandom);
        timer.Active = false;

        moving_up = Subs.RandomBool();
    }
Beispiel #23
0
        /// <summary>Add a subscription instance</summary>
        public async Task Add(Subscription sub)
        {
            Debug.Assert(Misc.AssertMainThread());
            Debug.Assert(sub.Api == null);
            sub.Api = Api;

            // If there are existing subscriptions equal to 'sub' stop and remove them
            var tasks = Subs.Where(x => Equals(x, sub)).Select(x => Remove(x));
            await Task.WhenAll(tasks);

            // Add 'sub' to the collection
            Subs.Add(sub);
            await sub.Start();
        }
Beispiel #24
0
        /// <summary>
        /// Takes a local DateTime-struct and returns the Sun's right ascension (RAd) and declination (DECLd) in degrees as a PosStruct.
        /// </summary>
        /// <param name="DT"></param>
        /// <returns></returns>
        public static Structs.Pos SunPosTG(Structs.MyDateTime DT)
        {
            double GDay   = Time.LDTtoGCDay(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double GMonth = Time.LDTtoGCMonth(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double GYear  = Time.LDTtoGCYear(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);
            double SL     = Subs.SunLong(DT.LocHour, DT.LocMin, DT.LocSec, DT.DS, DT.ZC, DT.LocDay, DT.LocMonth, DT.LocYear);

            double Sra  = Subs.EclCoo_RA(SL, 0, 0, 0, 0, 0, GDay, GMonth, GYear);
            double Sdec = Subs.EclCoo_Dec(SL, 0, 0, 0, 0, 0, GDay, GMonth, GYear);

            Structs.Pos result = new Structs.Pos(Sra, Sdec);

            return(result);
        }
Beispiel #25
0
    private void CreateRandomObstacle()
    {
        int rx = Subs.GetRandom(GridWidth);
        int ry = Subs.GetRandom(GridHeight);

        Vector3 rv = new Vector3(1, 0, 1) * 2.5f + new Vector3(Subs.GetRandom(5f), 0, Subs.GetRandom(5f));

        var go = Instantiate(Obstacle_prefab, new Vector3(rx * TileSize, 170, ry * TileSize) + rv, Quaternion.identity) as GameObject;

        if (obs_timer.Delay > 500)
        {
            obs_timer.Delay -= 100;
        }
    }
Beispiel #26
0
 // configured da client using rx
 static IObservable <ItemValue> DaRxxReader(Subs subs)
 {
     return(RxxReader(subs,
                      (id, tag) => DAItemChangedObservable.Create <object>(new DAItemGroupArguments(
                                                                               GetElementAttribute(tag, "da", "endpoint"),
                                                                               GetElementAttribute(tag, "da", "server"),
                                                                               $"{tag.Parent.Attribute("name").Value}.{tag.Attribute("node").Value}",
                                                                               int.Parse(GetAttribute(tag, "updateRate")),
                                                                               id)
                                                                           )
                      .Select(val => new SubValue {
         Quality = val.Vtq.HasValue ? val.Vtq.Quality == DAQualities.GoodNonspecific : false, Value = val?.Vtq?.Value
     })
                      ));
 }
Beispiel #27
0
        private void PublicAPI_Load(object sender, EventArgs e)
        {
            if (socket != null)
            {
                socket.OnDataPairs        += Socket_OnDataPairs;
                socket.OnDataPairsDetail  += Socket_OnDataPairsDetail;
                socket.OnDataOrderbook    += Socket_OnDataOrderbook;
                socket.OnDataRecentTrades += Socket_OnDataRecentTrades;
                socket.OnDataLastPrice    += Socket_OnDataLastPrice;
                socket.OnDataPriceByTime  += Socket_OnDataPriceByTime;

                // get market data
                socket?.Send(Subs.Pairs(SubsType.GetExist));
            }
        }
Beispiel #28
0
    public FactionData(string name, bool ai, WorldData world)
    {
        Name = name;
        AI   = ai;

        Colonies = new List <ColonyData>();
        Ships    = new List <ShipData>();

        if (ai)
        {
            AI_c = new FactionAI(this, world);
        }

        Color_ = Subs.RandomColor();
    }
Beispiel #29
0
        /// <summary>Returns null if the replace field is valid, otherwise an exception describing what's wrong</summary>
        public Exception ValidateReplace()
        {
            try
            {
                // All tags in 'Replace' must exist in the match expression
                if (!GetTags(Replace).All(t => Subs.ContainsKey(t.Id)))
                {
                    return(new ArgumentException("The replace pattern contains unknown tags"));
                }

                // No prob, bob!
                return(null);
            }
            catch (Exception ex) { return(ex); }
        }
Beispiel #30
0
    void Start()
    {
        AIPathFinder.canMove = true;
        AIPathFinder.OnTargetReachedEvent += OnTargetReached;
        SetSelected(false);

        color = Subs.RandomColor();
        GraphicsMain.SetColor(color);

        stuck_timer        = new Timer(4000);
        stuck_timer.Active = false;

        hp   = MaxHP;
        LAPS = 0;
    }
Beispiel #31
0
        static void RecursivelyInspectComments(Func<Subs.Post, RedditSharp.Things.Comment, Subs.Comment, Subs.Comment> commentFunc,
            Subs.Post post, 
            RedditSharp.Things.Comment redditComment, 
            Subs.Comment parentComment = null)
        {
            if (redditComment.Kind == "more")
            {
                return;
            }

            if (redditComment.Kind != "t1")
            {
                return;
            }

            var comment = commentFunc(post, redditComment, parentComment);
            if (comment == null) return;

            foreach (var childRedditComment in redditComment.Comments)
            {
                RecursivelyInspectComments(commentFunc, post, childRedditComment, comment);
            }
        }
Beispiel #32
0
        static IObservable<ItemValue> RxxReader(Subs subs, Func<string, XElement, IObservable<SubValue>> subscriber)
        {



            subs.tags.ToList().ForEach(t => TitleDisplay(t.line, t.column, t.tag));

            using (new ConsoleColourer(White, Black))
                subs.tags.Where(t => t.index == 0).ToList().ForEach(t => TagsDisplay(t.line - 1, t.column, t.tag.Parent));


            return Observable.Merge(subs.tags.AsParallel().Select(
                (t, index) =>
                subscriber(t.id, t.tag)
                    .DistinctUntilChanged(v => $"{v.Quality}:{v.Value}")
                    .Select(val => new ItemValue
                    {
                        val = val.val,
                        Id = t.id,
                        Line = t.line,
                        Index = t.column,
                        Tag = t.tag,
                        Value = val.Value,
                        Quality = val.Quality
                    })
            ).ToList()).SubscribeOn(Scheduler.Default);
        }
Beispiel #33
0
        // configured da client using rx
        static IObservable<ItemValue> UaRxxReader(Subs subs)
        {
            using (new Timer("UaRxxReader"))
                return RxxReader(subs, Ua);


        }
Beispiel #34
0
        // configured da client using rx
        static IObservable<ItemValue> DaRxxReader(Subs subs)
        {

            return RxxReader(subs,
                (id, tag) => DAItemChangedObservable.Create<object>(new DAItemGroupArguments(
                    GetElementAttribute(tag, "da", "endpoint"),
                    GetElementAttribute(tag, "da", "server"),
                    $"{tag.Parent.Attribute("name").Value}.{tag.Attribute("node").Value}",
                    int.Parse(GetAttribute(tag, "updateRate")),
                    id)
                 )
                    .Select(val => new SubValue { Quality = val.Vtq.HasValue ? val.Vtq.Quality == DAQualities.GoodNonspecific : false, Value = val?.Vtq?.Value })
             );


        }
Beispiel #35
0
        static void SubTitle(Subs pageCommand)
        {
            var command = pageCommand.command.Split(' ');
            var group = command.Skip(1).FirstOrDefault();
            using (new ConsoleColourer(White, Black))
                Write($"{group} ");
            using (new ConsoleColourer(Yellow, Black))
                WriteLine("[w(rite) <id> <value>] | [s(tatus) <id>] | [u(a) <group>] | [d(a) <group>] | q(uit)");

            new ConsolePositioner(0, 1, BufferWidth);
            Write("> ");
        }