예제 #1
0
파일: Node.cs 프로젝트: torum/BlogWrite
        public NodeService(string name, Uri endPoint, ApiTypes api, ServiceTypes serviceType) : base(name)
        {
            // Default account icon
            PathIcon = "M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z";

            EndPoint = endPoint;

            Api = api;

            ServiceType = serviceType;

            //Id = Guid.NewGuid().ToString();
            Id = endPoint.AbsoluteUri;

            switch (api)
            {
            case ApiTypes.atAtomPub:
                Client = new AtomPubClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atXMLRPC_MovableType:
                Client = new XmlRpcClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atXMLRPC_WordPress:
                Client = new XmlRpcClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atFeed:
                Client = new FeedClient();
                break;

                //TODO: WP, AtomAPI
            }
        }
예제 #2
0
 public ApplicationLayer(ApiTypes apiType, ISessionLayer sessionLayer, IFrameLayer frameLayer, ITransportLayer transportLayer)
 {
     ApiType        = apiType;
     SessionLayer   = sessionLayer;
     FrameLayer     = frameLayer;
     TransportLayer = transportLayer;
 }
예제 #3
0
        async Task <T> GetDataFromApi <T>(ApiTypes apiType, string apiRoute, string accessToken)
        {
            {
                var client = new HttpClient();

                if (string.IsNullOrWhiteSpace(accessToken) == false)
                {
                    client.SetBearerToken(accessToken);
                }

                client.BaseAddress = new Uri($"{GetApiBaseAddress()}/api/");
                client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue(MediaTypeNames.Application.Json));

                var response = await client.GetAsync(apiRoute);

                if (response.IsSuccessStatusCode)
                {
                    var json = await response.Content.ReadAsStringAsync();

                    var model = JsonConvert.DeserializeObject <T>(json);

                    return(model);
                }
                return(default(T));
            }

            string GetApiBaseAddress() => apiType == ApiTypes.Student ? Urls.ApiStudentsUrl : Urls.ApiTeachersUrl;
        }
예제 #4
0
        public NodeService(string name, string username, string password, Uri endPoint, ApiTypes api) : base(name)
        {
            UserName     = username;
            UserPassword = password;
            EndPoint     = endPoint;
            // Default account icon
            PathIcon = "M12,19.2C9.5,19.2 7.29,17.92 6,16C6.03,14 10,12.9 12,12.9C14,12.9 17.97,14 18,16C16.71,17.92 14.5,19.2 12,19.2M12,5A3,3 0 0,1 15,8A3,3 0 0,1 12,11A3,3 0 0,1 9,8A3,3 0 0,1 12,5M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12C22,6.47 17.5,2 12,2Z";

            switch (api)
            {
            case ApiTypes.atAtomPub:
                Client = new AtomPubClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atXMLRPC:
                Client = new XmlRpcClient(UserName, UserPassword, EndPoint);
                break;

            case ApiTypes.atAtomFeed:
                Client = new AtomFeedClient(EndPoint);
                break;

                //TODO: AtomAPI
            }

            Api = api;

            ID = Guid.NewGuid().ToString();
        }
예제 #5
0
        private void Update(kcsapi_combined_battle_midnight data, ApiTypes apiType)
        {
            if (apiType == ApiTypes.combined_battle_midnight_sp)
            {
                // 적, 아군 함대 정보 갱신
                this.UpdateFleets(data.api_deck_id, data, data.api_formation);

                // 체력 갱신
                this.UpdateMaxHP(data.api_f_maxhps, data.api_e_maxhps, data.api_f_maxhps_combined);
                this.UpdateBefHP(data.api_f_nowhps, data.api_e_nowhps, data.api_f_nowhps_combined);
            }

            // 체력 갱신
            this.UpdateNowHP(data.api_f_nowhps, data.api_e_nowhps, data.api_f_nowhps_combined);

            if (apiType == ApiTypes.combined_battle_midnight_sp)
            {
                battleCalculator
                .Initialize(
                    this.AliasFirst, this.AliasSecond,
                    this.EnemyFirst, this.EnemySecond
                    );
            }

            battleCalculator.Update(data, (ApiTypes_CombinedMidnight)apiType);
        }
예제 #6
0
 public SynergyRequest(int userId, ApiTypes api, string request)
 {
     // TODO: Complete member initialization
     this.UserId  = userId;
     this.Api     = api;
     this.Request = request;
 }
예제 #7
0
        private void Update(kcsapi_combined_battle_midnight_ec data, ApiTypes apiType)
        {
            // 체력 갱신
            this.UpdateNowHP(data.api_f_nowhps, data.api_e_nowhps, data.api_f_nowhps_combined, data.api_e_nowhps_combined);

            // 전투 계산
            battleCalculator.Update(data);
        }
        public TimeLoggingController()
        {
            var apiService = new ApiTypes(null);
            var service    = new PDashServices(apiService);

            _controller     = new Controller(service);
            _osTimerService = new OsTimerService(this);
        }
예제 #9
0
파일: DataChunk.cs 프로젝트: jimzrt/hyper
 /// <summary>
 /// Initializes a new instance of the <see cref="DataChunk"/> class.
 /// </summary>
 /// <param name="data">The data.</param>
 public DataChunk(byte[] data, byte sessionId, bool isOutcome, ApiTypes apiType)
 {
     IsOutcome        = isOutcome;
     SessionId        = sessionId;
     TimeStamp        = Tools.CurrentDateTime;
     DataBufferLength = data != null ? data.Length : 0;
     DataBuffer       = data;
     ApiType          = apiType;
 }
예제 #10
0
        static PDashAPI()
        {
            var apiService = new ApiTypes(null);
            var service    = new PDashServices(apiService);

            Controller          = new RobustController(service);
            stateChangedHandler = new StateChangedEventHandler(iOSTimeLoggingStateChanged);
            TimeLoggingController.TimeLoggingStateChanged += stateChangedHandler;
        }
예제 #11
0
 public ApplicationClient(ApiTypes apiType, byte sessionId, ISessionClient sc, IFrameClient fc, ITransportClient tc)
 {
     ApiType         = apiType;
     SessionId       = sessionId;
     SessionClient   = sc;
     FrameClient     = fc;
     TransportClient = tc;
     BindLayers();
 }
예제 #12
0
        private void Update(kcsapi_combined_battle_ec_nighttoday data, ApiTypes apiType)
        {
            // 적, 아군 함대 정보 갱신
            this.UpdateFleetsCombinedEnemy(data.api_deck_id, data);

            // 체력 갱신
            this.UpdateMaxHP(data.api_f_maxhps, data.api_e_maxhps, data.api_f_maxhps_combined, data.api_e_maxhps_combined);
            this.UpdateBefHP(data.api_f_nowhps, data.api_e_nowhps, data.api_f_nowhps_combined, data.api_e_nowhps_combined);
            this.UpdateNowHP(data.api_f_nowhps, data.api_e_nowhps, data.api_f_nowhps_combined, data.api_e_nowhps_combined);

            // 전투 계산
            battleCalculator.Update(data);
        }
예제 #13
0
        private void Update(kcsapi_combined_airbattle data, ApiTypes apiType)
        {
            // 적, 아군 함대 정보 갱신
            this.UpdateFleets(data.api_deck_id, data, data.api_formation);

            // 체력 갱신
            this.UpdateMaxHP(data.api_f_maxhps, data.api_e_maxhps, data.api_f_maxhps_combined);
            this.UpdateBefHP(data.api_f_nowhps, data.api_e_nowhps, data.api_f_nowhps_combined);
            this.UpdateNowHP(data.api_f_nowhps, data.api_e_nowhps, data.api_f_nowhps_combined);

            // 전투 계산
            battleCalculator
            .Initialize(
                this.AliasFirst, this.AliasSecond,
                this.EnemyFirst, this.EnemySecond
                )
            .Update(data, (ApiTypes_CombinedAirBattle)apiType);
        }
예제 #14
0
        private static int RequestApi(SynergyDbContext context, ApiTypes api)
        {
            var apiType = context.Synergy_API.Where(x => x.Api == api.ToString() && x.IsActive).FirstOrDefault();

            if (apiType != null)
            {
                return(apiType.Id);
            }
            else
            {
                Synergy_Api addApi = new Synergy_Api()
                {
                    Api      = api.ToString(),
                    IsActive = true
                };
                context.Synergy_API.Add(addApi);
                return(addApi.Id);
            }
        }
예제 #15
0
        public ClientApiResult(ApiController controller, string baseUrl, string apiUrl, ApiTypes apiType = ApiTypes.Get,
                               object data = null, string contentType = "application/json")
        {
            if (baseUrl == null)
            {
                throw new ArgumentNullException("baseUrl");
            }

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

            BaseUrl     = baseUrl;
            ApiUrl      = apiUrl;
            ContentType = contentType;
            ApiType     = apiType;
            Data        = data;
            _controller = controller;
        }
        private void UpdateCurrentKeys(ApiTypes value)
        {
            switch (value)
            {
            case ApiTypes.Constant:
                CurrentKeys = ConstantKeys;
                break;

            case ApiTypes.Declares:
                CurrentKeys = DllImportKeys;
                break;

            case ApiTypes.Types:
                CurrentKeys = StructKeys;
                break;

            default:
                CurrentKeys = ConstantKeys;
                break;
            }
        }
예제 #17
0
        private void Update(kcsapi_sortie_battle data, ApiTypes apiType)
        {
            if (apiType == ApiTypes.practice_battle)
            {
                this.ClearBattleInfo();
            }

            // 적, 아군 함대 정보 갱신
            this.UpdateFleets(data.api_deck_id, data, data.api_formation);

            // 체력 갱신
            this.UpdateMaxHP(data.api_f_maxhps, data.api_e_maxhps);
            this.UpdateBefHP(data.api_f_nowhps, data.api_e_nowhps);
            this.UpdateNowHP(data.api_f_nowhps, data.api_e_nowhps);

            // 전투 계산
            battleCalculator
            .Initialize(
                this.AliasFirst, this.AliasSecond,
                this.EnemyFirst, this.EnemySecond
                )
            .Update(data, (ApiTypes_Sortie)apiType);
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            // Create UI

            _drawerLayout = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            // Init toolbar
            _toolbar       = FindViewById <Toolbar>(Resource.Id.toolbar);
            _toolbar.Title = this.Resources.GetString(Resource.String.app_name);
            SetSupportActionBar(_toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);
            //_toolbar.

            // Attach item selected handler to navigation view
            var navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            navigationView.SetCheckedItem(0);
            navigationView.Menu.GetItem(0).SetChecked(true);

            navigationView.NavigationItemSelected += NavigationView_NavigationItemSelected;

            // Create ActionBarDrawerToggle button and add it to the toolbar
            var drawerToggle = new ActionBarDrawerToggle(this, _drawerLayout, _toolbar, Resource.String.open_drawer,
                                                         Resource.String.close_drawer);

            _drawerLayout.SetDrawerListener(drawerToggle);
            //  drawerToggle.SetHomeAsUpIndicator(null);
            drawerToggle.SyncState();

            _loginFragment             = new Login();
            _homeFragment              = new Home();
            _settingsFragment          = new SettingsPage();
            _globalTimeLogFragment     = new GlobalTimeLogList();
            _timeLogDetailFragment     = new TimeLogDetail();
            _listOfProjectFragment     = new ListOfProjects();
            _taskDetailFragment        = new TaskDetails();
            _taskTimeLogDetailFragment = new TaskTimeLogList();
            _listOfTasksFragment       = new ListProjectTasks("");
            _testFragment              = new TestFragment();

            //for testing
            //_currentFragment = _testFragment;
            // if logged in
            _currentFragment = _homeFragment;
            // else
            //CurrentFragment = ListOfProjectFragment;

            var fragmentTx = FragmentManager.BeginTransaction();

            // The fragment will have the ID of Resource.Id.fragment_container.
            fragmentTx.Replace(Resource.Id.fragmentContainer, _currentFragment);
            // Commit the transaction.
            fragmentTx.Commit();

            var apiService = new ApiTypes();
            var service    = new PDashServices(apiService);

            Ctrl = new Controller(service);

            // ...
            CheckForCrashes();
            //  checkForUpdates();

            // FragmentManager.AddOnBackStackChangedListener(this);
            // shouldDisplayHomeUp();
        }