public static StatusDatabase P4ParseFstat(string p4Status, string rootDir) { var statusDatabase = new StatusDatabase(); var lines = p4Status.Split(new Char[] { '\r', '\n' }); int numLines = 0; int rootDirLength = rootDir.Length; string rootUnixDir = rootDir.Replace("\\", "/"); List<string> fstatLines = new List<string>(); while (numLines < lines.Length) { String line = lines[numLines++]; if (line.StartsWith("... depotFile")) { AddItemToDatabase(fstatLines.ToArray(), rootDirLength, rootUnixDir, ref statusDatabase); fstatLines.Clear(); } fstatLines.Add(line); } // make sure we get the last one if (fstatLines.Count > 0) { AddItemToDatabase(fstatLines.ToArray(), rootDirLength, rootUnixDir, ref statusDatabase); } return statusDatabase; }
Random _myRng = new Random(); // They're all the rage. #endregion Fields #region Constructors public FileSelector( StatusDatabase db, PlaylistCriteria criteria ) { // Passed us a null reference parameter? Debug.Assert( null != db ); Debug.Assert( null != criteria ); _database = db; _criteria = criteria; }
public static StatusDatabase P4ParseStatus(string p4Status, String username) { // p4 status command returns status of unversioned files var statusDatabase = new StatusDatabase(); var lines = p4Status.Split(new Char[] { '\r', '\n' }); foreach (String line in lines) { if (line.IndexOf(" - reconcile") == -1) continue; // sometimes output may contain blank lines... var status = ParseStatusLine(line, username); string assetPath = line.Substring(0, line.IndexOf(" - reconcile")).Replace('\\', '/').Trim().Replace(P4Util.Instance.Vars.unixWorkingDirectory + "/", ""); status.assetPath = new ComposedString(assetPath); statusDatabase[status.assetPath] = status; } return statusDatabase; }
private static void AddItemToDatabase(string[] fstatLines, int rootDirLength, string rootUnixDir, ref StatusDatabase statusDatabase) { if (fstatLines.Length > 0) { P4FStatData fileData = new P4FStatData(); fileData.ReadFromLines(fstatLines); string unixPath = fileData.clientFile.Replace("\\", "/"); if (unixPath.Length > rootDirLength) { string assetPath = unixPath.Remove(0, rootDirLength + 1); if (unixPath.Contains(rootUnixDir)) { var status = PopulateFromFstatData(fileData); status.assetPath = assetPath; statusDatabase[new ComposedString(assetPath)] = status; } } } }
private static StatusDatabase ParseStatusResult(XmlDocument xmlDoc) { if (!xmlDoc.HasChildNodes) return null; var statusDatabase = new StatusDatabase(); XmlNodeList entries = xmlDoc.GetElementsByTagName("entry"); foreach (XmlNode entryIt in entries) { ComposedString assetPath = new ComposedString((entryIt.Attributes["path"].InnerText.Replace('\\', '/')).Trim()); var status = ParseXMLNode(entryIt); status.assetPath = assetPath; statusDatabase[assetPath] = status; } XmlNodeList changelists = xmlDoc.GetElementsByTagName("changelist"); foreach (XmlNode changelistIt in changelists) { string changelist = changelistIt.Attributes["name"].InnerText; foreach (XmlNode entryIt in changelistIt.ChildNodes) { ComposedString assetPath = new ComposedString((entryIt.Attributes["path"].InnerText.Replace('\\', '/')).Trim()); if (statusDatabase.ContainsKey(assetPath)) { statusDatabase[assetPath].changelist = changelist; if (changelist == SVNCommands.localEditChangeList) { statusDatabase[assetPath].allowLocalEdit = true; } } } } foreach (var assetPathIt in new List<ComposedString>(statusDatabase.Keys)) { string assetPathStr = assetPathIt.Compose(); if (Directory.Exists(assetPathStr)) { var status = statusDatabase[assetPathIt]; if (status.fileStatus == VCFileStatus.Unversioned) { foreach (var unversionedIt in GetFilesInFolder(assetPathStr)) { var fileStatus = new VersionControlStatus { assetPath = unversionedIt, fileStatus = VCFileStatus.Unversioned, }; statusDatabase[unversionedIt] = fileStatus; } } } } return statusDatabase; }
public DecoratorLoopback(DataCarrier carrier, StatusDatabase statusDatabase) { dataCarrier = carrier; this.statusDatabase = statusDatabase; }
static void _CreateDatabase( string connectionString ) { StatusDatabase db = new StatusDatabase( connectionString ); db.CreateTablesIfNecessary(); }
/// /// \warning When creating an object for remoting, call Init() and /// access the singleton returned by theBackend. This constructor /// is public only for use by non-remoting configurations. /// public Backend( int desiredQueueSize, string connectionString, Quality qualityLevel, Backend.CompressionType compressionType, string metadataFileName ) { _Trace( "[Backend]" ); _qualityLevel = qualityLevel; _compressionType = compressionType; _desiredQueueSize = desiredQueueSize; _connectionString = connectionString; if (null == _connectionString) throw new ApplicationException( "Engine is not properly initialized by the server" ); _database = new StatusDatabase( _connectionString ); _metadataSender = new MetadataSender( metadataFileName ); // Todo: initialize compressor from stored settings in database _compressor = _LoadCompressor(); // Get defaults from this kind of thing? // string bufferSize = // ConfigurationSettings.AppSettings ["BufferSize"]; // Set up default buffering for the audio engine _player = new Player(); _player.bufferSize = 44100 / 8 ; _player.buffersInQueue = 40; _player.buffersToPreload = 20; // Set up callbacks _player.OnTrackFinished += new TrackFinishedHandler( _TrackFinishedCallback ); _player.OnTrackPlayed += new TrackStartingHandler( _TrackStartingCallback ); _player.OnReadBuffer += new ReadBufferHandler( _TrackReadCallback ); }