public bool SaveChanges() { string data = "#Rykon Server configuration file v1.0 be carefull !!"; data += "\r\nShowDateTime=" + Val(ShowDateTime); data += "\r\nShowMessageError=" + Val(ShowMessageError); data += "\r\nShowDirIcon=" + Val(ShowDirIcon); data += "\r\nShowHostAndPort=" + Val(ShowHostAndPort); data += "\r\nShowPoweredByEnd=" + Val(ShowPoweredByEnd); data += "\r\nPoweredByEnd=" + (PoweredByEnd); data += "\r\nAutoStartListening=" + Val(AutoStartListening); data += "\r\nPort=" + (Port); data += "\r\nScreenShotEvery=" + (ScreenShotEvery); data += "\r\nPublicServer=" + Val(IsPublicServer); data += "\r\nRootDirectory=" + (RootDirectory); data += "\r\nShowFullPaths=" + Val(ShowFullPaths); data += "\r\nEnableListen=" + Val(EnableVideo); data += "\r\nEnableListen=" + Val(EnableListen); data += "\r\nEnableControler=" + Val(EnableControler); data += "\r\nEnableStream=" + (EnableStream); data += "\r\nServerAuthId=" + (ServerAuthId); data += "\r\nServerAuthPass="******"\r\nVideoPassword="******"\r\nControlPassword="******"\r\nListenPassword="******"\r\nStreamPassword="******"\r\nUploadPassword="******"\r\nSecureVideo=" + (SecureVideo); data += "\r\nSecureStream=" + (SecureStream); data += "\r\nSecureControl=" + (SecureControl); data += "\r\nSecureListen=" + (SecureListen); data += "\r\nSecureUpload=" + (SecureUpload); data += "\r\nMainApp=" + (MainApp); try { AppHelper.RepairPath(FilePath); System.IO.File.WriteAllText(this.FilePath, data); saved = true; } catch { saved = false; } return(saved); }
public static string GetRootDirectory(string alter = "") { string d = global::RykonServer.Properties.Settings.Default.RootDir; if (d == "\\RootDir\\" && AppHelper.ExistedDir(alter)) { d = alter + ((!alter.EndsWith("\\RootDir\\"))?"\\RootDir\\":""); } if (AppHelper.ExistedDir(d) == false) { d = alter + "\\RootDir\\"; AppHelper.RepairPath(d, true); } return(d); }
internal static List <Rykonpath> getDirectoryPaths(string dir, string rootdirectory, out int sepindex) { sepindex = 0; try { if (AppHelper.ExistedDir(dir) == false) { dir = AppHelper.RepairPathSlashes(dir); AppHelper.RepairPath(dir); } if (AppHelper.ExistedDir(dir) == false) { return(null); } List <Rykonpath> resul = new List <Rykonpath>(); string[] files = AppHelper.GetFiles(dir); string[] dirs = AppHelper.GetDirectories(dir); if (dirs != null) { foreach (string d in dirs) { resul.Add(new Rykonpath(d, Rykonpathtype.directory, rootdirectory)); } } if (files != null) { foreach (string f in files) { resul.Add(new Rykonpath(f, Rykonpathtype.File, rootdirectory)); } } sepindex = dirs.Length; return(resul); } catch { return(null); } }