Ejemplo n.º 1
0
        async Task <byte[]> DownloadTwitterProfileImage(IEnumerable <Claim> claims)
        {
            var accessTokenClaim       = claims.FirstOrDefault(x => x.Type == "urn:tokens:twitter:accesstoken");
            var accessTokenSecretClaim = claims.FirstOrDefault(x => x.Type == "urn:tokens:twitter:accesstokensecret");

            if (accessTokenClaim != null && accessTokenSecretClaim != null)
            {
                var twitter = TDSettings.DefaultTwitter();
                var service = new TwitterService(
                    twitter.ID,
                    twitter.Key,
                    accessTokenClaim.Value,
                    accessTokenSecretClaim.Value
                    );

                var profile = service.GetUserProfile(new GetUserProfileOptions());
                if (profile != null && !String.IsNullOrWhiteSpace(profile.ProfileImageUrlHttps))
                {
                    return(await DownloadData(profile.ProfileImageUrlHttps));
                }
            }
            return(null);
        }
 public TR55Controller(ITR55Agent sa, IOptions <TDSettings> settings) : base()
 {
     tempdistSettings = settings.Value;
     this.agent       = sa;
 }
        public TDServiceAgent(TDSettings settings)

        {
            this.settings = settings;
        }
Ejemplo n.º 4
0
        public override void OnInspectorGUI()
        {
            foldoutStyle           = EditorStyles.foldout;
            foldoutStyle.fontStyle = FontStyle.Bold;

            serializedObject.Update();

            GUILayout.Label("You must have an App ID and Client Key to use Tapdaq", EditorStyles.boldLabel);

            if (GUILayout.Button("Visit Tapdaq.com"))
            {
                Application.OpenURL("https://tapdaq.com/dashboard/apps");
            }

            GUILayout.Label("Current version:", EditorStyles.boldLabel);
            GUILayout.Label("Unity plugin: \t" + TDSettings.pluginVersion);

            GUILayout.Space(15);

            DrawSeparator(2);

            GUILayout.Space(15);

            GUILayout.Label("App Settings", EditorStyles.boldLabel);

            settings.ios_applicationID = EditorGUILayout.TextField("iOS Application ID", settings.ios_applicationID);
            settings.ios_clientKey     = EditorGUILayout.TextField("iOS Client Key", settings.ios_clientKey);
            settings.admob_appid_ios   = EditorGUILayout.TextField("iOS AdMob AppId", settings.admob_appid_ios);

            GUILayout.Space(20);

            settings.android_applicationID = EditorGUILayout.TextField("Android Application ID", settings.android_applicationID);
            settings.android_clientKey     = EditorGUILayout.TextField("Android Client Key", settings.android_clientKey);
            settings.admob_appid_android   = EditorGUILayout.TextField("Android AdMob AppId", settings.admob_appid_android);

            GUILayout.Space(15);

            settings.autoReloadAds = EditorGUILayout.Toggle("Auto-reload Ads", settings.autoReloadAds);

            GUILayout.Space(15);

            settings.isDebugMode = EditorGUILayout.Toggle("Debug Mode?", settings.isDebugMode);

            GUILayout.Space(15);

            // SKAdNetworkIds

            //GUILayout.Label("SKAdNetworkIds", EditorStyles.boldLabel, GUILayout.MaxWidth(100));
            showSKAdNetworkIds = EditorGUILayout.Foldout(showSKAdNetworkIds, "SKAdNetworkIds", foldoutStyle);
            if (showSKAdNetworkIds)
            {
                GUILayout.BeginHorizontal();
                EditorGUILayout.LabelField("Name", GUILayout.MaxWidth(120));
                EditorGUILayout.LabelField("ID", GUILayout.MaxWidth(120));
                GUILayout.EndHorizontal();

                List <TDKeyValuePair> skAdNetworkIdsList = new List <TDKeyValuePair>(TDSettings.getInstance().skAdNetworkIds);

                foreach (TDKeyValuePair pair in skAdNetworkIdsList)
                {
                    GUILayout.BeginHorizontal();
                    EditorGUILayout.TextField(pair.getKey(), GUILayout.MaxWidth(120));
                    EditorGUILayout.TextField(pair.getValue(), GUILayout.MaxWidth(120));
                    if (GUILayout.Button("Remove", GUILayout.Width(75)))
                    {
                        //Invoke remove
                        skAdNetworkIdsList.Remove(pair);
                        TDSettings.getInstance().skAdNetworkIds = skAdNetworkIdsList;
                        skAdNetworkIdKey = skAdNetworkIdValue = null;
                        return;
                    }
                    GUILayout.EndHorizontal();
                }

                GUILayout.BeginHorizontal();

                string placeholderKey = "SKAdNetworkId";
                int    keyCount       = skAdNetworkIdsList.Count;

                while (skAdNetworkIdsList.Find(f => f.getKey() == placeholderKey + keyCount) != null)
                {
                    keyCount++;
                }

                if (String.IsNullOrEmpty(skAdNetworkIdKey) || skAdNetworkIdsList.Find(f => f.getKey() == skAdNetworkIdKey) != null)
                {
                    skAdNetworkIdKey = placeholderKey + keyCount;
                }

                skAdNetworkIdKey   = EditorGUILayout.TextField(skAdNetworkIdKey, GUILayout.MaxWidth(120));
                skAdNetworkIdValue = EditorGUILayout.TextField(skAdNetworkIdValue, GUILayout.MaxWidth(120));
                if (GUILayout.Button("Add", GUILayout.Width(75)))
                {
                    if (String.IsNullOrEmpty(skAdNetworkIdValue))
                    {
                        EditorUtility.DisplayDialog("Error", "SKAdNetworkId value is null or empty", "OK");
                    }
                    else if (skAdNetworkIdsList.Find(f => f.getKey() == skAdNetworkIdKey) != null)
                    {
                        EditorUtility.DisplayDialog("Error", "SKAdNetworkId key already exists", "OK");
                    }
                    else
                    {
                        //Invoke Add
                        TDKeyValuePair pair = new TDKeyValuePair(skAdNetworkIdKey, skAdNetworkIdValue);
                        skAdNetworkIdsList.Add(pair);
                        TDSettings.getInstance().skAdNetworkIds = skAdNetworkIdsList;
                        skAdNetworkIdValue = "";
                    }
                }
                TDSettings.getInstance().skAdNetworkIds = skAdNetworkIdsList;
                GUILayout.EndHorizontal();
            }

            GUILayout.Space(15);

            ShowTestDevices();

            GUILayout.Space(15);

            // Adapters
            DrawSeparator(2);

            GUILayout.Space(10);

            GUILayout.BeginVertical();
            GUILayout.BeginHorizontal();
            GUILayout.Label("Network", EditorStyles.boldLabel, GUILayout.MaxWidth(100));
            GUILayout.Label("iOS", EditorStyles.boldLabel, GUILayout.MaxWidth(100));
            GUILayout.Label("Android", EditorStyles.boldLabel, GUILayout.MaxWidth(100));
            GUILayout.EndHorizontal();

            EditorGUI.BeginChangeCheck();
            foreach (TDNetwork network in TDSettings.getInstance().networks)
            {
                GUILayout.Space(10);

                GUILayout.BeginHorizontal();
                GUILayout.Label(network.name, GUILayout.MaxWidth(100));
                if (network.cocoapodsAdapterDependency != null)
                {
                    network.iOSEnabled = EditorGUILayout.Toggle("", network.iOSEnabled, GUILayout.MaxWidth(100));
                }
                if (network.mavenAdapterDependency != null)
                {
                    network.androidEnabled = EditorGUILayout.Toggle(network.androidEnabled, GUILayout.MaxWidth(100));
                }
                GUILayout.EndHorizontal();
            }
            EditorGUI.EndChangeCheck();

            GUILayout.EndVertical();

            GUILayout.Space(25);

            ShowButton("Save Adapters", 130, Color.white, () => {
                SaveAdapters();

                // Save settings
                if (GUI.changed)
                {
                    EditorUtility.SetDirty(settings);
                }
            });
        }
Ejemplo n.º 5
0
 void OnEnable()
 {
     whiteTexture = Texture2D.whiteTexture;
     settings     = (TDSettings)target;
     TDManifestResolver.FixAndroidManifest();
 }
Ejemplo n.º 6
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedTableSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     TDSettings ds = new TDSettings();
     global::System.Xml.Schema.XmlSchemaAny any1 = new global::System.Xml.Schema.XmlSchemaAny();
     any1.Namespace = "http://www.w3.org/2001/XMLSchema";
     any1.MinOccurs = new decimal(0);
     any1.MaxOccurs = decimal.MaxValue;
     any1.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any1);
     global::System.Xml.Schema.XmlSchemaAny any2 = new global::System.Xml.Schema.XmlSchemaAny();
     any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1";
     any2.MinOccurs = new decimal(1);
     any2.ProcessContents = global::System.Xml.Schema.XmlSchemaContentProcessing.Lax;
     sequence.Items.Add(any2);
     global::System.Xml.Schema.XmlSchemaAttribute attribute1 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute1.Name = "namespace";
     attribute1.FixedValue = ds.Namespace;
     type.Attributes.Add(attribute1);
     global::System.Xml.Schema.XmlSchemaAttribute attribute2 = new global::System.Xml.Schema.XmlSchemaAttribute();
     attribute2.Name = "tableTypeName";
     attribute2.FixedValue = "ConnectionDataTable";
     type.Attributes.Add(attribute2);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }
Ejemplo n.º 7
0
 public static global::System.Xml.Schema.XmlSchemaComplexType GetTypedDataSetSchema(global::System.Xml.Schema.XmlSchemaSet xs) {
     TDSettings ds = new TDSettings();
     global::System.Xml.Schema.XmlSchemaComplexType type = new global::System.Xml.Schema.XmlSchemaComplexType();
     global::System.Xml.Schema.XmlSchemaSequence sequence = new global::System.Xml.Schema.XmlSchemaSequence();
     global::System.Xml.Schema.XmlSchemaAny any = new global::System.Xml.Schema.XmlSchemaAny();
     any.Namespace = ds.Namespace;
     sequence.Items.Add(any);
     type.Particle = sequence;
     global::System.Xml.Schema.XmlSchema dsSchema = ds.GetSchemaSerializable();
     if (xs.Contains(dsSchema.TargetNamespace)) {
         global::System.IO.MemoryStream s1 = new global::System.IO.MemoryStream();
         global::System.IO.MemoryStream s2 = new global::System.IO.MemoryStream();
         try {
             global::System.Xml.Schema.XmlSchema schema = null;
             dsSchema.Write(s1);
             for (global::System.Collections.IEnumerator schemas = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator(); schemas.MoveNext(); ) {
                 schema = ((global::System.Xml.Schema.XmlSchema)(schemas.Current));
                 s2.SetLength(0);
                 schema.Write(s2);
                 if ((s1.Length == s2.Length)) {
                     s1.Position = 0;
                     s2.Position = 0;
                     for (; ((s1.Position != s1.Length) 
                                 && (s1.ReadByte() == s2.ReadByte())); ) {
                         ;
                     }
                     if ((s1.Position == s1.Length)) {
                         return type;
                     }
                 }
             }
         }
         finally {
             if ((s1 != null)) {
                 s1.Close();
             }
             if ((s2 != null)) {
                 s2.Close();
             }
         }
     }
     xs.Add(dsSchema);
     return type;
 }