Ejemplo n.º 1
0
        public SQLiteAsyncConnection GetConnection()
        {
            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var path = Path.Combine(documentsPath, "sqliteonly.db3");

            return new SQLiteAsyncConnection(path);
        }
Ejemplo n.º 2
0
        public string GetDatabasePath(string sqliteFilename)
        {
            string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var    path          = Path.Combine(documentsPath, sqliteFilename);

            return(path);
        }
Ejemplo n.º 3
0
        public string LoadText(string filename)
        {
            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var filePath      = Path.Combine(documentsPath, filename);

            return(System.IO.File.ReadAllText(filePath));
        }
Ejemplo n.º 4
0
        public SQLiteAsyncConnection GetConnection()
        {
            var documentPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var path         = Path.Combine(documentPath, "MySQLite.db3");

            return(new SQLiteAsyncConnection(path));
        }
Ejemplo n.º 5
0
        public static void Main(string[] args)
        {
            var region = Env.GetEnvironmentVariable("AWS_DEFAULT_REGION");

            if (string.IsNullOrEmpty(region))
            {
                throw new System.Exception("Environment variable AWS_DEFAULT_REGION is not set");
            }
            var accountId = Env.GetEnvironmentVariable("AWS_ACCOUNT_ID");

            if (string.IsNullOrEmpty(accountId))
            {
                throw new System.Exception("Environment variable AWS_ACCOUNT_ID is not set");
            }
            var app = new App();

            new SolarStack(app, new StackProps
            {
                Env = new Environment
                {
                    Account = accountId,
                    Region  = region
                }
            });
            app.Synth();
        }
Ejemplo n.º 6
0
 public static IEnumerable <(string key, string value)> GetInfo()
 {
     foreach (DictionaryEntry pair in E.GetEnvironmentVariables())
     {
         yield return(pair.Key + "", pair.Value + "");
     }
 }
Ejemplo n.º 7
0
 public SplashScreen()
     : base(Resource.Layout.SplashScreen)
 {
     DataAccess.ApplicationContext.DbPath =
         Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                      DatabaseConstants.DB_NAME);
 }
Ejemplo n.º 8
0
        private static string GetLocalFilePath(string filename)
        {
            //指定されたファイルのパスを取得します。なければ作成してそのパスを返却します
            var path = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            return(Path.Combine(path, filename));
        }
Ejemplo n.º 9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            RequestWindowFeature(WindowFeatures.ActionBar);
            RequestWindowFeature(WindowFeatures.Progress);
            RequestWindowFeature(WindowFeatures.IndeterminateProgress);

            SetProgressBarIndeterminate(true);
            SetProgressBarIndeterminateVisibility(true);

            ActionBar.NavigationMode = ActionBarNavigationMode.Tabs;
            ActionBar.Title          = "Tasks Example";
            ActionBar.SetDisplayShowTitleEnabled(true);

            if (bundle != null)
            {
                this.selectedId = bundle.GetString("selected");
            }

            DB = new SQLiteAsyncConnection(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), "todo.db"));
            //DB = new SQLiteAsyncConnection("C:\\Users\\taozh_000\\Desktop\\XamarinApps\\samples\\icecream_test1\\icecream_test1\\Database\\sqliteDB1\\PlayChat.SQLite");
            // Create our tables
            DB.CreateTablesAsync <List, ListItem>().ContinueWith(t => LoadLists(), uiScheduler);

            LoadLists();
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            Instance = this;

            OurLogger = new LoggerConfiguration()
                        .WriteTo.File(
                path: Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "XamarinLib-{Date}.log"),
                outputTemplate: "{Timestamp:yyyy-MM-dd HH:mm:ss.fff zzz} [{Level}] [{SourceContext}] {Message}{NewLine}{Exception}",
                fileSizeLimitBytes: 100000000,
                rollingInterval: RollingInterval.Day,
                rollOnFileSizeLimit: true,
                retainedFileCountLimit: 31,
                encoding: System.Text.Encoding.UTF8
                )
                        .WriteTo.AndroidLog()
                        .CreateLogger();

            OurLogger.Information("On MainActivity OnCreate");

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
            LoadApplication(new App());
        }
        public SQLiteConnection CreateConnection()
        {
            var    sqliteFilename        = "GarduinoDB.db";
            string documentDirectoryPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var    path = Path.Combine(documentDirectoryPath, sqliteFilename);

            if (!File.Exists(path))
            {
                using (var binaryReader = new BinaryReader(Android.App.Application.Context.Assets.Open(sqliteFilename)))
                {
                    using (var binaryWriter = new BinaryWriter(new FileStream(path, FileMode.Create)))
                    {
                        byte[] buffer = new byte[2048];
                        int    length = 0;
                        while ((length = binaryReader.Read(buffer, 0, buffer.Length)) > 0)
                        {
                            binaryWriter.Write(buffer, 0, length);
                        }
                    }
                }
            }
            var connection = new SQLiteConnection(path);

            return(connection);
        }
Ejemplo n.º 12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(savedInstanceState);

            string fileName   = "BCMWeb_db.db3";
            string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            ServicePointManager.ServerCertificateValidationCallback += (se, cert, chain, sslerror) => { return(true); };
            string fullPathFile       = Path.Combine(folderPath, fileName);
            var    mainDisplayInfo    = DeviceDisplay.MainDisplayInfo;
            var    pixelWidth         = (int)mainDisplayInfo.Width;
            var    pixelHeight        = (int)mainDisplayInfo.Height;
            var    screenPixelDensity = mainDisplayInfo.Density;

            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            global::Xamarin.Forms.Forms.SetFlags("CollectionView_Experimental");
            global::Xamarin.Forms.Forms.Init(this, savedInstanceState);

            _app = new App(fullPathFile, (double)((pixelHeight - 0.5f) / screenPixelDensity), (double)((pixelWidth - 0.5f) / screenPixelDensity));
            App.deviceDownloadRoot = ApplicationContext.GetExternalFilesDir(Android.OS.Environment.DirectoryDownloads).AbsolutePath;
            Downloaded();

            LoadApplication(_app);
        }
Ejemplo n.º 13
0
        public bool CheckExistenceOf(string filename)
        {
            var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var filePath      = Path.Combine(documentsPath, filename);

            return(File.Exists(filePath));
        }
Ejemplo n.º 14
0
        private static void Main()
        {
            //System.Console.WriteLine("Hello!");
            //System.Console.Out.WriteLine("World!");
#if add_accounts
            add_accounts();
            return;
#endif

            //mwg.Sshfs.SharpSSHTest.ssh_test2();
            //mwg.Sshfs.SshNetTest.ssh_test();
            //return;

            if (!arguments.Read(Environment.GetCommandLineArgs()))
            {
                System.Console.Error.WriteLine("mwg.Sshfs! 引数指定に誤りが含まれていました。終了します。");
                System.Console.Error.WriteLine("mwg.Sshfs: 引数指定の詳細については mwg.Sshfs --help を見て下さい。");
                return;
            }

            if (arguments.IsHelp)
            {
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //SettingForm form=new SettingForm();
            //form.sftpAccountEditor1.Account=setting.GetAccount("kocoa") as SftpAccount;

            UserInterface.WndSetting form = new UserInterface.WndSetting();
            Application.Run(form);
        }
Ejemplo n.º 15
0
        public CommandLineEnvironments GetEnvironment()
        {
            const string term = "TERM";

            return(string.IsNullOrEmpty(SysEnv.GetEnvironmentVariable(term))
        ? CommandLineEnvironments.Win32
        : CommandLineEnvironments.AnsiCompatible);
        }
Ejemplo n.º 16
0
 public async Task SaveAsync(string filename, string text)
 {
     await Task.Run(() => {
         var documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
         var filePath      = Path.Combine(documentsPath, filename);
         File.WriteAllText(filePath, text);
     });
 }
Ejemplo n.º 17
0
        public static string GetAbsoluteFileName(string filename)
        {
            string personalFolder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            return(personalFolder + Path.DirectorySeparatorChar +
                   ANTLRWORKS_DIR + Path.DirectorySeparatorChar +
                   filename);
        }
        public SQLiteConnection DbConnection()
        {
            var dbName = "CustomersDb.db3";
            var path   = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), dbName);
            var conn   = new SQLiteConnection(path);

            return(conn);
        }
Ejemplo n.º 19
0
        public static string GetLocalDbPath()
        {
            var    sqliteFileName = "workoutDatabaseTest4.db3";
            string libraryPath    = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var    path           = Path.Combine(libraryPath, sqliteFileName);

            return(path);
        }
Ejemplo n.º 20
0
 // https://qiita.com/tmisuoka0423/items/325dfe91e7073b358435
 // https://docs.aws.amazon.com/cdk/latest/guide/environments.html
 private static Environment makeEnv(string account = null, string region = null)
 {
     return(new Environment
     {
         Account = account ?? SysEnv.GetEnvironmentVariable("CDK_DEFAULT_ACCOUNT"),
         Region = region ?? SysEnv.GetEnvironmentVariable("CDK_DEFAULT_REGION")
     });
 }
Ejemplo n.º 21
0
        public string GetLocalFilePath(string filename)
        {
            string path   = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            string dbPath = Path.Combine(path, filename);

            CopyDatabaseIfNotExists(dbPath, filename);

            return(dbPath);
        }
Ejemplo n.º 22
0
        /// Get file path to the current user's profile
        public string GetProfilePath(PlatformType platform)
        {
            if (platform == PlatformType.Windows)
            {
                return(Env.GetEnvironmentVariable("USERPROFILE"));
            }

            return(Env.GetEnvironmentVariable("HOME"));
        }
Ejemplo n.º 23
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            LoginScreenControl <CredentialsProvider> .Activate(this);

            //Login Screen function, If theres errors delete this and the credentials provider class
            var path   = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var dbPath = Path.Combine(path, "counters.db3");

            DatabaseHelper.CreateDatabase(dbPath);

            await ViewModelLocator.Counters.LoadCountersAsync();

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

            //Set hamburger items menu
            SupportActionBar.SetHomeAsUpIndicator(Resource.Drawable.ic_menu);

            //setup navigation view
            _navigationView = FindViewById <NavigationView>(Resource.Id.nav_view);

            //handle navigation
            _navigationView.NavigationItemSelected += (sender, e) =>
            {
                e.MenuItem.SetChecked(true);

                // Switch statement for nav buttons
                switch (e.MenuItem.ItemId)
                {
                case Resource.Id.nav_counters:
                    ListItemClicked(0);
                    break;

                case Resource.Id.nav_about:
                    ListItemClicked(1);
                    break;

                case Resource.Id.nav_Add:
                    ListItemClicked(2);
                    break;

                case Resource.Id.nav_Sort:
                    ListItemClicked(3);
                    break;
                }

                _drawerLayout.CloseDrawers();
            };


            //if first time you will want to go ahead and click first item.
            if (savedInstanceState == null)
            {
                ListItemClicked(0);
            }
        }
Ejemplo n.º 24
0
        public DllPathsAdded()
        {
            DllTools.AddPathVariable(Environment.ExpandEnvironmentVariables("%META_CORE%"));

            DllTools.AddPathVariable(Environment.ExpandEnvironmentVariables("%META_INTERNAL_UNITY_SDK%")
                                     + DllTools.DirSep()
                                     + "Plugins"
                                     + DllTools.DirSep()
                                     + "x86_64");
        }
Ejemplo n.º 25
0
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            string baseDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal);

            LoadApplication(new App(baseDirectory));
        }
Ejemplo n.º 26
0
        /// Initialize new CommandHandler
        public CommandHandler()
        {
            string path = Env.GetEnvironmentVariable("PATH");

            _envPaths = path.Split(Path.PathSeparator).ToList();

            _extensions = new List <string>
            {
                "exe", "bat", "ps1", "py", "sh"
            };
        }
Ejemplo n.º 27
0
        public SQLiteConnection GetConnection()
        {
            //Set name of db
            string sqliteFilename = "TravelDB.db";
            //Create path
            string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); //Documents folder
            var    path          = Path.Combine(documentsPath, sqliteFilename);
            //Create Connection
            var connection = new SQLiteConnection(path);

            return(connection);
        }
Ejemplo n.º 28
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            _data = _data ?? Data.GetInstance(new SQLiteConnection(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), Constants.DatabaseName)));
            var view = inflater.Inflate(Resource.Layout.Main_ExerciseList, container, false);

            _exerciseRecyclerView = view.FindViewById <RecyclerView>(Resource.Id.ExerciseList);
            _addExerciseButton    = view.FindViewById(Resource.Id.AddExerciseButton);

            _addExerciseButton.Click += (sender, args) => StartActivity(new Intent(Activity, typeof(ManageExerciseActivity)));

            _exerciseRecyclerView.SetLayoutManager(new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false));

            return(view);
        }
Ejemplo n.º 29
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;

            //Important Remember
            var fileLocation = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
            var dbPath       = Path.Combine(fileLocation, "DatabaseProject.sqlite");

            base.OnCreate(savedInstanceState);
            Forms.Init(this, savedInstanceState);

            //Pass constructor
            LoadApplication(new App(dbPath));
        }
Ejemplo n.º 30
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource   = Resource.Layout.Toolbar;
            base.SetTheme(Resource.Style.MainTheme);

            base.OnCreate(savedInstanceState);
            Forms.Init(this, savedInstanceState);

            // Database Declaration
            string fullPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                           "smartdose_db.sqlite");

            LoadApplication(new App(fullPath));
        }