コード例 #1
0
        private static void MigrateCommands(string path)
        {
            var lstCommands = new List <ApkCommand>();

            var fs      = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            var oXmlDoc = new XmlDocument();

            oXmlDoc.Load(fs);

            var xmlNodes = oXmlDoc.GetElementsByTagName("item");

            foreach (XmlNode oNode in xmlNodes)
            {
                var co = new ApkCommand();

                co.Title   = oNode.ChildNodes[0].InnerText;
                co.Command = oNode.ChildNodes[1].InnerText;

                lstCommands.Add(co);
            }

            fs.Close();
            fs.Dispose();

            SqliteConnector.SetCommands(lstCommands);

            File.Delete(path);
        }
コード例 #2
0
        }                                         //Flag idicating LocalAPK is running under portable mode

        public static WindowInfo GetMainWindowInfo()
        {
            var locX      = SqliteConnector.GetSettingValue(SettingEnum.WindowLocX);
            var locY      = SqliteConnector.GetSettingValue(SettingEnum.WindowLocY);
            var width     = SqliteConnector.GetSettingValue(SettingEnum.WindowSizeWidth);
            var height    = SqliteConnector.GetSettingValue(SettingEnum.WindowSizeHeight);
            var maximized = SqliteConnector.GetSettingValue(SettingEnum.WindowMaximized);
            var minimized = SqliteConnector.GetSettingValue(SettingEnum.WindowMinimized);

            if (string.IsNullOrWhiteSpace(locX) || string.IsNullOrWhiteSpace(locY) || string.IsNullOrWhiteSpace(width) ||
                string.IsNullOrWhiteSpace(height) || string.IsNullOrWhiteSpace(maximized) ||
                string.IsNullOrWhiteSpace(minimized))
            {
                return(null);
            }
            var windowInfo = new WindowInfo
            {
                Location  = new Point(Convert.ToInt32(locX), Convert.ToInt32(locY)),
                Size      = new Size(Convert.ToInt32(width), Convert.ToInt32(height)),
                Maximized = Convert.ToBoolean(maximized),
                Minimized = Convert.ToBoolean(minimized)
            };

            return(windowInfo);
        }
コード例 #3
0
        private static void MigrateLicence(string path)
        {
            var fs      = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            var oXmlDoc = new XmlDocument();

            oXmlDoc.Load(fs);

            var xmlNodes = oXmlDoc.GetElementsByTagName("license");

            var xmlNode = xmlNodes.Item(0);

            if (xmlNode != null)
            {
                foreach (XmlElement xe in xmlNode)
                {
                    if (xe.Name == "email" && !string.IsNullOrWhiteSpace(xe.InnerText))
                    {
                        SqliteConnector.SetSettingValue(SettingEnum.LicenceEmail, xe.InnerText);
                    }
                    if (xe.Name == "code" && !string.IsNullOrWhiteSpace(xe.InnerText))
                    {
                        SqliteConnector.SetSettingValue(SettingEnum.LicenceCode, xe.InnerText);
                    }
                }
            }

            fs.Close();
            fs.Dispose();

            File.Delete(path);
        }
コード例 #4
0
        private static void MigrateSettings(string path)
        {
            var fs      = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            var oXmlDoc = new XmlDocument();

            oXmlDoc.Load(fs);

            //Fetch google play
            var downloadLatestVersionInfoNode = oXmlDoc.GetElementsByTagName("downloadLatestVersionInfo")[0];

            if (downloadLatestVersionInfoNode.InnerText == "true")
            {
                SqliteConnector.SetSettingValue(SettingEnum.AutoFetchGooglePlay, "true");
            }
            else
            {
                SqliteConnector.SetSettingValue(SettingEnum.AutoFetchGooglePlay, "false");
            }

            //New group for every subdir
            var newGroupSub = oXmlDoc.GetElementsByTagName("newGroupSub")[0];

            if (newGroupSub.InnerText == "true")
            {
                SqliteConnector.SetSettingValue(SettingEnum.SubdirGroup, "true");
            }
            else
            {
                SqliteConnector.SetSettingValue(SettingEnum.SubdirGroup, "false");
            }

            //Group dirs
            var groupResults = oXmlDoc.GetElementsByTagName("groupResults")[0];

            if (groupResults.InnerText == "true")
            {
                SqliteConnector.SetSettingValue(SettingEnum.GroupResults, "true");
            }
            else
            {
                SqliteConnector.SetSettingValue(SettingEnum.GroupResults, "false");
            }

            //Startup refresh
            var startupRefresh = oXmlDoc.GetElementsByTagName("startupRefresh")[0];

            if (startupRefresh.InnerText == "true")
            {
                SqliteConnector.SetSettingValue(SettingEnum.StartupRefresh, "true");
            }
            else
            {
                SqliteConnector.SetSettingValue(SettingEnum.StartupRefresh, "false");
            }

            fs.Close();
            fs.Dispose();

            File.Delete(path);
        }
コード例 #5
0
 public static void SaveMainWindowInfo(WindowInfo wi)
 {
     SqliteConnector.SetSettingValue(SettingEnum.WindowLocX, Convert.ToString(wi.Location.X));
     SqliteConnector.SetSettingValue(SettingEnum.WindowLocY, Convert.ToString(wi.Location.Y));
     SqliteConnector.SetSettingValue(SettingEnum.WindowSizeWidth, Convert.ToString(wi.Size.Width));
     SqliteConnector.SetSettingValue(SettingEnum.WindowSizeHeight, Convert.ToString(wi.Size.Height));
     SqliteConnector.SetSettingValue(SettingEnum.WindowMaximized, wi.Maximized.ToString().ToLower());
     SqliteConnector.SetSettingValue(SettingEnum.WindowMinimized, wi.Minimized.ToString().ToLower());
 }
コード例 #6
0
ファイル: clsUtils.cs プロジェクト: softmobilocka/LocalAPK
        public static List <string> CheckRemovedScanFolders()
        {
            var removedDirs = new List <string>();

            foreach (var dir in SqliteConnector.GetScanFolders())
            {
                if (!Directory.Exists(dir))
                {
                    removedDirs.Add(dir);
                }
            }
            return(removedDirs);
        }
コード例 #7
0
        private static void MigrateMassRename(string path)
        {
            var fs      = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            var oXmlDoc = new XmlDocument();

            oXmlDoc.Load(fs);

            var massRename = oXmlDoc.GetElementsByTagName("currentValue")[0];

            SqliteConnector.SetSettingValue(SettingEnum.MassRenameString, massRename.InnerText);

            fs.Close();
            fs.Dispose();

            File.Delete(path);
        }
コード例 #8
0
        private static void MigrateFolders(string path)
        {
            var lstFolders = new List <string>();

            var fs      = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
            var oXmlDoc = new XmlDocument();

            oXmlDoc.Load(fs);

            var xmlNodes = oXmlDoc.GetElementsByTagName("item");

            foreach (XmlNode oNode in xmlNodes)
            {
                lstFolders.Add(oNode.InnerText);
            }

            fs.Close();
            fs.Dispose();

            SqliteConnector.SetScanFolders(lstFolders);

            File.Delete(path);
        }