Пример #1
0
        static private void DisplayHelp()
        {
            Console.Write("Running on ");
            List <string> envirnment = WindowsEnvironmentInformationProvider.GetEnvironmentRuntimeDisplayInformation();

            foreach (string line in envirnment)
            {
                Console.WriteLine(line);
            }
            Console.WriteLine("Usage: GeneratePlaylist <controlfile>");
            Console.WriteLine("Where");
            Console.WriteLine("  <controlfile> = XML control file eg. podcasts.xml");
        }
Пример #2
0
        public void Assertion_Succeeds()
        {
            var writeTime = File.GetLastWriteTime(Assembly.GetExecutingAssembly().Location);

            Console.WriteLine($"Write Time (Local): {writeTime.ToLocalTime().ToString()}");
            List <string> environment = WindowsEnvironmentInformationProvider.GetEnvironmentRuntimeDisplayInformation();

            foreach (var line in environment)
            {
                Console.WriteLine(line);
            }
            Assert.AreEqual(4, 2 + 2);
        }
Пример #3
0
        static private void DisplayHelp()
        {
            Console.Write("Running on ");
            List <string> envirnment = WindowsEnvironmentInformationProvider.GetEnvironmentRuntimeDisplayInformation();

            foreach (string line in envirnment)
            {
                Console.WriteLine(line);
            }
            Console.WriteLine("Usage: PerfmonCountersInstaller <option>");
            Console.WriteLine("Where");
            Console.WriteLine("  <option> = del to delete the counters and nothing to install them");
        }
Пример #4
0
        public void Initialise()
        {
            Logger.Debug(() => $"SettingsViewModel:Initialise");
            List <string> environment = WindowsEnvironmentInformationProvider.GetEnvironmentRuntimeDisplayInformation();
            StringBuilder builder     = new StringBuilder();

            builder.AppendLine(AndroidApplication.DisplayVersion);
            builder.AppendLine(AndroidApplication.DisplayPackage);
            foreach (string line in environment)
            {
                builder.AppendLine(line);
            }
            Observables.Version?.Invoke(this, builder.ToString());
        }
Пример #5
0
        public override void OnCreate()
        {
            Log.Debug(LOGCAT_TAG, $"AndroidApplication:OnCreate SDK == {Android.OS.Build.VERSION.SdkInt}, {(int)Android.OS.Build.VERSION.SdkInt}");
            Log.Debug(LOGCAT_TAG, $"AndroidApplication:OnCreate PackageName == {this.PackageName}");
            SetupExceptionHandler();
            PackageInfo package         = PackageManager.GetPackageInfo(PackageName, 0);
            long        longVersionCode = PackageInfoCompat.GetLongVersionCode(package);

#if DEBUG
            var config = "(Debug)";
#else
            var config = "(Release)";
#endif
            DisplayVersion = $"v{package.VersionName}, ({longVersionCode}), {config}";
            DisplayPackage = $"{PackageName}";
            Log.Debug(LOGCAT_TAG, $"AndroidApplication:OnCreate Version == {DisplayVersion}");

            base.OnCreate();
            var dirs = Context.GetExternalFilesDirs(null);
            if (dirs != null && dirs[0] != null)
            {
                // use our external folder - dependes on package name
                Log.Debug(LOGCAT_TAG, $"AndroidApplication:OnCreate Logs == {dirs[0].AbsolutePath}");
                LoggerFactory = new NLoggerLoggerFactory(dirs[0].AbsolutePath);
            }
            else
            {
                // hard code and hope for the best
                LoggerFactory = new NLoggerLoggerFactory($"/sdcard/Android/data/{this.PackageName}/files/");
            }
            Logger = LoggerFactory.Logger;
            Logger.Debug(() => $"AndroidApplication:Logging init");

            // initialise the IoC container
            IocContainer = InitializeIocContainer();
            AddExtrasToIocContainer(IocContainer);

            Logger.Debug(() => $"AndroidApplication:IoC Init, {DisplayVersion}, {Android.OS.Build.VERSION.SdkInt}, {(int)Android.OS.Build.VERSION.SdkInt}, {this.PackageName}");
            // display the core components version
            List <string> envirnment = WindowsEnvironmentInformationProvider.GetEnvironmentRuntimeDisplayInformation();
            foreach (string line in envirnment)
            {
                Logger.Debug(() => $"AndroidApplication:{line}");
            }

            Analytics = IocContainer.Resolve <IAnalyticsEngine>();
            Analytics?.LifecycleLaunchEvent();
        }
Пример #6
0
        private TextView GenerateDiagnosticInfo()
        {
            TextView      view        = new TextView(this);
            List <string> environment = WindowsEnvironmentInformationProvider.GetEnvironmentRuntimeDisplayInformation();
            StringBuilder builder     = new StringBuilder();

            builder.AppendLine(GetVersionDisplay());
            foreach (string line in environment)
            {
                builder.AppendLine(line);
            }
            view.Text = builder.ToString();

            view.SetSingleLine(false);
            return(view);
        }
Пример #7
0
        static private void DisplayHelp()
        {
            Console.Write("Running on ");
            List <string> envirnment = WindowsEnvironmentInformationProvider.GetEnvironmentRuntimeDisplayInformation();

            foreach (string line in envirnment)
            {
                Console.WriteLine(line);
            }
            Console.WriteLine("Usage: PodcastUtilities.Integration.Tests <tests>");
            Console.WriteLine("Where");
            Console.WriteLine("  <tests> = all: run all tests");
#if NETFULL
            Console.WriteLine("          = mtp: run portable device tests");
#endif
            Console.WriteLine("          = control: run control file tests");
            Console.WriteLine("          = download: run download tests");
        }
Пример #8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            AndroidApplication = Application as AndroidApplication;
            AndroidApplication.Logger.Debug(() => "MainActivity:OnCreate");
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            DriveInfoProvider   = AndroidApplication.IocContainer.Resolve <IDriveInfoProvider>();
            FileSystemHelper    = AndroidApplication.IocContainer.Resolve <IFileSystemHelper>();
            PreferencesProvider = AndroidApplication.IocContainer.Resolve <IPreferencesProvider>();
            ControlFileUri      = PreferencesProvider.GetPreferenceString(ApplicationContext.GetString(Resource.String.prefs_control_uri_key), "");
            AndroidApplication.Logger.Debug(() => $"MainActivity:OnCreate Conrol Uri = {ControlFileUri}");

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

            // Get our UI controls from the loaded layout
            List <string> envirnment = WindowsEnvironmentInformationProvider.GetEnvironmentRuntimeDisplayInformation();
            StringBuilder builder    = new StringBuilder();

            builder.AppendLine(AndroidApplication.DisplayVersion);
            foreach (string line in envirnment)
            {
                builder.AppendLine(line);
            }
            SetTextViewText(Resource.Id.txtVersions, builder.ToString());

            builder.Clear();

            builder.AppendLine($"Personal Folder = {System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal)}");
            builder.AppendLine($"AppData Folder = {System.Environment.GetFolderPath(System.Environment.SpecialFolder.ApplicationData)}");
            builder.AppendLine($"CommonAppData Folder = {System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData)}");
            Java.IO.File[] files = ApplicationContext.GetExternalFilesDirs(null);
            foreach (Java.IO.File file in files)
            {
                builder.AppendLine($"ExternalFile = {file.AbsolutePath}");
                OverrideRoot = file.AbsolutePath;
            }
            builder.AppendLine($"Podcasts Folder = {Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPodcasts).AbsolutePath}");
            SetTextViewText(Resource.Id.txtAppStorage, builder.ToString());

            ProgressSpinner = FindViewById <ProgressSpinnerView>(Resource.Id.progressBar);

            Button btnLoad = FindViewById <Button>(Resource.Id.btnLoadConfig);

            btnLoad.Click += (sender, e) => LoadConfig();

            Button btnFind = FindViewById <Button>(Resource.Id.btnFindPodcasts);

            // works
            btnFind.Click += (sender, e) => Task.Run(() => FindEpisodesToDownload());
            // crash - java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
            //btnFind.Click += async (sender, e) => await Task.Run(() => FindEpisodesToDownload());
            // blocks UI thread
            //btnFind.Click += async (sender, e) => FindEpisodesToDownload();

            Button btnSetRoot = FindViewById <Button>(Resource.Id.btnSetRoot);

            btnSetRoot.Click += (sender, e) => SetRoot();

            Button btnDownload = FindViewById <Button>(Resource.Id.btnDownload);

            btnDownload.Click += (sender, e) => Task.Run(() => Download());

            bool isReadonly  = Android.OS.Environment.MediaMountedReadOnly.Equals(Android.OS.Environment.ExternalStorageState);
            bool isWriteable = Android.OS.Environment.MediaMounted.Equals(Android.OS.Environment.ExternalStorageState);

            if (!string.IsNullOrEmpty(ControlFileUri))
            {
                try
                {
                    // TODO - we need to ask permission if the file has been edited by another app
                    Android.Net.Uri uri = Android.Net.Uri.Parse(ControlFileUri);
                    AndroidApplication.ControlFile = OpenControlFile(uri);
                }
                catch (Exception ex)
                {
                    AndroidApplication.Logger.LogException(() => $"MainActivity: OnCreate", ex);
                    SetTextViewText(Resource.Id.txtConfigFilePath, $"Error {ex.Message}");
                }
            }
        }