示例#1
0
		public static ZipHandle OpenArchive64 (ZlibFileFuncDef64 funcDef, Append append)
		{
			ZipHandle h = zipOpen2_64 ("", (int) append, IntPtr.Zero, ref funcDef);
			if (h.IsInvalid)
				throw new Exception ("Could not open the zip archive");
			return h;
		}
        public void When_Key_Exists_Append_Succeeds()
        {
            const string key = "Hello";
            const string expected = "Hello!";

            //clean up old keys
            var deleteOperation = new Delete(key, GetVBucket(), Converter, Serializer);
            IOStrategy.Execute(deleteOperation);

            deleteOperation = new Delete(key + "!", GetVBucket(),  Converter, Serializer);
            IOStrategy.Execute(deleteOperation);

            //create the key
            var set = new Set<string>(key, "Hello", GetVBucket(), Converter);
            var addResult = IOStrategy.Execute(set);
            Assert.IsTrue(addResult.Success);

            var append = new Append<string>(key, "!", Serializer, GetVBucket(), Converter);
            var result = IOStrategy.Execute(append);

            
            Assert.IsTrue(result.Success);
            Assert.AreEqual(string.Empty, result.Value);

            var get = new Get<string>(key, GetVBucket(),  Converter, Serializer);
            var getResult = IOStrategy.Execute(get);
            Assert.AreEqual(expected, getResult.Value);
        }
 public void Test_Clone()
 {
     var operation = new Append<string>("Hello", "!", GetVBucket(), Transcoder, OperationLifespanTimeout);
     var cloned = operation.Clone();
     Assert.AreEqual(operation.CreationTime, cloned.CreationTime);
     Assert.AreEqual(operation.Cas, cloned.Cas);
     Assert.AreEqual(operation.VBucket.Index, cloned.VBucket.Index);
     Assert.AreEqual(operation.Key, cloned.Key);
     Assert.AreEqual(operation.Opaque, cloned.Opaque);
     Assert.AreEqual(operation.RawValue, ((OperationBase<string>)cloned).RawValue);
 }
示例#4
0
        public override async Task OnStartAsync(StartArgs args)
        {
            // show splash

            if (args.StartKind == StartKinds.Launch && args.Arguments is ILaunchActivatedEventArgs e)
            {
                Window.Current.Content = new SplashPage(e.SplashScreen);
            }

            // built initial path

            var path = PathBuilder
                       .Create(true, nameof(MainPage), ("Filter", "Plumber"))
                       .Append(nameof(MainPage), ("Record", "567"), ("ScrollPosition", "234"))
                       .ToString();

            // do initial navigation (hide splash)

            var shell = Central.Container.Resolve <ShellPage>();
            await shell.ShellView.NavigationService.NavigateAsync(path);

            Window.Current.Content = shell;
        }
        /// <summary>
        /// Appends a value to a give key.
        /// </summary>
        /// <param name="key">The key to append too.</param>
        /// <param name="value">The value to append to the key.</param>
        /// <returns></returns>
        public IOperationResult <string> Append(string key, string value)
        {
            IVBucket vBucket;
            var      server = GetServer(key, out vBucket);

            var operation       = new Append <string>(key, value, _serializer, vBucket, _converter);
            var operationResult = server.Send(operation);

            if (CheckForConfigUpdates(operationResult))
            {
                Log.Info(m => m("Requires retry {0}", key));
            }
            return(operationResult);
        }
示例#6
0
 public override int GetHashCode()
 {
     unchecked
     {
         var hashCode = base.GetHashCode();
         hashCode = (hashCode * 397) ^ Append.GetHashCode();
         hashCode = (hashCode * 397) ^ (FileContents != null ? FileContents.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ (OutputPath != null ? OutputPath.GetHashCode() : 0);
         hashCode = (hashCode * 397) ^ Overwrite.GetHashCode();
         hashCode = (hashCode * 397) ^ AppendTop.GetHashCode();
         hashCode = (hashCode * 397) ^ AppendBottom.GetHashCode();
         return(hashCode);
     }
 }
示例#7
0
        public override async Task OnStartAsync(StartArgs args)
        {
            // show splash

            if (args.StartKind == StartKinds.Launch && args.Arguments is ILaunchActivatedEventArgs e)
            {
                Window.Current.Content = new SplashPage(e.SplashScreen);
            }

            // built initial path

            var path = PathBuilder
                       .Create(nameof(MainPage), ("Record", "0567"))
                       .Append(nameof(MainPage), ("Record", "1567"))
                       .Append(nameof(MainPage), ("Record", "2567"))
                       .Append(nameof(MainPage), ("Record", "3567"))
                       .Append(nameof(MainPage), ("Record", "4567"))
                       .Append(nameof(MainPage), ("Record", "5567"))
                       .Append(nameof(MainPage), ("Record", "6567"))
                       .ToString();

            // initialize services

            var data = Container.Resolve <IDataService>();
            await data.InitializeAsync();

            // setup shell

            var shell = Container.Resolve <ShellPage>();

            Window.Current.Content = shell;

            // first page

            var navigationService = shell.ShellView.NavigationService;
            await navigationService.NavigateAsync(path);
        }
示例#8
0
        /// <summary>
        /// Add new plugin.
        /// </summary>
        private void AddPlugins()
        {
            foreach (string pluginName in _config.plugins)
            {
                string command = String.Format("cordova plugin add {0}", pluginName);
                string success = String.Format(_rm.GetString("AddPlugins1"), pluginName);
                string fail    = String.Format(_rm.GetString("AddPlugins2"), pluginName);

                using (var process = new HostData(command, true, "", success, fail))
                {
                    Append append = AppendText;
                    process.Run(append);
                }
            }
        }
        public async Task <IMutationResult> AppendAsync(string id, byte[] value, AppendOptions options)
        {
            using (var op = new Append <byte[]>
            {
                Cid = Cid,
                Key = id,
                Content = value,
                DurabilityLevel = options.DurabilityLevel
            })
            {
                await ExecuteOp(op, options.Token, options.Timeout);

                return(new MutationResult(op.Cas, null, op.MutationToken));
            }
        }
示例#10
0
        public void CanMergeComplexOperations()
        {
            var tx1 = Common.RandomSmartTransaction();
            var tx2 = Common.RandomSmartTransaction();
            var tx3 = Common.RandomSmartTransaction();
            var tx4 = Common.RandomSmartTransaction();
            var tx5 = Common.RandomSmartTransaction();
            var tx6 = Common.RandomSmartTransaction();
            var tx7 = Common.RandomSmartTransaction();
            var tx8 = Common.RandomSmartTransaction();

            var a1 = new Append(tx1, tx2);
            var a2 = new Append(tx3, tx4, tx5);
            var r1 = new Remove(tx6.GetHash());
            var a3 = new Append(tx6);
            var r2 = new Remove(tx1.GetHash(), tx2.GetHash());
            var r3 = new Remove(tx6.GetHash());
            var a4 = new Append(tx1);
            var u1 = new Update(tx7);
            var u2 = new Update(tx8);

            var unmergedOperations = new ITxStoreOperation[] { a1, a2, a3, a4, r1, r2, r3, u1, u2 };
            var mergedOperations   = OperationMerger.Merge(unmergedOperations);

            Assert.Equal(3, mergedOperations.Count());

            unmergedOperations = new ITxStoreOperation[] { u1, u2, r1, r2, r3, a1, a2, a3, a4 };
            mergedOperations   = OperationMerger.Merge(unmergedOperations);
            Assert.Equal(3, mergedOperations.Count());

            unmergedOperations = new ITxStoreOperation[] { a1, r1, u1, a2, r2, a3, r3, u2, a4 };
            mergedOperations   = OperationMerger.Merge(unmergedOperations);
            Assert.Equal(9, mergedOperations.Count());

            unmergedOperations = new ITxStoreOperation[] { a1, a2, r1, a3, r2, r3, a4, u1, u2 };
            mergedOperations   = OperationMerger.Merge(unmergedOperations);
            Assert.Equal(6, mergedOperations.Count());
            var mergedOperationsArray = mergedOperations.ToArray();

            Assert.Equal(5, Assert.IsType <Append>(mergedOperationsArray[0]).Transactions.Count());
            Assert.Single(Assert.IsType <Remove>(mergedOperationsArray[1]).Transactions);
            Assert.Single(Assert.IsType <Append>(mergedOperationsArray[2]).Transactions);
            Assert.Equal(3, Assert.IsType <Remove>(mergedOperationsArray[3]).Transactions.Count());
            Assert.Single(Assert.IsType <Append>(mergedOperationsArray[4]).Transactions);
            Assert.Equal(2, Assert.IsType <Update>(mergedOperationsArray[5]).Transactions.Count());
        }
示例#11
0
        protected virtual AccessRights GetMask(IWorkflowActivityContext context)
        {
            var mask = AccessRights.None;

            if (Read.Get(context.GetExecutionContext()))
            {
                mask = mask | AccessRights.ReadAccess;
            }

            if (Append.Get(context.GetExecutionContext()))
            {
                mask = mask | AccessRights.AppendAccess;
            }

            if (AppendTo.Get(context.GetExecutionContext()))
            {
                mask = mask | AccessRights.AppendToAccess;
            }

            if (Read.Get(context.GetExecutionContext()))
            {
                mask = mask | AccessRights.ReadAccess;
            }

            if (Write.Get(context.GetExecutionContext()))
            {
                mask = mask | AccessRights.WriteAccess;
            }

            if (Delete.Get(context.GetExecutionContext()))
            {
                mask = mask | AccessRights.DeleteAccess;
            }

            if (AssignAccess.Get(context.GetExecutionContext()))
            {
                mask = mask | AccessRights.AssignAccess;
            }

            if (ShareAccess.Get(context.GetExecutionContext()))
            {
                mask = mask | AccessRights.ShareAccess;
            }

            return(mask);
        }
        public async Task <IMutationResult> AppendAsync(string id, byte[] value, AppendOptions?options = null)
        {
            //sanity check for deferred bootstrapping errors
            _bucket.ThrowIfBootStrapFailed();

            options ??= new AppendOptions();
            using var op = new Append <byte[]>(_bucket.Name, id)
                  {
                      Cid             = Cid,
                      Content         = value,
                      DurabilityLevel = options.DurabilityLevel,
                      Transcoder      = _transcoder
                  };
            await _bucket.SendAsync(op, options.TokenValue, options.TimeoutValue).ConfigureAwait(false);

            return(new MutationResult(op.Cas, null, op.MutationToken));
        }
        public async Task <IMutationResult> AppendAsync(string id, byte[] value, AppendOptions options = null)
        {
            options = options ?? new AppendOptions();
            using (var op = new Append <byte[]>
            {
                Cid = Cid,
                Key = id,
                Content = value,
                DurabilityLevel = options.DurabilityLevel,
                Transcoder = _transcoder
            })
            {
                await _bucket.SendAsync(op, options.Token, options.Timeout);

                return(new MutationResult(op.Cas, null, op.MutationToken));
            }
        }
示例#14
0
        public static string AppendToString(Append append)
        {
            switch (append)
            {
            case Append.Left:
                return("z lewej");

            case Append.Right:
                return("z prawej");

            case Append.None:
                return("brak");

            default:
                return("unk.");
            }
        }
        /// <summary>
        ///     Copies the features from the source into the the target feature class.
        /// </summary>
        /// <param name="source">The source.</param>
        /// <param name="targetTableName">Name of the target table.</param>
        /// <param name="filter">The filter.</param>
        /// <param name="visibleFields">
        ///     Specifies which fields from the input table to rename and make visible in the output table
        ///     view.
        /// </param>
        /// <param name="schemaMatchRequired">
        ///     if set to <c>true</c> if the schema must match between the two feature classes to
        ///     append the data.
        /// </param>
        /// <param name="workspace">The workspace.</param>
        /// <param name="trackCancel">The track cancel.</param>
        /// <param name="eventHandler">The event handler.</param>
        public static void CopyTo(this IFeatureClass source, string targetTableName, IQueryFilter filter, Dictionary <string, string> visibleFields, bool schemaMatchRequired, IWorkspace workspace, ITrackCancel trackCancel, IGeoProcessorEvents eventHandler)
        {
            object input = source;

            if (filter != null && !string.IsNullOrEmpty(filter.WhereClause))
            {
                var name = string.Format("{0}_V", ((IDataset)source).Name);
                input = source.MakeView(name, filter, visibleFields, trackCancel, eventHandler);
            }

            Append gp = new Append();

            gp.inputs      = input;
            gp.target      = workspace.GetAbsolutePath(targetTableName);
            gp.schema_type = schemaMatchRequired ? "TEST" : "NO_TEST";

            gp.Run(trackCancel, eventHandler);
        }
 public void SaveToXml(XmlTextWriter xmlWriter)
 {
     xmlWriter.WriteStartElement("ledDisplays");
     xmlWriter.WriteAttributeString("id", ID);
     xmlWriter.WriteAttributeString("description", Description);
     xmlWriter.WriteAttributeString("align", Align.ToString());
     xmlWriter.WriteAttributeString("trim", Trim.ToString());
     xmlWriter.WriteAttributeString("append", Append.ToString());
     xmlWriter.WriteAttributeString("appendString", AppendString);
     foreach (LEDDisplayInGroup led in LEDDisplaysInGroup)
     {
         xmlWriter.WriteStartElement("ledDisplay");
         xmlWriter.WriteAttributeString("ledDisplay", led.LEDDisplay.ID);
         xmlWriter.WriteAttributeString("order", led.Order.ToString());
         xmlWriter.WriteEndElement();
     }
     xmlWriter.WriteEndElement();
 }
示例#17
0
        public override IOperation Clone()
        {
            var cloned = new Append <T>(BucketName, Key)
            {
                ReplicaIdx              = ReplicaIdx,
                Content                 = Content,
                Transcoder              = Transcoder,
                VBucketId               = VBucketId,
                Opaque                  = Opaque,
                Attempts                = Attempts,
                Cas                     = Cas,
                CreationTime            = CreationTime,
                MutationToken           = MutationToken,
                LastConfigRevisionTried = LastConfigRevisionTried,
                ErrorCode               = ErrorCode
            };

            return(cloned);
        }
示例#18
0
        /// <summary>
        /// Adds the Android platform
        /// </summary>
        private bool AddAndroidPlatform()
        {
            // TODO:
            // 안드로이드 플랫폼이 이미 추가되었다 => true이면 생략
            //      - JSON 필요의 경우, folderName/package.json 파일에 cordova.platforms에 "android"가 존재할 때
            //      - JSON이 필요하지 않은 경우, folderName/platforms/android/android.json 파일이 있다

            var ret = false;

            if (!System.IO.File.Exists(@"platforms/android/android.json"))
            {
                using (HostData process = new HostData("cordova platform add android", true, "", _rm.GetString("AddAndroidPlatform1"), _rm.GetString("AddAndroidPlatform2")))
                {
                    Append append = AppendText;
                    ret = process.Run(append);
                }
            }

            return(ret);
        }
        public void CanMergeComplexOperations()
        {
            var tx1 = Global.GenerateRandomSmartTransaction();
            var tx2 = Global.GenerateRandomSmartTransaction();
            var tx3 = Global.GenerateRandomSmartTransaction();
            var tx4 = Global.GenerateRandomSmartTransaction();
            var tx5 = Global.GenerateRandomSmartTransaction();
            var tx6 = Global.GenerateRandomSmartTransaction();

            var a1 = new Append(tx1, tx2);
            var a2 = new Append(tx3, tx4, tx5);
            var r1 = new Remove(tx6.GetHash());
            var a3 = new Append(tx6);
            var r2 = new Remove(tx1.GetHash(), tx2.GetHash());
            var r3 = new Remove(tx6.GetHash());
            var a4 = new Append(tx1);

            var unmergedOperations = new ITxStoreOperation[] { a1, a2, a3, a4, r1, r2, r3 };
            var mergedOperations   = OperationMerger.Merge(unmergedOperations);

            Assert.Equal(2, mergedOperations.Count());

            unmergedOperations = new ITxStoreOperation[] { r1, r2, r3, a1, a2, a3, a4 };
            mergedOperations   = OperationMerger.Merge(unmergedOperations);
            Assert.Equal(2, mergedOperations.Count());

            unmergedOperations = new ITxStoreOperation[] { a1, r1, a2, r2, a3, r3, a4 };
            mergedOperations   = OperationMerger.Merge(unmergedOperations);
            Assert.Equal(7, mergedOperations.Count());

            unmergedOperations = new ITxStoreOperation[] { a1, a2, r1, a3, r2, r3, a4 };
            mergedOperations   = OperationMerger.Merge(unmergedOperations);
            Assert.Equal(5, mergedOperations.Count());
            var mergedOperationsArray = mergedOperations.ToArray();

            Assert.Equal(5, Assert.IsType <Append>(mergedOperationsArray[0]).Transactions.Count());
            Assert.Single(Assert.IsType <Remove>(mergedOperationsArray[1]).Transactions);
            Assert.Single(Assert.IsType <Append>(mergedOperationsArray[2]).Transactions);
            Assert.Equal(3, Assert.IsType <Remove>(mergedOperationsArray[3]).Transactions.Count());
            Assert.Single(Assert.IsType <Append>(mergedOperationsArray[4]).Transactions);
        }
示例#20
0
        public async Task <IMutationResult> AppendAsync(string id, byte[] value, AppendOptions?options = null)
        {
            //sanity check for deferred bootstrapping errors
            _bucket.ThrowIfBootStrapFailed();

            options ??= new AppendOptions();
            using var rootSpan = RootSpan(OperationNames.Append);
            using var op       = new Append <byte[]>(_bucket.Name, id)
                  {
                      Cid             = Cid,
                      CName           = Name,
                      Content         = value,
                      DurabilityLevel = options.DurabilityLevel,
                      Span            = rootSpan
                  };
            _operationConfigurator.Configure(op, options);

            await RetryUntilTimeoutOrSuccessAsync(options.TokenValue, options.TimeoutValue, op).ConfigureAwait(false);

            return(new MutationResult(op.Cas, null, op.MutationToken));
        }
示例#21
0
        public override void Save(XmlTextWriter xml)
        {
            xml.WriteStartElement("displaySet");
            xml.WriteAttributeString("id", ID);
            xml.WriteAttributeString("description", Description);
            xml.WriteAttributeString("align", Align.ToString());
            xml.WriteAttributeString("trim", Trim.ToString());
            xml.WriteAttributeString("append", Append.ToString());
            xml.WriteAttributeString("appendString", AppendString);
            Array.Sort(Displays);
            for (int i = 0; i < Displays.Length; i++)
            {
                Display d = Displays[i];
                d.Index = i;
                xml.WriteStartElement("display");
                xml.WriteAttributeString("id", d.LED7Display.ID);
                xml.WriteAttributeString("index", d.Index.ToString());
                xml.WriteEndElement();
            }

            xml.WriteEndElement();
        }
示例#22
0
    // Use this for initialization
    void Start()
    {
        NativeList <int>  indices = new NativeList <int>(Allocator.TempJob);
        NativeArray <int> numbers = new NativeArray <int>(5, Allocator.TempJob);

        numbers[0] = 0;
        numbers[1] = 1;
        numbers[2] = 0;
        numbers[3] = 1;
        numbers[4] = 0;
        var handle = default(JobHandle);

        /*
         * var condition = new Condition
         * {
         *  indices = indices,
         *  numbers = numbers
         * };
         * handle = condition.Schedule(handle);
         */

        var append = new Append
        {
            numbers = numbers
        };

        handle = append.ScheduleAppend(indices, numbers.Length, 1, handle);

        var filter = new Filter
        {
            numbers = numbers,
        };

        handle = filter.ScheduleFilter(indices, 1, handle);
        handle.Complete();
        Debug.Log(indices.Length);
        indices.Dispose();
        numbers.Dispose();
    }
示例#23
0
        // Module defining this command


        // Optional custom code for this activity


        /// <summary>
        /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
        /// </summary>
        /// <param name="context">The NativeActivityContext for the currently running activity.</param>
        /// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
        /// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
        protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
        {
            System.Management.Automation.PowerShell invoker       = global::System.Management.Automation.PowerShell.Create();
            System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);

            // Initialize the arguments

            if (InputObject.Expression != null)
            {
                targetCommand.AddParameter("InputObject", InputObject.Get(context));
            }

            if (FilePath.Expression != null)
            {
                targetCommand.AddParameter("FilePath", FilePath.Get(context));
            }

            if (LiteralPath.Expression != null)
            {
                targetCommand.AddParameter("LiteralPath", LiteralPath.Get(context));
            }

            if (Append.Expression != null)
            {
                targetCommand.AddParameter("Append", Append.Get(context));
            }

            if (Variable.Expression != null)
            {
                targetCommand.AddParameter("Variable", Variable.Get(context));
            }


            return(new ActivityImplementationContext()
            {
                PowerShellInstance = invoker
            });
        }
示例#24
0
        public void When_Operation_Is_Created_Opaque_Is_Incremented()
        {
            var get1 = new Get <dynamic>("thekey", null, Transcoder, OperationLifespanTimeout);
            var get2 = new Get <dynamic>("thekey", null, Transcoder, OperationLifespanTimeout);

            Assert.Greater(get2.Opaque, get1.Opaque);

            var set3 = new Set <dynamic>("thekey", "the value", null, Transcoder, OperationLifespanTimeout);

            Assert.Greater(set3.Opaque, get2.Opaque);

            var set4 = new Set <string>("thekey", "the value", null, Transcoder, OperationLifespanTimeout);

            Assert.Greater(set4.Opaque, set3.Opaque);

            var append5 = new Append <string>("thekey", null, null, Transcoder, OperationLifespanTimeout);

            Assert.Greater(append5.Opaque, set4.Opaque);

            var append6 = new Append <byte[]>("thekey", null, null, Transcoder, OperationLifespanTimeout);

            Assert.Greater(append6.Opaque, append5.Opaque);
        }
        public void CanMergeSingleOperations()
        {
            var tx = Global.GenerateRandomSmartTransaction();

            var append = new Append(tx);
            var unmergedAppendOperations        = new[] { append };
            var mergedOperations                = OperationMerger.Merge(unmergedAppendOperations);
            var expectedOperation               = Assert.Single(mergedOperations);
            var expectedAppendOperationInstance = Assert.IsType <Append>(expectedOperation);
            var expectedTx = Assert.Single(expectedAppendOperationInstance.Transactions);

            Assert.Equal(expectedTx, tx);

            var remove = new Remove(tx.GetHash());
            var unmergedRemoveOperations = new[] { remove };

            mergedOperations  = OperationMerger.Merge(unmergedRemoveOperations);
            expectedOperation = Assert.Single(mergedOperations);
            var expectedRemoveOperationInstance = Assert.IsType <Remove>(expectedOperation);
            var expectedTxHash = Assert.Single(expectedRemoveOperationInstance.Transactions);

            Assert.Equal(expectedTxHash, tx.GetHash());
        }
示例#26
0
        /// <summary>
        /// 빌드에 필요한 프로그램이 컴퓨터에 설치되어있지 확인합니다.
        /// 이 작업은 약간 걸릴 수 있습니다.
        /// </summary>
        /// <returns></returns>
        public bool CheckRequirements()
        {
            Append append = AppendText;

            for (var i = 0; i < _hostList.Count; i++)
            {
                _status[i] = _hostList[i].Run(append);
            }

            // 결과에 상관 없이 메모리를 명시적으로 해제합니다.
            _hostList.ForEach((i) => {
                i.Dispose();
            });

            string JAVA_HOME        = Environment.GetEnvironmentVariable("JAVA_HOME");
            string ANDROID_HOME     = Environment.GetEnvironmentVariable("ANDROID_HOME");
            string ANDROID_SDK_ROOT = Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT");

            DataManager.Instance.JDKPath = String.IsNullOrEmpty(JAVA_HOME) ? "" : JAVA_HOME;

            if (!String.IsNullOrEmpty(ANDROID_HOME))
            {
                AppendText(String.Format(_rm.GetString("FOUND_ANDROID_HOME"), ANDROID_HOME));
                _status[SDK.ANDROID_SDK] = true;
            }
            else if (!String.IsNullOrEmpty(ANDROID_SDK_ROOT)) // (Recommended)
            {
                AppendText(String.Format(_rm.GetString("FOUND_ANDROID_SDK_ROOT"), ANDROID_SDK_ROOT));
                _status[SDK.ANDROID_SDK] = true;
            }

            GetPlatformsFolders();

            _isValid = _status.All(i => true);

            return(_isValid);
        }
示例#27
0
        /// <summary>
        /// Build current project after adding plugins
        /// </summary>
        private bool Flush()
        {
            if (File.Exists("build.json"))
            {
                AppendText(_rm.GetString("Flush1"));
            }
            else
            {
                AppendText("Cannot find the build.json file to your project folder");
            }

            CreateBuildExtrasFile();

            string mode = (_config.buildMode == 0) ? "--release" : "--debug";
            string cmd  = String.Format("cordova build android {0} --buildConfig=build.json", mode);

            // 코르도바는 빌드가 완료되면, 정상 출력 루트가 아닌 오류 쪽으로 빌드 완료 메시지를 보낸다.
            // 따라서, 오류 메시지를 정상인 것처럼 처리할 경우, 프로세스가 종료되지 않고 영원히 남게 된다.
            // TODO:
            // 따라서 빌드 실패 메시지에 빌드 성공 메시지를 넣어야 한다.
            // 다만, 이 경우 빌드 실패 시에도 빌드가 성공했다고 메시지가 뜨게 된다.
            // 구분할 수 있는 방법은 아직까지 없다. 리치 텍스트 박스에서 fail 글자를 추출하지 않는한 불가능하다.
            bool ret = false;

            using (HostData process = new HostData(cmd, true, "", _rm.GetString("Flush2"), _rm.GetString("Flush3")))
            {
                Append append = AppendText;
                ret = process.Run(append);

                if (!ret)
                {
                    AppendText("Unknown error. Please run a command called 'cordova build android' manually in your command line.");
                }
            }

            return(ret);
        }
示例#28
0
    private void OnEnable()
    {
        Hugger hg = (Hugger)target;

        Append[] apds = hg.GetComponentsInChildren <Append>();
        if (apds.Length == 0)
        {
            apds = new Append[1]
            {
                new GameObject("Append0", typeof(Append)).GetComponent <Append>()
            };
            apds[0].transform.parent = hg.transform;
            apds[0].LimitedGyre      = new Append.LimitedRotation(0f, 360f, 180f, apds[0].transform);
        }
        else
        {
            /* for(int i = 0; i<apds.Length; i++)
             * {
             *   apds[i].transform.parent = hg.transform;
             *   apds[i].LimitedGyre = new Append.LimitedRotation(Mathf.Round(360f / apds.Length * i), Mathf.Round(360f /apds.Length * (i+1)), Mathf.Round(360f / apds.Length * (2*i + 1)/2f), apds[i].transform);
             *   apds[i].transform.rotation = Quaternion.Euler(0f, 0f, 180f + apds[i].LimitedGyre.Current);
             * }*/
            for (int i = 0; i < apds.Length; i++)
            {
                apds[i].transform.rotation = Quaternion.Euler(0f, 0f, 180f + apds[i].LimitedGyre.Current);
            }
        }
        hg.Appends = apds;
        for (int i = 0; i < apds.Length; i++)
        {
            hg.Appends[i].ParentHugger = hg;
            hg.Appends[i].InitiateList();
            EditorUtility.SetDirty(hg.Appends[i]);
        }
        EditorUtility.SetDirty(hg);
    }
        public static string FormatText(LEDDisplaysDictionary dictionary, Align align, Trim trim, Append append, string appendString, int characters, string text, out int start)
        {
            if (text == null || text.Length == 0)
            {
                text = "";
            }

            int dotsCount = 0;

            for (int i = 0; i < text.Length; i++)
            {
                if (dictionary.IsDotChar(text[i]))
                {
                    dotsCount++;
                }
            }

            int textLength = text.Length - dotsCount;

            if (append != Append.None)
            {
                while (appendString.Length < characters)
                {
                    appendString += appendString;
                }
            }

            start = 0;

            if (textLength > characters)
            {
                if (trim == Trim.Right)
                {
                    text = text.Substring(0, characters);
                }
                else
                {
                    text = text.Substring(textLength - characters, characters);
                }
            }
            else
            {
                if (textLength < characters)
                {
                    int dif = characters - textLength;
                    if (append == Append.Left)
                    {
                        text = appendString.Substring(0, dif) + text;
                    }
                    else if (append == Append.Right)
                    {
                        text = text + appendString.Substring(appendString.Length - dif, dif);
                    }
                    else if (align != Align.Left)
                    {
                        if (align == Align.Center)
                        {
                            start = characters / 2 - textLength / 2;
                        }
                        else if (align == Align.Right)
                        {
                            start = characters - textLength;
                        }
                    }
                }
            }
            return(text);
        }
        public void Execute(IArray paramvalues, ITrackCancel trackcancel,
                            IGPEnvironmentManager envMgr, IGPMessages messages)
        {
            // Remember the original GP environment settings and temporarily override these settings

            var gpSettings = envMgr as IGeoProcessorSettings;
            bool origAddOutputsToMapSetting = gpSettings.AddOutputsToMap;
            bool origLogHistorySetting = gpSettings.LogHistory;
            gpSettings.AddOutputsToMap = false;
            gpSettings.LogHistory = false;

            // Create the Geoprocessor

            Geoprocessor gp = new Geoprocessor();

            try
            {
                // Validate our values

                IGPMessages validateMessages = ((IGPFunction2)this).Validate(paramvalues, false, envMgr);
                if ((validateMessages as IGPMessage).IsError())
                {
                    messages.AddError(1, "Validate failed");
                    return;
                }

                // Unpack values

                IGPParameter gpParam = paramvalues.get_Element(InputNWFeatureClass) as IGPParameter;
                IGPValue inputNWFeatureClassValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputMNFeatureClass) as IGPParameter;
                IGPValue inputMNFeatureClassValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputMPTable) as IGPParameter;
                IGPValue inputMPTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputSITable) as IGPParameter;
                IGPValue inputSITableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputSPTable) as IGPParameter;
                IGPValue inputSPTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(OutputFileGDB) as IGPParameter;
                IGPValue outputFileGDBValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(OutputFileGDBVersion) as IGPParameter;
                IGPValue outputFileGDBVersionValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputFeatureDatasetName) as IGPParameter;
                IGPValue inputFeatureDatasetNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputNetworkDatasetName) as IGPParameter;
                IGPValue inputNetworkDatasetNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputCreateNetworkAttributesInMetric) as IGPParameter;
                IGPValue inputCreateNetworkAttributeInMetricValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputCreateTwoDistanceAttributes) as IGPParameter;
                IGPValue inputCreateTwoDistanceAttributesValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputRSTable) as IGPParameter;
                IGPValue inputRSTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputTimeZoneIDBaseFieldName) as IGPParameter;
                IGPValue inputTimeZoneIDBaseFieldNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputTimeZoneTable) as IGPParameter;
                IGPValue inputTimeZoneTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputCommonTimeZoneForTheEntireDataset) as IGPParameter;
                IGPValue inputCommonTimeZoneForTheEntireDatasetValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputHSNPTable) as IGPParameter;
                IGPValue inputHSNPTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputHSPRTable) as IGPParameter;
                IGPValue inputHSPRTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputRDTable) as IGPParameter;
                IGPValue inputRDTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLiveTrafficFeedFolder) as IGPParameter;
                IGPValue inputLiveTrafficFeedFolderValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLiveTrafficFeedArcGISServerConnection) as IGPParameter;
                IGPValue inputLiveTrafficFeedArcGISServerConnectionValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLiveTrafficFeedGeoprocessingServiceName) as IGPParameter;
                IGPValue inputLiveTrafficFeedGeoprocessingServiceNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLiveTrafficFeedGeoprocessingTaskName) as IGPParameter;
                IGPValue inputLiveTrafficFeedGeoprocessingTaskNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLTRTable) as IGPParameter;
                IGPValue inputLTRTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLRSTable) as IGPParameter;
                IGPValue inputLRSTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLVCTable) as IGPParameter;
                IGPValue inputLVCTableValue = m_gpUtils.UnpackGPValue(gpParam);

                double fgdbVersion = 0.0;
                if (!(outputFileGDBVersionValue.IsEmpty()))
                    fgdbVersion = Convert.ToDouble(outputFileGDBVersionValue.GetAsText(), System.Globalization.CultureInfo.InvariantCulture);

                bool createNetworkAttributesInMetric = false;
                if (!(inputCreateNetworkAttributeInMetricValue.IsEmpty()))
                    createNetworkAttributesInMetric = ((inputCreateNetworkAttributeInMetricValue.GetAsText()).ToUpper() == "TRUE");

                bool createTwoDistanceAttributes = false;
                if (!(inputCreateTwoDistanceAttributesValue.IsEmpty()))
                    createTwoDistanceAttributes = ((inputCreateTwoDistanceAttributesValue.GetAsText()).ToUpper() == "TRUE");

                if (inputTimeZoneIDBaseFieldNameValue.IsEmpty() ^ inputTimeZoneTableValue.IsEmpty())
                {
                    messages.AddError(1, "The Time Zone ID Base Field Name and the Time Zone Table must be specified together.");
                    return;
                }

                string timeZoneIDBaseFieldName = "";
                bool directedTimeZoneIDFields = false;
                if (!(inputTimeZoneIDBaseFieldNameValue.IsEmpty()))
                {
                    timeZoneIDBaseFieldName = inputTimeZoneIDBaseFieldNameValue.GetAsText();
                    IDETable inputTable = m_gpUtils.DecodeDETable(inputNWFeatureClassValue);
                    if (inputTable.Fields.FindField(timeZoneIDBaseFieldName) == -1)
                    {
                        directedTimeZoneIDFields = true;
                        if (((inputTable.Fields.FindField("FT_" + timeZoneIDBaseFieldName) == -1) || (inputTable.Fields.FindField("TF_" + timeZoneIDBaseFieldName) == -1)))
                        {
                            messages.AddError(1, "Field named " + timeZoneIDBaseFieldName + " does not exist, nor the pair of fields with FT_ and TF_ prefixing " + timeZoneIDBaseFieldName + " does not exist.");
                            return;
                        }
                    }
                }

                string commonTimeZone = "";
                if (!(inputCommonTimeZoneForTheEntireDatasetValue.IsEmpty()))
                    commonTimeZone = inputCommonTimeZoneForTheEntireDatasetValue.GetAsText();

                if (inputHSNPTableValue.IsEmpty() ^ inputHSPRTableValue.IsEmpty())
                {
                    messages.AddError(1, "The HSNP and HSPR tables must be specified together.");
                    return;
                }

                bool agsConnectionIsEmpty = inputLiveTrafficFeedArcGISServerConnectionValue.IsEmpty();
                bool gpServiceNameIsEmpty = inputLiveTrafficFeedGeoprocessingServiceNameValue.IsEmpty();
                bool gpTaskNameIsEmpty = inputLiveTrafficFeedGeoprocessingTaskNameValue.IsEmpty();
                if ((agsConnectionIsEmpty | gpServiceNameIsEmpty | gpTaskNameIsEmpty) ^
                    (agsConnectionIsEmpty & gpServiceNameIsEmpty & gpTaskNameIsEmpty))
                {
                    messages.AddError(1, "The ArcGIS Server Connection, Geoprocessing Service Name, and Geoprocessing Task Name must all be specified together.");
                    return;
                }

                bool feedFolderIsEmpty = inputLiveTrafficFeedFolderValue.IsEmpty();
                if (!(feedFolderIsEmpty | agsConnectionIsEmpty))
                {
                    messages.AddError(1, "The live traffic feed folder and live traffic feed connection cannot be specified together.");
                    return;
                }

                bool usesLiveTraffic = !(inputRDTableValue.IsEmpty());
                if (!usesLiveTraffic ^ (feedFolderIsEmpty & agsConnectionIsEmpty))
                {
                    messages.AddError(1, "The RD table and live traffic feed folder or connection must be specified together.");
                    return;
                }

                ITrafficFeedLocation trafficFeedLocation = null;
                if (usesLiveTraffic)
                {
                    if (feedFolderIsEmpty)
                    {
                        // We're using an ArcGIS Server Connection and Geoprocessing Service/Task

                        ITrafficFeedGPService tfgps = new TrafficFeedGPServiceClass();
                        IName trafficFeedGPServiceName = m_gpUtils.GetNameObject(inputLiveTrafficFeedArcGISServerConnectionValue as IDataElement);
                        tfgps.ConnectionProperties = ((IAGSServerConnectionName)trafficFeedGPServiceName).ConnectionProperties;
                        tfgps.ServiceName = inputLiveTrafficFeedGeoprocessingServiceNameValue.GetAsText();
                        tfgps.TaskName = inputLiveTrafficFeedGeoprocessingTaskNameValue.GetAsText();
                        trafficFeedLocation = tfgps as ITrafficFeedLocation;
                    }
                    else
                    {
                        // We're using a Traffic Feed Folder

                        ITrafficFeedDirectory tfd = new TrafficFeedDirectoryClass();
                        tfd.TrafficDirectory = inputLiveTrafficFeedFolderValue.GetAsText();
                        trafficFeedLocation = tfd as ITrafficFeedLocation;
                    }
                }

                if (inputLRSTableValue.IsEmpty() ^ inputLVCTableValue.IsEmpty())
                {
                    messages.AddError(1, "The LRS and LVC tables must be specified together.");
                    return;
                }

                // Get the path to the output file GDB, and feature dataset and network dataset names

                string outputFileGdbPath = outputFileGDBValue.GetAsText();
                string fdsName = inputFeatureDatasetNameValue.GetAsText();
                string ndsName = inputNetworkDatasetNameValue.GetAsText();

                // Create the new file geodatabase and feature dataset

                AddMessage("Creating the file geodatabase and feature dataset...", messages, trackcancel);

                int lastBackslash = outputFileGdbPath.LastIndexOf("\\");
                CreateFileGDB createFGDBTool = new CreateFileGDB();
                createFGDBTool.out_folder_path = outputFileGdbPath.Remove(lastBackslash);
                createFGDBTool.out_name = outputFileGdbPath.Substring(lastBackslash + 1);
                createFGDBTool.out_version = "9.3";
                gp.Execute(createFGDBTool, trackcancel);

                CreateFeatureDataset createFDSTool = new CreateFeatureDataset();
                createFDSTool.out_dataset_path = outputFileGdbPath;
                createFDSTool.out_name = fdsName;
                createFDSTool.spatial_reference = inputNWFeatureClassValue.GetAsText();
                gp.Execute(createFDSTool, trackcancel);

                // Import the NW feature class to the file geodatabase
                // If we're using ArcInfo, also sort the feature class

                MakeFeatureLayer makeFeatureLayerTool = new MakeFeatureLayer();
                makeFeatureLayerTool.in_features = inputNWFeatureClassValue.GetAsText();
                makeFeatureLayerTool.out_layer = "nw_Layer";
                makeFeatureLayerTool.where_clause = "FEATTYP <> 4165";
                gp.Execute(makeFeatureLayerTool, trackcancel);

                string pathToFds = outputFileGdbPath + "\\" + fdsName;
                string streetsFeatureClassPath = pathToFds + "\\" + StreetsFCName;
                FeatureClassToFeatureClass importFCTool = null;

                IAoInitialize aoi = new AoInitializeClass();
                if (aoi.InitializedProduct() == esriLicenseProductCode.esriLicenseProductCodeAdvanced)
                {
                    AddMessage("Importing and spatially sorting the Streets feature class...", messages, trackcancel);

                    Sort sortTool = new Sort();
                    sortTool.in_dataset = "nw_Layer";
                    sortTool.out_dataset = streetsFeatureClassPath;
                    sortTool.sort_field = "Shape";
                    sortTool.spatial_sort_method = "PEANO";
                    gp.Execute(sortTool, trackcancel);
                }
                else
                {
                    AddMessage("Importing the Streets feature class...", messages, trackcancel);

                    importFCTool = new FeatureClassToFeatureClass();
                    importFCTool.in_features = "nw_Layer";
                    importFCTool.out_path = pathToFds;
                    importFCTool.out_name = StreetsFCName;
                    gp.Execute(importFCTool, trackcancel);
                }

                Delete deleteTool = new Delete();
                deleteTool.in_data = "nw_Layer";
                gp.Execute(deleteTool, trackcancel);

                // Add an index to the Streets feature class's ID field

                AddMessage("Indexing the ID field...", messages, trackcancel);

                AddIndex addIndexTool = new AddIndex();
                addIndexTool.in_table = streetsFeatureClassPath;
                addIndexTool.fields = "ID";
                addIndexTool.index_name = "ID";
                gp.Execute(addIndexTool, trackcancel);

                // Copy the time zones table to the file geodatabase

                TableToTable importTableTool = null;
                if (timeZoneIDBaseFieldName != "")
                {
                    AddMessage("Copying the TimeZones table...", messages, trackcancel);

                    importTableTool = new TableToTable();
                    importTableTool.in_rows = inputTimeZoneTableValue.GetAsText();
                    importTableTool.out_path = outputFileGdbPath;
                    importTableTool.out_name = "TimeZones";
                    gp.Execute(importTableTool, trackcancel);
                }

                // Initialize common variables that will be used for both
                // processing historical traffic and maneuvers
                AddField addFieldTool = null;
                AddJoin addJoinTool = null;
                RemoveJoin removeJoinTool = null;
                CalculateField calcFieldTool = null;
                TableSelect tableSelectTool = null;
                MakeTableView makeTableViewTool = null;

                #region Process Historical Traffic Tables

                bool usesHistoricalTraffic = false;

                if (!(inputHSNPTableValue.IsEmpty()))
                {
                    usesHistoricalTraffic = true;

                    // Add fields for the weekday/weekend/all-week averages to the Streets feature class

                    AddMessage("Creating fields for the weekday/weekend/all-week averages...", messages, trackcancel);

                    addFieldTool = new AddField();
                    addFieldTool.in_table = streetsFeatureClassPath;

                    addFieldTool.field_type = "SHORT";
                    addFieldTool.field_name = "FT_Weekday";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "TF_Weekday";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "FT_Weekend";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "TF_Weekend";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "FT_AllWeek";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "TF_AllWeek";
                    gp.Execute(addFieldTool, trackcancel);

                    addFieldTool.field_type = "FLOAT";
                    addFieldTool.field_name = "FT_WeekdayMinutes";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "TF_WeekdayMinutes";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "FT_WeekendMinutes";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "TF_WeekendMinutes";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "FT_AllWeekMinutes";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "TF_AllWeekMinutes";
                    gp.Execute(addFieldTool, trackcancel);

                    // Separate out the FT and TF speeds into separate tables and index the NETWORK_ID fields

                    AddMessage("Extracting speed information...", messages, trackcancel);

                    string FTSpeedsTablePath = outputFileGdbPath + "\\FT_Speeds";
                    string TFSpeedsTablePath = outputFileGdbPath + "\\TF_Speeds";

                    tableSelectTool = new TableSelect();
                    tableSelectTool.in_table = inputHSNPTableValue.GetAsText();
                    tableSelectTool.out_table = FTSpeedsTablePath;
                    tableSelectTool.where_clause = "VAL_DIR = 2";
                    gp.Execute(tableSelectTool, trackcancel);

                    tableSelectTool.out_table = TFSpeedsTablePath;
                    tableSelectTool.where_clause = "VAL_DIR = 3";
                    gp.Execute(tableSelectTool, trackcancel);

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = FTSpeedsTablePath;
                    addIndexTool.fields = "NETWORK_ID";
                    addIndexTool.index_name = "NETWORK_ID";
                    gp.Execute(addIndexTool, trackcancel);
                    addIndexTool.in_table = TFSpeedsTablePath;
                    gp.Execute(addIndexTool, trackcancel);

                    // Calculate the speeds fields

                    makeFeatureLayerTool = new MakeFeatureLayer();
                    makeFeatureLayerTool.in_features = streetsFeatureClassPath;
                    makeFeatureLayerTool.out_layer = "Streets_Layer";
                    gp.Execute(makeFeatureLayerTool, trackcancel);

                    addJoinTool = new AddJoin();
                    addJoinTool.in_layer_or_view = "Streets_Layer";
                    addJoinTool.in_field = "ID";
                    addJoinTool.join_table = FTSpeedsTablePath;
                    addJoinTool.join_field = "NETWORK_ID";
                    gp.Execute(addJoinTool, trackcancel);

                    AddMessage("Copying over the FT weekday speeds...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "Streets_Layer";
                    calcFieldTool.field = StreetsFCName + ".FT_Weekday";
                    calcFieldTool.expression = "[FT_Speeds.SPWEEKDAY]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Copying over the FT weekend speeds...", messages, trackcancel);

                    calcFieldTool.field = StreetsFCName + ".FT_Weekend";
                    calcFieldTool.expression = "[FT_Speeds.SPWEEKEND]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Copying over the FT all-week speeds...", messages, trackcancel);

                    calcFieldTool.field = StreetsFCName + ".FT_AllWeek";
                    calcFieldTool.expression = "[FT_Speeds.SPWEEK]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    removeJoinTool = new RemoveJoin();
                    removeJoinTool.in_layer_or_view = "Streets_Layer";
                    removeJoinTool.join_name = "FT_Speeds";
                    gp.Execute(removeJoinTool, trackcancel);

                    addJoinTool = new AddJoin();
                    addJoinTool.in_layer_or_view = "Streets_Layer";
                    addJoinTool.in_field = "ID";
                    addJoinTool.join_table = TFSpeedsTablePath;
                    addJoinTool.join_field = "NETWORK_ID";
                    gp.Execute(addJoinTool, trackcancel);

                    AddMessage("Copying over the TF weekday speeds...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "Streets_Layer";
                    calcFieldTool.field = StreetsFCName + ".TF_Weekday";
                    calcFieldTool.expression = "[TF_Speeds.SPWEEKDAY]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Copying over the TF weekend speeds...", messages, trackcancel);

                    calcFieldTool.field = StreetsFCName + ".TF_Weekend";
                    calcFieldTool.expression = "[TF_Speeds.SPWEEKEND]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Copying over the TF all-week speeds...", messages, trackcancel);

                    calcFieldTool.field = StreetsFCName + ".TF_AllWeek";
                    calcFieldTool.expression = "[TF_Speeds.SPWEEK]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    removeJoinTool = new RemoveJoin();
                    removeJoinTool.in_layer_or_view = "Streets_Layer";
                    removeJoinTool.join_name = "TF_Speeds";
                    gp.Execute(removeJoinTool, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_Layer";
                    gp.Execute(deleteTool, trackcancel);

                    deleteTool.in_data = FTSpeedsTablePath;
                    gp.Execute(deleteTool, trackcancel);
                    deleteTool.in_data = TFSpeedsTablePath;
                    gp.Execute(deleteTool, trackcancel);

                    // Calculate the travel time fields

                    AddMessage("Calculating the FT weekday travel times...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = streetsFeatureClassPath;

                    calcFieldTool.field = "FT_WeekdayMinutes";
                    calcFieldTool.expression = "[METERS] * 0.06 / s";
                    calcFieldTool.code_block = "s = [FT_Weekday]\nIf IsNull(s) Then s = [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the FT weekend travel times...", messages, trackcancel);

                    calcFieldTool.field = "FT_WeekendMinutes";
                    calcFieldTool.expression = "[METERS] * 0.06 / s";
                    calcFieldTool.code_block = "s = [FT_Weekend]\nIf IsNull(s) Then s = [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the FT all-week travel times...", messages, trackcancel);

                    calcFieldTool.field = "FT_AllWeekMinutes";
                    calcFieldTool.expression = "[METERS] * 0.06 / s";
                    calcFieldTool.code_block = "s = [FT_AllWeek]\nIf IsNull(s) Then s = [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the TF weekday travel times...", messages, trackcancel);

                    calcFieldTool.field = "TF_WeekdayMinutes";
                    calcFieldTool.expression = "[METERS] * 0.06 / s";
                    calcFieldTool.code_block = "s = [TF_Weekday]\nIf IsNull(s) Then s = [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the TF weekend travel times...", messages, trackcancel);

                    calcFieldTool.field = "TF_WeekendMinutes";
                    calcFieldTool.expression = "[METERS] * 0.06 / s";
                    calcFieldTool.code_block = "s = [TF_Weekend]\nIf IsNull(s) Then s = [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the TF all-week travel times...", messages, trackcancel);

                    calcFieldTool.field = "TF_AllWeekMinutes";
                    calcFieldTool.expression = "[METERS] * 0.06 / s";
                    calcFieldTool.code_block = "s = [TF_AllWeek]\nIf IsNull(s) Then s = [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    // Create the DailyProfiles table

                    AddMessage("Creating the profiles table...", messages, trackcancel);

                    CreateDailyProfilesTable(m_gpUtils.OpenDataset(inputHSPRTableValue) as ITable, outputFileGdbPath, fgdbVersion);

                    // Copy over the historical traffic records of the HSNP table to the file geodatabase

                    AddMessage("Copying HSNP table to the file geodatabase...", messages, trackcancel);

                    string histTrafficJoinTablePath = outputFileGdbPath + "\\" + HistTrafficJoinTableName;

                    tableSelectTool.out_table = histTrafficJoinTablePath;
                    tableSelectTool.where_clause = "SPFREEFLOW > 0";
                    gp.Execute(tableSelectTool, trackcancel);

                    // Add FCID, FID, and position fields to the Streets_DailyProfiles table

                    AddMessage("Creating fields on the historical traffic join table...", messages, trackcancel);

                    addFieldTool = new AddField();
                    addFieldTool.in_table = histTrafficJoinTablePath;

                    addFieldTool.field_type = "LONG";
                    addFieldTool.field_name = "EdgeFCID";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "EdgeFID";
                    gp.Execute(addFieldTool, trackcancel);

                    addFieldTool.field_type = "DOUBLE";
                    addFieldTool.field_name = "EdgeFrmPos";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "EdgeToPos";
                    gp.Execute(addFieldTool, trackcancel);

                    // If we're creating 10.0, then also create the FreeflowMinutes field

                    if (fgdbVersion == 10.0)
                    {
                        addFieldTool.field_type = "DOUBLE";
                        addFieldTool.field_name = "FreeflowMinutes";
                        gp.Execute(addFieldTool, trackcancel);
                    }

                    // Calculate the fields

                    AddMessage("Calculating the EdgeFrmPos field for historical traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = histTrafficJoinTablePath;

                    calcFieldTool.field = "EdgeFrmPos";
                    calcFieldTool.expression = "x";
                    calcFieldTool.code_block = "Select Case [VAL_DIR]\n  Case 2: x = 0\n  Case 3: x = 1\nEnd Select";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeToPos field for historical traffic...", messages, trackcancel);

                    calcFieldTool.field = "EdgeToPos";
                    calcFieldTool.expression = "x";
                    calcFieldTool.code_block = "Select Case [VAL_DIR]\n  Case 2: x = 1\n  Case 3: x = 0\nEnd Select";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeFCID field for historical traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = histTrafficJoinTablePath;
                    calcFieldTool.field = "EdgeFCID";
                    calcFieldTool.expression = "1";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeFID field for historical traffic...", messages, trackcancel);

                    makeTableViewTool = new MakeTableView();
                    makeTableViewTool.in_table = histTrafficJoinTablePath;
                    makeTableViewTool.out_view = "Streets_DailyProfiles_View";
                    gp.Execute(makeTableViewTool, trackcancel);

                    addJoinTool = new AddJoin();
                    addJoinTool.in_layer_or_view = "Streets_DailyProfiles_View";
                    addJoinTool.in_field = "NETWORK_ID";
                    addJoinTool.join_table = streetsFeatureClassPath;
                    addJoinTool.join_field = "ID";
                    gp.Execute(addJoinTool, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "Streets_DailyProfiles_View";
                    calcFieldTool.field = HistTrafficJoinTableName + ".EdgeFID";
                    calcFieldTool.expression = "[" + StreetsFCName + ".OBJECTID]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    if (fgdbVersion == 10.0)
                    {
                        AddMessage("Calculating the FreeflowMinutes field...", messages, trackcancel);

                        calcFieldTool = new CalculateField();
                        calcFieldTool.in_table = "Streets_DailyProfiles_View";
                        calcFieldTool.field = HistTrafficJoinTableName + ".FreeflowMinutes";
                        calcFieldTool.expression = "[" + StreetsFCName + ".METERS] * 0.06 / [" + HistTrafficJoinTableName + ".SPFREEFLOW]";
                        calcFieldTool.expression_type = "VB";
                        gp.Execute(calcFieldTool, trackcancel);
                    }

                    removeJoinTool = new RemoveJoin();
                    removeJoinTool.in_layer_or_view = "Streets_DailyProfiles_View";
                    removeJoinTool.join_name = StreetsFCName;
                    gp.Execute(removeJoinTool, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_DailyProfiles_View";
                    gp.Execute(deleteTool, trackcancel);

                    // Add an index to the Streets feature class's NET2CLASS field

                    AddMessage("Indexing the NET2CLASS field...", messages, trackcancel);

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = streetsFeatureClassPath;
                    addIndexTool.fields = "NET2CLASS";
                    addIndexTool.index_name = "NET2CLASS";
                    gp.Execute(addIndexTool, trackcancel);
                }
                #endregion

                #region Process Live Traffic Table

                if (usesLiveTraffic)
                {
                    // Copy the RD table to the file geodatabase

                    AddMessage("Creating the live traffic join table...", messages, trackcancel);

                    importTableTool = new TableToTable();
                    importTableTool.in_rows = inputRDTableValue.GetAsText();
                    importTableTool.out_path = outputFileGdbPath;
                    importTableTool.out_name = TMCJoinTableName;
                    gp.Execute(importTableTool, trackcancel);

                    string TMCJoinTablePath = outputFileGdbPath + "\\" + TMCJoinTableName;

                    // Add FCID, FID, position, and TMC fields to the Streets_TMC table

                    AddMessage("Creating fields on the live traffic join table...", messages, trackcancel);

                    addFieldTool = new AddField();
                    addFieldTool.in_table = TMCJoinTablePath;

                    addFieldTool.field_type = "LONG";
                    addFieldTool.field_name = "EdgeFCID";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "EdgeFID";
                    gp.Execute(addFieldTool, trackcancel);

                    addFieldTool.field_type = "DOUBLE";
                    addFieldTool.field_name = "EdgeFrmPos";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "EdgeToPos";
                    gp.Execute(addFieldTool, trackcancel);

                    addFieldTool.field_type = "TEXT";
                    addFieldTool.field_length = 9;
                    addFieldTool.field_name = "TMC";
                    gp.Execute(addFieldTool, trackcancel);

                    // Calculate the fields

                    AddMessage("Calculating the TMC field for live traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = TMCJoinTablePath;
                    calcFieldTool.field = "TMC";
                    calcFieldTool.expression = "Right([RDSTMC], 9)";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeFrmPos field for live traffic...", messages, trackcancel);

                    calcFieldTool.field = "EdgeFrmPos";
                    calcFieldTool.expression = "x";
                    calcFieldTool.code_block = "Select Case Left([RDSTMC], 1)\n  Case \"+\": x = 0\n  Case \"-\": x = 1\nEnd Select";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeToPos field for live traffic...", messages, trackcancel);

                    calcFieldTool.field = "EdgeToPos";
                    calcFieldTool.expression = "x";
                    calcFieldTool.code_block = "Select Case Left([RDSTMC], 1)\n  Case \"-\": x = 0\n  Case \"+\": x = 1\nEnd Select";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeFCID field for live traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = TMCJoinTablePath;
                    calcFieldTool.field = "EdgeFCID";
                    calcFieldTool.expression = "1";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeFID field for live traffic...", messages, trackcancel);

                    makeTableViewTool = new MakeTableView();
                    makeTableViewTool.in_table = TMCJoinTablePath;
                    makeTableViewTool.out_view = "Streets_TMC_View";
                    gp.Execute(makeTableViewTool, trackcancel);

                    addJoinTool = new AddJoin();
                    addJoinTool.in_layer_or_view = "Streets_TMC_View";
                    addJoinTool.in_field = "ID";
                    addJoinTool.join_table = streetsFeatureClassPath;
                    addJoinTool.join_field = "ID";
                    gp.Execute(addJoinTool, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "Streets_TMC_View";
                    calcFieldTool.field = TMCJoinTableName + ".EdgeFID";
                    calcFieldTool.expression = "[" + StreetsFCName + ".OBJECTID]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    removeJoinTool = new RemoveJoin();
                    removeJoinTool.in_layer_or_view = "Streets_TMC_View";
                    removeJoinTool.join_name = StreetsFCName;
                    gp.Execute(removeJoinTool, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_TMC_View";
                    gp.Execute(deleteTool, trackcancel);

                    // If Historical Traffic is not being used, then we need to create placeholder historical traffic tables

                    if (!usesHistoricalTraffic)
                    {
                        // Create the Streets_DailyProfiles table by starting with a copy of the Streets_TMC table

                        AddMessage("Creating the historical traffic join table...", messages, trackcancel);

                        importTableTool = new TableToTable();
                        importTableTool.in_rows = TMCJoinTablePath;
                        importTableTool.out_path = outputFileGdbPath;
                        importTableTool.out_name = HistTrafficJoinTableName;
                        gp.Execute(importTableTool, trackcancel);

                        string histTrafficJoinTablePath = outputFileGdbPath + "\\" + HistTrafficJoinTableName;

                        AddMessage("Creating and calculating the KPH field on the historical traffic join table...", messages, trackcancel);

                        addFieldTool = new AddField();
                        addFieldTool.in_table = histTrafficJoinTablePath;
                        addFieldTool.field_type = "SHORT";
                        addFieldTool.field_name = "KPH";
                        gp.Execute(addFieldTool, trackcancel);

                        makeTableViewTool = new MakeTableView();
                        makeTableViewTool.in_table = histTrafficJoinTablePath;
                        makeTableViewTool.out_view = "Streets_DailyProfiles_View";
                        gp.Execute(makeTableViewTool, trackcancel);

                        addJoinTool = new AddJoin();
                        addJoinTool.in_layer_or_view = "Streets_DailyProfiles_View";
                        addJoinTool.in_field = "EdgeFID";
                        addJoinTool.join_table = streetsFeatureClassPath;
                        addJoinTool.join_field = "OBJECTID";
                        gp.Execute(addJoinTool, trackcancel);

                        calcFieldTool = new CalculateField();
                        calcFieldTool.in_table = "Streets_DailyProfiles_View";
                        calcFieldTool.field = HistTrafficJoinTableName + ".KPH";
                        calcFieldTool.expression = "[" + StreetsFCName + ".KPH]";
                        calcFieldTool.expression_type = "VB";
                        gp.Execute(calcFieldTool, trackcancel);

                        removeJoinTool = new RemoveJoin();
                        removeJoinTool.in_layer_or_view = "Streets_DailyProfiles_View";
                        removeJoinTool.join_name = StreetsFCName;
                        gp.Execute(removeJoinTool, trackcancel);

                        deleteTool = new Delete();
                        deleteTool.in_data = "Streets_DailyProfiles_View";
                        gp.Execute(deleteTool, trackcancel);

                        AddMessage("Creating and calculating the PROFILE fields on the historical traffic join table...", messages, trackcancel);

                        for (int i = 1; i <= 7; i++)
                        {
                            string fieldName = "PROFILE_" + Convert.ToString(i, System.Globalization.CultureInfo.InvariantCulture);

                            addFieldTool = new AddField();
                            addFieldTool.in_table = histTrafficJoinTablePath;
                            addFieldTool.field_type = "SHORT";
                            addFieldTool.field_name = fieldName;
                            gp.Execute(addFieldTool, trackcancel);

                            calcFieldTool = new CalculateField();
                            calcFieldTool.in_table = histTrafficJoinTablePath;
                            calcFieldTool.field = fieldName;
                            calcFieldTool.expression = "1";
                            calcFieldTool.expression_type = "VB";
                            gp.Execute(calcFieldTool, trackcancel);
                        }

                        // Create the Profiles table

                        CreateNonHistoricalDailyProfilesTable(outputFileGdbPath);
                    }
                }
                #endregion

                // Copy the MN feature class to the file geodatabase

                AddMessage("Copying the Maneuvers feature class and indexing...", messages, trackcancel);

                importFCTool = new FeatureClassToFeatureClass();
                importFCTool.in_features = inputMNFeatureClassValue.GetAsText();
                importFCTool.out_path = outputFileGdbPath;
                importFCTool.out_name = "mn";
                gp.Execute(importFCTool, trackcancel);

                string mnFeatureClassPath = outputFileGdbPath + "\\mn";

                addIndexTool = new AddIndex();
                addIndexTool.in_table = mnFeatureClassPath;
                addIndexTool.fields = "ID";
                addIndexTool.index_name = "ID";
                gp.Execute(addIndexTool, trackcancel);

                // Copy the MP table to the file geodatabase

                AddMessage("Copying the Maneuver Path table...", messages, trackcancel);

                importTableTool = new TableToTable();
                importTableTool.in_rows = inputMPTableValue.GetAsText();
                importTableTool.out_path = outputFileGdbPath;
                importTableTool.out_name = "mp";
                gp.Execute(importTableTool, trackcancel);

                string mpTablePath = outputFileGdbPath + "\\mp";

                // Add and calculate the at junction and feature type fields to the MP table

                AddMessage("Creating and calculating fields for the maneuver types and at junctions...", messages, trackcancel);

                addFieldTool = new AddField();
                addFieldTool.in_table = mpTablePath;
                addFieldTool.field_name = "JNCTID";
                addFieldTool.field_type = "DOUBLE";
                gp.Execute(addFieldTool, trackcancel);

                addFieldTool.field_name = "FEATTYP";
                addFieldTool.field_type = "SHORT";
                gp.Execute(addFieldTool, trackcancel);

                makeTableViewTool = new MakeTableView();
                makeTableViewTool.in_table = mpTablePath;
                makeTableViewTool.out_view = "mp_View";
                gp.Execute(makeTableViewTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "mp_View";
                addJoinTool.in_field = "ID";
                addJoinTool.join_table = mnFeatureClassPath;
                addJoinTool.join_field = "ID";
                gp.Execute(addJoinTool, trackcancel);

                calcFieldTool = new CalculateField();
                calcFieldTool.in_table = "mp_View";
                calcFieldTool.field = "mp.JNCTID";
                calcFieldTool.expression = "[mn.JNCTID]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                calcFieldTool.field = "mp.FEATTYP";
                calcFieldTool.expression = "[mn.FEATTYP]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "mp_View";
                removeJoinTool.join_name = "mn";
                gp.Execute(removeJoinTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = "mp_View";
                gp.Execute(deleteTool, trackcancel);

                deleteTool.in_data = mnFeatureClassPath;
                gp.Execute(deleteTool, trackcancel);

                // Extract only the prohibited maneuvers (feature types 2103 and 2101)

                AddMessage("Extracting prohibited maneuvers...", messages, trackcancel);

                string prohibMPwJnctIDTablePath = outputFileGdbPath + "\\ProhibMPwJnctID";
                string tempTablePath = outputFileGdbPath + "\\TempTable";

                tableSelectTool = new TableSelect();
                tableSelectTool.in_table = mpTablePath;
                tableSelectTool.out_table = prohibMPwJnctIDTablePath;
                tableSelectTool.where_clause = "FEATTYP = 2103";
                gp.Execute(tableSelectTool, trackcancel);

                tableSelectTool.out_table = tempTablePath;
                tableSelectTool.where_clause = "FEATTYP = 2101";
                gp.Execute(tableSelectTool, trackcancel);

                Append appendTool = new Append();
                appendTool.inputs = tempTablePath;
                appendTool.target = prohibMPwJnctIDTablePath;
                appendTool.schema_type = "TEST";
                gp.Execute(appendTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = tempTablePath;
                gp.Execute(deleteTool, trackcancel);

                AddMessage("Creating turn feature class...", messages, trackcancel);

                // Create the turn feature class

                string tempStatsTablePath = outputFileGdbPath + "\\tempStatsTable";

                Statistics statsTool = new Statistics();
                statsTool.in_table = prohibMPwJnctIDTablePath;
                statsTool.out_table = tempStatsTablePath;
                statsTool.statistics_fields = "SEQNR MAX";
                gp.Execute(statsTool, null);

                CreateAndPopulateTurnFeatureClass(outputFileGdbPath, fdsName, "ProhibMPwJnctID", "tempStatsTable",
                                                  messages, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = tempStatsTablePath;
                gp.Execute(deleteTool, trackcancel);

                deleteTool.in_data = prohibMPwJnctIDTablePath;
                gp.Execute(deleteTool, trackcancel);

                GC.Collect();

                // Extract the bifurcations (feature type 9401)

                AddMessage("Extracting bifurcations...", messages, trackcancel);

                string bifurcationMPwJnctIDTablePath = outputFileGdbPath + "\\BifurcationMPwJnctID";

                tableSelectTool = new TableSelect();
                tableSelectTool.in_table = mpTablePath;
                tableSelectTool.out_table = bifurcationMPwJnctIDTablePath;
                tableSelectTool.where_clause = "FEATTYP = 9401";
                gp.Execute(tableSelectTool, trackcancel);

                deleteTool.in_data = mpTablePath;
                gp.Execute(deleteTool, trackcancel);

                // Add and calculate the StreetsOID and the from-/to-junction ID fields to the MP table

                AddMessage("Creating and calculating fields for the StreetsOID and the from-/to-junction IDs...", messages, trackcancel);

                addFieldTool = new AddField();
                addFieldTool.in_table = bifurcationMPwJnctIDTablePath;
                addFieldTool.field_type = "LONG";
                addFieldTool.field_name = "StreetsOID";
                gp.Execute(addFieldTool, trackcancel);

                addFieldTool.field_type = "DOUBLE";
                addFieldTool.field_name = "F_JNCTID";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_name = "T_JNCTID";
                gp.Execute(addFieldTool, trackcancel);

                makeTableViewTool = new MakeTableView();
                makeTableViewTool.in_table = bifurcationMPwJnctIDTablePath;
                makeTableViewTool.out_view = "bifurcationMP_View";
                gp.Execute(makeTableViewTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "bifurcationMP_View";
                addJoinTool.in_field = "TRPELID";
                addJoinTool.join_table = streetsFeatureClassPath;
                addJoinTool.join_field = "ID";
                gp.Execute(addJoinTool, trackcancel);

                calcFieldTool = new CalculateField();
                calcFieldTool.in_table = "bifurcationMP_View";
                calcFieldTool.field = "BifurcationMPwJnctID.StreetsOID";
                calcFieldTool.expression = "[Streets.OBJECTID]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                calcFieldTool.field = "BifurcationMPwJnctID.F_JNCTID";
                calcFieldTool.expression = "[Streets.F_JNCTID]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                calcFieldTool.field = "BifurcationMPwJnctID.T_JNCTID";
                calcFieldTool.expression = "[Streets.T_JNCTID]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "bifurcationMP_View";
                removeJoinTool.join_name = "Streets";
                gp.Execute(removeJoinTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = "bifurcationMP_View";
                gp.Execute(deleteTool, trackcancel);

                AddMessage("Creating RoadSplits table...", messages, trackcancel);

                // Create the RoadSplits table

                CreateAndPopulateRoadSplitsTable(outputFileGdbPath, "BifurcationMPwJnctID", messages, trackcancel);

                deleteTool.in_data = bifurcationMPwJnctIDTablePath;
                gp.Execute(deleteTool, trackcancel);

                GC.Collect();

                #region Process Restrictions Table

                bool usesRSTable = false;

                if (!(inputRSTableValue.IsEmpty()))
                {
                    usesRSTable = true;

                    // Extract the information from the Restrictions table

                    AddMessage("Extracting information from the Restrictions table...", messages, trackcancel);

                    string rsTablePath = outputFileGdbPath + "\\rs";

                    tableSelectTool = new TableSelect();
                    tableSelectTool.in_table = inputRSTableValue.GetAsText();
                    tableSelectTool.out_table = rsTablePath;
                    tableSelectTool.where_clause = "RESTRTYP = 'DF' OR FEATTYP IN (2101, 2103)";
                    gp.Execute(tableSelectTool, trackcancel);

                    // Create and populate fields for the Streets

                    makeFeatureLayerTool = new MakeFeatureLayer();
                    makeFeatureLayerTool.in_features = streetsFeatureClassPath;
                    makeFeatureLayerTool.out_layer = "Streets_Layer";
                    gp.Execute(makeFeatureLayerTool, trackcancel);

                    CreateAndPopulateRSField(outputFileGdbPath, false, "FT_AllVehicles_Restricted",
                                             "DIR_POS IN (1, 2) AND VT = 0", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "TF_AllVehicles_Restricted",
                                             "DIR_POS IN (1, 3) AND VT = 0", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "FT_PassengerCars_Restricted",
                                             "DIR_POS IN (1, 2) AND VT = 11", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "TF_PassengerCars_Restricted",
                                             "DIR_POS IN (1, 3) AND VT = 11", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "FT_ResidentialVehicles_Restricted",
                                             "DIR_POS IN (1, 2) AND VT = 12", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "TF_ResidentialVehicles_Restricted",
                                             "DIR_POS IN (1, 3) AND VT = 12", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "FT_Taxis_Restricted",
                                             "DIR_POS IN (1, 2) AND VT = 16", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "TF_Taxis_Restricted",
                                             "DIR_POS IN (1, 3) AND VT = 16", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "FT_PublicBuses_Restricted",
                                             "DIR_POS IN (1, 2) AND VT = 17", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, false, "TF_PublicBuses_Restricted",
                                             "DIR_POS IN (1, 3) AND VT = 17", gp, messages, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_Layer";
                    gp.Execute(deleteTool, trackcancel);

                    // Create and populate fields for the RestrictedTurns

                    string pathToTurnFC = pathToFds + "\\" + TurnFCName;

                    makeFeatureLayerTool = new MakeFeatureLayer();
                    makeFeatureLayerTool.in_features = pathToTurnFC;
                    makeFeatureLayerTool.out_layer = "RestrictedTurns_Layer";
                    gp.Execute(makeFeatureLayerTool, trackcancel);

                    CreateAndPopulateRSField(outputFileGdbPath, true, "AllVehicles_Restricted", "VT = 0 OR RESTRTYP = '8I'", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, true, "PassengerCars_Restricted", "VT = 11", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, true, "ResidentialVehicles_Restricted", "VT = 12", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, true, "Taxis_Restricted", "VT = 16", gp, messages, trackcancel);
                    CreateAndPopulateRSField(outputFileGdbPath, true, "PublicBuses_Restricted", "VT = 17", gp, messages, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "RestrictedTurns_Layer";
                    gp.Execute(deleteTool, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = rsTablePath;
                    gp.Execute(deleteTool, trackcancel);
                }
                #endregion

                #region Process Logistics Truck Routes Table

                bool usesLTRTable = false;

                if (!(inputLTRTableValue.IsEmpty()))
                {
                    usesLTRTable = true;

                    makeFeatureLayerTool = new MakeFeatureLayer();
                    makeFeatureLayerTool.in_features = streetsFeatureClassPath;
                    makeFeatureLayerTool.out_layer = "Streets_Layer";
                    gp.Execute(makeFeatureLayerTool, trackcancel);

                    if (fgdbVersion >= 10.1)
                    {
                        CreateAndPopulateLTRField(outputFileGdbPath, inputLTRTableValue.GetAsText(),
                                                  "NationalSTAARoute", "PREFERRED = 1", gp, messages, trackcancel);
                        CreateAndPopulateLTRField(outputFileGdbPath, inputLTRTableValue.GetAsText(),
                                                  "NationalRouteAccess", "PREFERRED = 2", gp, messages, trackcancel);
                        CreateAndPopulateLTRField(outputFileGdbPath, inputLTRTableValue.GetAsText(),
                                                  "DesignatedTruckRoute", "PREFERRED = 3", gp, messages, trackcancel);
                        CreateAndPopulateLTRField(outputFileGdbPath, inputLTRTableValue.GetAsText(),
                                                  "TruckBypassRoad", "PREFERRED = 4", gp, messages, trackcancel);
                    }

                    CreateAndPopulateLTRField(outputFileGdbPath, inputLTRTableValue.GetAsText(),
                                              "NoCommercialVehicles", "RESTRICTED = 1", gp, messages, trackcancel);
                    CreateAndPopulateLTRField(outputFileGdbPath, inputLTRTableValue.GetAsText(),
                                              "ImmediateAccessOnly", "RESTRICTED = 2", gp, messages, trackcancel);
                    CreateAndPopulateLTRField(outputFileGdbPath, inputLTRTableValue.GetAsText(),
                                              "TrucksRestricted", "RESTRICTED = 3", gp, messages, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_Layer";
                    gp.Execute(deleteTool, trackcancel);
                }
                #endregion

                #region Process Logistics Restrictions Table

                bool usesLRSTable = false;
                string lrsStatsTablePath = outputFileGdbPath + "\\lrs_Stats";

                if (!(inputLRSTableValue.IsEmpty()))
                {
                    usesLRSTable = true;

                    // Copy the LRS table to the file geodatabase

                    AddMessage("Copying the Logistics Restrictions (LRS) table...", messages, trackcancel);

                    importTableTool = new TableToTable();
                    importTableTool.in_rows = inputLRSTableValue.GetAsText();
                    importTableTool.out_path = outputFileGdbPath;
                    importTableTool.out_name = "lrs";
                    gp.Execute(importTableTool, trackcancel);

                    string lrsTablePath = outputFileGdbPath + "\\lrs";

                    // Copy the SUBSEQNR 1 rows of the LVC table to the file geodatabase

                    AddMessage("Copying the Logistics Vehicle Characteristics (LVC) table...", messages, trackcancel);

                    string lvcTablePath = outputFileGdbPath + "\\lvc";

                    tableSelectTool = new TableSelect();
                    tableSelectTool.in_table = inputLVCTableValue.GetAsText();
                    tableSelectTool.out_table = lvcTablePath;
                    tableSelectTool.where_clause = "SUBSEQNR = 1";
                    gp.Execute(tableSelectTool, trackcancel);

                    // Add and calculate join fields on the LRS and LVC tables

                    addFieldTool = new AddField();
                    addFieldTool.field_name = "ID_SEQNR";
                    addFieldTool.field_length = 19;
                    addFieldTool.field_type = "TEXT";
                    addFieldTool.in_table = lrsTablePath;
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.in_table = lvcTablePath;
                    gp.Execute(addFieldTool, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.field = "ID_SEQNR";
                    calcFieldTool.expression = "[ID] & \".\" & [SEQNR]";
                    calcFieldTool.expression_type = "VB";

                    AddMessage("Calculating the join field on the LRS table...", messages, trackcancel);

                    calcFieldTool.in_table = lrsTablePath;
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the join field on the LVC table...", messages, trackcancel);

                    calcFieldTool.in_table = lvcTablePath;
                    gp.Execute(calcFieldTool, trackcancel);

                    // Index the join field on the LVC table

                    AddMessage("Indexing the join field...", messages, trackcancel);

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = lvcTablePath;
                    addIndexTool.fields = "ID_SEQNR";
                    addIndexTool.index_name = "ID_SEQNR";
                    gp.Execute(addIndexTool, trackcancel);

                    // Join the LRS and LVC tables together, and only extract those rows from
                    // the LRS table that do not have an accompanying row in the LVC table

                    AddMessage("Simplifying the LRS table...", messages, trackcancel);

                    makeTableViewTool = new MakeTableView();
                    makeTableViewTool.in_table = lrsTablePath;
                    makeTableViewTool.out_view = "lrs_View";
                    gp.Execute(makeTableViewTool, trackcancel);

                    addJoinTool = new AddJoin();
                    addJoinTool.in_layer_or_view = "lrs_View";
                    addJoinTool.in_field = "ID_SEQNR";
                    addJoinTool.join_table = lvcTablePath;
                    addJoinTool.join_field = "ID_SEQNR";
                    gp.Execute(addJoinTool, trackcancel);

                    importTableTool = new TableToTable();
                    importTableTool.in_rows = "lrs_View";
                    importTableTool.out_path = outputFileGdbPath;
                    importTableTool.out_name = "lrs_simplified";
                    importTableTool.where_clause = "lvc.OBJECTID IS NULL";
                    importTableTool.field_mapping = "ID \"ID\" true true false 8 Double 0 0 ,First,#," + lrsTablePath + ",lrs.ID,-1,-1;" +
                                                    "SEQNR \"SEQNR\" true true false 2 Short 0 0 ,First,#," + lrsTablePath + ",lrs.SEQNR,-1,-1;" +
                                                    "FEATTYP \"FEATTYP\" true true false 2 Short 0 0 ,First,#," + lrsTablePath + ",lrs.FEATTYP,-1,-1;" +
                                                    "RESTRTYP \"RESTRTYP\" true true false 2 Text 0 0 ,First,#," + lrsTablePath + ",lrs.RESTRTYP,-1,-1;" +
                                                    "VT \"VT\" true true false 2 Short 0 0 ,First,#," + lrsTablePath + ",lrs.VT,-1,-1;" +
                                                    "RESTRVAL \"RESTRVAL\" true true false 2 Short 0 0 ,First,#," + lrsTablePath + ",lrs.RESTRVAL,-1,-1;" +
                                                    "LIMIT \"LIMIT\" true true false 8 Double 0 0 ,First,#," + lrsTablePath + ",lrs.LIMIT,-1,-1;" +
                                                    "UNIT_MEAS \"UNIT_MEAS\" true true false 2 Short 0 0 ,First,#," + lrsTablePath + ",lrs.UNIT_MEAS,-1,-1;" +
                                                    "LANE_VALID \"LANE_VALID\" true true false 20 Text 0 0 ,First,#," + lrsTablePath + ",lrs.LANE_VALID,-1,-1;" +
                                                    "VALDIRPOS \"VALDIRPOS\" true true false 2 Short 0 0 ,First,#," + lrsTablePath + ",lrs.VALDIRPOS,-1,-1;" +
                                                    "VERIFIED \"VERIFIED\" true true false 2 Short 0 0 ,First,#," + lrsTablePath + ",lrs.VERIFIED,-1,-1";
                    gp.Execute(importTableTool, trackcancel);

                    removeJoinTool = new RemoveJoin();
                    removeJoinTool.in_layer_or_view = "lrs_View";
                    removeJoinTool.join_name = "lvc";
                    gp.Execute(removeJoinTool, trackcancel);

                    string lrsSimplifiedTablePath = outputFileGdbPath + "\\lrs_simplified";

                    deleteTool = new Delete();
                    deleteTool.in_data = "lrs_View";
                    gp.Execute(deleteTool, trackcancel);

                    deleteTool.in_data = lrsTablePath;
                    gp.Execute(deleteTool, trackcancel);
                    deleteTool.in_data = lvcTablePath;
                    gp.Execute(deleteTool, trackcancel);

                    // Get statistics on the simplified LRS table

                    AddMessage("Analyzing the LRS table...", messages, trackcancel);

                    statsTool = new Statistics();
                    statsTool.in_table = lrsSimplifiedTablePath;
                    statsTool.out_table = lrsStatsTablePath;
                    statsTool.statistics_fields = "ID COUNT";
                    statsTool.case_field = "RESTRTYP;VT;RESTRVAL";
                    gp.Execute(statsTool, trackcancel);

                    // Create and populate the logistics restriction fields

                    CreateAndPopulateLogisticsRestrictionFields(outputFileGdbPath, "lrs_Stats", lrsSimplifiedTablePath, gp, messages, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = lrsSimplifiedTablePath;
                    gp.Execute(deleteTool, trackcancel);
                }
                #endregion

                GC.Collect();

                // Create Signpost feature class and table

                AddMessage("Creating signpost feature class and table...", messages, trackcancel);

                CreateSignposts(inputSITableValue.GetAsText(), inputSPTableValue.GetAsText(), outputFileGdbPath,
                                messages, trackcancel);

                AddSpatialIndex addSpatialIndexTool = new AddSpatialIndex();
                addSpatialIndexTool.in_features = pathToFds + "\\" + SignpostFCName;
                gp.Execute(addSpatialIndexTool, trackcancel);

                addIndexTool = new AddIndex();
                addIndexTool.in_table = outputFileGdbPath + "\\" + SignpostJoinTableName;
                addIndexTool.fields = "SignpostID";
                addIndexTool.index_name = "SignpostID";
                gp.Execute(addIndexTool, trackcancel);

                addIndexTool.fields = "Sequence";
                addIndexTool.index_name = "Sequence";
                gp.Execute(addIndexTool, trackcancel);

                addIndexTool.fields = "EdgeFCID";
                addIndexTool.index_name = "EdgeFCID";
                gp.Execute(addIndexTool, trackcancel);

                addIndexTool.fields = "EdgeFID";
                addIndexTool.index_name = "EdgeFID";
                gp.Execute(addIndexTool, trackcancel);

                GC.Collect();

                // Upgrade the geodatabase (if not 9.3)

                if (fgdbVersion > 9.3)
                {
                    UpgradeGDB upgradeGdbTool = new UpgradeGDB();
                    upgradeGdbTool.input_workspace = outputFileGdbPath;
                    gp.Execute(upgradeGdbTool, trackcancel);
                }

                // Create and build the network dataset, then pack it in a GPValue

                AddMessage("Creating and building the network dataset...", messages, trackcancel);

                CreateAndBuildNetworkDataset(outputFileGdbPath, fgdbVersion, fdsName, ndsName, createNetworkAttributesInMetric,
                                             createTwoDistanceAttributes, timeZoneIDBaseFieldName, directedTimeZoneIDFields, commonTimeZone,
                                             usesHistoricalTraffic, trafficFeedLocation, usesRSTable, usesLTRTable, usesLRSTable, "lrs_Stats");

                // Once the network dataset is built, we can delete the stats table

                if (usesLRSTable)
                {
                    deleteTool = new Delete();
                    deleteTool.in_data = lrsStatsTablePath;
                    gp.Execute(deleteTool, trackcancel);
                }

                // Write the build errors to the turn feature class

                TurnGeometryUtilities.WriteBuildErrorsToTurnFC(outputFileGdbPath, fdsName, TurnFCName, messages, trackcancel);

                // Compact the output file geodatabase

                AddMessage("Compacting the output file geodatabase...", messages, trackcancel);

                Compact compactTool = new Compact();
                compactTool.in_workspace = outputFileGdbPath;
                gp.Execute(compactTool, trackcancel);
            }
            catch (Exception e)
            {
                if (gp.MaxSeverity == 2)
                {
                    object missing = System.Type.Missing;
                    messages.AddError(1, gp.GetMessages(ref missing));
                }
                messages.AddError(1, e.Message);
                messages.AddError(1, e.StackTrace);
            }
            finally
            {
                // Restore the original GP environment settings

                gpSettings.AddOutputsToMap = origAddOutputsToMapSetting;
                gpSettings.LogHistory = origLogHistorySetting;
            }
            GC.Collect();
            return;
        }
示例#31
0
		public ZipArchive (Stream stream, Append append, bool ownsStream)
		{
			Stream = new ZipStream (stream, ownsStream);
			Handle = NativeVersion.Use32Bit ? NativeZip.OpenArchive32 (Stream.IOFunctions32, append) : NativeZip.OpenArchive64 (Stream.IOFunctions64, append);
		}
        public void Execute(IArray paramvalues, ITrackCancel trackcancel,
                            IGPEnvironmentManager envMgr, IGPMessages messages)
        {
            // Remember the original GP environment settings and temporarily override these settings

            var gpSettings = envMgr as IGeoProcessorSettings;
            bool origAddOutputsToMapSetting = gpSettings.AddOutputsToMap;
            bool origLogHistorySetting = gpSettings.LogHistory;
            gpSettings.AddOutputsToMap = false;
            gpSettings.LogHistory = false;

            // Create the Geoprocessor

            Geoprocessor gp = new Geoprocessor();

            try
            {
                // Validate our values

                IGPMessages validateMessages = ((IGPFunction2)this).Validate(paramvalues, false, envMgr);
                if ((validateMessages as IGPMessage).IsError())
                {
                    messages.AddError(1, "Validate failed");
                    return;
                }

                // Unpack values

                IGPParameter gpParam = paramvalues.get_Element(InputStreetsFeatureClass) as IGPParameter;
                IGPValue inputStreetsFeatureClassValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputAltStreetsFeatureClass) as IGPParameter;
                IGPValue inputAltStreetsFeatureClassValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputZLevelsFeatureClass) as IGPParameter;
                IGPValue inputZLevelsFeatureClassValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputCdmsTable) as IGPParameter;
                IGPValue inputCdmsTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputRdmsTable) as IGPParameter;
                IGPValue inputRdmsTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputSignsTable) as IGPParameter;
                IGPValue inputSignsTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(OutputFileGDB) as IGPParameter;
                IGPValue outputFileGDBValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(OutputFileGDBVersion) as IGPParameter;
                IGPValue outputFileGDBVersionValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputFeatureDatasetName) as IGPParameter;
                IGPValue inputFeatureDatasetNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputNetworkDatasetName) as IGPParameter;
                IGPValue inputNetworkDatasetNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputCreateNetworkAttributesInMetric) as IGPParameter;
                IGPValue inputCreateNetworkAttributeInMetricValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputCreateArcGISOnlineNetworkAttributes) as IGPParameter;
                IGPValue inputCreateArcGISOnlineNetworkAttributesValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputTimeZoneIDBaseFieldName) as IGPParameter;
                IGPValue inputTimeZoneIDBaseFieldNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputTimeZoneTable) as IGPParameter;
                IGPValue inputTimeZoneTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputCommonTimeZoneForTheEntireDataset) as IGPParameter;
                IGPValue inputCommonTimeZoneForTheEntireDatasetValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputTrafficTable) as IGPParameter;
                IGPValue inputTrafficTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLinkReferenceFileFC14) as IGPParameter;
                IGPValue inputLinkReferenceFileFC14Value = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLinkReferenceFileFC5) as IGPParameter;
                IGPValue inputLinkReferenceFileFC5Value = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputTMCReferenceFile) as IGPParameter;
                IGPValue inputTMCReferenceFileValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputSPDFile) as IGPParameter;
                IGPValue inputSPDFileValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLiveTrafficFeedFolder) as IGPParameter;
                IGPValue inputLiveTrafficFeedFolderValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLiveTrafficFeedArcGISServerConnection) as IGPParameter;
                IGPValue inputLiveTrafficFeedArcGISServerConnectionValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLiveTrafficFeedGeoprocessingServiceName) as IGPParameter;
                IGPValue inputLiveTrafficFeedGeoprocessingServiceNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputLiveTrafficFeedGeoprocessingTaskName) as IGPParameter;
                IGPValue inputLiveTrafficFeedGeoprocessingTaskNameValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputUSCndModTable) as IGPParameter;
                IGPValue inputUSCndModTableValue = m_gpUtils.UnpackGPValue(gpParam);
                gpParam = paramvalues.get_Element(InputNonUSCndModTable) as IGPParameter;
                IGPValue inputNonUSCndModTableValue = m_gpUtils.UnpackGPValue(gpParam);

                double fgdbVersion = 0.0;
                if (!(outputFileGDBVersionValue.IsEmpty()))
                    fgdbVersion = Convert.ToDouble(outputFileGDBVersionValue.GetAsText(), System.Globalization.CultureInfo.InvariantCulture);

                bool createNetworkAttributesInMetric = false;
                if (!(inputCreateNetworkAttributeInMetricValue.IsEmpty()))
                    createNetworkAttributesInMetric = ((inputCreateNetworkAttributeInMetricValue.GetAsText()).ToUpper() == "TRUE");

                bool createArcGISOnlineNetworkAttributes = false;
                if (!(inputCreateArcGISOnlineNetworkAttributesValue.IsEmpty()))
                    createArcGISOnlineNetworkAttributes = ((inputCreateArcGISOnlineNetworkAttributesValue.GetAsText()).ToUpper() == "TRUE");

                if (inputTimeZoneIDBaseFieldNameValue.IsEmpty() ^ inputTimeZoneTableValue.IsEmpty())
                {
                    messages.AddError(1, "The Time Zone ID Base Field Name and the Time Zone Table must be specified together.");
                    return;
                }

                string timeZoneIDBaseFieldName = "";
                bool directedTimeZoneIDFields = false;
                if (!(inputTimeZoneIDBaseFieldNameValue.IsEmpty()))
                {
                    timeZoneIDBaseFieldName = inputTimeZoneIDBaseFieldNameValue.GetAsText();
                    IDETable inputTable = m_gpUtils.DecodeDETable(inputStreetsFeatureClassValue);
                    if (inputTable.Fields.FindField(timeZoneIDBaseFieldName) == -1)
                    {
                        directedTimeZoneIDFields = true;
                        if (((inputTable.Fields.FindField("FT_" + timeZoneIDBaseFieldName) == -1) || (inputTable.Fields.FindField("TF_" + timeZoneIDBaseFieldName) == -1)))
                        {
                            messages.AddError(1, "Field named " + timeZoneIDBaseFieldName + " does not exist, nor the pair of fields with FT_ and TF_ prefixing " + timeZoneIDBaseFieldName + " does not exist.");
                            return;
                        }
                    }
                }

                string commonTimeZone = "";
                if (!(inputCommonTimeZoneForTheEntireDatasetValue.IsEmpty()))
                    commonTimeZone = inputCommonTimeZoneForTheEntireDatasetValue.GetAsText();

                if (inputLinkReferenceFileFC14Value.IsEmpty() ^ inputLinkReferenceFileFC5Value.IsEmpty())
                {
                    messages.AddError(1, "Both Traffic Patterns Link Reference .csv files must be specified together.");
                    return;
                }

                bool usesHistoricalTraffic = !(inputSPDFileValue.IsEmpty());
                bool usesNTPFullCoverage = !(inputLinkReferenceFileFC5Value.IsEmpty());
                if ((inputTMCReferenceFileValue.IsEmpty() & !usesNTPFullCoverage) ^ inputSPDFileValue.IsEmpty())
                {
                    messages.AddError(1, "The Traffic Patterns SPD .csv file must be specified with the Traffic Patterns Link/TMC Reference .csv file(s).");
                    return;
                }

                if (inputTrafficTableValue.IsEmpty() & !inputTMCReferenceFileValue.IsEmpty())
                {
                    messages.AddError(1, "If the TMC Reference .csv file is specified, then the Traffic table must also be specified.");
                    return;
                }

                bool agsConnectionIsEmpty = inputLiveTrafficFeedArcGISServerConnectionValue.IsEmpty();
                bool gpServiceNameIsEmpty = inputLiveTrafficFeedGeoprocessingServiceNameValue.IsEmpty();
                bool gpTaskNameIsEmpty = inputLiveTrafficFeedGeoprocessingTaskNameValue.IsEmpty();
                if ((agsConnectionIsEmpty | gpServiceNameIsEmpty | gpTaskNameIsEmpty) ^
                    (agsConnectionIsEmpty & gpServiceNameIsEmpty & gpTaskNameIsEmpty))
                {
                    messages.AddError(1, "The ArcGIS Server Connection, Geoprocessing Service Name, and Geoprocessing Task Name must all be specified together.");
                    return;
                }

                bool feedFolderIsEmpty = inputLiveTrafficFeedFolderValue.IsEmpty();
                if (!(feedFolderIsEmpty | agsConnectionIsEmpty))
                {
                    messages.AddError(1, "The live traffic feed folder and live traffic feed connection cannot be specified together.");
                    return;
                }

                if (inputTrafficTableValue.IsEmpty() & !(feedFolderIsEmpty & agsConnectionIsEmpty))
                {
                    messages.AddError(1, "The Traffic table must be specified to use Live Traffic.");
                    return;
                }

                bool usesTransport = true;
                if (inputUSCndModTableValue.IsEmpty() && inputNonUSCndModTableValue.IsEmpty())
                    usesTransport = false;

                ITrafficFeedLocation trafficFeedLocation = null;
                if (!agsConnectionIsEmpty)
                {
                    // We're using an ArcGIS Server Connection and Geoprocessing Service/Task

                    ITrafficFeedGPService tfgps = new TrafficFeedGPServiceClass();
                    IName trafficFeedGPServiceName = m_gpUtils.GetNameObject(inputLiveTrafficFeedArcGISServerConnectionValue as IDataElement);
                    tfgps.ConnectionProperties = ((IAGSServerConnectionName)trafficFeedGPServiceName).ConnectionProperties;
                    tfgps.ServiceName = inputLiveTrafficFeedGeoprocessingServiceNameValue.GetAsText();
                    tfgps.TaskName = inputLiveTrafficFeedGeoprocessingTaskNameValue.GetAsText();
                    trafficFeedLocation = tfgps as ITrafficFeedLocation;
                }
                else if (!feedFolderIsEmpty)
                {
                    // We're using a Traffic Feed Folder

                    ITrafficFeedDirectory tfd = new TrafficFeedDirectoryClass();
                    tfd.TrafficDirectory = inputLiveTrafficFeedFolderValue.GetAsText();
                    trafficFeedLocation = tfd as ITrafficFeedLocation;
                }

                // Get the path to the output file GDB, and feature dataset and network dataset names

                string outputFileGdbPath = outputFileGDBValue.GetAsText();
                string fdsName = inputFeatureDatasetNameValue.GetAsText();
                string ndsName = inputNetworkDatasetNameValue.GetAsText();

                // Create the new file geodatabase and feature dataset

                AddMessage("Creating the file geodatabase and feature dataset...", messages, trackcancel);

                int lastBackslash = outputFileGdbPath.LastIndexOf("\\");
                CreateFileGDB createFGDBTool = new CreateFileGDB();
                createFGDBTool.out_folder_path = outputFileGdbPath.Remove(lastBackslash);
                createFGDBTool.out_name = outputFileGdbPath.Substring(lastBackslash + 1);
                createFGDBTool.out_version = "9.3";
                gp.Execute(createFGDBTool, trackcancel);

                CreateFeatureDataset createFDSTool = new CreateFeatureDataset();
                createFDSTool.out_dataset_path = outputFileGdbPath;
                createFDSTool.out_name = fdsName;
                createFDSTool.spatial_reference = inputStreetsFeatureClassValue.GetAsText();
                gp.Execute(createFDSTool, trackcancel);

                // Import the Streets feature class to the file geodatabase
                // If we're using ArcInfo, also sort the feature class

                string pathToFds = outputFileGdbPath + "\\" + fdsName;
                string streetsFeatureClassPath = pathToFds + "\\" + StreetsFCName;

                IAoInitialize aoi = new AoInitializeClass();
                if (aoi.InitializedProduct() == esriLicenseProductCode.esriLicenseProductCodeAdvanced)
                {
                    AddMessage("Importing and spatially sorting the Streets feature class...", messages, trackcancel);

                    Sort sortTool = new Sort();
                    sortTool.in_dataset = inputStreetsFeatureClassValue.GetAsText();
                    sortTool.out_dataset = streetsFeatureClassPath;
                    sortTool.sort_field = "Shape";
                    sortTool.spatial_sort_method = "PEANO";
                    gp.Execute(sortTool, trackcancel);
                }
                else
                {
                    AddMessage("Importing the Streets feature class...", messages, trackcancel);

                    FeatureClassToFeatureClass importFCTool = new FeatureClassToFeatureClass();
                    importFCTool.in_features = inputStreetsFeatureClassValue.GetAsText();
                    importFCTool.out_path = pathToFds;
                    importFCTool.out_name = StreetsFCName;
                    gp.Execute(importFCTool, trackcancel);
                }

                // Add an index to the Streets feature class's LINK_ID field

                AddMessage("Indexing the LINK_ID field...", messages, trackcancel);

                AddIndex addIndexTool = new AddIndex();
                addIndexTool.in_table = streetsFeatureClassPath;
                addIndexTool.fields = "LINK_ID";
                addIndexTool.index_name = "LINK_ID";
                gp.Execute(addIndexTool, trackcancel);

                // Add the alternate street name fields to the Streets feature class

                AddMessage("Creating fields on the Streets feature class for the alternate street names...", messages, trackcancel);

                AddField addFieldTool = new AddField();
                addFieldTool.in_table = streetsFeatureClassPath;

                addFieldTool.field_type = "TEXT";
                addFieldTool.field_length = 240;
                addFieldTool.field_name = "ST_NAME_Alt";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_length = 3;
                addFieldTool.field_name = "ST_LANGCD_Alt";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_length = 6;
                addFieldTool.field_name = "ST_NM_PREF_Alt";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_length = 90;
                addFieldTool.field_name = "ST_TYP_BEF_Alt";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_length = 105;
                addFieldTool.field_name = "ST_NM_BASE_Alt";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_length = 6;
                addFieldTool.field_name = "ST_NM_SUFF_Alt";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_length = 90;
                addFieldTool.field_name = "ST_TYP_AFT_Alt";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_length = 1;
                addFieldTool.field_name = "DIRONSIGN_Alt";
                gp.Execute(addFieldTool, trackcancel);

                // Extract the explicatable street names

                string ExplicatblTablePath = outputFileGdbPath + "\\Explicatbl";

                AddMessage("Extracting the explicatable street names...", messages, trackcancel);

                TableSelect tableSelectTool = new TableSelect();
                tableSelectTool.in_table = inputAltStreetsFeatureClassValue.GetAsText();
                tableSelectTool.out_table = ExplicatblTablePath;
                tableSelectTool.where_clause = "EXPLICATBL = 'Y'";
                gp.Execute(tableSelectTool, trackcancel);

                // Determine which explicatable names are alternate names and extract them

                MakeTableView makeTableViewTool = new MakeTableView();
                makeTableViewTool.in_table = ExplicatblTablePath;
                makeTableViewTool.out_view = "Explicatbl_View";
                gp.Execute(makeTableViewTool, trackcancel);

                AddJoin addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "Explicatbl_View";
                addJoinTool.in_field = "LINK_ID";
                addJoinTool.join_table = streetsFeatureClassPath;
                addJoinTool.join_field = "LINK_ID";
                gp.Execute(addJoinTool, trackcancel);

                AddMessage("Extracting the alternate street names...", messages, trackcancel);

                TableToTable importTableTool = new TableToTable();
                importTableTool.in_rows = "Explicatbl_View";
                importTableTool.out_path = outputFileGdbPath;
                importTableTool.out_name = "AltNames";
                importTableTool.where_clause = "Explicatbl.ST_TYP_BEF <> " + StreetsFCName + ".ST_TYP_BEF OR " +
                                               "Explicatbl.ST_NM_BASE <> " + StreetsFCName + ".ST_NM_BASE OR " +
                                               "Explicatbl.ST_TYP_AFT <> " + StreetsFCName + ".ST_TYP_AFT";
                importTableTool.field_mapping = "LINK_ID \"LINK_ID\" true true false 4 Long 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.LINK_ID,-1,-1;" +
                                                "ST_NAME \"ST_NAME\" true true false 240 Text 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.ST_NAME,-1,-1;" +
                                                "ST_LANGCD \"ST_LANGCD\" true true false 3 Text 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.ST_LANGCD,-1,-1;" +
                                                "ST_NM_PREF \"ST_NM_PREF\" true true false 6 Text 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.ST_NM_PREF,-1,-1;" +
                                                "ST_TYP_BEF \"ST_TYP_BEF\" true true false 90 Text 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.ST_TYP_BEF,-1,-1;" +
                                                "ST_NM_BASE \"ST_NM_BASE\" true true false 105 Text 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.ST_NM_BASE,-1,-1;" +
                                                "ST_NM_SUFF \"ST_NM_SUFF\" true true false 6 Text 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.ST_NM_SUFF,-1,-1;" +
                                                "ST_TYP_AFT \"ST_TYP_AFT\" true true false 90 Text 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.ST_TYP_AFT,-1,-1;" +
                                                "DIRONSIGN \"DIRONSIGN\" true true false 1 Text 0 0 ,First,#," + ExplicatblTablePath + ",Explicatbl.DIRONSIGN,-1,-1";
                gp.Execute(importTableTool, trackcancel);

                RemoveJoin removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "Explicatbl_View";
                removeJoinTool.join_name = StreetsFCName;
                gp.Execute(removeJoinTool, trackcancel);

                Delete deleteTool = new Delete();
                deleteTool.in_data = "Explicatbl_View";
                gp.Execute(deleteTool, trackcancel);
                deleteTool.in_data = ExplicatblTablePath;
                gp.Execute(deleteTool, trackcancel);

                string AltNamesTablePath = outputFileGdbPath + "\\AltNames";

                addIndexTool = new AddIndex();
                addIndexTool.in_table = AltNamesTablePath;
                addIndexTool.fields = "LINK_ID";
                addIndexTool.index_name = "LINK_ID";
                gp.Execute(addIndexTool, trackcancel);

                // Calculate the alternate street name fields

                MakeFeatureLayer makeFeatureLayerTool = new MakeFeatureLayer();
                makeFeatureLayerTool.in_features = streetsFeatureClassPath;
                makeFeatureLayerTool.out_layer = "Streets_Layer";
                gp.Execute(makeFeatureLayerTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "Streets_Layer";
                addJoinTool.in_field = "LINK_ID";
                addJoinTool.join_table = AltNamesTablePath;
                addJoinTool.join_field = "LINK_ID";
                gp.Execute(addJoinTool, trackcancel);

                AddMessage("Copying over the alternate ST_NAME values...", messages, trackcancel);

                CalculateField calcFieldTool = new CalculateField();
                calcFieldTool.in_table = "Streets_Layer";
                calcFieldTool.expression_type = "VB";
                calcFieldTool.field = StreetsFCName + ".ST_NAME_Alt";
                calcFieldTool.expression = "[AltNames.ST_NAME]";
                gp.Execute(calcFieldTool, trackcancel);

                AddMessage("Copying over the alternate ST_LANGCD values...", messages, trackcancel);

                calcFieldTool.field = StreetsFCName + ".ST_LANGCD_Alt";
                calcFieldTool.expression = "[AltNames.ST_LANGCD]";
                gp.Execute(calcFieldTool, trackcancel);

                AddMessage("Copying over the alternate ST_NM_PREF values...", messages, trackcancel);

                calcFieldTool.field = StreetsFCName + ".ST_NM_PREF_Alt";
                calcFieldTool.expression = "[AltNames.ST_NM_PREF]";
                gp.Execute(calcFieldTool, trackcancel);

                AddMessage("Copying over the alternate ST_TYP_BEF values...", messages, trackcancel);

                calcFieldTool.field = StreetsFCName + ".ST_TYP_BEF_Alt";
                calcFieldTool.expression = "[AltNames.ST_TYP_BEF]";
                gp.Execute(calcFieldTool, trackcancel);

                AddMessage("Copying over the alternate ST_NM_BASE values...", messages, trackcancel);

                calcFieldTool.field = StreetsFCName + ".ST_NM_BASE_Alt";
                calcFieldTool.expression = "[AltNames.ST_NM_BASE]";
                gp.Execute(calcFieldTool, trackcancel);

                AddMessage("Copying over the alternate ST_NM_SUFF values...", messages, trackcancel);

                calcFieldTool.field = StreetsFCName + ".ST_NM_SUFF_Alt";
                calcFieldTool.expression = "[AltNames.ST_NM_SUFF]";
                gp.Execute(calcFieldTool, trackcancel);

                AddMessage("Copying over the alternate ST_TYP_AFT values...", messages, trackcancel);

                calcFieldTool.field = StreetsFCName + ".ST_TYP_AFT_Alt";
                calcFieldTool.expression = "[AltNames.ST_TYP_AFT]";
                gp.Execute(calcFieldTool, trackcancel);

                AddMessage("Copying over the alternate DIRONSIGN values...", messages, trackcancel);

                calcFieldTool.field = StreetsFCName + ".DIRONSIGN_Alt";
                calcFieldTool.expression = "[AltNames.DIRONSIGN]";
                gp.Execute(calcFieldTool, trackcancel);

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "Streets_Layer";
                removeJoinTool.join_name = "AltNames";
                gp.Execute(removeJoinTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = "Streets_Layer";
                gp.Execute(deleteTool, trackcancel);
                deleteTool.in_data = AltNamesTablePath;
                gp.Execute(deleteTool, trackcancel);

                // Add fields for the Z-Level values to the Streets feature class

                AddMessage("Creating fields on the Streets feature class for the Z-Level values...", messages, trackcancel);

                addFieldTool = new AddField();
                addFieldTool.in_table = streetsFeatureClassPath;

                addFieldTool.field_type = "SHORT";
                addFieldTool.field_name = "F_ZLEV";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_name = "T_ZLEV";
                gp.Execute(addFieldTool, trackcancel);

                // Separate out the From and To Z-Level values into separate tables and index the LINK_ID fields

                string FromZsTablePath = outputFileGdbPath + "\\FromZs";
                string ToZsTablePath = outputFileGdbPath + "\\ToZs";

                AddMessage("Extracting the From Z-Level information...", messages, trackcancel);

                tableSelectTool = new TableSelect();
                tableSelectTool.in_table = inputZLevelsFeatureClassValue.GetAsText();
                tableSelectTool.out_table = FromZsTablePath;
                tableSelectTool.where_clause = "INTRSECT = 'Y' AND POINT_NUM = 1";
                gp.Execute(tableSelectTool, trackcancel);

                AddMessage("Extracting the To Z-Level information...", messages, trackcancel);

                tableSelectTool.out_table = ToZsTablePath;
                tableSelectTool.where_clause = "INTRSECT = 'Y' AND POINT_NUM > 1";
                gp.Execute(tableSelectTool, trackcancel);

                AddMessage("Analyzing the Z-Level information...", messages, trackcancel);

                addIndexTool = new AddIndex();
                addIndexTool.in_table = FromZsTablePath;
                addIndexTool.fields = "LINK_ID";
                addIndexTool.index_name = "LINK_ID";
                gp.Execute(addIndexTool, trackcancel);
                addIndexTool.in_table = ToZsTablePath;
                gp.Execute(addIndexTool, trackcancel);

                // Calculate the Z-Level fields

                makeFeatureLayerTool = new MakeFeatureLayer();
                makeFeatureLayerTool.in_features = streetsFeatureClassPath;
                makeFeatureLayerTool.out_layer = "Streets_Layer";
                gp.Execute(makeFeatureLayerTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "Streets_Layer";
                addJoinTool.in_field = "LINK_ID";
                addJoinTool.join_table = FromZsTablePath;
                addJoinTool.join_field = "LINK_ID";
                gp.Execute(addJoinTool, trackcancel);

                AddMessage("Copying over the F_ZLEV values...", messages, trackcancel);

                calcFieldTool = new CalculateField();
                calcFieldTool.in_table = "Streets_Layer";
                calcFieldTool.field = StreetsFCName + ".F_ZLEV";
                calcFieldTool.expression = "[FromZs.Z_LEVEL]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "Streets_Layer";
                removeJoinTool.join_name = "FromZs";
                gp.Execute(removeJoinTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "Streets_Layer";
                addJoinTool.in_field = "LINK_ID";
                addJoinTool.join_table = ToZsTablePath;
                addJoinTool.join_field = "LINK_ID";
                gp.Execute(addJoinTool, trackcancel);

                AddMessage("Copying over the T_ZLEV values...", messages, trackcancel);

                calcFieldTool = new CalculateField();
                calcFieldTool.in_table = "Streets_Layer";
                calcFieldTool.field = StreetsFCName + ".T_ZLEV";
                calcFieldTool.expression = "[ToZs.Z_LEVEL]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "Streets_Layer";
                removeJoinTool.join_name = "ToZs";
                gp.Execute(removeJoinTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = "Streets_Layer";
                gp.Execute(deleteTool, trackcancel);

                deleteTool.in_data = FromZsTablePath;
                gp.Execute(deleteTool, trackcancel);
                deleteTool.in_data = ToZsTablePath;
                gp.Execute(deleteTool, trackcancel);

                // Add fields for the distance (Meters), language, and speed (KPH) values to the Streets feature class

                AddMessage("Creating fields on the Streets feature class for distance, speed, and language...", messages, trackcancel);

                addFieldTool = new AddField();
                addFieldTool.in_table = streetsFeatureClassPath;

                addFieldTool.field_type = "DOUBLE";
                addFieldTool.field_name = "Meters";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_type = "FLOAT";
                addFieldTool.field_name = "KPH";
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_type = "TEXT";
                addFieldTool.field_name = "Language";
                addFieldTool.field_length = 2;
                gp.Execute(addFieldTool, trackcancel);
                addFieldTool.field_type = "TEXT";
                addFieldTool.field_name = "Language_Alt";
                addFieldTool.field_length = 2;
                gp.Execute(addFieldTool, trackcancel);

                // Calculate the distance (Meters), language, and speed (KPH) fields

                AddMessage("Calculating the distance, speed, and language fields...", messages, trackcancel);

                CalculateMetersKPHAndLanguageFields(outputFileGdbPath);

                if (createArcGISOnlineNetworkAttributes)
                {
                    CreateAndPopulateDirectionalVehicleAccessFields("AR_AUTO", streetsFeatureClassPath, gp, messages, trackcancel);
                    CreateAndPopulateDirectionalVehicleAccessFields("AR_BUS", streetsFeatureClassPath, gp, messages, trackcancel);
                    CreateAndPopulateDirectionalVehicleAccessFields("AR_TAXIS", streetsFeatureClassPath, gp, messages, trackcancel);
                    CreateAndPopulateDirectionalVehicleAccessFields("AR_TRUCKS", streetsFeatureClassPath, gp, messages, trackcancel);
                    CreateAndPopulateDirectionalVehicleAccessFields("AR_DELIV", streetsFeatureClassPath, gp, messages, trackcancel);
                    CreateAndPopulateDirectionalVehicleAccessFields("AR_EMERVEH", streetsFeatureClassPath, gp, messages, trackcancel);
                    CreateAndPopulateDirectionalVehicleAccessFields("AR_MOTOR", streetsFeatureClassPath, gp, messages, trackcancel);
                }

                // Add a field to the Streets feature class indicating roads closed for construction

                AddMessage("Creating the ClosedForConstruction field on the Streets feature class...", messages, trackcancel);

                addFieldTool = new AddField();
                addFieldTool.in_table = streetsFeatureClassPath;
                addFieldTool.field_type = "TEXT";
                addFieldTool.field_name = "ClosedForConstruction";
                addFieldTool.field_length = 1;
                gp.Execute(addFieldTool, trackcancel);

                // Create a table for looking up roads closed for construction

                AddMessage("Creating and indexing the table containing roads closed for construction...", messages, trackcancel);

                string closedForConstructionTablePath = outputFileGdbPath + "\\ClosedForConstruction";

                tableSelectTool = new TableSelect();
                tableSelectTool.in_table = inputCdmsTableValue.GetAsText();
                tableSelectTool.out_table = closedForConstructionTablePath;
                tableSelectTool.where_clause = "COND_TYPE = 3";
                gp.Execute(tableSelectTool, trackcancel);

                addIndexTool = new AddIndex();
                addIndexTool.in_table = closedForConstructionTablePath;
                addIndexTool.fields = "LINK_ID";
                addIndexTool.index_name = "LINK_ID";
                gp.Execute(addIndexTool, trackcancel);

                makeFeatureLayerTool = new MakeFeatureLayer();
                makeFeatureLayerTool.in_features = streetsFeatureClassPath;
                makeFeatureLayerTool.out_layer = "Streets_Layer";
                gp.Execute(makeFeatureLayerTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "Streets_Layer";
                addJoinTool.in_field = "LINK_ID";
                addJoinTool.join_table = closedForConstructionTablePath;
                addJoinTool.join_field = "LINK_ID";
                addJoinTool.join_type = "KEEP_COMMON";
                gp.Execute(addJoinTool, trackcancel);

                AddMessage("Calculating the ClosedForConstruction field...", messages, trackcancel);

                calcFieldTool = new CalculateField();
                calcFieldTool.in_table = "Streets_Layer";
                calcFieldTool.field = "Streets.ClosedForConstruction";
                calcFieldTool.expression = "\"Y\"";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "Streets_Layer";
                removeJoinTool.join_name = "ClosedForConstruction";
                gp.Execute(removeJoinTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = "Streets_Layer";
                gp.Execute(deleteTool, trackcancel);
                deleteTool.in_data = closedForConstructionTablePath;
                gp.Execute(deleteTool, trackcancel);

                // Add fields to the Streets feature class indicating roads with usage fees

                string[] arFieldSuffixes = new string[] { "AUTO", "BUS", "TAXIS", "CARPOOL", "PEDSTRN",
                                                          "TRUCKS", "THRUTR", "DELIVER", "EMERVEH", "MOTOR" };

                AddMessage("Creating the UFR fields on the Streets feature class...", messages, trackcancel);

                foreach (string arFieldSuffix in arFieldSuffixes)
                {
                    addFieldTool = new AddField();
                    addFieldTool.in_table = streetsFeatureClassPath;
                    addFieldTool.field_name = "UFR_" + arFieldSuffix;
                    addFieldTool.field_type = "TEXT";
                    addFieldTool.field_length = 1;
                    gp.Execute(addFieldTool, trackcancel);
                }

                // Create a table for looking up roads with usage fees

                AddMessage("Creating and indexing the table containing roads with usage fees...", messages, trackcancel);

                string usageFeeRequiredTablePath = outputFileGdbPath + "\\UsageFeeRequired";

                tableSelectTool = new TableSelect();
                tableSelectTool.in_table = inputCdmsTableValue.GetAsText();
                tableSelectTool.out_table = usageFeeRequiredTablePath;
                tableSelectTool.where_clause = "COND_TYPE = 12";
                gp.Execute(tableSelectTool, trackcancel);

                addIndexTool = new AddIndex();
                addIndexTool.in_table = usageFeeRequiredTablePath;
                addIndexTool.fields = "LINK_ID";
                addIndexTool.index_name = "LINK_ID";
                gp.Execute(addIndexTool, trackcancel);

                makeFeatureLayerTool = new MakeFeatureLayer();
                makeFeatureLayerTool.in_features = streetsFeatureClassPath;
                makeFeatureLayerTool.out_layer = "Streets_Layer";
                gp.Execute(makeFeatureLayerTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "Streets_Layer";
                addJoinTool.in_field = "LINK_ID";
                addJoinTool.join_table = usageFeeRequiredTablePath;
                addJoinTool.join_field = "LINK_ID";
                addJoinTool.join_type = "KEEP_COMMON";
                gp.Execute(addJoinTool, trackcancel);

                AddMessage("Calculating the ClosedForConstruction field...", messages, trackcancel);

                foreach (string arFieldSuffix in arFieldSuffixes)
                {
                    AddMessage("Calculating the UFR_" + arFieldSuffix + " field on the Streets feature class...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "Streets_Layer";
                    calcFieldTool.field = "Streets.UFR_" + arFieldSuffix;
                    calcFieldTool.expression = "[UsageFeeRequired.AR_" + arFieldSuffix + "]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);
                }

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "Streets_Layer";
                removeJoinTool.join_name = "UsageFeeRequired";
                gp.Execute(removeJoinTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = "Streets_Layer";
                gp.Execute(deleteTool, trackcancel);
                deleteTool.in_data = usageFeeRequiredTablePath;
                gp.Execute(deleteTool, trackcancel);

                // Copy the time zones table to the file geodatabase

                if (timeZoneIDBaseFieldName != "")
                {
                    AddMessage("Copying the TimeZones table...", messages, trackcancel);

                    importTableTool = new TableToTable();
                    importTableTool.in_rows = inputTimeZoneTableValue.GetAsText();
                    importTableTool.out_path = outputFileGdbPath;
                    importTableTool.out_name = "TimeZones";
                    gp.Execute(importTableTool, trackcancel);
                }

                #region Process Historical Traffic Tables

                if (usesHistoricalTraffic)
                {
                    // Create the Patterns table and index its PatternID field

                    AddMessage("Creating the Patterns table...", messages, trackcancel);

                    string listOfConstantPatterns = CreatePatternsTable(inputSPDFileValue.GetAsText(), outputFileGdbPath, fgdbVersion);

                    string patternsTablePath = outputFileGdbPath + "\\" + ProfilesTableName;

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = patternsTablePath;
                    addIndexTool.fields = "PatternID";
                    addIndexTool.index_name = "PatternID";
                    gp.Execute(addIndexTool, trackcancel);

                    string histTrafficJoinTablePath = outputFileGdbPath + "\\" + HistTrafficJoinTableName;

                    // Add fields for the average speeds to the Streets feature class

                    AddMessage("Creating fields for the average speeds and travel times...", messages, trackcancel);

                    addFieldTool = new AddField();
                    addFieldTool.in_table = streetsFeatureClassPath;

                    addFieldTool.field_type = "FLOAT";
                    addFieldTool.field_name = "FT_AverageSpeed";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "TF_AverageSpeed";
                    gp.Execute(addFieldTool, trackcancel);

                    if (usesNTPFullCoverage)
                    {
                        // Convert the Link Reference files to a FileGDB table

                        AddMessage("Converting the Link Reference files to a table...", messages, trackcancel);

                        ConvertLinkReferenceFilesToFGDBTable(inputLinkReferenceFileFC14Value.GetAsText(),
                                                             inputLinkReferenceFileFC5Value.GetAsText(),
                                                             outputFileGdbPath);

                        string referenceTablePath = outputFileGdbPath + "\\TempRefTable";

                        // Extract out the rows we want in our historical traffic table

                        AddMessage("Creating the historical traffic join table...", messages, trackcancel);

                        if (listOfConstantPatterns == "")
                        {
                            Rename renameTool = new Rename();
                            renameTool.in_data = referenceTablePath;
                            renameTool.out_data = histTrafficJoinTablePath;
                            gp.Execute(renameTool, trackcancel);
                        }
                        else
                        {
                            tableSelectTool = new TableSelect();
                            tableSelectTool.in_table = referenceTablePath;
                            tableSelectTool.out_table = histTrafficJoinTablePath;
                            tableSelectTool.where_clause = "NOT ( IS_FC5 = 'Y' AND U IN (" + listOfConstantPatterns +
                                                           ") AND U = M AND M = T AND T = W AND W = R AND R = F AND F = S )";
                            gp.Execute(tableSelectTool, trackcancel);

                            deleteTool = new Delete();
                            deleteTool.in_data = referenceTablePath;
                            gp.Execute(deleteTool, trackcancel);
                        }
                    }
                    else
                    {
                        // Convert the TMC Reference file to a FileGDB table and index its TMC field

                        AddMessage("Converting the TMC Reference file to a table...", messages, trackcancel);

                        ConvertTMCReferenceFileToFGDBTable(inputTMCReferenceFileValue.GetAsText(), outputFileGdbPath);

                        string referenceTablePath = outputFileGdbPath + "\\TempRefTable";

                        addIndexTool = new AddIndex();
                        addIndexTool.in_table = referenceTablePath;
                        addIndexTool.fields = "TMC";
                        addIndexTool.index_name = "TMC";
                        gp.Execute(addIndexTool, trackcancel);

                        // Copy over the Traffic table to the file geodatabase

                        AddMessage("Copying Traffic table to the file geodatabase...", messages, trackcancel);

                        importTableTool = new TableToTable();
                        importTableTool.in_rows = inputTrafficTableValue.GetAsText();
                        importTableTool.out_path = outputFileGdbPath;
                        importTableTool.out_name = "Street";
                        gp.Execute(importTableTool, trackcancel);

                        string trafficTablePath = outputFileGdbPath + "\\Street";

                        // Add the TMC field and calculate it

                        AddMessage("Calculating TMC values for historical traffic...", messages, trackcancel);

                        addFieldTool = new AddField();
                        addFieldTool.in_table = trafficTablePath;
                        addFieldTool.field_type = "TEXT";
                        addFieldTool.field_length = 9;
                        addFieldTool.field_name = "TMC";
                        gp.Execute(addFieldTool, trackcancel);

                        calcFieldTool = new CalculateField();
                        calcFieldTool.in_table = trafficTablePath;
                        calcFieldTool.field = "TMC";
                        calcFieldTool.expression = "Replace(Replace(Right([TRAFFIC_CD], 9), \"+\", \"P\"), \"-\", \"N\")";
                        calcFieldTool.expression_type = "VB";
                        gp.Execute(calcFieldTool, trackcancel);

                        AddMessage("Creating the historical traffic join table...", messages, trackcancel);

                        // Join the Traffic table to the Reference table...

                        makeTableViewTool = new MakeTableView();
                        makeTableViewTool.in_table = trafficTablePath;
                        makeTableViewTool.out_view = "Traffic_View";
                        gp.Execute(makeTableViewTool, trackcancel);

                        addJoinTool = new AddJoin();
                        addJoinTool.in_layer_or_view = "Traffic_View";
                        addJoinTool.in_field = "TMC";
                        addJoinTool.join_table = referenceTablePath;
                        addJoinTool.join_field = "TMC";
                        addJoinTool.join_type = "KEEP_COMMON";
                        gp.Execute(addJoinTool, trackcancel);

                        // ...then create the Streets_Patterns table by copying out the joined rows

                        importTableTool = new TableToTable();
                        importTableTool.in_rows = "Traffic_View";
                        importTableTool.out_path = outputFileGdbPath;
                        importTableTool.out_name = HistTrafficJoinTableName;
                        importTableTool.field_mapping = "LINK_ID \"LINK_ID\" true true false 4 Long 0 0 ,First,#," + trafficTablePath + ",Street.LINK_ID,-1,-1;" +
                                                        "TRAFFIC_CD \"TRAFFIC_CD\" true true false 10 Text 0 0 ,First,#," + trafficTablePath + ",Street.TRAFFIC_CD,-1,-1;" +
                                                        "TMC \"TMC\" true true false 9 Text 0 0 ,First,#," + trafficTablePath + ",Street.TMC,-1,-1;" +
                                                        "U \"U\" true true false 2 Short 0 0 ,First,#," + trafficTablePath + ",TempRefTable.U,-1,-1;" +
                                                        "M \"M\" true true false 2 Short 0 0 ,First,#," + trafficTablePath + ",TempRefTable.M,-1,-1;" +
                                                        "T \"T\" true true false 2 Short 0 0 ,First,#," + trafficTablePath + ",TempRefTable.T,-1,-1;" +
                                                        "W \"W\" true true false 2 Short 0 0 ,First,#," + trafficTablePath + ",TempRefTable.W,-1,-1;" +
                                                        "R \"R\" true true false 2 Short 0 0 ,First,#," + trafficTablePath + ",TempRefTable.R,-1,-1;" +
                                                        "F \"F\" true true false 2 Short 0 0 ,First,#," + trafficTablePath + ",TempRefTable.F,-1,-1;" +
                                                        "S \"S\" true true false 2 Short 0 0 ,First,#," + trafficTablePath + ",TempRefTable.S,-1,-1";
                        gp.Execute(importTableTool, trackcancel);

                        // Delete the join, view, and temporary tables

                        removeJoinTool = new RemoveJoin();
                        removeJoinTool.in_layer_or_view = "Traffic_View";
                        removeJoinTool.join_name = "TempRefTable";
                        gp.Execute(removeJoinTool, trackcancel);

                        deleteTool = new Delete();
                        deleteTool.in_data = "Traffic_View";
                        gp.Execute(deleteTool, trackcancel);

                        deleteTool = new Delete();
                        deleteTool.in_data = referenceTablePath;
                        gp.Execute(deleteTool, trackcancel);

                        deleteTool = new Delete();
                        deleteTool.in_data = trafficTablePath;
                        gp.Execute(deleteTool, trackcancel);
                    }

                    AddMessage("Creating fields on the historical traffic join table...", messages, trackcancel);

                    addFieldTool = new AddField();
                    addFieldTool.in_table = histTrafficJoinTablePath;

                    // Add FCID, FID, position, AverageSpeed[_X], and BaseSpeed[_X] fields to the Streets_Patterns table

                    addFieldTool.field_type = "LONG";
                    addFieldTool.field_name = "EdgeFCID";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "EdgeFID";
                    gp.Execute(addFieldTool, trackcancel);

                    addFieldTool.field_type = "DOUBLE";
                    addFieldTool.field_name = "EdgeFrmPos";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "EdgeToPos";
                    gp.Execute(addFieldTool, trackcancel);

                    addFieldTool.field_type = "FLOAT";
                    addFieldTool.field_name = "AverageSpeed";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "AverageSpeed_U";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "AverageSpeed_M";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "AverageSpeed_T";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "AverageSpeed_W";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "AverageSpeed_R";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "AverageSpeed_F";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "AverageSpeed_S";
                    gp.Execute(addFieldTool, trackcancel);

                    addFieldTool.field_type = "FLOAT";
                    addFieldTool.field_name = "BaseSpeed";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "BaseSpeed_U";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "BaseSpeed_M";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "BaseSpeed_T";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "BaseSpeed_W";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "BaseSpeed_R";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "BaseSpeed_F";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "BaseSpeed_S";
                    gp.Execute(addFieldTool, trackcancel);

                    // If we're creating 10.0, then we also need to create the BaseMinutes field

                    if (fgdbVersion == 10.0)
                    {
                        addFieldTool.field_type = "DOUBLE";
                        addFieldTool.field_name = "BaseMinutes";
                        gp.Execute(addFieldTool, trackcancel);
                    }

                    // Populate the AverageSpeed_X and BaseSpeed_X fields

                    makeTableViewTool = new MakeTableView();
                    makeTableViewTool.in_table = histTrafficJoinTablePath;
                    makeTableViewTool.out_view = "Streets_Patterns_View";
                    gp.Execute(makeTableViewTool, trackcancel);

                    PopulateAverageSpeedAndBaseSpeedFields(patternsTablePath, "U", gp, messages, trackcancel);
                    PopulateAverageSpeedAndBaseSpeedFields(patternsTablePath, "M", gp, messages, trackcancel);
                    PopulateAverageSpeedAndBaseSpeedFields(patternsTablePath, "T", gp, messages, trackcancel);
                    PopulateAverageSpeedAndBaseSpeedFields(patternsTablePath, "W", gp, messages, trackcancel);
                    PopulateAverageSpeedAndBaseSpeedFields(patternsTablePath, "R", gp, messages, trackcancel);
                    PopulateAverageSpeedAndBaseSpeedFields(patternsTablePath, "F", gp, messages, trackcancel);
                    PopulateAverageSpeedAndBaseSpeedFields(patternsTablePath, "S", gp, messages, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_Patterns_View";
                    gp.Execute(deleteTool, trackcancel);

                    // Calculate the AverageSpeed and BaseSpeed fields

                    AddMessage("Calculating the AverageSpeed field...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = histTrafficJoinTablePath;
                    calcFieldTool.field = "AverageSpeed";
                    calcFieldTool.expression = "( (1/[AverageSpeed_U]) + (1/[AverageSpeed_M]) + (1/[AverageSpeed_T]) + (1/[AverageSpeed_W]) + (1/[AverageSpeed_R]) + (1/[AverageSpeed_F]) + (1/[AverageSpeed_S]) ) / " +
                                               "( (1/[AverageSpeed_U]/[AverageSpeed_U]) + (1/[AverageSpeed_M]/[AverageSpeed_M]) + (1/[AverageSpeed_T]/[AverageSpeed_T]) + (1/[AverageSpeed_W]/[AverageSpeed_W]) + (1/[AverageSpeed_R]/[AverageSpeed_R]) + (1/[AverageSpeed_F]/[AverageSpeed_F]) + (1/[AverageSpeed_S]/[AverageSpeed_S]) )";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the BaseSpeed field...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = histTrafficJoinTablePath;
                    calcFieldTool.field = "BaseSpeed";
                    calcFieldTool.expression = "( (1/[BaseSpeed_U]) + (1/[BaseSpeed_M]) + (1/[BaseSpeed_T]) + (1/[BaseSpeed_W]) + (1/[BaseSpeed_R]) + (1/[BaseSpeed_F]) + (1/[BaseSpeed_S]) ) / " +
                                               "( (1/[BaseSpeed_U]/[BaseSpeed_U]) + (1/[BaseSpeed_M]/[BaseSpeed_M]) + (1/[BaseSpeed_T]/[BaseSpeed_T]) + (1/[BaseSpeed_W]/[BaseSpeed_W]) + (1/[BaseSpeed_R]/[BaseSpeed_R]) + (1/[BaseSpeed_F]/[BaseSpeed_F]) + (1/[BaseSpeed_S]/[BaseSpeed_S]) )";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    DeleteField deleteFieldTool = new DeleteField();
                    deleteFieldTool.in_table = histTrafficJoinTablePath;
                    deleteFieldTool.drop_field = "AverageSpeed_U;AverageSpeed_M;AverageSpeed_T;AverageSpeed_W;AverageSpeed_R;AverageSpeed_F;AverageSpeed_S;BaseSpeed_U;BaseSpeed_M;BaseSpeed_T;BaseSpeed_W;BaseSpeed_R;BaseSpeed_F;BaseSpeed_S";
                    gp.Execute(deleteFieldTool, trackcancel);

                    makeTableViewTool = new MakeTableView();
                    makeTableViewTool.in_table = histTrafficJoinTablePath;
                    makeTableViewTool.out_view = "Streets_Patterns_View";
                    gp.Execute(makeTableViewTool, trackcancel);

                    addJoinTool = new AddJoin();
                    addJoinTool.in_layer_or_view = "Streets_Patterns_View";
                    addJoinTool.in_field = (usesNTPFullCoverage ? "LINK_PVID" : "LINK_ID");
                    addJoinTool.join_table = streetsFeatureClassPath;
                    addJoinTool.join_field = "LINK_ID";
                    gp.Execute(addJoinTool, trackcancel);

                    // Calculate the BaseMinutes field (if 10.0)

                    if (fgdbVersion == 10.0)
                    {
                        AddMessage("Calculating the BaseMinutes field...", messages, trackcancel);

                        calcFieldTool = new CalculateField();
                        calcFieldTool.in_table = "Streets_Patterns_View";
                        calcFieldTool.field = HistTrafficJoinTableName + ".BaseMinutes";
                        calcFieldTool.expression = "[" + StreetsFCName + ".Meters] * 0.06 / [" + HistTrafficJoinTableName + ".BaseSpeed]";
                        calcFieldTool.expression_type = "VB";
                        gp.Execute(calcFieldTool, trackcancel);
                    }

                    // Calculate the FCID, FID, and position fields

                    AddMessage("Calculating the EdgeFID field for historical traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "Streets_Patterns_View";
                    calcFieldTool.field = HistTrafficJoinTableName + ".EdgeFID";
                    calcFieldTool.expression = "[" + StreetsFCName + ".OBJECTID]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    removeJoinTool = new RemoveJoin();
                    removeJoinTool.in_layer_or_view = "Streets_Patterns_View";
                    removeJoinTool.join_name = StreetsFCName;
                    gp.Execute(removeJoinTool, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_Patterns_View";
                    gp.Execute(deleteTool, trackcancel);

                    AddMessage("Calculating the EdgeFCID field for historical traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = histTrafficJoinTablePath;
                    calcFieldTool.field = "EdgeFCID";
                    calcFieldTool.expression = "1";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeFrmPos field for historical traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = histTrafficJoinTablePath;

                    calcFieldTool.field = "EdgeFrmPos";
                    calcFieldTool.expression = "x";
                    calcFieldTool.code_block = (usesNTPFullCoverage ? "Select Case [TRAVEL_DIRECTION]\n  Case \"F\": x = 0\n  Case \"T\": x = 1\nEnd Select" :
                                                                      "Select Case Left([TRAFFIC_CD], 1)\n  Case \"+\": x = 0\n  Case \"-\": x = 1\nEnd Select");
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeToPos field for historical traffic...", messages, trackcancel);

                    calcFieldTool.field = "EdgeToPos";
                    calcFieldTool.expression = "x";
                    calcFieldTool.code_block = (usesNTPFullCoverage ? "Select Case [TRAVEL_DIRECTION]\n  Case \"T\": x = 0\n  Case \"F\": x = 1\nEnd Select" :
                                                                      "Select Case Left([TRAFFIC_CD], 1)\n  Case \"-\": x = 0\n  Case \"+\": x = 1\nEnd Select");
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    // Write the average speeds to the streets feature class

                    WriteAverageSpeedsToStreets(outputFileGdbPath, streetsFeatureClassPath, usesNTPFullCoverage, gp, messages, trackcancel);

                    // Add fields for the average travel times to the Streets feature class

                    AddMessage("Creating fields for the average travel times...", messages, trackcancel);

                    addFieldTool = new AddField();
                    addFieldTool.in_table = streetsFeatureClassPath;

                    addFieldTool.field_type = "FLOAT";
                    addFieldTool.field_name = "FT_Minutes";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "TF_Minutes";
                    gp.Execute(addFieldTool, trackcancel);

                    // Calculate the average travel time fields

                    AddMessage("Calculating the FT travel times...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = streetsFeatureClassPath;

                    calcFieldTool.field = "FT_Minutes";
                    calcFieldTool.expression = "[Meters] * 0.06 / s";
                    calcFieldTool.code_block = "s = [FT_AverageSpeed]\nIf IsNull(s) Then s = [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the TF travel times...", messages, trackcancel);

                    calcFieldTool.field = "TF_Minutes";
                    calcFieldTool.expression = "[Meters] * 0.06 / s";
                    calcFieldTool.code_block = "s = [TF_AverageSpeed]\nIf IsNull(s) Then s = [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    // Offset the daily pattern fields (U,M,T,W,R,F,S) on the historical traffic join table

                    OffsetDailyPatternFields(histTrafficJoinTablePath, patternsTablePath);

                    // Add an index to the Streets feature class's FUNC_CLASS field

                    AddMessage("Indexing the FUNC_CLASS field...", messages, trackcancel);

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = streetsFeatureClassPath;
                    addIndexTool.fields = "FUNC_CLASS";
                    addIndexTool.index_name = "FUNC_CLASS";
                    gp.Execute(addIndexTool, trackcancel);
                }
                else
                {
                    // Create and calculate the generic Minutes field from speed categories

                    addFieldTool = new AddField();
                    addFieldTool.in_table = streetsFeatureClassPath;
                    addFieldTool.field_type = "FLOAT";
                    addFieldTool.field_name = "Minutes";
                    gp.Execute(addFieldTool, trackcancel);

                    AddMessage("Calculating the Minutes field...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = streetsFeatureClassPath;
                    calcFieldTool.field = "Minutes";
                    calcFieldTool.expression = "[Meters] * 0.06 / [KPH]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);
                }
                #endregion

                #region Process Live Traffic Table

                // Create the live traffic table (for 10.1 or later)

                if (fgdbVersion >= 10.1 && !inputTrafficTableValue.IsEmpty())
                {
                    // Copy over the Traffic table to the file geodatabase

                    AddMessage("Copying Traffic table to the file geodatabase...", messages, trackcancel);

                    importTableTool = new TableToTable();
                    importTableTool.in_rows = inputTrafficTableValue.GetAsText();
                    importTableTool.out_path = outputFileGdbPath;
                    importTableTool.out_name = TMCJoinTableName;
                    gp.Execute(importTableTool, trackcancel);

                    string TMCJoinTablePath = outputFileGdbPath + "\\" + TMCJoinTableName;

                    // Add the TMC field and calculate it

                    AddMessage("Calculating TMC values for live traffic...", messages, trackcancel);

                    addFieldTool = new AddField();
                    addFieldTool.in_table = TMCJoinTablePath;
                    addFieldTool.field_type = "TEXT";
                    addFieldTool.field_length = 9;
                    addFieldTool.field_name = "TMC";
                    gp.Execute(addFieldTool, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = TMCJoinTablePath;
                    calcFieldTool.field = "TMC";
                    calcFieldTool.expression = "Right([TRAFFIC_CD], 9)";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Creating the live traffic join table...", messages, trackcancel);

                    // Add FCID, FID, and position fields to the Streets_TMC table

                    AddMessage("Creating fields on the live traffic join table...", messages, trackcancel);

                    addFieldTool = new AddField();
                    addFieldTool.in_table = TMCJoinTablePath;

                    addFieldTool.field_type = "LONG";
                    addFieldTool.field_name = "EdgeFCID";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "EdgeFID";
                    gp.Execute(addFieldTool, trackcancel);

                    addFieldTool.field_type = "DOUBLE";
                    addFieldTool.field_name = "EdgeFrmPos";
                    gp.Execute(addFieldTool, trackcancel);
                    addFieldTool.field_name = "EdgeToPos";
                    gp.Execute(addFieldTool, trackcancel);

                    // Calculate the fields

                    AddMessage("Calculating the EdgeFrmPos field for live traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = TMCJoinTablePath;

                    calcFieldTool.field = "EdgeFrmPos";
                    calcFieldTool.expression = "x";
                    calcFieldTool.code_block = "Select Case Left([TRAFFIC_CD], 1)\n  Case \"+\": x = 0\n  Case \"-\": x = 1\nEnd Select";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeToPos field for live traffic...", messages, trackcancel);

                    calcFieldTool.field = "EdgeToPos";
                    calcFieldTool.expression = "x";
                    calcFieldTool.code_block = "Select Case Left([TRAFFIC_CD], 1)\n  Case \"-\": x = 0\n  Case \"+\": x = 1\nEnd Select";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeFCID field for live traffic...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = TMCJoinTablePath;
                    calcFieldTool.field = "EdgeFCID";
                    calcFieldTool.expression = "1";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    AddMessage("Calculating the EdgeFID field for live traffic...", messages, trackcancel);

                    makeTableViewTool = new MakeTableView();
                    makeTableViewTool.in_table = TMCJoinTablePath;
                    makeTableViewTool.out_view = "Streets_TMC_View";
                    gp.Execute(makeTableViewTool, trackcancel);

                    addJoinTool = new AddJoin();
                    addJoinTool.in_layer_or_view = "Streets_TMC_View";
                    addJoinTool.in_field = "LINK_ID";
                    addJoinTool.join_table = streetsFeatureClassPath;
                    addJoinTool.join_field = "LINK_ID";
                    gp.Execute(addJoinTool, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "Streets_TMC_View";
                    calcFieldTool.field = TMCJoinTableName + ".EdgeFID";
                    calcFieldTool.expression = "[" + StreetsFCName + ".OBJECTID]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    removeJoinTool = new RemoveJoin();
                    removeJoinTool.in_layer_or_view = "Streets_TMC_View";
                    removeJoinTool.join_name = StreetsFCName;
                    gp.Execute(removeJoinTool, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_TMC_View";
                    gp.Execute(deleteTool, trackcancel);

                    // If Historical Traffic is not being used, then we need to create placeholder historical traffic tables

                    if (!usesHistoricalTraffic)
                    {
                        // Create the Streets_Patterns table by starting with a copy of the Streets_TMC table

                        AddMessage("Creating the historical traffic join table...", messages, trackcancel);

                        importTableTool = new TableToTable();
                        importTableTool.in_rows = TMCJoinTablePath;
                        importTableTool.out_path = outputFileGdbPath;
                        importTableTool.out_name = HistTrafficJoinTableName;
                        gp.Execute(importTableTool, trackcancel);

                        string histTrafficJoinTablePath = outputFileGdbPath + "\\" + HistTrafficJoinTableName;

                        AddMessage("Creating and calculating the KPH field on the historical traffic join table...", messages, trackcancel);

                        addFieldTool = new AddField();
                        addFieldTool.in_table = histTrafficJoinTablePath;
                        addFieldTool.field_type = "FLOAT";
                        addFieldTool.field_name = "KPH";
                        gp.Execute(addFieldTool, trackcancel);

                        makeTableViewTool = new MakeTableView();
                        makeTableViewTool.in_table = histTrafficJoinTablePath;
                        makeTableViewTool.out_view = "Streets_Patterns_View";
                        gp.Execute(makeTableViewTool, trackcancel);

                        addJoinTool = new AddJoin();
                        addJoinTool.in_layer_or_view = "Streets_Patterns_View";
                        addJoinTool.in_field = "EdgeFID";
                        addJoinTool.join_table = streetsFeatureClassPath;
                        addJoinTool.join_field = "OBJECTID";
                        gp.Execute(addJoinTool, trackcancel);

                        calcFieldTool = new CalculateField();
                        calcFieldTool.in_table = "Streets_Patterns_View";
                        calcFieldTool.field = HistTrafficJoinTableName + ".KPH";
                        calcFieldTool.expression = "[" + StreetsFCName + ".KPH]";
                        calcFieldTool.expression_type = "VB";
                        gp.Execute(calcFieldTool, trackcancel);

                        removeJoinTool = new RemoveJoin();
                        removeJoinTool.in_layer_or_view = "Streets_Patterns_View";
                        removeJoinTool.join_name = StreetsFCName;
                        gp.Execute(removeJoinTool, trackcancel);

                        deleteTool = new Delete();
                        deleteTool.in_data = "Streets_Patterns_View";
                        gp.Execute(deleteTool, trackcancel);

                        AddMessage("Creating and calculating the daily patterns fields on the historical traffic join table...", messages, trackcancel);

                        string[] fieldNames = new string[] { "S", "M", "T", "W", "R", "F", "S" };
                        foreach (string f in fieldNames)
                        {
                            addFieldTool = new AddField();
                            addFieldTool.in_table = histTrafficJoinTablePath;
                            addFieldTool.field_type = "SHORT";
                            addFieldTool.field_name = f;
                            gp.Execute(addFieldTool, trackcancel);

                            calcFieldTool = new CalculateField();
                            calcFieldTool.in_table = histTrafficJoinTablePath;
                            calcFieldTool.field = f;
                            calcFieldTool.expression = "1";
                            calcFieldTool.expression_type = "VB";
                            gp.Execute(calcFieldTool, trackcancel);
                        }

                        // Create the Patterns table

                        CreateNonHistoricalPatternsTable(outputFileGdbPath);
                    }
                }
                #endregion

                // Copy the Cdms table to the file geodatabase

                AddMessage("Copying the Condition/Driving Manoeuvres (CDMS) table and indexing...", messages, trackcancel);

                importTableTool = new TableToTable();
                importTableTool.in_rows = inputCdmsTableValue.GetAsText();
                importTableTool.out_path = outputFileGdbPath;
                importTableTool.out_name = "Cdms";
                gp.Execute(importTableTool, trackcancel);

                string cdmsTablePath = outputFileGdbPath + "\\Cdms";

                addIndexTool = new AddIndex();
                addIndexTool.in_table = cdmsTablePath;
                addIndexTool.fields = "COND_ID";
                addIndexTool.index_name = "COND_ID";
                gp.Execute(addIndexTool, trackcancel);

                // Copy the Rdms table to the file geodatabase

                AddMessage("Copying the Restricted Driving Manoeuvres (RDMS) table...", messages, trackcancel);

                importTableTool = new TableToTable();
                importTableTool.in_rows = inputRdmsTableValue.GetAsText();
                importTableTool.out_path = outputFileGdbPath;
                importTableTool.out_name = "Rdms";
                gp.Execute(importTableTool, trackcancel);

                string rdmsTablePath = outputFileGdbPath + "\\Rdms";

                // Add and calculate the end of link and condition type fields to the Rdms table

                AddMessage("Creating and calculating fields for the manoeuvre types and ends of link...", messages, trackcancel);

                addFieldTool = new AddField();
                addFieldTool.in_table = rdmsTablePath;
                addFieldTool.field_name = "COND_TYPE";
                addFieldTool.field_type = "LONG";
                gp.Execute(addFieldTool, trackcancel);

                addFieldTool.field_name = "END_OF_LK";
                addFieldTool.field_type = "TEXT";
                addFieldTool.field_length = 1;
                gp.Execute(addFieldTool, trackcancel);

                makeTableViewTool = new MakeTableView();
                makeTableViewTool.in_table = rdmsTablePath;
                makeTableViewTool.out_view = "Rdms_View";
                gp.Execute(makeTableViewTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "Rdms_View";
                addJoinTool.in_field = "COND_ID";
                addJoinTool.join_table = cdmsTablePath;
                addJoinTool.join_field = "COND_ID";
                gp.Execute(addJoinTool, trackcancel);

                calcFieldTool = new CalculateField();
                calcFieldTool.in_table = "Rdms_View";
                calcFieldTool.field = "Rdms.COND_TYPE";
                calcFieldTool.expression = "[Cdms.COND_TYPE]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                calcFieldTool.field = "Rdms.END_OF_LK";
                calcFieldTool.expression = "[Cdms.END_OF_LK]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "Rdms_View";
                removeJoinTool.join_name = "Cdms";
                gp.Execute(removeJoinTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = "Rdms_View";
                gp.Execute(deleteTool, trackcancel);

                // Extract only the gates (condition type 4) and prohibitied manoeuvres (condition type 7)
                // If using Transport, also extract the Transport manoeuvres (condition type 26)

                AddMessage("Extracting restricted driving manoeuvres...", messages, trackcancel);

                string prohibRdmsWEndOfLkTablePath = outputFileGdbPath + "\\ProhibRdmsWEndOfLk";

                tableSelectTool = new TableSelect();
                tableSelectTool.in_table = rdmsTablePath;
                tableSelectTool.out_table = prohibRdmsWEndOfLkTablePath;
                if (usesTransport)
                    tableSelectTool.where_clause = "COND_TYPE IN (4, 7, 26)";
                else
                    tableSelectTool.where_clause = "COND_TYPE IN (4, 7)";
                gp.Execute(tableSelectTool, trackcancel);

                AddMessage("Creating turn feature class...", messages, trackcancel);

                // Create the turn feature class

                string tempStatsTablePath = outputFileGdbPath + "\\tempStatsTable";

                Statistics statsTool = new Statistics();
                statsTool.in_table = prohibRdmsWEndOfLkTablePath;
                statsTool.out_table = tempStatsTablePath;
                statsTool.statistics_fields = "SEQ_NUMBER MAX";
                gp.Execute(statsTool, null);

                CreateAndPopulateTurnFeatureClass(outputFileGdbPath, fdsName, "ProhibRdmsWEndOfLk", "tempStatsTable",
                                                  messages, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = tempStatsTablePath;
                gp.Execute(deleteTool, trackcancel);

                string pathToTurnFC = pathToFds + "\\" + TurnFCName;

                // Create and calculate condition type and access restriction fields on the turn feature class

                addFieldTool = new AddField();
                addFieldTool.in_table = pathToTurnFC;
                addFieldTool.field_name = "COND_TYPE";
                addFieldTool.field_type = "LONG";
                gp.Execute(addFieldTool, trackcancel);

                AddMessage("Creating access restriction fields on the turn feature class...", messages, trackcancel);

                foreach (string arFieldSuffix in arFieldSuffixes)
                {
                    addFieldTool = new AddField();
                    addFieldTool.in_table = pathToTurnFC;
                    addFieldTool.field_name = "AR_" + arFieldSuffix;
                    addFieldTool.field_type = "TEXT";
                    addFieldTool.field_length = 1;
                    gp.Execute(addFieldTool, trackcancel);
                }

                makeFeatureLayerTool = new MakeFeatureLayer();
                makeFeatureLayerTool.in_features = pathToTurnFC;
                makeFeatureLayerTool.out_layer = "Turn_Layer";
                gp.Execute(makeFeatureLayerTool, trackcancel);

                addJoinTool = new AddJoin();
                addJoinTool.in_layer_or_view = "Turn_Layer";
                addJoinTool.in_field = "COND_ID";
                addJoinTool.join_table = cdmsTablePath;
                addJoinTool.join_field = "COND_ID";
                gp.Execute(addJoinTool, trackcancel);

                AddMessage("Calculating the COND_TYPE field on the turn feature class...", messages, trackcancel);

                calcFieldTool = new CalculateField();
                calcFieldTool.in_table = "Turn_Layer";
                calcFieldTool.field = TurnFCName + ".COND_TYPE";
                calcFieldTool.expression = "[Cdms.COND_TYPE]";
                calcFieldTool.expression_type = "VB";
                gp.Execute(calcFieldTool, trackcancel);

                foreach (string arFieldSuffix in arFieldSuffixes)
                {
                    AddMessage("Calculating the AR_" + arFieldSuffix + " field on the turn feature class...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "Turn_Layer";
                    calcFieldTool.field = TurnFCName + ".AR_" + arFieldSuffix;
                    calcFieldTool.expression = "[Cdms.AR_" + arFieldSuffix + "]";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);
                }

                removeJoinTool = new RemoveJoin();
                removeJoinTool.in_layer_or_view = "Turn_Layer";
                removeJoinTool.join_name = "Cdms";
                gp.Execute(removeJoinTool, trackcancel);

                deleteTool = new Delete();
                deleteTool.in_data = "Turn_Layer";
                gp.Execute(deleteTool, trackcancel);

                deleteTool.in_data = cdmsTablePath;
                gp.Execute(deleteTool, trackcancel);

                deleteTool.in_data = prohibRdmsWEndOfLkTablePath;
                gp.Execute(deleteTool, trackcancel);

                GC.Collect();

                #region Process Transport Tables

                if (usesTransport)
                {
                    string nonDimensionalCndModTablePath = outputFileGdbPath + "\\nonDimensionalCndMod";
                    string dimensionalCndModTablePath = outputFileGdbPath + "\\dimensionalCndMod";

                    if (!(inputUSCndModTableValue.IsEmpty()))
                    {
                        // Extract the Transport information for the US

                        AddMessage("Extracting the US non-dimensional conditions...", messages, trackcancel);

                        tableSelectTool = new TableSelect();
                        tableSelectTool.in_table = inputUSCndModTableValue.GetAsText();
                        tableSelectTool.out_table = nonDimensionalCndModTablePath;
                        tableSelectTool.where_clause = "MOD_TYPE IN (38, 39, 46, 49, 60, 75)";
                        gp.Execute(tableSelectTool, trackcancel);

                        AddMessage("Extracting the US dimensional conditions...", messages, trackcancel);

                        tableSelectTool.out_table = dimensionalCndModTablePath;
                        tableSelectTool.where_clause = "MOD_TYPE IN (41, 42, 43, 44, 45, 48, 81)";
                        gp.Execute(tableSelectTool, trackcancel);

                        // Create a new field to hold the dimension in a common unit (m or kg or KPH)

                        addFieldTool = new AddField();
                        addFieldTool.in_table = dimensionalCndModTablePath;
                        addFieldTool.field_name = "MetersOrKilogramsOrKPH";
                        addFieldTool.field_type = "DOUBLE";
                        gp.Execute(addFieldTool, trackcancel);

                        AddMessage("Calculating common units of measure...", messages, trackcancel);

                        calcFieldTool = new CalculateField();
                        calcFieldTool.in_table = dimensionalCndModTablePath;
                        calcFieldTool.field = "MetersOrKilogramsOrKPH";
                        calcFieldTool.code_block = "x = CLng([MOD_VAL])\nSelect Case [MOD_TYPE]\n" +
                                                   "  Case 41, 44, 45, 81: x = x * 0.0254\n" +
                                                   "  Case 42, 43: x = x * 0.45359237\n" +
                                                   "  Case 48: x = x * 1.609344\nEnd Select";
                        calcFieldTool.expression = "x";
                        calcFieldTool.expression_type = "VB";
                        gp.Execute(calcFieldTool, trackcancel);

                        if (!(inputNonUSCndModTableValue.IsEmpty()))
                        {
                            string tempNonDimensionalCndModTablePath = outputFileGdbPath + "\\tempNonDimensionalCndMod";
                            string tempDimensionalCndModTablePath = outputFileGdbPath + "\\tempDimensionalCndMod";

                            // Extract the Transport information for outside the US to temporary tables

                            AddMessage("Extracting the non-US non-dimensional conditions...", messages, trackcancel);

                            tableSelectTool = new TableSelect();
                            tableSelectTool.in_table = inputNonUSCndModTableValue.GetAsText();
                            tableSelectTool.out_table = tempNonDimensionalCndModTablePath;
                            tableSelectTool.where_clause = "MOD_TYPE IN (38, 39, 46, 49, 60, 75)";
                            gp.Execute(tableSelectTool, trackcancel);

                            AddMessage("Extracting the non-US dimensional conditions...", messages, trackcancel);

                            tableSelectTool.out_table = tempDimensionalCndModTablePath;
                            tableSelectTool.where_clause = "MOD_TYPE IN (41, 42, 43, 44, 45, 48, 81)";
                            gp.Execute(tableSelectTool, trackcancel);

                            // Create a new field to hold the dimension in a common unit (m or kg)

                            addFieldTool = new AddField();
                            addFieldTool.in_table = tempDimensionalCndModTablePath;
                            addFieldTool.field_name = "MetersOrKilogramsOrKPH";
                            addFieldTool.field_type = "DOUBLE";
                            gp.Execute(addFieldTool, trackcancel);

                            AddMessage("Calculating common units of measure...", messages, trackcancel);

                            calcFieldTool = new CalculateField();
                            calcFieldTool.in_table = dimensionalCndModTablePath;
                            calcFieldTool.field = "MetersOrKilogramsOrKPH";
                            calcFieldTool.code_block = "x = CLng([MOD_VAL])\nSelect Case [MOD_TYPE]\n" +
                                                       "  Case 41, 44, 45, 81: x = x * 0.01\nEnd Select";
                            calcFieldTool.expression = "x";
                            calcFieldTool.expression_type = "VB";
                            gp.Execute(calcFieldTool, trackcancel);

                            // Append the temporary tables to the main table containing US attributes

                            Append appendTool = new Append();
                            appendTool.inputs = tempNonDimensionalCndModTablePath;
                            appendTool.target = nonDimensionalCndModTablePath;
                            gp.Execute(appendTool, trackcancel);

                            appendTool.inputs = tempDimensionalCndModTablePath;
                            appendTool.target = dimensionalCndModTablePath;
                            gp.Execute(appendTool, trackcancel);

                            deleteTool = new Delete();
                            deleteTool.in_data = tempNonDimensionalCndModTablePath;
                            gp.Execute(deleteTool, trackcancel);
                            deleteTool.in_data = tempDimensionalCndModTablePath;
                            gp.Execute(deleteTool, trackcancel);
                        }
                    }
                    else
                    {
                        // Extract the Transport information for outside the US

                        AddMessage("Extracting the non-US non-dimensional conditions...", messages, trackcancel);

                        tableSelectTool = new TableSelect();
                        tableSelectTool.in_table = inputNonUSCndModTableValue.GetAsText();
                        tableSelectTool.out_table = nonDimensionalCndModTablePath;
                        tableSelectTool.where_clause = "MOD_TYPE IN (38, 39, 46, 49, 60, 75)";
                        gp.Execute(tableSelectTool, trackcancel);

                        AddMessage("Extracting the non-US dimensional conditions...", messages, trackcancel);

                        tableSelectTool.out_table = dimensionalCndModTablePath;
                        tableSelectTool.where_clause = "MOD_TYPE IN (41, 42, 43, 44, 45, 48, 81)";
                        gp.Execute(tableSelectTool, trackcancel);

                        // Create a new field to hold the dimension in a common unit (m or kg)

                        addFieldTool = new AddField();
                        addFieldTool.in_table = dimensionalCndModTablePath;
                        addFieldTool.field_name = "MetersOrKilogramsOrKPH";
                        addFieldTool.field_type = "DOUBLE";
                        gp.Execute(addFieldTool, trackcancel);

                        AddMessage("Calculating common units of measure...", messages, trackcancel);

                        calcFieldTool = new CalculateField();
                        calcFieldTool.in_table = dimensionalCndModTablePath;
                        calcFieldTool.field = "MetersOrKilogramsOrKPH";
                        calcFieldTool.code_block = "x = CLng([MOD_VAL])\nSelect Case [MOD_TYPE]\n" +
                                                   "  Case 41, 44, 45, 81: x = x * 0.01\nEnd Select";
                        calcFieldTool.expression = "x";
                        calcFieldTool.expression_type = "VB";
                        gp.Execute(calcFieldTool, trackcancel);
                    }

                    // Create a table for looking up LINK_IDs from COND_IDs

                    AddMessage("Creating and indexing LINK_ID/COND_ID look-up table for preferred roads...", messages, trackcancel);

                    string preferredLinkIDLookupTablePath = outputFileGdbPath + "\\preferredLinkIDLookupTable";

                    tableSelectTool = new TableSelect();
                    tableSelectTool.in_table = inputCdmsTableValue.GetAsText();
                    tableSelectTool.out_table = preferredLinkIDLookupTablePath;
                    tableSelectTool.where_clause = "COND_TYPE = 27";
                    gp.Execute(tableSelectTool, trackcancel);

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = preferredLinkIDLookupTablePath;
                    addIndexTool.fields = "COND_ID";
                    addIndexTool.index_name = "COND_ID";
                    gp.Execute(addIndexTool, trackcancel);

                    // Create a table for looking up the condition's direction

                    AddMessage("Creating and indexing direction look-up table for preferred roads...", messages, trackcancel);

                    string preferredDirectionLookupTablePath = outputFileGdbPath + "\\preferredDirectionLookupTable";

                    tableSelectTool = new TableSelect();
                    tableSelectTool.in_table = nonDimensionalCndModTablePath;
                    tableSelectTool.out_table = preferredDirectionLookupTablePath;
                    tableSelectTool.where_clause = "MOD_TYPE = 60";
                    gp.Execute(tableSelectTool, trackcancel);

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = preferredDirectionLookupTablePath;
                    addIndexTool.fields = "COND_ID";
                    addIndexTool.index_name = "COND_ID";
                    gp.Execute(addIndexTool, trackcancel);

                    // Create a table for looking up LINK_IDs from COND_IDs

                    AddMessage("Creating and indexing LINK_ID/COND_ID look-up table for restrictions...", messages, trackcancel);

                    string restrictionLinkIDLookupTablePath = outputFileGdbPath + "\\restrictionLinkIDLookupTable";

                    tableSelectTool = new TableSelect();
                    tableSelectTool.in_table = inputCdmsTableValue.GetAsText();
                    tableSelectTool.out_table = restrictionLinkIDLookupTablePath;
                    tableSelectTool.where_clause = "COND_TYPE = 23";
                    gp.Execute(tableSelectTool, trackcancel);

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = restrictionLinkIDLookupTablePath;
                    addIndexTool.fields = "COND_ID";
                    addIndexTool.index_name = "COND_ID";
                    gp.Execute(addIndexTool, trackcancel);

                    // Create a table for looking up the condition's direction

                    AddMessage("Creating and indexing direction look-up table for restrictions...", messages, trackcancel);

                    string restrictionDirectionLookupTablePath = outputFileGdbPath + "\\restrictionDirectionLookupTable";

                    tableSelectTool = new TableSelect();
                    tableSelectTool.in_table = nonDimensionalCndModTablePath;
                    tableSelectTool.out_table = restrictionDirectionLookupTablePath;
                    tableSelectTool.where_clause = "MOD_TYPE = 38";
                    gp.Execute(tableSelectTool, trackcancel);

                    addIndexTool = new AddIndex();
                    addIndexTool.in_table = restrictionDirectionLookupTablePath;
                    addIndexTool.fields = "COND_ID";
                    addIndexTool.index_name = "COND_ID";
                    gp.Execute(addIndexTool, trackcancel);

                    makeFeatureLayerTool = new MakeFeatureLayer();
                    makeFeatureLayerTool.in_features = streetsFeatureClassPath;
                    makeFeatureLayerTool.out_layer = "Streets_Layer";
                    gp.Execute(makeFeatureLayerTool, trackcancel);

                    CreateAndPopulateTruckFCOverrideField(outputFileGdbPath, gp, messages, trackcancel);

                    if (fgdbVersion >= 10.1)
                    {
                        // Create and calculate the preferred fields for Streets

                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "STAAPreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '1'", gp, messages, trackcancel);
                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "TruckDesignatedPreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '2'", gp, messages, trackcancel);
                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "NRHMPreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '3'", gp, messages, trackcancel);
                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "ExplosivesPreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '4'", gp, messages, trackcancel);
                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "PIHPreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '5'", gp, messages, trackcancel);
                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "MedicalWastePreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '6'", gp, messages, trackcancel);
                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "RadioactivePreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '7'", gp, messages, trackcancel);
                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "HazmatPreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '8'", gp, messages, trackcancel);
                        CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, true, "LocallyPreferred",
                                                                  "MOD_TYPE = 49 AND MOD_VAL = '9'", gp, messages, trackcancel);

                        if (createArcGISOnlineNetworkAttributes)
                        {
                            CreateAndPopulateAGOLTextTransportFieldsOnStreets(outputFileGdbPath, "PreferredTruckRoute",
                                                                              new string[] { "STAAPreferred", "TruckDesignatedPreferred", "LocallyPreferred" },
                                                                              gp, messages, trackcancel);
                            CreateAndPopulateAGOLTextTransportFieldsOnStreets(outputFileGdbPath, "PreferredHazmatRoute",
                                                                              new string[] { "NRHMPreferred", "ExplosivesPreferred", "PIHPreferred", "MedicalWastePreferred", "RadioactivePreferred", "HazmatPreferred" },
                                                                              gp, messages, trackcancel);
                        }
                    }

                    // Create and calculate the HazMat restriction fields for Streets

                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "ExplosivesProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '1'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "GasProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '2'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "FlammableProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '3'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "CombustibleProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '4'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "OrganicProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '5'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "PoisonProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '6'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "RadioactiveProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '7'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "CorrosiveProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '8'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "OtherHazmatProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '9'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "AnyHazmatProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '20'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "PIHProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '21'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "HarmfulToWaterProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '22'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "ExplosiveAndFlammableProhibited",
                                                              "MOD_TYPE = 39 AND MOD_VAL = '23'", gp, messages, trackcancel);

                    if (createArcGISOnlineNetworkAttributes)
                    {
                        CreateAndPopulateAGOLTextTransportFieldsOnStreets(outputFileGdbPath, "AGOL_AnyHazmatProhibited",
                                                                          new string[] { "ExplosivesProhibited", "GasProhibited", "FlammableProhibited", "CombustibleProhibited", "OrganicProhibited", "PoisonProhibited", "RadioactiveProhibited", "CorrosiveProhibited",
                                                                                         "OtherHazmatProhibited", "AnyHazmatProhibited", "PIHProhibited", "HarmfulToWaterProhibited", "ExplosiveAndFlammableProhibited" },
                                                                          gp, messages, trackcancel);
                    }

                    // Create and calculate the other restriction fields for Streets

                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, true, false, false, "HeightLimit_Meters",
                                                              "MOD_TYPE = 41", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, true, false, false, "WeightLimit_Kilograms",
                                                              "MOD_TYPE = 42", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, true, false, false, "WeightLimitPerAxle_Kilograms",
                                                              "MOD_TYPE = 43", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, true, false, false, "LengthLimit_Meters",
                                                              "MOD_TYPE = 44", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, true, false, false, "WidthLimit_Meters",
                                                              "MOD_TYPE = 45", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, true, false, "MaxTrailersAllowedOnTruck",
                                                              "MOD_TYPE = 46 AND MOD_VAL IN ('1', '2', '3')", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "SemiOrTractorWOneOrMoreTrailersProhibited",
                                                              "MOD_TYPE = 46 AND MOD_VAL = '4'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, true, false, "MaxAxlesAllowed",
                                                              "MOD_TYPE = 75 AND MOD_VAL IN ('1', '2', '3', '4', '5')", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "SingleAxleProhibited",
                                                              "MOD_TYPE = 75 AND MOD_VAL = '6'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, false, false, false, "TandemAxleProhibited",
                                                              "MOD_TYPE = 75 AND MOD_VAL = '7'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, true, false, false, "KingpinToRearAxleLengthLimit_Meters",
                                                              "MOD_TYPE = 81", gp, messages, trackcancel);

                    // Create and calculate the truck speed fields for Streets

                    CreateAndPopulateTransportFieldsOnStreets(outputFileGdbPath, true, false, true, "TruckKPH",
                                                              "MOD_TYPE = 48", gp, messages, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "Streets_Layer";
                    gp.Execute(deleteTool, trackcancel);

                    deleteTool.in_data = preferredLinkIDLookupTablePath;
                    gp.Execute(deleteTool, trackcancel);
                    deleteTool.in_data = preferredDirectionLookupTablePath;
                    gp.Execute(deleteTool, trackcancel);

                    deleteTool.in_data = restrictionLinkIDLookupTablePath;
                    gp.Execute(deleteTool, trackcancel);
                    deleteTool.in_data = restrictionDirectionLookupTablePath;
                    gp.Execute(deleteTool, trackcancel);

                    makeFeatureLayerTool = new MakeFeatureLayer();
                    makeFeatureLayerTool.in_features = pathToTurnFC;
                    makeFeatureLayerTool.out_layer = "RestrictedTurns_Layer";
                    gp.Execute(makeFeatureLayerTool, trackcancel);

                    // Create and calculate the HazMat restriction fields for RestrictedTurns

                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "ExplosivesProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '1'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "GasProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '2'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "FlammableProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '3'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "CombustibleProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '4'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "OrganicProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '5'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "PoisonProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '6'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "RadioactiveProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '7'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "CorrosiveProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '8'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "OtherHazmatProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '9'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "AnyHazmatProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '20'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "PIHProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '21'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "HarmfulToWaterProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '22'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "ExplosiveAndFlammableProhibited",
                                                           "MOD_TYPE = 39 AND MOD_VAL = '23'", gp, messages, trackcancel);

                    if (createArcGISOnlineNetworkAttributes)
                    {
                        CreateAndPopulateAGOLTextTransportFieldOnTurns(outputFileGdbPath, "AGOL_AnyHazmatProhibited",
                                                                       new string[] { "ExplosivesProhibited", "GasProhibited", "FlammableProhibited", "CombustibleProhibited", "OrganicProhibited", "PoisonProhibited", "RadioactiveProhibited", "CorrosiveProhibited",
                                                                                      "OtherHazmatProhibited", "AnyHazmatProhibited", "PIHProhibited", "HarmfulToWaterProhibited", "ExplosiveAndFlammableProhibited" },
                                                                       gp, messages, trackcancel);
                    }

                    // Create and calculate the other restriction fields for RestrictedTurns

                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, true, false, "HeightLimit_Meters",
                                                           "MOD_TYPE = 41", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, true, false, "WeightLimit_Kilograms",
                                                           "MOD_TYPE = 42", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, true, false, "WeightLimitPerAxle_Kilograms",
                                                           "MOD_TYPE = 43", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, true, false, "LengthLimit_Meters",
                                                           "MOD_TYPE = 44", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, true, false, "WidthLimit_Meters",
                                                           "MOD_TYPE = 45", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, true, "MaxTrailersAllowedOnTruck",
                                                           "MOD_TYPE = 46 AND MOD_VAL IN ('1', '2', '3')", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "SemiOrTractorWOneOrMoreTrailersProhibited",
                                                           "MOD_TYPE = 46 AND MOD_VAL = '4'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, true, "MaxAxlesAllowed",
                                                           "MOD_TYPE = 75 AND MOD_VAL IN ('1', '2', '3', '4', '5')", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "SingleAxleProhibited",
                                                           "MOD_TYPE = 75 AND MOD_VAL = '6'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, false, false, "TandemAxleProhibited",
                                                           "MOD_TYPE = 75 AND MOD_VAL = '7'", gp, messages, trackcancel);
                    CreateAndPopulateTransportFieldOnTurns(outputFileGdbPath, true, false, "KingpinToRearAxleLengthLimit_Meters",
                                                           "MOD_TYPE = 81", gp, messages, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "RestrictedTurns_Layer";
                    gp.Execute(deleteTool, trackcancel);

                    // Create and calculate the AllTransportProhibited field

                    addFieldTool = new AddField();
                    addFieldTool.in_table = pathToTurnFC;
                    addFieldTool.field_name = "AllTransportProhibited";
                    addFieldTool.field_type = "TEXT";
                    addFieldTool.field_length = 1;
                    gp.Execute(addFieldTool, trackcancel);

                    makeFeatureLayerTool = new MakeFeatureLayer();
                    makeFeatureLayerTool.in_features = pathToTurnFC;
                    makeFeatureLayerTool.out_layer = "RestrictedTurns_Layer";
                    makeFeatureLayerTool.where_clause = "COND_TYPE = 26 AND ExplosivesProhibited IS NULL AND GasProhibited IS NULL AND " +
                                                        "FlammableProhibited IS NULL AND CombustibleProhibited IS NULL AND OrganicProhibited IS NULL AND " +
                                                        "PoisonProhibited IS NULL AND RadioactiveProhibited IS NULL AND CorrosiveProhibited IS NULL AND " +
                                                        "OtherHazmatProhibited IS NULL AND AnyHazmatProhibited IS NULL AND PIHProhibited IS NULL AND " +
                                                        "HarmfulToWaterProhibited IS NULL AND ExplosiveAndFlammableProhibited IS NULL AND " +
                                                        "HeightLimit_Meters IS NULL AND WeightLimit_Kilograms IS NULL AND WeightLimitPerAxle_Kilograms IS NULL AND " +
                                                        "LengthLimit_Meters IS NULL AND WidthLimit_Meters IS NULL AND MaxTrailersAllowedOnTruck IS NULL AND " +
                                                        "SemiOrTractorWOneOrMoreTrailersProhibited IS NULL AND MaxAxlesAllowed IS NULL AND " +
                                                        "SingleAxleProhibited IS NULL AND TandemAxleProhibited IS NULL AND KingpinToRearAxleLengthLimit_Meters IS NULL";
                    gp.Execute(makeFeatureLayerTool, trackcancel);

                    AddMessage("Calculating the AllTransportProhibited field...", messages, trackcancel);

                    calcFieldTool = new CalculateField();
                    calcFieldTool.in_table = "RestrictedTurns_Layer";
                    calcFieldTool.field = "AllTransportProhibited";
                    calcFieldTool.expression = "\"Y\"";
                    calcFieldTool.expression_type = "VB";
                    gp.Execute(calcFieldTool, trackcancel);

                    deleteTool = new Delete();
                    deleteTool.in_data = "RestrictedTurns_Layer";
                    gp.Execute(deleteTool, trackcancel);

                    deleteTool.in_data = nonDimensionalCndModTablePath;
                    gp.Execute(deleteTool, trackcancel);
                    deleteTool.in_data = dimensionalCndModTablePath;
                    gp.Execute(deleteTool, trackcancel);

                    GC.Collect();
                }
                #endregion

                // Extract the special explications (condition type 9) from the Rdms Table and create RoadSplits table

                AddMessage("Creating RoadSplits table...", messages, trackcancel);

                string specialExplicationRdmsWEndOfLkTablePath = outputFileGdbPath + "\\SpecialExplicationRdmsWEndOfLk";

                tableSelectTool = new TableSelect();
                tableSelectTool.in_table = rdmsTablePath;
                tableSelectTool.out_table = specialExplicationRdmsWEndOfLkTablePath;
                tableSelectTool.where_clause = "COND_TYPE = 9";
                gp.Execute(tableSelectTool, trackcancel);

                deleteTool.in_data = rdmsTablePath;
                gp.Execute(deleteTool, trackcancel);

                CreateRoadSplitsTable("SpecialExplicationRdmsWEndOfLk", outputFileGdbPath, messages, trackcancel);

                deleteTool.in_data = specialExplicationRdmsWEndOfLkTablePath;
                gp.Execute(deleteTool, trackcancel);

                // Create Signpost feature class and table

                AddMessage("Creating signpost feature class and table...", messages, trackcancel);

                CreateSignposts(inputSignsTableValue.GetAsText(), outputFileGdbPath, messages, trackcancel);

                AddSpatialIndex addSpatialIndexTool = new AddSpatialIndex();
                addSpatialIndexTool.in_features = pathToFds + "\\" + SignpostFCName;
                gp.Execute(addSpatialIndexTool, trackcancel);

                addIndexTool = new AddIndex();
                addIndexTool.in_table = outputFileGdbPath + "\\" + SignpostJoinTableName;
                addIndexTool.fields = "SignpostID";
                addIndexTool.index_name = "SignpostID";
                gp.Execute(addIndexTool, trackcancel);

                addIndexTool.fields = "Sequence";
                addIndexTool.index_name = "Sequence";
                gp.Execute(addIndexTool, trackcancel);

                addIndexTool.fields = "EdgeFCID";
                addIndexTool.index_name = "EdgeFCID";
                gp.Execute(addIndexTool, trackcancel);

                addIndexTool.fields = "EdgeFID";
                addIndexTool.index_name = "EdgeFID";
                gp.Execute(addIndexTool, trackcancel);

                GC.Collect();

                // Upgrade the geodatabase (if not 9.3)

                if (fgdbVersion > 9.3)
                {
                    UpgradeGDB upgradeGdbTool = new UpgradeGDB();
                    upgradeGdbTool.input_workspace = outputFileGdbPath;
                    gp.Execute(upgradeGdbTool, trackcancel);
                }

                // Create and build the network dataset, then pack it in a GPValue

                AddMessage("Creating and building the network dataset...", messages, trackcancel);

                CreateAndBuildNetworkDataset(outputFileGdbPath, fgdbVersion, fdsName, ndsName, createNetworkAttributesInMetric,
                                             createArcGISOnlineNetworkAttributes, timeZoneIDBaseFieldName, directedTimeZoneIDFields, commonTimeZone,
                                             usesHistoricalTraffic, trafficFeedLocation, usesTransport);

                // Write the build errors to the turn feature class

                TurnGeometryUtilities.WriteBuildErrorsToTurnFC(outputFileGdbPath, fdsName, TurnFCName, messages, trackcancel);

                // Compact the output file geodatabase

                AddMessage("Compacting the output file geodatabase...", messages, trackcancel);

                Compact compactTool = new Compact();
                compactTool.in_workspace = outputFileGdbPath;
                gp.Execute(compactTool, trackcancel);
            }
            catch (Exception e)
            {
                if (gp.MaxSeverity == 2)
                {
                    object missing = System.Type.Missing;
                    messages.AddError(1, gp.GetMessages(ref missing));
                }
                messages.AddError(1, e.Message);
                messages.AddError(1, e.StackTrace);
            }
            finally
            {
                // Restore the original GP environment settings

                gpSettings.AddOutputsToMap = origAddOutputsToMapSetting;
                gpSettings.LogHistory = origLogHistorySetting;
            }
            GC.Collect();
            return;
        }
示例#33
0
文件: ZipArchive.cs 项目: nobled/mono
		public ZipArchive (Stream stream, Append append, bool ownsStream)
		{
			Stream = new ZipStream (stream, ownsStream);
			Handle = NativeZip.OpenArchive (Stream.IOFunctions, append);
		}
示例#34
0
文件: ZipArchive.cs 项目: nobled/mono
		public ZipArchive (Stream stream, Append append)
			: this (stream, append, false)
		{
			
		}
示例#35
0
文件: ZipArchive.cs 项目: nobled/mono
		public ZipArchive (string filename, Append append)
			: this (File.Open (filename, FileMode.OpenOrCreate), append)
		{

		}
示例#36
0
 protected override object EvaluateString(string value) => $"{value}{Append.Execute()}";
示例#37
0
        /// <summary>
        /// 키스토어 파일을 생성합니다.
        /// </summary>
        public void CreateKeyStore()
        {
            string keystorePath = _config.keyPath;

            // 키스토어 파일이 이미 있다면
            if (System.IO.File.Exists(keystorePath))
            {
                AppendText(_rm.GetString("ALREADY_EXISTED_KEYSTORE"));
                return;
            }

            // TODO: 이 코드는 보기 좋지 않은 듯 하다.
            // 텍스트 목록을 한 번에 가져올 수 있는 섹시한 함수가 있을까?
            // 있다면 그때 변경하자.
            List <string> validData = new List <string>()
            {
                keystorePath,
                _config.keyAlias,
                _config.passWord,
                _config.passWord,
                _config.packageName,
                _config.keyOU,
                _config.keyO,
                _config.keyL,
                _config.keyS,
                _config.keyC
            };

            bool isOK = validData.All(text => !String.IsNullOrEmpty(text));

            if (isOK)
            {
                // TODO: 전달되는 인수가 너무 많다.
                // 더 간단한 처리 방법이 없을까?
                string cmd = String.Format("keytool -genkey -v -keystore {0} -alias {1} -keyalg RSA -keysize 2048 -validity 10000 -keypass {2} -storepass {3} -dname \"CN={4},OU={5},O={6},L={7},S={8},C={9}\" 2>&1",
                                           keystorePath,
                                           _config.keyAlias,
                                           _config.passWord,
                                           _config.passWord,
                                           _config.packageName,
                                           _config.keyOU,
                                           _config.keyO,
                                           _config.keyL,
                                           _config.keyS,
                                           _config.keyC
                                           );

                Append append = AppendText;

                bool status = false;

                using (HostData hostData = new HostData(cmd, false, "", _rm.GetString("CreateKeyStore1"), _rm.GetString("CreateKeyStore2")))
                {
                    status = hostData.Run(append);
                }

                // 키스토어가 정상적으로 생성되었다면 status가 true이다.
                if (status)
                {
                    AppendText(_rm.GetString("CreateKeyStore3"));
                }
                else
                {
                    AppendText(_rm.GetString("CreateKeyStore4"));
                }
            }
            else
            {
                // if the text is empty, try to show the error message.

                // 텍스트가 비어있을 때의 처리
                // 정상적으로 실행하였다면 이 부분은 절대 실행될 일이 없다.
                AppendText(_rm.GetString("CreateKeyStore5"));
            }
        }
示例#38
0
 public void Test()
 {
     Func<TestCase, string> f = delegate(TestCase c)
     {
         try
         {
             IEnumerator<Token> tks; ITokenEnumerator tkz; Token t;
             tks = Sty.ToStringListAndClean(c.Input).ConvertAll<Token>(Token.FromVG).GetEnumerator();
             tkz = new Append(new EnumeratorAdapter(tks), Token.ZEnd);
             Analyzer.Init(tkz);
             t = Analyzer.Analyze();
             return TokenEx.ToTree(t);
         }
         catch (Exception e)
         {
             return e.Message;
         }
     };
     new TestCase("", Inp, Epc, f).Run();
 }
示例#39
0
        /// <summary>
        /// Appends a value to a give key.
        /// </summary>
        /// <param name="key">The key to append too.</param>
        /// <param name="value">The value to append to the key.</param>
        /// <returns></returns>
        public IOperationResult <string> Append(string key, string value)
        {
            var operation = new Append <string>(key, value, _transcoder, null, _converter);

            return(SendWithRetry(operation));
        }
        public void When_Operation_Is_Created_Opaque_Is_Incremented()
        {
            var get1 = new Get<dynamic>("thekey", null, Transcoder, OperationLifespanTimeout);
            var get2 = new Get<dynamic>("thekey", null, Transcoder, OperationLifespanTimeout);
            Assert.Greater(get2.Opaque, get1.Opaque);

            var set3 = new Set<dynamic>("thekey", "the value", null, Transcoder, OperationLifespanTimeout);
            Assert.Greater(set3.Opaque, get2.Opaque);

            var set4 = new Set<string>("thekey", "the value", null, Transcoder, OperationLifespanTimeout);
            Assert.Greater(set4.Opaque, set3.Opaque);

            var append5 = new Append<string>("thekey", null, null, Transcoder, OperationLifespanTimeout);
            Assert.Greater(append5.Opaque, set4.Opaque);

            var append6 = new Append<byte[]>("thekey", null, null, Transcoder, OperationLifespanTimeout);
            Assert.Greater(append6.Opaque, append5.Opaque);
        }
示例#41
0
 private void appendFeatureClasses(string workspace,string outname)
 {
     m_GP.SetEnvironmentValue("workspace", workspace);
     IGpEnumList fcs = m_GP.ListFeatureClasses("", "", "");
     string fc_from = fcs.Next();
     string fc_to = fcs.Next();
     Append appendTool = new Append();
     while (fc_to != "")
     {
         appendTool.inputs = fc_from;
         appendTool.target = fc_to;
         m_GP.Execute(appendTool, null);
         fc_from = fc_to;
         fc_to = fcs.Next();
     }
     Copy copytool = new Copy();
     copytool.in_data = fc_from;
     copytool.out_data = m_Dirpath + outname;
     m_GP.Execute(copytool, null);
 }
 private void appendFeatureClasses(string path, string name)
 {
     StringBuilder sb = new StringBuilder();
     Append appendTool = new Append();
     IGpEnumList fcs = m_GP.ListFeatureClasses("", "", "");
     string fstr = fcs.Next();
     appendTool.target = fstr;
     fstr = fcs.Next();
     while (fstr!= "")
     {
         sb.AppendFormat("{0};", fstr);
         fstr = fcs.Next();
     }
     appendTool.inputs = sb.ToString();
     string pathname = System.IO.Path.Combine(path, name);
     appendTool.output = pathname;
     m_GP.Execute(appendTool, null);
     IFeatureClass resultFeacls = m_GP.Open(appendTool.output) as IFeatureClass;
     if (PhaseResultEvent != null)
         PhaseResultEvent(this, resultFeacls, "The result is added!");
 }
示例#43
0
 public void AddWords(string[] words)
 {
     Append.AddWords(conn, words);
 }