コード例 #1
0
        /// <summary>
        /// Gets the domains and display them.
        /// </summary>
        public async Task OnGetAsync()
        {
            List <DisplayDomainModel> domainModels        = new List <DisplayDomainModel>();
            DomainData             domainData             = new DomainData(_db);
            List <DataDomainModel> dataAccessDomainModels = await domainData.GetDomains();

            foreach (DataDomainModel dataAccessDomainModel in dataAccessDomainModels)
            {
                domainModels.Add(new DisplayDomainModel
                {
                    Domain = dataAccessDomainModel.Domain,
                    Id     = dataAccessDomainModel.Id,
                });
            }

            Domains = domainModels;
        }
コード例 #2
0
ファイル: Question.cshtml.cs プロジェクト: Cyrilchc/Queezie
        /// <summary>
        /// Get all domains.
        /// </summary>
        private async Task <List <DisplayDomainModel> > GetDomains()
        {
            DomainData domainData = new DomainData(_db);
            List <DisplayDomainModel> domainModels     = new List <DisplayDomainModel>();
            List <DataDomainModel>    dataDomainModels = await domainData.GetDomains();

            foreach (var dataDomainModel in dataDomainModels)
            {
                domainModels.Add(new DisplayDomainModel
                {
                    Domain = dataDomainModel.Domain,
                    Id     = dataDomainModel.Id,
                });
            }

            return(domainModels);
        }
コード例 #3
0
        public HttpResponseMessage GetDropsPaged()
        {
            //Data subscription'ın geçerliliği kontrolü
            if (!IsSubscribedDataService())
            {
                return(Request.CreateResponse(HttpStatusCode.UpgradeRequired, "Renew your data subscription!"));
            }
            //****
            DomainData dd = new DomainData();
            DropDomainModelWebApiPaged DropDomainList = new DropDomainModelWebApiPaged();
            var           ListOfTLDs = Request.Headers.GetValues("ListOfTLDs").FirstOrDefault();
            List <string> TLDs       = JsonConvert.DeserializeObject <List <string> >(ListOfTLDs);

            string IsKeyword      = Request.Headers.GetValues("IsKeyword").FirstOrDefault();
            char   DropOrLastDrop = Convert.ToChar(Request.Headers.GetValues("DropOrLastDrop").FirstOrDefault());
            //for paging+filters
            int    NumOfRecPerPage = Convert.ToInt32(Request.Headers.GetValues("NumOfRecPerPage").FirstOrDefault());
            int    WhichPage       = Convert.ToInt32(Request.Headers.GetValues("WhichPage").FirstOrDefault());
            char   SortBy          = Convert.ToChar(Request.Headers.GetValues("SortBy").FirstOrDefault());
            string SearchStr       = Request.Headers.GetValues("SearchStr").FirstOrDefault();

            //string KeyWord = Request.Headers.GetValues("KeyWord").FirstOrDefault();
            string dropDate = Request.Headers.GetValues("dropDate").FirstOrDefault();
            //****
            //for excel
            bool IsExcel = (Request.Headers.GetValues("IsExcel").FirstOrDefault() == "1")?true:false;

            if (IsKeyword == "0")
            {
                var MatchCriteria = Request.Headers.GetValues("MatchCriteria").FirstOrDefault();
                MatchCriteriaWithPatternModel objMC = JsonConvert.DeserializeObject <MatchCriteriaWithPatternModel>(MatchCriteria);
                DropDomainList = dd.GetFilteredDropingDomainsPaged(objMC, TLDs, DropOrLastDrop, SortBy, SearchStr, NumOfRecPerPage, WhichPage, dropDate, IsExcel);
            }
            if (IsKeyword == "1")
            {
                string IncludeHyphens           = Request.Headers.GetValues("IncludeHyphens").FirstOrDefault();
                string IncludeNumbers           = Request.Headers.GetValues("IncludeNumbers").FirstOrDefault();
                var    Keywords                 = Request.Headers.GetValues("Keywords").FirstOrDefault();
                List <KeywordModel> objKeywords = JsonConvert.DeserializeObject <List <KeywordModel> >(Keywords);
                DropDomainList = dd.GetDropingDomainsByKeywordsPaged(IncludeHyphens, IncludeNumbers, objKeywords, TLDs, DropOrLastDrop, SortBy, SearchStr, NumOfRecPerPage, WhichPage, dropDate, IsExcel);
            }

            return(Request.CreateResponse(HttpStatusCode.OK, DropDomainList));
            //return Request.CreateResponse(HttpStatusCode.OK, HttpContext.Current.User.Identity.Name);
        }
コード例 #4
0
        /*
         * Trigger rules for callback functions
         */
        #region rules

        public bool OnGetDomainByNameRule(RMessage message)
        {
            if (message.Type != MessageType.GET_DOMAIN_BY_NAME_REPLY)
            {
                return(false);
            }
            if (model.Domain_Name == null)
            {
                return(false);
            }
            DomainData dom = (DomainData)message.Data;

            if (!model.Domain_Name.Equals(dom.Name))
            {
                return(false);
            }
            return(true);
        }
コード例 #5
0
        private static bool CheckForSharing(string url, DomainData domainData)
        {
            //todo:
            if (url.Contains("iframe"))
            {
                return(false);
            }

            foreach (string ignoreCase in domainData.IgnorePhrases)
            {
                if (url.Contains(ignoreCase))
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #6
0
        /// <summary>
        /// Creates a new domain.
        /// </summary>
        /// <returns>Refresh the page.</returns>
        public async Task <IActionResult> OnPost()
        {
            if (!ModelState.IsValid)
            {
                return(Page());
            }

            DomainData      domainData     = new DomainData(_db);
            DataDomainModel newDomainModel = new DataDomainModel
            {
                Domain = DisplayDomain.Domain,
                Id     = DisplayDomain.Id,
            };

            await domainData.InsertDomain(newDomainModel);

            return(RedirectToPage("./domain"));
        }
コード例 #7
0
        public void Export(IProject2 project, ConfigParameterString exportPath, Func <Id <LocalizedStringType>, Id <LocalizedText>, Tuple <string, DateTime> > localize, IErrorCheckerUtilities <IConversationNode> util)
        {
            DomainData builtIn = new DomainData();

            builtIn.Connectors.Add(SpecialConnectors.Input);
            builtIn.Connectors.Add(SpecialConnectors.Output);
            var data = project.DomainFilesCollection.Select(d => d.Data).Concat(builtIn.Only());

            using (var sfd = new SaveFileDialog())
            {
                sfd.DefaultExt       = "*.cs";
                sfd.AddExtension     = true;
                sfd.CreatePrompt     = false;
                sfd.InitialDirectory = exportPath.Value;
                sfd.OverwritePrompt  = true;
                sfd.ValidateNames    = true;
                sfd.Title            = "Export to C# source file";
                if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    exportPath.Value = Path.GetDirectoryName(sfd.FileName);
                    string @namespace = project.File.File.Name;
                    @namespace = Path.ChangeExtension(@namespace, null);
                    @namespace = new string(@namespace.Where(c => char.IsLetterOrDigit(c) || c == '_').ToArray());
                    if (@namespace.Length == 0)
                    {
                        @namespace = "MyNamespace";
                    }
                    while (char.IsDigit(@namespace.First()))
                    {
                        @namespace = @namespace.Substring(1);
                        if (@namespace.Length == 0)
                        {
                            @namespace = "MyNamespace";
                        }
                    }
                    CSDomainSerializer <INodeGui, NodeUIData, ConversationEditorData> s = new CSDomainSerializer <INodeGui, NodeUIData, ConversationEditorData>(BasicTypeMap(), @namespace);
                    using (var stream = new FileStream(sfd.FileName, FileMode.OpenOrCreate, FileAccess.Write))
                    {
                        stream.SetLength(0);
                        s.Write(data, stream);
                    }
                }
            }
        }
コード例 #8
0
        public static string Action(this UrlHelper urlHelper, string actionName, string controllerName, RouteValueDictionary routeValues, bool requireAbsoluteUrl)
        {
            if (requireAbsoluteUrl)
            {
                HttpContextBase currentContext = new HttpContextWrapper(HttpContext.Current);
                RouteData       routeData      = RouteTable.Routes.GetRouteData(currentContext);

                routeData.Values["controller"] = controllerName;
                routeData.Values["action"]     = actionName;

                DomainRoute domainRoute = routeData.Route as DomainRoute;
                if (domainRoute != null)
                {
                    DomainData domainData = domainRoute.GetDomainData(new RequestContext(currentContext, routeData), routeData.Values);
                    return(urlHelper.Action(actionName, controllerName, routeData.Values, domainData.Protocol, domainData.HostName));
                }
            }
            return(urlHelper.Action(actionName, controllerName, routeValues));
        }
コード例 #9
0
        /// <summary>
        /// Webviews the term open.
        /// </summary>
        /// <returns>The term open.</returns>
        public void WebviewIntroductionOpen()
        {
            HeaderPanel.Instance.BackButtonSwitch(false);
            //HeaderPanel.Instance.BackButtonSwitch (true, WebviewIntroductionClose);
            if (_introduction != null)
            {
                string url         = DomainData.GetWebviewDataURL(DomainData.WEBVIEW_INTRODUCTION);
                string querystring = "";

                querystring = "?user_key=" + AppStartLoadBalanceManager._userKey;

                url = url += querystring;
                var uri = new System.Uri(url);
                Application.OpenURL(uri.AbsoluteUri);
                //_introduction.SetActive (true);
                //_introduction.transform.GetChild (0).GetChild(0).GetComponent<IntroductionWebView> ().Init ();
                //PanelAnimate (_introduction);
            }
        }
コード例 #10
0
        public static MvcHtmlString ActionLink(this HtmlHelper htmlHelper, string linkText, string actionName, string controllerName, RouteValueDictionary routeValues, IDictionary <string, object> htmlAttributes, bool requireAbsoluteUrl)
        {
            if (requireAbsoluteUrl)
            {
                HttpContextBase currentContext = new HttpContextWrapper(HttpContext.Current);
                RouteData       routeData      = RouteTable.Routes.GetRouteData(currentContext);

                routeData.Values["controller"] = controllerName;
                routeData.Values["action"]     = actionName;

                DomainRoute domainRoute = routeData.Route as DomainRoute;
                if (domainRoute != null)
                {
                    DomainData domainData = domainRoute.GetDomainData(new RequestContext(currentContext, routeData), routeData.Values);
                    return(htmlHelper.ActionLink(linkText, actionName, controllerName, domainData.Protocol, domainData.HostName, domainData.Fragment, routeData.Values, null));
                }
            }
            return(htmlHelper.ActionLink(linkText, actionName, controllerName, routeValues, htmlAttributes));
        }
コード例 #11
0
        public void NotifyAboutGet()
        {
            Interlocked.Increment(ref _getCount);

            if (_getCount == _desiredGetCount)
            {
                Task.Run(() =>
                {
                    var sw = new Stopwatch();
                    sw.Start();
                    Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Started preparation for POST");

                    //_swMemory = new System.Timers.Timer(1000);
                    //_swMemory.Elapsed += (sender, args) => { TotalMemoryHelper.Show(); };
                    //_swMemory.Start();

                    StatusData.PrepareForUpdates();
                    CityData.PrepareForUpdates();
                    CountryData.PrepareForUpdates();
                    SNameData.PrepareForUpdates();

                    FNameData.PrepareForUpdates();
                    SexData.PrepareForUpdates();
                    PremiumData.PrepareForUpdates();
                    CodeData.PrepareForUpdates();

                    DomainData.PrepareForUpdates();
                    BirthYearData.PrepareForUpdates();
                    InterestsData.PrepareForUpdates();
                    JoinedYearData.PrepareForUpdates();

                    TotalMemoryHelper.Show();
                    GCSettings.LargeObjectHeapCompactionMode = GCLargeObjectHeapCompactionMode.CompactOnce;
                    GC.Collect();
                    GC.WaitForFullGCApproach();
                    TotalMemoryHelper.Show();


                    Console.WriteLine($"{DateTime.Now.ToLongTimeString()} Finished preparation for POST in {sw.ElapsedMilliseconds} ms");
                });
            }
        }
コード例 #12
0
        private void Statistics(bool full)
        {
            Console.WriteLine($"Current TimeStamp: {Holder.Instance.CurrentTimeStamp}");

            Console.WriteLine($"Sex {SexData.GetStatistics(full)}");
            Console.WriteLine($"Status {StatusData.GetStatistics(full)}");
            Console.WriteLine($"Premium {PremiumData.GetStatistics(full)}");

            Console.WriteLine($"City {CityData.GetStatistics(full)}");
            Console.WriteLine($"Country {CountryData.GetStatistics(full)}");

            Console.WriteLine(value: $"Code {CodeData.GetStatistics(full)}");
            Console.WriteLine($"Domain {DomainData.GetStatistics(full)}");
            Console.WriteLine($"FName {FNameData.GetStatistics(full)}");
            Console.WriteLine($"SName {SNameData.GetStatistics(full)}");

            Console.WriteLine($"Interests {InterestsData.GetStatistics(full)}");

            Console.WriteLine($"BirthYear {BirthYearData.GetStatistics(full)}");
            Console.WriteLine($"JoinedYear {JoinedYearData.GetStatistics(full)}");
        }
コード例 #13
0
    /// <summary>
    /// Gps Map the webview load.
    /// Map用のWEBViewデータを取得する
    /// </summary>
    public void Init()
    {
        _loadingOverlay.SetActive(true);
        LoadingTimer.Instance.IsTimerStop(true);
        _webView = this.gameObject.AddComponent <UniWebView> ();
        _webView.backButtonEnable         = false;
        _webView.autoShowWhenLoadComplete = true;

        // 設定サイズを取得
        WebviewLayout.InsetsParameter wInsets = WebviewLayout.GetInsetsWebview(0.19f, 0.0f, 0.2f);
        _webView.insets = new UniWebViewEdgeInsets(wInsets.top, wInsets.side, wInsets.bottom, wInsets.side);
        _webView.SetTransparentBackground(true);
        _webView.AddUrlScheme("chat");

        string url         = DomainData.GetWebviewDataURL(DomainData.WEBVIEW_INTRODUCTION);
        string querystring = "";

        querystring = "?user_key=" + AppStartLoadBalanceManager._userKey;

        _webView.url = url += querystring;
        _webView.Load();
        _webView.OnLoadComplete    += OnLoadComplete;
        _webView.OnReceivedMessage += OnReceivedMessage;
    }
コード例 #14
0
        /// <summary>
        /// Request this instance.
        /// </summary>
        private void Request(Dictionary <string, string> postDatas)
        {
            string url = DomainData.GetApiUrl(DomainData.MESSAGE_USER_LIST);

            HttpHandler.Send <MessageUserListEntity.Result> (url, postDatas, CallBack);
        }
コード例 #15
0
        /// <summary>
        /// Request this instance.
        /// </summary>
        private void Request(Dictionary <string, string> postDatas)
        {
            string url = DomainData.GetApiUrl(DomainData.SEND_RANDOM_MESSAGE);

            HttpHandler.Send <EazyReturnDataEntity.ResultComplete> (url, postDatas, CallBack);
        }
コード例 #16
0
        /// <summary>
        /// Request this instance.
        /// </summary>
        private void Request(Dictionary <string, string> postDatas)
        {
            string url = DomainData.GetApiUrl(DomainData.SEND_REPORT);

            HttpHandler.Send <EazyReturnDataEntity.ResultReport> (url, postDatas, CallBack);
        }
コード例 #17
0
 private async void WhenASessionDoesntExist()
 {
     _sessions = DomainData.GenerateSessions(new[] { 100, 101, 102 }, Enumerable.Empty <Speaker>().ToArray());
     _httpHelper.Setup(m => m.FetchSessions()).Returns(Task.FromResult(_sessions));
     _httpHelper.Setup(m => m.FetchSession(It.IsAny <int>())).Returns(Task.FromResult(Task.FromResult <string>(null)));
 }
コード例 #18
0
 private void AndEqualAmountOfSessions()
 {
     _sessions = DomainData.GenerateSessions(new[] { 100, 101, 102 }, _speakers.ToArray());
     _httpHelper.Setup(m => m.FetchSessions()).Returns(Task.FromResult(_sessions));
 }
コード例 #19
0
ファイル: viewgroups.ascx.cs プロジェクト: jaytem/minGit
    private void Populate_MapCMSUserGroupToADGrid_Search(DomainData[] data)
    {
        System.Web.UI.WebControls.BoundColumn colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "GROUPTITLE";
        colBound.HeaderText = m_refMsg.GetMessage("active directory group title");
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.Width = Unit.Percentage(40);
        colBound.ItemStyle.Width = Unit.Percentage(40);
        MapCMSGroupToADGrid.Columns.Add(colBound);

        colBound = new System.Web.UI.WebControls.BoundColumn();
        colBound.DataField = "DOMAINTITLE";
        colBound.HeaderText = m_refMsg.GetMessage("domain title");
        colBound.ItemStyle.Wrap = false;
        colBound.HeaderStyle.CssClass = "title-header";
        colBound.HeaderStyle.Width = Unit.Percentage(40);
        colBound.ItemStyle.Width = Unit.Percentage(40);
        MapCMSGroupToADGrid.Columns.Add(colBound);
        System.Text.StringBuilder result = new System.Text.StringBuilder();
        result.Append("<input type=\"hidden\" name=\"id\" value=\"" + user_data.UserId + "\">");
        result.Append("<input type=\"hidden\" name=\"rp\" value=\"" + rp + "\">");
        result.Append("<input type=\"hidden\" name=\"e1\" value=\"" + e1 + "\">");
        result.Append("<input type=\"hidden\" name=\"e2\" value=\"" + e2 + "\">");
        result.Append("<input type=\"hidden\" name=\"f\" value=\"" + f + "\">");
        result.Append("<input type=\"hidden\" name=\"adusername\">");
        result.Append("<input type=\"hidden\" name=\"addomain\">");

        DataTable dt = new DataTable();
        DataRow dr;
        dt.Columns.Add(new DataColumn("GROUPTITLE", typeof(string)));
        dt.Columns.Add(new DataColumn("DOMAINTITLE", typeof(string)));
        dr = dt.NewRow();
        dr[0] = "<input type=\"Text\" name=\"groupname\" maxlength=\"255\" size=\"25\" OnKeyPress=\"javascript:return CheckKeyValue(event,\'34\');\">";
        dr[0] += result.ToString();
        int i = 0;
        dr[1] = "<select name=\"domainname\">";
        if ((!(domain_data == null)) && m_refContentApi.RequestInformationRef.ADAdvancedConfig == false)
        {
            dr[1] += "<option selected value=\"All Domains\">" + m_refMsg.GetMessage("all domain select caption") + "</option>";
        }
        for (i = 0; i <= domain_data.Length - 1; i++)
        {
            dr[1] += "<option value=\"" + domain_data[i].Name + "\">" + domain_data[i].Name + "</option>";
        }
        dr[1] += "</select>";

        dt.Rows.Add(dr);

        dr = dt.NewRow();
        dr[0] = "<input type=\"submit\" name=\"search\" value=\"" + m_refMsg.GetMessage("generic Search") + "\">";
        dr[1] = "";

        dt.Rows.Add(dr);

        DataView dv = new DataView(dt);
        MapCMSGroupToADGrid.DataSource = dv;
        MapCMSGroupToADGrid.DataBind();
    }
コード例 #20
0
        /// <summary>
        /// Populate a domain's various type data from xml
        /// </summary>
        /// <param name="domain">The domain to fill</param>
        /// <param name="root">The xml root node</param>
        private static void ReadTypes(DomainData domain, XElement root)
        {
            foreach (var a in root.Elements("DynamicEnumeration"))
            {
                DynamicEnumerationData typeData = new DynamicEnumerationData(a.Attribute("name").Value, Guid.Parse(a.Attribute("guid").Value));
                domain.DynamicEnumerations.Add(typeData);
            }
            foreach (var a in root.Elements("Enumeration"))
            {
                var name   = a.Attribute("name").Value;
                var guid   = Guid.Parse(a.Attribute("guid").Value);
                var values = a.Elements("Value").Select(value => new EnumerationData.Element(value.Attribute("name").Value, Guid.Parse(value.Attribute("guid").Value)));

                EnumerationData typeData;

                if (a.Element("Default") != null)
                {
                    if (a.Element("Default").Attributes("guid").Any())
                    {
                        var def = Guid.Parse(a.Element("Default").Attribute("guid").Value);
                        typeData = new EnumerationData(name, guid, values, def);
                    }
                    else if (a.Element("Default").Attributes("name").Any())
                    {
                        var def = a.Element("Default").Attribute("name").Value;
                        typeData = new EnumerationData(name, guid, values, def);
                    }
                    else
                    {
                        throw new Exception("Enumeration declared with a default node but no recognised default value");
                    }
                }
                else
                {
                    typeData = new EnumerationData(name, guid, values);
                }

                domain.Enumerations.Add(typeData);
            }
            foreach (var a in root.Elements("Decimal"))
            {
                var aName = a.Attribute("name").Value;
                var guid  = Guid.Parse(a.Attribute("guid").Value);
                var aMax  = a.Attributes("max").Select <XAttribute, decimal?>(b => decimal.Parse(b.Value)).SingleOrDefault();
                var aMin  = a.Attributes("min").Select <XAttribute, decimal?>(b => decimal.Parse(b.Value)).SingleOrDefault();
                var aDef  = a.Attributes("default").Select <XAttribute, decimal?>(b => decimal.Parse(b.Value)).SingleOrDefault();

                DecimalData typeData = new DecimalData(aName, guid, aMax, aMin, aDef);

                domain.Decimals.Add(typeData);
            }
            foreach (var a in root.Elements("Integer"))
            {
                var aName = a.Attribute("name").Value;
                var guid  = Guid.Parse(a.Attribute("guid").Value);
                var aMax  = a.Attributes("max").Select <XAttribute, int?>(b => int.Parse(b.Value)).SingleOrDefault();
                var aMin  = a.Attributes("min").Select <XAttribute, int?>(b => int.Parse(b.Value)).SingleOrDefault();
                var aDef  = a.Attributes("default").Select <XAttribute, int?>(b => int.Parse(b.Value)).SingleOrDefault();

                IntegerData typeData = new IntegerData(aName, guid, aMax, aMin, aDef);

                domain.Integers.Add(typeData);
            }
        }
コード例 #21
0
        /// <summary>
        /// Request this instance.
        /// </summary>
        private void Request(Dictionary <string, string> postDatas)
        {
            string url = DomainData.GetApiUrl(DomainData.SET_DEVICE_TOKEN);

            HttpHandler.Send <EazyReturnDataEntity.Result> (url, postDatas, CallBack);
        }
コード例 #22
0
        /// <summary>
        /// Request this instance.
        /// </summary>
        private void Request(Dictionary <string, string> postDatas)
        {
            string url = DomainData.GetApiUrl(DomainData.LIMIT_RELEASE);

            HttpHandler.Send <EazyReturnDataEntity.LimitMessageDecisionResult> (url, postDatas, CallBack, CallBackError);
        }
コード例 #23
0
ファイル: DomainData.Tests.cs プロジェクト: karataliu/RESTier
 public void SourceOfEntityContainerElementIsNotCallable()
 {
     Assert.Throws <InvalidOperationException>(() => DomainData.Source <object>("EntitySet"));
 }
コード例 #24
0
        private void Request(Dictionary <string, string> postDatas)
        {
            string url = DomainData.GetApiUrl(DomainData.HELP_LIST);

            HttpHandler.Send <HelpListEntity.Result> (url, postDatas, CallBack);
        }
コード例 #25
0
ファイル: DomainData.Tests.cs プロジェクト: karataliu/RESTier
 public void ResultOfEntityContainerElementIsNotCallable()
 {
     Assert.Throws <InvalidOperationException>(() => DomainData.Result <object>("Singleton"));
 }
コード例 #26
0
        public async Task <ActionResult> Create(DomainData data)
        {
            SymmetricEncryption se = new SymmetricEncryption();

            DataRepository.Instance.Domain    = data.Domain;
            DataRepository.Instance.RemoteKey = se.Decrypt(data.Key, data.Domain);

            string privateKey;
            string publicKey;

            AsymmetricEncryption.GenerateKeys(4096, out publicKey, out privateKey);

            DataRepository.Instance.Key = new LocalKey
            {
                PrivateKey = privateKey,
                PublicKey  = publicKey
            };

            using (var client = new HttpClient())
            {
                client.BaseAddress = new Uri("http://localhost:4427/");
//				client.DefaultRequestHeaders.Accept.Clear();
                client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

                string encryptedPublicKey         = se.Encrypt(DataRepository.Instance.Key.PublicKey, DataRepository.Instance.Domain);
                Dictionary <string, string> pData = new Dictionary <string, string>
                {
                    { "Key", encryptedPublicKey },
                    { "Domain", DataRepository.Instance.Domain }
                };

                HttpResponseMessage response1 = await client.PostAsJsonAsync("api/ClientConnection", pData);

                if (!response1.IsSuccessStatusCode)
                {
                    return(View((object)response1.ToString()));
                }

                var response2 = await client.GetAsync("api/Licenses?domain=" + DataRepository.Instance.Domain);

                if (!response2.IsSuccessStatusCode)
                {
                    return(View((object)response2.ToString()));
                }

                var responseContent = await response2.Content.ReadAsAsync <Dictionary <string, string> >();

                LicenseFile.Write(responseContent["data"]);

/*
 *                              byte[] encryptedData = Convert.FromBase64String(responseContent["data"]);
 *
 *                              var licenseData = AsymmetricEncryption.Decrypt(encryptedData, 4096, DataRepository.Instance.Key.PrivateKey);
 *                              LicenseData license = ObjectSerializer.Deserialize(licenseData) as LicenseData;
 */

                //string result = await response.Content.ReadAsStringAsync();
//				return View((object)license);
                return(View("ReadLicense"));
            }

            //return View((object)DataRepository.Instance.RemoteKey);
        }
コード例 #27
0
ファイル: DomainData.Tests.cs プロジェクト: karataliu/RESTier
 public void ResultOfComposableFunctionIsNotCallable()
 {
     Assert.Throws <InvalidOperationException>(() => DomainData.Result <object>("Namespace", "Function"));
 }
コード例 #28
0
 private void WhenThereAreValidSpeakers()
 {
     _speakers = DomainData.GenerateSpeakers(new int[] { 1, 2, 3, }, new string[] { "John", "Josh", "Joe" });
     _httpHelper.Setup(m => m.FetchSpeakers()).Returns(Task.FromResult(_speakers));
 }
コード例 #29
0
ファイル: DomainData.Tests.cs プロジェクト: karataliu/RESTier
 public void ValueIsNotCallable()
 {
     Assert.Throws <InvalidOperationException>(() => DomainData.Value <object>(new object(), "Property"));
 }
コード例 #30
0
 private void AndSomeSessionsWithNoSpeakers()
 {
     _sessions = DomainData.GenerateSessions(new[] { 100, 101, 102 }, _speakers.Take(1).ToArray());
     _httpHelper.Setup(m => m.FetchSessions()).Returns(Task.FromResult(_sessions));
 }
コード例 #31
0
        private void Request(Dictionary <string, string> postDatas)
        {
            string url = DomainData.GetApiUrl(DomainData.READ_BOARD);

            HttpHandler.Send <ReadBoardEntity.Result> (url, postDatas, CallBack);
        }