public string Get(Platform platform, Version version)
 {
     var path = Plugins.PluginLocator.GetAutoTestDirectory();
     var platformString = getPlatformString(platform);
     var frameworkString = getFrameworkString(version);
     return Path.Combine(path, string.Format("AutoTest.TestRunner{0}{1}.exe", platformString, frameworkString));
 }
Example #2
0
        public SalesHomePage(IApp app, Platform platform)
            : base(app, platform, "WEEKLY AVERAGE", "WEEKLY AVERAGE")
        {
            if (OnAndroid)
            {
                FirstLead = x => x.Marked("50% - Value Proposition");
                ListView = x => x.Id("content");
                AddLeadButton = x => x.Class("FloatingActionButton");
                LeadCell = x => x.Class("ViewCellRenderer_ViewCellContainer");
                ChartIdentifier = x => x.Id("stripLinesLayout");
            }
            if (OniOS)
            {
                FirstLead = x => x.Class("UITableViewCellContentView");
                ListView = x => x.Class("UILayoutContainerView");
                AddLeadButton = x => x.Id("add_ios_gray");
            }

            //Verifying page has loaded
            app.WaitForElement(LeadCell);
            app.WaitForElement(ChartIdentifier);

            app.WaitForNoElement(SalesDataLoading, timeout: TimeSpan.FromSeconds(20));
            app.WaitForNoElement(LeadsLoading, timeout: TimeSpan.FromSeconds(20));
        }
Example #3
0
 //===================================================================== INITIALIZE
 public Train(Platform platform)
 {
     _id = CurrentID;
     CurrentID++;
     _platform = platform;
     _nextTrack = MathUtils.Rand(0, platform.Destinations.Count - 1);
 }
 public string Get(Platform platform, Version version)
 {
     var path = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath);
     var platformString = getPlatformString(platform);
     var frameworkString = getFrameworkString(version);
     return Path.Combine(path, string.Format("AutoTest.TestRunner{0}{1}.exe", platformString, frameworkString));
 }
 internal ModulePropertiesForSerialization(
     Guid persistentIdentifier,
     ushort fileAlignment,
     string targetRuntimeVersion,
     Platform platform,
     bool trackDebugData,
     ulong baseAddress,
     ulong sizeOfHeapReserve,
     ulong sizeOfHeapCommit,
     ulong sizeOfStackReserve,
     ulong sizeOfStackCommit,
     bool enableHighEntropyVA,
     bool strongNameSigned,
     bool configureToExecuteInAppContainer,
     SubsystemVersion subsystemVersion)
 {
     this.PersistentIdentifier = (persistentIdentifier == default(Guid)) ? Guid.NewGuid() : persistentIdentifier;
     this.FileAlignment = fileAlignment;
     this.TargetRuntimeVersion = targetRuntimeVersion;
     this.Platform = platform;
     this.TrackDebugData = trackDebugData;
     this.BaseAddress = baseAddress;
     this.SizeOfHeapReserve = sizeOfHeapReserve;
     this.SizeOfHeapCommit = sizeOfHeapCommit;
     this.SizeOfStackReserve = sizeOfStackReserve;
     this.SizeOfStackCommit = sizeOfStackCommit;
     this.EnableHighEntropyVA = enableHighEntropyVA;
     this.StrongNameSigned = strongNameSigned;
     this.ConfigureToExecuteInAppContainer = configureToExecuteInAppContainer;
     this.SubsystemVersion = subsystemVersion.Equals(SubsystemVersion.None)
         ? SubsystemVersion.Default(OutputKind.ConsoleApplication, this.Platform)
         : subsystemVersion;
 }
        public static void Pack(string sourcePath, string saveFileName, bool updateSng = false, Platform predefinedPlatform = null, bool updateManifest = false, bool fixShowlights = true)
        {
            //  if (!Path.GetFileName(sourcePath).ToLower().Contains("crowd.psarc"))
            DeleteFixedAudio(sourcePath);
            Platform platform = sourcePath.GetPlatform();

            if (predefinedPlatform != null && predefinedPlatform.platform != GamePlatform.None && predefinedPlatform.version != GameVersion.None)
                platform = predefinedPlatform;

            switch (platform.platform)
            {
                case GamePlatform.Pc:
                case GamePlatform.Mac:
                    if (platform.version == GameVersion.RS2012)
                        PackPC(sourcePath, saveFileName, true, updateSng);
                    else if (platform.version == GameVersion.RS2014)
                        Pack2014(sourcePath, saveFileName, platform, updateSng, updateManifest, fixShowlights: fixShowlights);
                    break;
                case GamePlatform.XBox360:
                    PackXBox360(sourcePath, saveFileName, platform, updateSng, updateManifest);
                    break;
                case GamePlatform.PS3:
                    PackPS3(sourcePath, saveFileName, platform, updateSng, updateManifest);
                    break;
                case GamePlatform.None:
                    throw new InvalidOperationException(String.Format("Invalid directory structure of package. {0}Directory: {1}", Environment.NewLine, sourcePath));
            }
        }
		public static void SearchFor (this IApp app, Platform platform, string searchString)
		{
			var ios = platform == Platform.iOS;

			app.Tap (x => x.Id (ios ? "button_add" : "action_search"));

			app.Screenshot ("Start Search");


			try {

				// type in each char one at a time
				foreach (var item in searchString)
					app.EnterText (item.ToString ());

			} catch (Exception) {

				// clear and try again
				app.ClearText ();

				foreach (var item in searchString)
					app.EnterText (ios ? "Search" : "search_src_text", item.ToString ());

			}

			app.Screenshot ($"Locations Search: '{searchString}'");
		}
        public static void Main( string[] args )
        {
            // Init
            Platform = DeterminePlatform();
            FixOSXLibraryPaths();
            SetupEmbeddedAssemblies();
            Arguments = new ProgramArguments( args );
            Language = DetermineLanguage();

            // Determine UI to run
            string gui = Arguments.GetString( "gui" );
            if( gui == null )
            {
                if( Platform == Platform.Windows )
                {
                    gui = "winforms";
                }
                else
                {
                    gui = "gtk";
                }
            }

            // Run UI
            if( gui == "winforms" )
            {
                WinFormsInterface.Run();
            }
            else if( gui == "gtk" )
            {
                GTKInterface.Run();
            }
        }
Example #9
0
 private Tapstream(string accountName, string developerSecret, string hardware)
 {
     del = new DelegateImpl(this);
     platform = new PlatformImpl();
     listener = new CoreListenerImpl();
     core = new Core(del, platform, listener, accountName, developerSecret, hardware);
 }
Example #10
0
        public string ToString(Platform platform)
        {
            var renderer = new StringRenderer(platform);
            this.Render(renderer);
            return renderer.ToString();

        }
Example #11
0
        public static IApp StartApp(Platform platform)
        {
            if (platform == Platform.Android)
            {
                string currentFile = new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath;
                FileInfo fi = new FileInfo(currentFile);
                string dir = fi.Directory.Parent.Parent.Parent.FullName;

                // PathToAPK is a property or an instance variable in the test class
                apkPath = Path.Combine(dir, "MyDriving.Android", "bin", "XTC", "com.microsoft.mydriving-Signed.apk");

                app = ConfigureApp
                    .Android
                    .ApkFile(apkPath)
                    .StartApp(Xamarin.UITest.Configuration.AppDataMode.Clear);
            }
            else
            {
                app = ConfigureApp
                    .iOS
                    //.AppBundle(appPath)
                    .InstalledApp("com.microsoft.mydriving")
                    .StartApp(Xamarin.UITest.Configuration.AppDataMode.Clear);
            }

            return app;
        }
Example #12
0
        /// <summary>
        /// 获取通知的Json格式字符串
        /// <example>
        /// 格式:{"n_builder_id":"通知样式","n_title":"通知标题","n_content":"通知内容", "n_extras":{"ios":{"badge":8, "sound":"happy"}, "user_param_1":"value1", "user_param_2":"value2"}}
        /// </example>
        /// </summary>
        /// <param name="platform">The platform.</param>
        /// <returns></returns>
        public string GetJsonString(Platform platform = Platform.Android|Platform.iOS)
        {
            IDictionary<string, object> data = new Dictionary<string, object> { { "n_title", this.Title ?? string.Empty }, { "n_content", this.Content ?? string.Empty } };
            IDictionary<string, object> extra = new Dictionary<string, object>();
            if (this.CustomizedValue != null)
                foreach (string key in this.CustomizedValue.Keys)
                {
                    extra[key] = this.CustomizedValue[key];
                }
            if (platform.Contains(Platform.Android))
            {
                if (this.Android_BuilderId > 0 && this.Android_BuilderId <= 1000)
                    data["n_builder_id"] = this.Android_BuilderId;
            }
            if (platform.Contains(Platform.iOS))
            {
                IDictionary<string, object> iOSExtra = new Dictionary<string, object>();

                iOSExtra["badge"] = this.iOS_Badge;

                if (!string.IsNullOrWhiteSpace(this.iOS_Sound))
                    iOSExtra["sound"] = this.iOS_Sound;
                extra["ios"] = iOSExtra;
            }
            data.Add("n_extras", extra);
            return JsonConvert.SerializeObject(data);
        }
Example #13
0
        protected override void Initialize()
        {
            this.identityTransform = Matrix.Identity;
            this.platform = WaveServices.Platform;

            base.Initialize();
        }
Example #14
0
 public Tapstream(OperationQueue queue, string accountName, string developerSecret, string hardware)
 {
     del = new DelegateImpl();
     platform = new PlatformImpl();
     listener = new CoreListenerImpl(queue);
     core = new Core(del, platform, listener, accountName, developerSecret, hardware);
 }
        public static string Convert(string sourcePackage, Platform sourcePlatform, Platform targetPlatform, string appId)
        {
            var needRebuildPackage = sourcePlatform.IsConsole != targetPlatform.IsConsole;
            var tmpDir = Path.GetTempPath();

            var fileName = Path.GetFileNameWithoutExtension(sourcePackage);
            if (sourcePlatform.platform == GamePlatform.PS3)
                if (fileName.Contains(".psarc"))
                    fileName = fileName.Substring(0, fileName.LastIndexOf("."));

            var unpackedDir = Packer.Unpack(sourcePackage, tmpDir, false, true, false, sourcePlatform);

            // DESTINATION
            var nameTemplate = (!targetPlatform.IsConsole) ? "{0}{1}.psarc" : "{0}{1}";

            var packageName = Path.GetFileNameWithoutExtension(sourcePackage);
            if (packageName.EndsWith(new Platform(GamePlatform.Pc, GameVersion.None).GetPathName()[2]) ||
                    packageName.EndsWith(new Platform(GamePlatform.Mac, GameVersion.None).GetPathName()[2]) ||
                    packageName.EndsWith(new Platform(GamePlatform.XBox360, GameVersion.None).GetPathName()[2]) ||
                    packageName.EndsWith(new Platform(GamePlatform.PS3, GameVersion.None).GetPathName()[2] + ".psarc"))
            {
                packageName = packageName.Substring(0, packageName.LastIndexOf("_"));
            }
            var targetFileName = Path.Combine(Path.GetDirectoryName(sourcePackage), String.Format(nameTemplate, Path.Combine(Path.GetDirectoryName(sourcePackage), packageName), targetPlatform.GetPathName()[2]));

            // CONVERSION
            if (needRebuildPackage)
                ConvertPackageRebuilding(unpackedDir, targetFileName, targetPlatform, appId);
            else
                ConvertPackageForSimilarPlatform(unpackedDir, targetFileName, sourcePlatform, targetPlatform, appId);

            DirectoryExtension.SafeDelete(unpackedDir);

            return String.Empty;
        }
        public void Resolve(Stream stream)
        {
            _platform = Platform.Unknown;
            using (var reader = new StreamReader(stream))
            {
                string buffer = reader.ReadToEnd();
                bool resolvedIdAndPlatform =
                    Resolve(buffer, DogtagsBlockStart);
                if (!resolvedIdAndPlatform)
                    Resolve(buffer, UnlocksBlockStart);

                if (_userId <= 0)
                {
                    Messenger.Default.Send(new BattlelogResponseMessage(UnableToParse, false));
                    return;
                }

                if (_platform == Platform.Unknown)
                {
                    Messenger.Default.Send(new BattlelogResponseMessage(UnableToParse, false));
                    return;
                }
                Messenger.Default.Send(new UserIdAndPlatformResolvedMessage(_userId, _platform));
            }
        }
Example #17
0
        public static IApp StartApp(Platform platform)
        {
            // TODO: If the iOS or Android app being tested is included in the solution 
            // then open the Unit Tests window, right click Test Apps, select Add App Project
            // and select the app projects that should be tested.
            //
            // The iOS project should have the Xamarin.TestCloud.Agent NuGet package
            // installed. To start the Test Cloud Agent the following code should be
            // added to the FinishedLaunching method of the AppDelegate:
            //
            //    #if ENABLE_TEST_CLOUD
            //    Xamarin.Calabash.Start();
            //    #endif
            if (platform == Platform.Android)
            {
                return ConfigureApp
                    .Android
                // TODO: Update this path to point to your Android app and uncomment the
                // code if the app is not included in the solution.
                //.ApkFile ("../../../Droid/bin/Debug/xamarinforms.apk")
                    .StartApp();
            }

            return ConfigureApp
                .iOS
            // TODO: Update this path to point to your iOS app and uncomment the
            // code if the app is not included in the solution.
            //.AppBundle ("../../../iOS/bin/iPhoneSimulator/Debug/XamarinForms.iOS.app")
                .StartApp();
        }
Example #18
0
		public TestApplication(Platform platform)
			: base(platform)
		{
			TestAssemblies = DefaultTestAssemblies().ToList();
			this.Name = "Test Application";
			this.Style = "application";
		}
Example #19
0
		public static void SearchForAndSelect (this IApp app, Platform platform, string searchString, string selection, string waitFor)
		{
			var ios = platform == Platform.iOS;

			app.SearchFor (platform, searchString);

			try {

				app.WaitForElement (x => x.Marked (selection));


				app.Tap (x => x.Marked (selection));

				app.WaitForElement (x => x.Marked (waitFor));


			} catch (Exception) {


				app.Tap (x => x.Id (ios ? "LocationSearchTvCell_nameLabel" : "text1").Index (2));
			}


			app.Screenshot ($"Added Location: '{selection}'");
		}
        public static void UnpackSng(Stream input, Stream output, Platform platform) {
            EndianBitConverter conv = platform.GetBitConverter;

            using (var decrypted = new MemoryStream())
            using (var ebrDec = new EndianBinaryReader(conv, decrypted)) {
                byte[] key;
                switch (platform.platform) {
                    case GamePlatform.Mac:
                        key = RijndaelEncryptor.SngKeyMac;
                        break;
                    case GamePlatform.Pc:
                        key = RijndaelEncryptor.SngKeyPC;
                        break;
                    default:
                        key = null;
                        break;
                }
                if (key != null)
                    RijndaelEncryptor.DecryptSngData(input, decrypted, key, conv);
                else {
                    input.CopyTo(decrypted);
                    decrypted.Seek(8, SeekOrigin.Begin);
                }
                //unZip
                long plainLen = ebrDec.ReadUInt32();
                ushort xU = ebrDec.ReadUInt16();
                decrypted.Position -= 2;
                if (xU == 0x78DA || xU == 0xDA78) {//LE 55928 //BE 30938
                    RijndaelEncryptor.Unzip(decrypted, output, false);
                }
            }
        }
Example #21
0
        public static void Init(Platform platform, ToolkitType DefaultToolKit, ToolkitType[] supportedToolkits)
        {
            CurrentPlatform = platform;
            SuportedPlatformToolkits = supportedToolkits;

            bool tkset = false;

            try
            {
                var settings = File.ReadAllLines(SettingsFile);
                foreach (var setting in settings)
                {
                    string[] split = setting.Split('=');
                    if (split[0] == "Toolkit")
                    {
                        try
                        {
                            _toolKitType = (ToolkitType)Enum.Parse(typeof(ToolkitType), split[1]);
                            tkset = true;
                        }
                        catch {
                        }
                    }
                }
            }
            catch
            {
            }

            if(!tkset)
                _toolKitType = DefaultToolKit;
        }
Example #22
0
		public WebBrowser (Platform platform)
		{
			this.platform = platform;
			callbacks = new Callback(this);
			loaded = Base.Init (this, platform);
			documents = new Hashtable ();
		}
Example #23
0
        private static Dictionary<string, Type> _typeTable = new Dictionary<string, Type>(); // <type name, Type> pairs.

        #endregion Fields

        #region Constructors

        static AssemblyUtil()
        {
            PlatformID id = Environment.OSVersion.Platform;
            if(   id == PlatformID.Win32NT
               || id == PlatformID.Win32S
               || id == PlatformID.Win32Windows
               || id == PlatformID.WinCE)
            {
                platform_ = Platform.Windows;
            }
            else
            {
                platform_ = Platform.NonWindows;
            }

            if(System.Type.GetType("Mono.Runtime") != null)
            {
                runtime_ = Runtime.Mono;
            }
            else
            {
                runtime_ = Runtime.DotNET;
            }

            System.Version v = System.Environment.Version;
            runtimeMajor_ = v.Major;
            runtimeMinor_ = v.Minor;
            runtimeBuild_ = v.Build;
            runtimeRevision_ = v.Revision;

            v = System.Environment.OSVersion.Version;

            osx_ = false;
            if (platform_ == Platform.NonWindows)
            {
                try
                {
                    Assembly a = Assembly.Load(
                        "Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756");
                    Type syscall = a.GetType("Mono.Unix.Native.Syscall");
                    if(syscall != null)
                    {
                        MethodInfo method = syscall.GetMethod("uname", BindingFlags.Static | BindingFlags.Public);
                        if(method != null)
                        {
                            object[] p = new object[1];
                            method.Invoke(null, p);
                            if(p[0] != null)
                            {
                                Type utsname = a.GetType("Mono.Unix.Native.Utsname");
                                osx_ = ((string)utsname.GetField("sysname").GetValue(p[0])).Equals("Darwin");
                            }
                        }
                    }
                }
                catch(System.Exception)
                {
                }
            }
        }
        public static void Write(string inputFile, string outputFile, ArrangementType arrangementType, Platform platform)
        {
            using (var reader = new StreamReader(inputFile))
            {
                var bitConverter = platform.GetBitConverter;
                if (arrangementType == ArrangementType.Vocal)
                {
                    var serializer = new XmlSerializer(typeof(Vocals));
                    var vocals = (Vocals)serializer.Deserialize(reader);
                    WriteRocksmithVocalsFile(vocals, outputFile, bitConverter);
                }
                else
                {
                    var serializer = new XmlSerializer(typeof(Song));
                    var song = (Song)serializer.Deserialize(reader);

                    // TODO: song.Tuning is null in toolkit generated RS1 Xml files
                    // TODO: this is only a quick fix of the root problem
                    var tuning = new Int16[] { 0, 0, 0, 0, 0, 0 };
                    if (song.Tuning != null) tuning = song.Tuning.ToArray();

                    WriteRocksmithSngFile(song, InstrumentTuningExtensions.GetTuningByOffsets(tuning), arrangementType, outputFile, bitConverter);

                }
            }
        }
Example #25
0
        protected BasePage(IApp app, Platform platform)
        {
            this.app = app;

            OnAndroid = platform == Platform.Android;
            OniOS = platform == Platform.iOS;
        }
        /// <summary>
        /// Initializes a new instance of the DesiredCapabilities class
        /// </summary>
        /// <param name="rawMap">Dictionary of items for the remotedriver</param>
        /// <example>
        /// <code>
        /// DesiredCapabilities capabilities = new DesiredCapabilities(new Dictionary<![CDATA[<string,object>]]>(){["browserName","firefox"],["version",string.Empty],["javaScript",true]});
        /// </code>
        /// </example>
        public DesiredCapabilities(Dictionary<string, object> rawMap)
        {
            this.name = (string)rawMap["browserName"];
            this.browserVersion = (string)rawMap["version"];
            this.javascriptEnabled = (bool)rawMap["javascriptEnabled"];

            if (rawMap.ContainsKey("platform"))
            {
                object raw = rawMap["platform"];
                string rawAsString = raw as string;
                Platform rawAsPlatform = raw as Platform;
                if (rawAsString != null)
                {
                    PlatformType platformInfo = (PlatformType)Enum.Parse(typeof(PlatformType), rawAsString, true);
                    this.browserPlatform = new Platform(platformInfo);
                }
                else if (rawAsPlatform != null)
                {
                    this.browserPlatform = rawAsPlatform;
                }
            }

            List<string> knownCapabilities = new List<string> { "browserName", "version", "javascriptEnabled", "platform" };
            foreach (string key in rawMap.Keys)
            {
                if (!knownCapabilities.Contains(key))
                {
                    this.customCapabilities[key] = rawMap[key];
                }
            }
        }
        public static IApp StartApp(Platform platform, string iOSSimulator, bool resetDevice)
        {
            // TODO: If the iOS or Android app being tested is included in the solution
            // then open the Unit Tests window, right click Test Apps, select Add App Project
            // and select the app projects that should be tested.
            if (platform == Platform.Android) {

                if (resetDevice) {
                    ResetEmulator ();
                }

                return ConfigureApp
                    .Android
                    .ApkFile ("../../binaries/com.xamarin.samples.taskydroidnew.exampleapp.apk")
                    .EnableLocalScreenshots ()
                    .StartApp ();

            } else if (platform == Platform.iOS) {

                if (resetDevice) {
                    ResetSimulator (iOSSimulator);
                }

                return ConfigureApp
                    .iOS
                    .AppBundle ("../../binaries/TaskyiOS.app")
                    .EnableLocalScreenshots ()
                    .DeviceIdentifier(iOSSimulator)
                    .StartApp ();
            }

            throw new ArgumentException ("Unsupported platform");
        }
Example #28
0
		private bool HasAllFiles(Platform platform, ZipFile zip)
		{
			string[] files;
			if (platform == Platform.WINDOWS)
			{
				files = new string[] { "Mac.exe", "FNA.dll" };
			}
			else
			{
				files = new string[]
				{ "Windows.exe", "Microsoft.Xna.Framework.dll", "Microsoft.Xna.Framework.Game.dll",
					"Microsoft.Xna.Framework.Graphics.dll", "Microsoft.Xna.Framework.Xact.dll"
				};
			}
			foreach (string file in files)
			{
				if (!zip.HasFile(file))
				{
					MessageBox.Show("Missing " + file + " from Install resources", "Installation Error",
						MessageBoxButtons.OK, MessageBoxIcon.Error);
					return false;
				}
			}
			return true;
		}
Example #29
0
        public static bool IsSupported(Platform platform)
        {
            if (platform == null)
                throw new ArgumentNullException("platform");

            return platform.Extensions.Contains(ExtensionName);
        }
Example #30
0
		public static bool Init (WebBrowser control, Platform platform)
		{
			lock (initLock) {
				if (!initialized) {
				
					Platform mozPlatform;
					try {
						short version = gluezilla_init (platform, out mozPlatform);

						monoMozDir = System.IO.Path.Combine (
						System.IO.Path.Combine (
						Environment.GetFolderPath (Environment.SpecialFolder.LocalApplicationData),
						".mono"), "mozilla-" + version);

					if (!System.IO.Directory.Exists (monoMozDir))
						System.IO.Directory.CreateDirectory (monoMozDir);
						
					}
					catch (DllNotFoundException) {
						Console.WriteLine ("libgluezilla not found. To have webbrowser support, you need libgluezilla installed");
						initialized = false;
						return false;
					}
					control.enginePlatform = mozPlatform;
					initialized = true;
				}
			}
			return initialized;
		}