Пример #1
0
        public void Save(string TaskPath)
        {
            // Making directories
            if (!IOHelper.CheckDirectoryExists(TaskPath))
            {
                IOHelper.CreateDirectory(TaskPath);
            }

            // Saving
            IniWorker ini = new IniWorker(IO.Path.Combine(TaskPath, "details.ini"));

            ini.IniWriteValue("General", "ID", this.ID.ToString());
            ini.IniWriteValue("General", "Name", this.Name);
            ini.IniWriteValue("General", "StartTime", this.StartTime.ToString());
            ini.IniWriteValue("General", "State", this.State.ToString());

            if (this.Executor == null)
            {
                throw new Exception("Empty executor!");
            }

            ini.IniWriteValue("General", "Executor", this.Executor.Name);

            // Saving Settings
            this.Executor.Save(TaskPath);
        }
Пример #2
0
        /// <summary>
        /// Saves WorkSpace to the specified directory
        /// </summary>
        /// <param name="WorkSpacePath">Path to the directory where WorkSpace will be saved.</param>
        public void Save(string WorkSpacePath)
        {
            Logger.Instanse.Append(string.Format("WorkSpace: {0}. Saving...", this.Name), LogMessageType.Info);
            try
            {
                if (!IOHelper.CheckDirectoryExists(WorkSpacePath))
                {
                    IOHelper.CreateDirectory(WorkSpacePath);
                }

                // Saving ini
                IniWorker ini = new IniWorker(IO.Path.Combine(WorkSpacePath, "details.ini"));
                ini.IniWriteValue("General", "ID", this.ID.ToString());
                ini.IniWriteValue("General", "Name", this.Name);

                this.SaveTasks(IO.Path.Combine(WorkSpacePath, "Tasks"));
                this.SaveImages(IO.Path.Combine(WorkSpacePath, "Images"));
                this.SaveKeywords(IO.Path.Combine(WorkSpacePath, "Keywords"));
                this.SaveTexts(IO.Path.Combine(WorkSpacePath, "Text"));
                this.SavePresets(IO.Path.Combine(WorkSpacePath, "Presets"));
                this.SaveTemplates(IO.Path.Combine(WorkSpacePath, "Templates"));

                Logger.Instanse.Append(string.Format("WorkSpace: {0}. Saved.", this.Name), LogMessageType.Info);
            }
            catch (Exception ex)
            {
                Logger.Instanse.Append(string.Format("WorkSpace: {0}. Failed to save.", this.Name), LogMessageType.Info);
                if (Options.Instanse.LogDebugMode)
                {
                    Logger.Instanse.Append(ex);
                }
            }
        }
Пример #3
0
        public void Save(string ImagePath)
        {
            // Saving details
            if (!IO.Directory.Exists(ImagePath))
            {
                IOHelper.CreateDirectory(ImagePath);
            }

            // Saving ini
            IniWorker ini = new IniWorker(IO.Path.Combine(ImagePath, "details.ini"));

            ini.IniWriteValue("General", "ID", this.ID.ToString());
            ini.IniWriteValue("General", "Name", this.Name);

            // Actual files
            string imageDirectory = IO.Path.Combine(ImagePath, "Images");

            if (!IO.Directory.Exists(imageDirectory))
            {
                IOHelper.CreateDirectory(imageDirectory);
            }

            string[] details = new string[this.Items.Count];
            for (int i = 0; i < this.Items.Count; i++)
            {
                if (this.Items[i].Path.ToLower().StartsWith("http"))
                {
                    details[i] = this.Items[i].Path;
                    continue;
                }

                string itemPath = string.Empty;
                if (!string.IsNullOrEmpty(this.Path))
                {
                    if (!this.Items[i].Path.ToLower().StartsWith(this.Path))
                    {
                        itemPath = IO.Path.Combine(imageDirectory,
                                                   IO.Path.IsPathRooted(this.Items[i].Path)
                                                       ? this.Items[i].Path.Substring(
                                                       this.Items[i].Path.LastIndexOf(@"\") + 1)
                                                       : this.Items[i].Path);
                    }
                }
                else
                {
                    itemPath = IO.Path.Combine(imageDirectory,
                                               this.Items[i].Path.Substring(this.Items[i].Path.LastIndexOf(@"\") + 1));
                }

                details[i] = itemPath.Substring(imageDirectory.Length).Trim(new char[] { '\\' });
                (this.Items[i] as File).Save(itemPath);
            }

            // Saving info.ini
            string iniPath = IO.Path.Combine(imageDirectory, "details.ini");

            IO.File.WriteAllLines(iniPath, details, Encoding.UTF8);
        }
Пример #4
0
        public void Save(string TextPath)
        {
            // Saving details
            if (!IOHelper.CheckDirectoryExists(TextPath))
            {
                IOHelper.CreateDirectory(TextPath);
            }

            // Saving ini
            IniWorker ini = new IniWorker(IO.Path.Combine(TextPath, "details.ini"));

            ini.IniWriteValue("General", "ID", this.ID.ToString());
            ini.IniWriteValue("General", "Name", this.Name);

            // Saving Items
            IO.File.WriteAllText(IO.Path.Combine(TextPath, "text.txt"), this.Content, Encoding.UTF8);
        }
Пример #5
0
        /// <summary>
        /// Saves keywords to specified directory
        /// </summary>
        /// <param name="KeyWordPath">Path to directory, where keywords will be saved</param>
        public void Save(string KeyWordPath)
        {
            // Saving details
            if (!IOHelper.CheckDirectoryExists(KeyWordPath))
            {
                IOHelper.CreateDirectory(KeyWordPath);
            }

            // Saving ini
            IniWorker ini = new IniWorker(IO.Path.Combine(KeyWordPath, "details.ini"));

            ini.IniWriteValue("General", "ID", this.ID.ToString());
            ini.IniWriteValue("General", "Name", this.Name);

            // Saving
            IO.File.WriteAllLines(IO.Path.Combine(KeyWordPath, "keywords.txt"), this.Items, Encoding.UTF8);
        }
Пример #6
0
        public void Save(string TemplatePath)
        {
            // Saving details
            if (!IOHelper.CheckDirectoryExists(TemplatePath))
            {
                IOHelper.CreateDirectory(TemplatePath);
            }

            // Saving ini
            IniWorker ini = new IniWorker(IO.Path.Combine(TemplatePath, "details.ini"));

            ini.IniWriteValue("General", "ID", this.ID.ToString());
            ini.IniWriteValue("General", "Name", this.Name);
            ini.IniWriteValue("General", "Encoding", Encoding.EncodingName);

            // Saving Items
            this.Export(IO.Path.Combine(TemplatePath, "Files"));
        }
Пример #7
0
        public void Save()
        {
            try
            {
                if (File.Exists(Path.Combine(Application.StartupPath, "GUI.ini")))
                {
                    // Removing readonly
                    FileInfo file = new FileInfo(Path.Combine(Application.StartupPath, "GUI.ini"));
                    file.Attributes = FileAttributes.Normal;
                }

                // Saving
                IniWorker ini      = new IniWorker(Path.Combine(Application.StartupPath, "GUI.ini"));
                string    iniGroup = string.Empty;

                // General
                iniGroup = "General";
                ini.IniWriteValue(iniGroup, "Language", this.Language.ToString());
                ini.IniWriteValue(iniGroup, "NoFxCheck", this.NoFxCheck.ToString());
            }
            catch (Exception) { }
        }
Пример #8
0
        public void Save()
        {
            try
            {
                if (File.Exists(Path.Combine(Application.StartupPath, "GUI.ini")))
                {
                    // Removing readonly
                    FileInfo file = new FileInfo(Path.Combine(Application.StartupPath, "GUI.ini"));
                    file.Attributes = FileAttributes.Normal;
                }

                // Saving
                IniWorker ini      = new IniWorker(Path.Combine(Application.StartupPath, "GUI.ini"));
                string    iniGroup = string.Empty;

                // General
                iniGroup = "General";
                ini.IniWriteValue(iniGroup, "NoFxCheck", this.NoFxCheck.ToString());

                // Appearance
                iniGroup = "Appearance";
                ini.IniWriteValue(iniGroup, "Appearance", this.Appearance.ToString());
                ini.IniWriteValue(iniGroup, "News", this.AppearanceNews.ToString());
                ini.IniWriteValue(iniGroup, "General", this.AppearanceGeneral.ToString());
                ini.IniWriteValue(iniGroup, "LargeCalendar", this.AppearanceLargeCalendar.ToString());

                // Manager
                iniGroup = "Manager";
                ini.IniWriteValue(iniGroup, "Manager", this.Manager.ToString());
                ini.IniWriteValue(iniGroup, "PinToDesktop", this.ManagerPin.ToString());
                ini.IniWriteValue(iniGroup, "Location", this.ManagerLocation.ToString());

                // Tray Window
                iniGroup = "Tray";
                ini.IniWriteValue(iniGroup, "TrayWindowPinned", this.TrayWindowPinned.ToString());
                ini.IniWriteValue(iniGroup, "TrayWindowOpacity", this.TrayWindowOpacity.ToString());

                // StartUp
                iniGroup = "StartUp";
                ini.IniWriteValue(iniGroup, "MinimizedStart", this.MinimizedStart.ToString());
                ini.IniWriteValue(iniGroup, "AutoStart", this.AutoStart.ToString());

                // Notifications
                iniGroup = "Notifications";
                ini.IniWriteValue(iniGroup, "Notifications", this.Notifications.ToString());
                ini.IniWriteValue(iniGroup, "Time", this.NotificationsTime.ToString());
                ini.IniWriteValue(iniGroup, "TaskStarted", this.NotificationsAtTaskStarted.ToString());
                ini.IniWriteValue(iniGroup, "TaskFailed", this.NotificationsAtTaskFailed.ToString());
                ini.IniWriteValue(iniGroup, "TaskFinished", this.NotificationsAtTaskFinished.ToString());
                ini.IniWriteValue(iniGroup, "NoTask", this.NotificationsAtNoTask.ToString());

                ini.IniWriteValue(iniGroup, "Sounds", this.PlaySounds.ToString());
                ini.IniWriteValue(iniGroup, "SoundsTime", this.PlaySoundsTime.ToString());
                ini.IniWriteValue(iniGroup, "SoundsTaskStarted", this.PlaySoundsAtTaskStarted.ToString());
                ini.IniWriteValue(iniGroup, "SoundsTaskStartedFile", this.PlaySoundsAtTaskStartedFile);
                ini.IniWriteValue(iniGroup, "SoundsTaskFailed", this.PlaySoundsAtTaskFailed.ToString());
                ini.IniWriteValue(iniGroup, "SoundsTaskFailedFile", this.PlaySoundsAtTaskFailedFile);
                ini.IniWriteValue(iniGroup, "SoundsTaskFinished", this.PlaySoundsAtTaskFinished.ToString());
                ini.IniWriteValue(iniGroup, "SoundsTaskFinishedFile", this.PlaySoundsAtTaskFinishedFile);
                ini.IniWriteValue(iniGroup, "SoundsNoTask", this.PlaySoundsAtNoTask.ToString());
                ini.IniWriteValue(iniGroup, "SoundsNoTaskFile", this.PlaySoundsAtNoTaskFile);

                // Updates
                iniGroup = "Updates";
                ini.IniWriteValue(iniGroup, "AtStartup", this.UpdateCheckAtStartup.ToString());
                ini.IniWriteValue(iniGroup, "WhileRunning", this.UpdateCheckWhileRunning.ToString());
                ini.IniWriteValue(iniGroup, "WhileRunningPeriod", this.UpdateCheckWhileRunningPeriod.ToString());

                // Monitor
                iniGroup = "Monitor";
                ini.IniWriteValue(iniGroup, "Monitor", this.Monitor.ToString());
                ini.IniWriteValue(iniGroup, "Notifications", this.MonitorNotifications.ToString());
                ini.IniWriteValue(iniGroup, "NotificationsTime", this.MonitorNotificationsTime.ToString());
                ini.IniWriteValue(iniGroup, "Log", this.MonitorLog.ToString());
                ini.IniWriteValue(iniGroup, "LogFileName", this.MonitorLogFileName);
                ini.IniWriteValue(iniGroup, "LogDirectory", this.MonitorLogDirectory);
                ini.IniWriteValue(iniGroup, "UpdateLog", this.MonitorUpdateLog.ToString());
                ini.IniWriteValue(iniGroup, "UpdateLogFileName", this.MonitorUpdateLogFileName);
                ini.IniWriteValue(iniGroup, "UpdateLogDirectory", this.MonitorUpdateLogDirectory);

                // Reporter
                iniGroup = "Reporting";
                ini.IniWriteValue(iniGroup, "Report", this.Report.ToString());
                ini.IniWriteValue(iniGroup, "ReportRnD", this.ReportRnD.ToString());
                ini.IniWriteValue(iniGroup, "To", this.ReportTo);
                ini.IniWriteValue(iniGroup, "From", this.ReportFrom);
                ini.IniWriteValue(iniGroup, "Subject", this.ReportSubject);
                ini.IniWriteValue(iniGroup, "Message", this.ReportMessage);
                ini.IniWriteValue(iniGroup, "Host", this.ReportHost);
                ini.IniWriteValue(iniGroup, "Port", this.ReportPort.ToString());
                ini.IniWriteValue(iniGroup, "Login", this.ReportLogin);
                ini.IniWriteValue(iniGroup, "Password", this.ReportPassword);
                ini.IniWriteValue(iniGroup, "Attachments", this.ReportAttachments.ToString());
            }
            catch (Exception) { }
        }
Пример #9
0
        public void Save()
        {
            try
            {
                Logger.Instanse.Append("Options: Saving...", LogMessageType.Info);
                if (File.Exists(Path.Combine(Core.MainPath, "Core.ini")))
                {
                    // Removing read-only
                    new FileInfo(Path.Combine(Core.MainPath, "Core.ini"))
                    {
                        Attributes = FileAttributes.Normal
                    };
                }

                // Saving
                IniWorker ini      = new IniWorker(Path.Combine(Core.MainPath, "Core.ini"));
                string    iniGroup = "General";

                // General
                ini.IniWriteValue(iniGroup, "Language", this.Language.ToString());
                ini.IniWriteValue(iniGroup, "MaximumConcurentTasks", this.MaximumConcurentTasks.ToString());
                ini.IniWriteValue(iniGroup, "TimeoutEnabled", this.TimeoutEnabled.ToString());
                ini.IniWriteValue(iniGroup, "Timeout", this.Timeout.ToString());

                // Plugins
                iniGroup = "Plugins";
                ini.IniWriteValue(iniGroup, "Enabled", this.PluginsEnabled.ToString());
                string temp = string.Empty;
                for (int i = 0; i < this.Plugins.Count; i++)
                {
                    temp += this.Plugins[i] + "|";
                }

                ini.IniWriteValue(iniGroup, "Plugins", temp);

                // Log
                iniGroup = "Log";
                ini.IniWriteValue(iniGroup, "Log", this.LogSave.ToString());
                ini.IniWriteValue(iniGroup, "MaxSize", this.LogMaxSize.ToString());
                ini.IniWriteValue(iniGroup, "FileName", this.LogFileName);
                ini.IniWriteValue(iniGroup, "Directory", this.LogDirectory);
                ini.IniWriteValue(iniGroup, "DebugMode", this.LogDebugMode.ToString());

                // Maintenance

                Logger.Instanse.Append("Options: Saved successfully.", LogMessageType.Info);
            }
            catch (Exception)
            {
                Logger.Instanse.Append("Options: Saving failed.", LogMessageType.Info);
            }
        }