public void AddProject(RenderProject project) { project.ProjectId = (RenderProject.NextProjectId++); project.Owner = User; project.GenerateRenderJobs(); ServerServices.AddProject(project); }
public static void ReplaceProject(int projectId, RenderProject project) { lock (_clients) { lock (Projects) { RenderProject oldproject = null; foreach (RenderProject p in Projects) { if (p.ProjectId == projectId) { oldproject = p; break; } } Projects.Remove(oldproject); foreach (ClientConnection c in _clients) { if (c.CurrentRender == oldproject) { c.CurrentRender = null; c.PriorityJobs.Add(new KillJob()); } } project.IsFinished = false; project.StartTimeSet = false; project.UpdateTimeSet = false; if (project.StartJobs > 0) { Projects.Add(project); // Check if project is in the Finished list and remove it foreach (RenderProject p in Projects) { if (p.ProjectId == project.ProjectId) { FinishedProjects.Remove(p); } } } else { project.FinalStatus = "No Frames to Render"; project.IsFinished = true; FinishedProjects.Add(project); } } } CallUpdateProjectList(); CallUpdateFinishedList(); }
public RenderProject Load(string filename) { RenderProject project = new RenderProject(); try { XmlSerializer s = new XmlSerializer(typeof(RenderProject)); TextReader r = new StreamReader(filename); project = (RenderProject)s.Deserialize(r); r.Close(); } catch (Exception ex) { logger.Error(ex, "Error loading file: " + filename); } return(project); }
public static void StopProject(int id) { RenderProject proj = null; lock (_clients) { lock (Projects) { foreach (RenderProject t in Projects) { if (t.ProjectId == id) { proj = t; t.RemoveAllJobs(); break; } } } // Check all the clients if any use the current project, // if yes set as null and kill any jobs. if (proj != null) { foreach (ClientConnection t in _clients) { if (t.CurrentRender == proj) { t.CurrentRender = null; t.PriorityJobs.Add(new KillJob()); } } Projects.Remove(proj); proj.RenderedFrameCount = proj.RenderedFrames.Count; proj.FinalStatus = "Stopped"; if (proj.StartTimeSet && proj.UpdateTimeSet) { proj.RenderTime = proj.UpdateTime - proj.StartTime; } proj.IsFinished = true; FinishedProjects.Add(proj); } } CallUpdateProjectList(); CallUpdateFinishedList(); }
public static void RemoveFinished(RenderProject project, bool needToLock) { if (needToLock) { lock (_clients) { lock (Projects) { FinishedProjects.Remove(project); } } } else { FinishedProjects.Remove(project); } CallUpdateFinishedList(); }
public static void AddProject(RenderProject project) { lock (Projects) { if (project.StartJobs > 0) { Projects.Add(project); } else { project.FinalStatus = "No Frames to Render"; project.IsFinished = true; FinishedProjects.Add(project); } } CallUpdateProjectList(); CallUpdateFinishedList(); }
public void RemoveProject(RenderProject project, bool needToLock) { if (needToLock) { lock (_clients) { lock (Projects) { RemoveProject(project); } } } else { RemoveProject(project); } CallUpdateProjectList(); CallUpdateFinishedList(); }
private static void RemoveProject(RenderProject project) { while (FinishedProjects.Count > 50) { FinishedProjects.RemoveAt(0); } GC.Collect(); project.RenderedFrameCount = project.RenderedFrames.Count; project.RenderTime = DateTime.Now - project.StartTime; project.FinalStatus = "Finished"; FinishedProjects.Add(project); Projects.Remove(project); foreach (ClientConnection t in _clients) { if (t.CurrentRender == project) { t.CurrentRender = null; } } }
public void RemoveFinished(RenderProject project) { ServerServices.RemoveFinished(project, true); }
public bool HasJobs() { if (_currConnection == null) { return(false); } if (!_currConnection.IsOnline) { return(false); } lock (_clients) { lock (Projects) { _currConnection.KeepAlive(); // Either paused or activation time disable it... if (!_currConnection.CanBeUsed) { return(false); } if (_currConnection.CurrentRender == null && Projects.Count > 0) { RenderProject project = null; foreach (RenderProject t in Projects) { if (t.Paused == false && t.Config == _currConnection.Config && t.HasFreeJobs()) { project = t; break; } } if (project != null) { if (!project.StartTimeSet) { project.StartTimeSet = true; project.StartTime = DateTime.Now; } _currConnection.CurrentRender = project; if (IsFirstClient()) { AddMessage(2, "Sending scene " + _currConnection.CurrentRender.SceneId + " to " + _currConnection.HostName + " (" + _currConnection.IPAddress + ")"); ChangeCurrentJobLabel("Downloading content for " + _currConnection.CurrentRender.SceneId); _currConnection.IsReady = false; _currConnection.Jobs.AddRange(_currConnection.CurrentRender.GetContentJobs()); _currConnection.Jobs.Add(new ClientReadyJob()); } else { ChangeCurrentJobLabel("Project " + _currConnection.CurrentRender.SceneId + " assigned. Waiting for first node on host."); _currConnection.Jobs.Add(new WaitFirstJob()); } } } else if (_currConnection.CurrentRender != null && _currConnection.Jobs.Count == 0) { if (_currConnection.CurrentRender.Paused == false && _currConnection.CurrentRender.HasFreeJobs()) { AddMessage(4, "Node " + _currConnection.HostName + " (" + _currConnection.IPAddress + ")" + ":" + _currConnection.Instance + " getting frame(s) job"); _currConnection.Jobs.Add(_currConnection.CurrentRender.GetRenderJob(_currConnection.Id, _currConnection.Instance)); } } CallUpdateProjectList(); if (_currConnection.Jobs.Count > 0) { return(true); } _currConnection.CurrentRender = null; ChangeCurrentJobLabel(""); return(false); } } }
public static void RemoveFinished(RenderProject project, bool needToLock) { if (needToLock) { lock (_clients) { lock (Projects) { FinishedProjects.Remove(project); } } } else FinishedProjects.Remove(project); CallUpdateFinishedList(); }
public static void ReplaceProject(int projectId, RenderProject project) { lock (_clients) { lock (Projects) { RenderProject oldproject = null; foreach (RenderProject p in Projects) { if (p.ProjectId == projectId) { oldproject = p; break; } } Projects.Remove(oldproject); foreach (ClientConnection c in _clients) { if (c.CurrentRender == oldproject) { c.CurrentRender = null; c.PriorityJobs.Add(new KillJob()); } } project.IsFinished = false; project.StartTimeSet = false; project.UpdateTimeSet = false; if (project.StartJobs > 0) { Projects.Add(project); // Check if project is in the Finished list and remove it foreach (RenderProject p in Projects) { if (p.ProjectId == project.ProjectId) FinishedProjects.Remove(p); } } else { project.FinalStatus = "No Frames to Render"; project.IsFinished = true; FinishedProjects.Add(project); } } } CallUpdateProjectList(); CallUpdateFinishedList(); }
private void RestoreProjectInfo(RenderProject project) { OverrideSettings.Checked = project.OverrideSettings; OverwriteFrames.Checked = project.OverwriteFrames; textScene.Text = project.SceneFile; textContentDir.Text = project.ContentDir; textOutputDir.Text = project.OutputDir; listConfig.SelectedIndex = project.Config; textPrefix.Text = project.Prefix; listImageFormat.SelectedIndex = project.ImageFormat; AlphaImageFormat.SelectedIndex = project.AlphaImageFormat; listOuputFormat.SelectedIndex = project.FileNameFormat; textStartFrame.Text = project.StartFrame.ToString(); textEndFrame.Text = project.EndFrame.ToString(); textFrameStep.Text = project.FrameSteps.ToString(); imageWidth.Text = project.Width.ToString(); imageHeight.Text = project.Height.ToString(); renderBlock.Text = project.Block.ToString(); imageAspect.Text = project.Aspect.ToString(); slicesDown.Text = project.SlicesDown.ToString(); slicesAcross.Text = project.SlicesAcross.ToString(); slicesOverlap.Text = project.Overlap.ToString(); deleteSplitFrames.Checked = project.DeleteSplitFrames; renderMode.SelectedIndex = project.RenderMode; traceShadow.Checked = (project.RenderEffect & 1) != 0; traceReflection.Checked = (project.RenderEffect & 2) != 0; traceRefraction.Checked = (project.RenderEffect & 4) != 0; traceTransp.Checked = (project.RenderEffect & 8) != 0; traceOcclusion.Checked = (project.RenderEffect & 16) != 0; recusionLimit.Value = project.RecursionLimit; renderLine.Checked = (project.RenderLine == 1); adaptiveThreshold.Text = "" + project.AdaptiveThreshold; adaptiveSampling.Checked = project.AdaptiveSampling == 1; reconFilter.SelectedIndex = project.ReconFilter; softFilter.Checked = project.FilterType == 1; if (project.StartFrame == project.EndFrame) { slicesDown.Enabled = true; slicesAcross.Enabled = true; slicesOverlap.Enabled = true; lblNbSlices.Enabled = true; lblSlicesOverlap.Enabled = true; deleteSplitFrames.Enabled = true; } else { slicesDown.Enabled = false; slicesAcross.Enabled = false; slicesOverlap.Enabled = false; lblNbSlices.Enabled = false; lblSlicesOverlap.Enabled = false; deleteSplitFrames.Enabled = false; } masterList.Items.Clear(); textContentDir.Text = project.ContentDir; string[] lines = _server.FileReadAllLines(textScene.Text); _cameraTypes.Clear(); cameraName.Items.Clear(); cameraType.Text = "Classic"; foreach (string l in lines) { if (l.StartsWith("CameraName ")) cameraName.Items.Add(l.Substring(l.LastIndexOf(' ') + 1)); else if (l.StartsWith("Plugin CameraHandler")) { string[] p = l.Split(' '); _cameraTypes.Add(p[3]); } else if (l.StartsWith("Plugin MasterHandler")) { string[] p = l.Split(' '); masterList.Items.Add(p[3], project.StrippedMaster.Contains(p[3])); } } cameraName.SelectedIndex = project.Camera; cameraAntialias.Value = project.CameraAntialias; cameraMinSamples.Value = project.MinSamples; cameraMaxSamples.Value = project.MaxSamples; samplingPattern.SelectedIndex = project.SamplingPattern; if (cameraType.Text == "Classic") { // New antialias if (project.AntialiasLevel == -1) { if (project.Antialias == 0) classicAntialias.SelectedIndex = 0; else classicAntialias.SelectedIndex = project.AntialiasLevel + 1; } // Old else classicAntialias.SelectedIndex = 14 + project.Antialias * 2 + project.EnhanceAA; } else classicAntialias.SelectedIndex = 0; cameraName_SelectedIndexChanged(null, null); radiosityType.SelectedIndex = project.Radiosity + project.RadiosityType; interpolatedGI.Checked = (project.InterpolatedGI == 1); backdropTranspGI.Checked = (project.BackdropTranspGI == 1); cachedGI.Checked = (project.CachedGI == 1); volumetricGI.Checked = (project.VolumetricGI == 1); useAmbientGI.Checked = (project.UseAmbientGI == 1); directionalGI.Checked = (project.DirectionalGI == 1); intensityGI.Text = string.Format("{0:0.00}", project.IntensityGI * 100.0); toleranceGI.Text = string.Format("{0:0.00}", project.ToleranceGI * 100.0); rayGI.Value = project.RayGI; minEvalGI.Text = string.Format("{0:0.00}", project.MinEvalGI * 1000.0); minPixelGI.Text = string.Format("{0:0.00}", project.MinPixelGI); indirectGI.Value = project.IndirectGI; emailNotify.Checked = project.EmailNotify; emailTo.Text = project.EmailTo; emailSubjectOk.Text = project.EmailSubjectOk; emailSubjectNotOk.Text = project.EmailSubjectNotOk; emailContainLog.Checked = project.EmailContainLog; }
private void btnSaveProject_Click(object sender, EventArgs e) { _shouldClose = false; SaveFileDialog dlg = new SaveFileDialog(); dlg.FileName = _currentFileName; dlg.AddExtension = true; dlg.DefaultExt = "xprj"; dlg.Filter = "Amleto project file (*.xprj)|*.xprj"; if (dlg.ShowDialog() != DialogResult.OK || dlg.FileName == "") { _shouldClose = false; return; } FileInfo f = new FileInfo(dlg.FileName); Text = "Add project to the queue - " + f.Name; _currentFileName = f.Name; RenderProject project = new RenderProject(); StoreProjectInfo(project); if (project.Save(dlg.FileName) == false) { MessageBox.Show("Error while saving " + f.Name, "Error while saving", MessageBoxButtons.OK, MessageBoxIcon.Error); } _shouldClose = false; }
public void RemoveProject(RenderProject project, bool needToLock) { if (needToLock) { lock (_clients) { lock (Projects) { RemoveProject(project); } } } else RemoveProject(project); CallUpdateProjectList(); CallUpdateFinishedList(); }
private void StoreProjectInfo(RenderProject project) { project.SceneFile = textScene.Text; project.ContentDir = textContentDir.Text; project.OutputDir = textOutputDir.Text; project.Config = listConfig.SelectedIndex; project.StartFrame = Convert.ToInt32(textStartFrame.Text); project.EndFrame = Convert.ToInt32(textEndFrame.Text); project.FrameSteps = Convert.ToInt32(textFrameStep.Text); project.Prefix = textPrefix.Text; project.ImageFormat = listImageFormat.SelectedIndex; project.AlphaImageFormat = AlphaImageFormat.SelectedIndex; project.SaveAlpha = SaveAlpha.Checked; project.AlphaPrefix = AlphaPrefix.Text; project.AlphaImageFormat = AlphaImageFormat.SelectedIndex; project.SaveAlpha = SaveAlpha.Checked; project.AlphaPrefix = AlphaPrefix.Text; project.FileNameFormat = listOuputFormat.SelectedIndex; project.Width = Convert.ToInt32(imageWidth.Text); project.Height = Convert.ToInt32(imageHeight.Text); project.Block = Convert.ToInt32(renderBlock.Text); project.SlicesDown = Convert.ToInt32(slicesDown.Text); project.SlicesAcross = Convert.ToInt32(slicesAcross.Text); project.Overlap = Convert.ToInt32(slicesOverlap.Text); project.DeleteSplitFrames = deleteSplitFrames.Checked; project.ReconFilter = reconFilter.SelectedIndex; project.AdaptiveSampling = (adaptiveSampling.Checked ? 1 : 0); project.FilterType = (softFilter.Checked ? 1 : 0); project.OverrideSettings = OverrideSettings.Checked; project.OverwriteFrames = OverwriteFrames.Checked; if (classicAntialias.SelectedIndex == 0) // No antialias { project.Antialias = 0; project.AntialiasLevel = -1; /*project.reconFilter = 0; project.adaptiveSampling = 0; project.enhanceAA = 0;*/ } else if (classicAntialias.SelectedIndex >= 14) // Old antialias { project.Antialias = (classicAntialias.SelectedIndex - 14) / 2; project.EnhanceAA = (classicAntialias.SelectedIndex - 14) % 2; project.AntialiasLevel = -1; } else // New { if (classicAntialias.SelectedIndex > 13) project.Antialias = 4; else if (classicAntialias.SelectedIndex > 9) project.Antialias = 3; else if (classicAntialias.SelectedIndex > 5) project.Antialias = 2; else project.Antialias = 1; project.AntialiasLevel = classicAntialias.SelectedIndex - 1; project.EnhanceAA = 0; } project.Aspect = Convert.ToDouble(imageAspect.Text); project.RenderEffect = (traceShadow.Checked ? 1 : 0) | (traceReflection.Checked ? 2 : 0) | (traceRefraction.Checked ? 4 : 0) | (traceTransp.Checked ? 8 : 0) | (traceOcclusion.Checked ? 16 : 0); project.RenderMode = renderMode.SelectedIndex; project.RecursionLimit = (int)recusionLimit.Value; project.RenderLine = (renderLine.Checked ? 1 : 0); project.AdaptiveThreshold = adaptiveThreshold.Text; project.Camera = cameraName.SelectedIndex; project.SamplingPattern = samplingPattern.SelectedIndex; project.CameraAntialias = (int)cameraAntialias.Value; project.MinSamples = (int)cameraMinSamples.Value; project.MaxSamples = (int)cameraMaxSamples.Value; if (radiosityType.SelectedIndex == 0) { project.Radiosity = 0; project.RadiosityType = 0; } else { project.Radiosity = 1; project.RadiosityType = radiosityType.SelectedIndex - 1; } project.InterpolatedGI = interpolatedGI.Checked ? 1 : 0; project.BackdropTranspGI = backdropTranspGI.Checked ? 1 : 0; project.CachedGI = cachedGI.Checked ? 1 : 0; project.VolumetricGI = volumetricGI.Checked ? 1 : 0; project.UseAmbientGI = useAmbientGI.Checked ? 1 : 0; project.DirectionalGI = directionalGI.Checked ? 1 : 0; project.IntensityGI = (Convert.ToDouble(intensityGI.Text) / 100.0); project.ToleranceGI = (Convert.ToDouble(toleranceGI.Text) / 100.0); project.RayGI = (int)rayGI.Value; project.MinEvalGI = Convert.ToDouble(minEvalGI.Text) / 1000.0; project.MinPixelGI = Convert.ToDouble(minPixelGI.Text); project.IndirectGI = (int)indirectGI.Value; project.EmailNotify = emailNotify.Checked; project.EmailTo = emailTo.Text; project.EmailSubjectOk = emailSubjectOk.Text; project.EmailSubjectNotOk = emailSubjectNotOk.Text; project.EmailContainLog = emailContainLog.Checked; project.EmailFrom = _server.EmailFrom; project.SmtpServer = _server.SmtpServer; project.SmtpUsername = _server.SmtpUsername; project.SmtpPassword = _server.SmtpPassword; foreach (string s in masterList.CheckedItems) { project.StrippedMaster.Add(s); _server.StrippedMasterAdd(s); } foreach (string s in masterList.Items) { if (!project.StrippedMaster.Contains(s)) _server.StrippedMasterRemove(s); } }
public RenderProject Load(string filename) { RenderProject project = new RenderProject(); try { XmlSerializer s = new XmlSerializer(typeof(RenderProject)); TextReader r = new StreamReader(filename); project = (RenderProject)s.Deserialize(r); r.Close(); } catch (Exception ex) { logger.Error(ex, "Error loading file: " + filename); } return project; }
public void ReplaceProject(int projectId, RenderProject project) { project.GenerateRenderJobs(); ServerServices.ReplaceProject(projectId, project); }
private void ServerWin_Shown(object sender, EventArgs e) { string version = Assembly.GetExecutingAssembly().GetName().Version.Major.ToString(); version = version + "." + Assembly.GetExecutingAssembly().GetName().Version.Minor; version = version + "." + Assembly.GetExecutingAssembly().GetName().Version.Build; Text = "Amleto Server " + version; BroadcastFinder findMaster = new BroadcastFinder(); if (findMaster.Server != "") // Let's connect to the master { _isMaster = false; try { // Find a free port for the callback... for (int i = 10000; i < 60000; i++) { try { BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider(); serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full; BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider(); IDictionary props = new Hashtable(); props["port"] = i; _channel = new TcpChannel(props, clientProv, serverProv); break; } catch (Exception ex) { logger.Error(ex, "Error creating TCP channel"); } } ChannelServices.RegisterChannel(_channel, false); _masterServer = (MasterServer)Activator.CreateInstance(typeof(MasterServer), new object[] { Environment.UserName }, new object[] { new UrlAttribute("tcp://" + findMaster.Server + ":" + findMaster.Port) }); List<string> oldMessages = _masterServer.GetOldMessages(); foreach (string s in oldMessages) DoConsumeMessage(s); List<FinishedFrame> oldFrames = _masterServer.GetOldFrames(); DoAddFrames(oldFrames); RepaintClientList(); RepaintProjectList(); Text = Text + " - Terminal"; } catch (Exception ex) { logger.Error(ex, "Error initialising server"); } } else // We should be master { _masterServer = new MasterServer(Environment.UserName); _isMaster = true; Text = Text + " - Master"; } if (_masterServer.RestoreSettings() == false || _masterServer.NbConfigs == 0) { SetupWin dlg = new SetupWin(_masterServer, false); dlg.ScanAllConfigs(); if (dlg.ShowDialog() != DialogResult.OK) Application.Exit(); _masterServer.Port = dlg.Port; _masterServer.AutoOfferPort = dlg.AutoPort; _masterServer.ReplaceConfigs(dlg.Configs); _masterServer.LogFile = dlg.LogFile; _masterServer.EmailFrom = dlg.EmailFrom; _masterServer.SmtpServer = dlg.SmtpServer; _masterServer.SmtpUsername = dlg.SmtpUsername; _masterServer.SmtpPassword = dlg.SmtpPassword; _masterServer.OfferWeb = dlg.OfferWeb; _masterServer.OfferWebPort = dlg.OfferWebPort; _masterServer.RenderBlocks = dlg.RenderBlocks; string res = _masterServer.SetMappedDrives(dlg.MappedDrives); if (res != "") MessageBox.Show(res); _masterServer.SaveSettings(); } _eventBridge = new EventBridge(RefreshClientList, RefreshProjectList, RefreshFinishedList, ShowImage, ConsumeMessage, ShowClientLog); _masterServer.AddClientStatus(_eventBridge.ClientRefresh); _masterServer.AddProjectStatus(_eventBridge.ProjectRefresh); _masterServer.AddFinishedStatus(_eventBridge.FinishedRefresh); _masterServer.AddImagePreview(_eventBridge.ImagePreview); _masterServer.AddMessageConsumer(_eventBridge.MessageConsume); if (_isMaster) { _masterServer.Startup(); // Restore previously saved jobs string loadPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Amleto"); loadPath = Path.Combine(loadPath, "RenderJobs"); if (Directory.Exists(loadPath)) { DirectoryInfo bufferPath = new DirectoryInfo(loadPath); foreach (FileInfo file in bufferPath.GetFiles("*.xml")) { RenderProject project = new RenderProject(); project = project.Load(file.FullName); _masterServer.AddProject(project); } } } DoConsumeMessage("Clearing thumbnail cache"); string thumbnailPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "Amleto"); thumbnailPath = Path.Combine(thumbnailPath, @"Cache\thumbnails"); try { if (Directory.Exists(thumbnailPath)) Directory.Delete(thumbnailPath, true); } catch (Exception ex) { logger.Error(ex, "Error clearing thumbnail cache"); } }
private void btnLoadProject_Click(object sender, EventArgs e) { _shouldClose = false; OpenFileDialog dlg = new OpenFileDialog(); dlg.DefaultExt = "xprj"; dlg.Filter = "Amleto project file (*.xprj)|*.xprj"; if (dlg.ShowDialog() != DialogResult.OK || dlg.FileName == "") { _shouldClose = false; return; } try { RenderProject project = new RenderProject(); project = project.Load(dlg.FileName); RestoreProjectInfo(project); btnAdd.Enabled = true; FileInfo f = new FileInfo(dlg.FileName); Text = "Add project to the queue - " + f.Name; _currentFileName = f.Name; } catch (Exception ex) { logger.Error(ex, "Error loading project"); } dlg.Dispose(); _shouldClose = false; }
public AddProject(MasterServer server, RenderProject prj) : this(server) { Text = "Edit project"; if (prj.IsFinished) { btnAdd.Text = "Restart"; textViewLog.Text = prj.Log.Replace("\n", "\r\n"); renderSetupTabs.TabPages.Add(logTab); } else { btnAdd.Text = "Save"; } btnAdd.Enabled = true; btnLoadProject.Enabled = false; _projectId = prj.ProjectId; _project = prj; textScene.Enabled = false; btnSelectScene.Enabled = false; RestoreProjectInfo(_project); }
private static void RemoveProject(RenderProject project) { while (FinishedProjects.Count > 50) FinishedProjects.RemoveAt(0); GC.Collect(); project.RenderedFrameCount = project.RenderedFrames.Count; project.RenderTime = DateTime.Now - project.StartTime; project.FinalStatus = "Finished"; FinishedProjects.Add(project); Projects.Remove(project); foreach (ClientConnection t in _clients) { if (t.CurrentRender == project) t.CurrentRender = null; } }
private void btnAdd_Click(object sender, EventArgs e) { _settings.SendEmail = emailNotify.Checked; _settings.ToEmail = emailTo.Text; _settings.SubjectOk = emailSubjectOk.Text; _settings.SubjectNotOk = emailSubjectNotOk.Text; ServerSettings.SaveSettings(_settings); if (_projectId != -1 && _project.IsFinished) { if (MessageBox.Show("Saving changes will start the project.\nAre you sure you want to restart it?", "Save changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; _project.IsFinished = false; } else if (_projectId != -1) { if (MessageBox.Show("Saving changes will reset the project status.", "Save changed", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) return; } if (!_server.DirectoryExists(textOutputDir.Text)) { if (MessageBox.Show("Output directory doesn't exists. Do you want to create it?", "Directory doesn't exist", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return; _server.CreateDirectory(textOutputDir.Text); } if (_projectId == -1) _project = new RenderProject(); StoreProjectInfo(_project); if (_projectId == -1) _server.AddProject(_project); else _server.ReplaceProject(_projectId, _project); _shouldClose = true; Close(); }